Skip to content

Move synthetics into assembler-preview job, remove standalone synthetics job - #3952

Merged
Mpdreamz merged 8 commits into
mainfrom
feat/synthetics-preview
Aug 27, 2026
Merged

Move synthetics into assembler-preview job, remove standalone synthetics job#3952
Mpdreamz merged 8 commits into
mainfrom
feat/synthetics-preview

Conversation

@Mpdreamz

@Mpdreamz Mpdreamz commented Aug 27, 2026

Copy link
Copy Markdown
Member

Why

The synthetics job in ci.yml built the entire assembled site from scratch on a 2-core ubuntu-latest — cloning ~30 repos, running the assembler, serving locally — before running journey tests against it. This took 20+ minutes and was the most frequent source of CI flakiness (git fetch timeouts, shallow lock collisions).

The assembler-preview job already builds and deploys the full assembled site to a CloudFront-backed S3 bucket on every PR. Running synthetics against that deployed URL costs nothing extra and gives the same signal without a redundant clone.

What

  • synthetics job removed from ci.yml.
  • Synthetics steps added to assembler-preview.yml after the S3 upload, against the known preview URL (https://docs-v3-preview.elastic.dev/${ASSEMBLER_PREVIEW_PATH_PREFIX}). No polling, no waiting — the URL is already live at that point in the job.
  • Deployment status reflects synthetics outcome: marked success only when both upload and journey tests pass.
  • synthetics.config.ts gains a preview case; synthetics:test:preview convenience script added to package.json for local use against a preview URL.

@Mpdreamz
Mpdreamz requested a review from a team as a code owner August 27, 2026 14:48
@Mpdreamz
Mpdreamz requested a review from reakaleek August 27, 2026 14:48
@Mpdreamz
Mpdreamz force-pushed the feat/synthetics-preview branch from f51caf7 to 41021c2 Compare August 27, 2026 14:59
@Mpdreamz Mpdreamz changed the title feat: run synthetics against deployed assembler-preview URL Move synthetics into assembler-preview job, remove standalone synthetics job Aug 27, 2026
Mpdreamz and others added 3 commits August 27, 2026 17:37
The synthetics CI job was cloning ~30 repos and running a full
assembler build on a 2-core ubuntu-latest runner, taking 20+ minutes
and routinely failing on git-fetch timeouts before the tests even ran.

The assembler-preview job already builds and deploys the assembled site
to S3 for every same-repo PR. Poll its GitHub deployment status until
it reports success, then point the synthetics journeys at that URL
instead of a local server. Fork PRs skip the job because they have no
assembler-preview deployment to wait for.

Adds DOCS_ENV=preview to synthetics.config.ts (reads DOCS_PREVIEW_BASE_URL,
which the CI step sets from the deployment's environment_url). The
journeys append /docs and sub-paths to baseUrl as before, which resolves
correctly against the preview path prefix.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Journeys were navigating to ${baseUrl}/docs which resolves to
.../docs/3952/docs — a path that doesn't exist in the assembled
preview output (content is served directly at the path prefix root).

Introduce params.docsRoot in synthetics.config.ts: for local/prod/
staging/edge it equals baseUrl + '/docs'; for preview it equals the
assembler-preview environment_url directly (no /docs suffix). Journeys
and accessibility audit now navigate relative to docsRoot so the same
test code works across all environments.

Also add a wait-on step before the synthetics run to let CloudFront
propagate the S3 upload before journey tests fire.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…ermission

Use shell variable expansion ($ASSEMBLER_PREVIEW_PATH_PREFIX) instead
of GitHub Actions template expansion (${{ env.* }}) in the run: step
to avoid zizmor's template-injection finding. The job-level env var is
already available in the shell environment.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@Mpdreamz
Mpdreamz force-pushed the feat/synthetics-preview branch from 560c666 to 1eb28c3 Compare August 27, 2026 15:39
Mpdreamz and others added 3 commits August 27, 2026 17:50
Use https-get:// instead of plain https:// so wait-on performs
an HTTP GET check (which follows redirects) rather than a TCP
socket check, which fails on HTTPS endpoints.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
wait-on treats non-2xx as failure; CloudFront returns a 301
redirect at the root path which wait-on interprets as not ready.
curl -L follows redirects and considers the final 2xx a success.
18 attempts × 10 s = up to 3 min wait, matching CloudFront's
typical invalidation propagation time.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…ew environment

- `synthetics:test:preview` now runs only navigation-test and api-explorer
  journeys (excludes mcp-server which requires a live backend not deployed
  for PR previews)
- Drop hardcoded `/docs` prefix from `href$=` selector and URL regexes in
  navigation-test.journey.ts: preview URLs include the full path prefix
  (`/elastic/docs-builder/docs/<pr>/reference/elasticsearch`) so selectors
  ending in `/docs/reference/elasticsearch` never matched

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ad test

The injected anchor used the hardcoded href '/docs/api/', which in preview
resolves to the domain root + /docs/api/ — not the assembler preview path.
Pass docsRoot into page.evaluate so the href and waitForRequest predicate
both use the environment-correct URL.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
working-directory: src/Elastic.Documentation.Site
run: npm ci

- name: Wait for preview to be live

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: we could use https://www.npmjs.com/package/wait-on for this. With npx wait-on ...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used that at first, the original did too but for some reason it kept timing out.

@Mpdreamz

Copy link
Copy Markdown
Member Author

@copilot please fix the merge conflicts in this pull request.

Co-authored-by: Mpdreamz <245275+Mpdreamz@users.noreply.github.com>

Copilot AI commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

@copilot please fix the merge conflicts in this pull request.

Resolved by merging origin/main into this branch and fixing the ci.yml conflict in commit 6eb446bb.

@Mpdreamz
Mpdreamz enabled auto-merge (squash) August 27, 2026 20:20
@Mpdreamz
Mpdreamz merged commit ca3028b into main Aug 27, 2026
25 checks passed
@Mpdreamz
Mpdreamz deleted the feat/synthetics-preview branch August 27, 2026 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants