Skip to content

Move Astro /api deploy to CI and fix the Astro 7 build guards - #39553

Open
devindford wants to merge 6 commits into
jen.gilbert/astro-basefrom
devin.ford/astro-router
Open

Move Astro /api deploy to CI and fix the Astro 7 build guards#39553
devindford wants to merge 6 commits into
jen.gilbert/astro-basefrom
devin.ford/astro-router

Conversation

@devindford

@devindford devindford commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

What does this PR do? What is the motivation?

Targets jen.gilbert/astro-base, not master.

Deploy execution leaves this repo. astro/scripts/deploy.mjs was the only file here that shelled out to the aws CLI and hardcoded S3 bucket names and CloudFront distribution IDs. It is deleted, along with its four deploy:* package scripts. The upload now runs as job steps in documentation-ci, which matches how Hugo's own deploy already works here: declared in hugo/config/{preview,live}/config.yaml, executed by CI tooling. astro/CLAUDE.md records the rule so this does not drift back.

astro/scripts/verifyDist.mjs stays. It verifies the shape of dist/client and knows nothing about where that output goes.

Two build blockers, both verified against the installed astro@7.1.5:

  • staticApiGuard destructured routes from astro:build:done. Astro 7 passes { pages, dir, assets, logger }, so every build died with a TypeError. Routes now come from astro:routes:resolved. The coverage guard could not simply follow — routes are route definitions, so the whole category tree is one dynamic [category] entry and a route-based count would report 1 against a floor of 150. It counts generated pages instead.
  • All 14 dd_e2e fixture pages declared prerender = true and were emitted into dist/client/dd_e2e/, failing the containment guard. They now render on demand, which the Playwright suite still exercises.

Three smaller fixes: bare /{lang}/api roots added to the local dev router, prefixed() treats a slashless path as root-relative, and spec-only changes (hugo/data/api/**) now trigger the preview-link bot.

Verification

A full preview build now completes: staticApiGuard passed: 19388 files contained under /api, 158 categories emitted — a line that could not print before. dist/client holds only api es fr ja ko with no root files. verify:dist passes standalone. Of 2,242 hrefs on a built category page, none are unprefixed and none are double-prefixed.

Tests: 689 headless and 151 Playwright passing, astro check reports 0 errors. 14 snapshot tests fail, which I confirmed are pre-existing on a clean tree — they need the gitignored SDK example files that only exist after make all-examples.

Known issue, deliberately not fixed here: the build warns that /api/latest/service-scorecards conflicts with the dynamic category route. Production serves /api/latest/scorecards/ as canonical and 301s service-scorecards to it, but SLUG_OVERRIDES in viewsBuilder.ts maps it the other way. That is one category out of 158 and is being tracked separately.

Merge readiness

  • Ready for merge

For Datadog employees:

  • ⚠️ Your branch name MUST follow the <name>/<description> convention and include the forward slash (/). If you've already created your PR with an incorrect branch name, please rename your branch and open a fresh PR.
  • 🤖 New: Comment with /review to run an automated check that catches common issues before a Documentation team member reviews your PR.

AI assistance

Claude Code was used to trace the deploy/CI dependencies across documentation, documentation-ci, and websites-images, and to write the changes and their tests.

Additional notes

The matching documentation-ci change must merge first — the astro CI jobs do not exist until it is on main. Those jobs are gated to devin.ford/astro-router and jen.gilbert/astro-base only, and uploads are additionally behind a feature flag that defaults to off.

devindford and others added 2 commits August 27, 2026 17:20
Adds the preview-branch path prefix funnel, moves fonts/icons under
src/assets so they work under that prefix, emits the six Hugo-owned
legacy /api redirects, moves pagesJson/llmsTxt output under dist/client/api,
adds a build-time containment/coverage guard, resolves @websites-modules
from the Hugo module cache, and wires up the local dev proxy, CI preview
links, and a deploy script for the eventual cutover.
Deploy execution no longer lives in this repo. `astro/scripts/deploy.mjs`
was the only file here that called the `aws` CLI and hardcoded bucket names
and CloudFront distribution IDs; it is deleted, along with its `deploy:*`
package scripts. The upload now runs as job steps in `documentation-ci`,
matching how Hugo's own deploy is declared here but executed by CI tooling.
`astro/CLAUDE.md` records the rule.

Two build blockers, both verified against the installed astro@7.1.5:

- `staticApiGuard` read `routes` from `astro:build:done`, which Astro 7 does
  not pass, so every build died with a TypeError. Routes now come from
  `astro:routes:resolved`. The coverage guard could not follow: routes are
  route definitions, so the category tree is one dynamic entry and the count
  would read 1 against a floor of 150. It counts generated pages instead.
- All 14 `dd_e2e` fixture pages were prerendered into `dist/client`, breaking
  the containment guard. They render on demand instead, which the Playwright
  suite still exercises.

Also: bare `/{lang}/api` roots in the local dev router, `prefixed()` treating
a slashless path as root-relative, and spec-only changes triggering the
preview-link bot.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@devindford
devindford requested review from a team as code owners August 28, 2026 15:35
@github-actions github-actions Bot added Architecture Everything related to the Doc backend Github Related to Github configurations labels Aug 28, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Preview links (active after the build_preview check completes)

No changed files under hugo/content/en/, e.g. this PR only touches the Astro API docs app:

@janine-c janine-c left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks like there's nothing to look at here from a docs team perspective; commenting to get it out of our review queue 🙂

The Astro /api app now publishes to its own bucket behind its own CloudFront
distribution rather than overlaying the bucket Hugo deploys into. Three
consequences here.

build.assets goes back to Astro's default `_astro`. It was `api/_astro` to
keep the overlay out of the shared bucket's root; that constraint is gone, and
the platform router hardcodes /_astro/, /images/ and /fonts/ as its cacheable
S3 fast-path, so anything else silently loses asset caching.

deriveSiteUrl gains a DOCS_SITE_URL override, checked ahead of every other
branch — the pair to DOCS_PATH_PREFIX in pathPrefix.ts. The platform serves at
its distribution root, so canonical URLs come from the distribution domain and
there is no branch path segment. No new mode is needed for the prefix itself:
pathPrefix already treats an empty-but-set DOCS_PATH_PREFIX as an override.

The containment guards accept `_astro/` at root alongside the /api subtrees,
in both staticApiGuard and its standalone verifyDist twin.

Verified with a full build: 19388 files contained, 158 categories, assets at
/_astro/ with no branch prefix, canonical on the distribution domain.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@devindford devindford changed the title [DOCS-XXXXX] Move Astro /api deploy to CI and fix the Astro 7 build guards Move Astro /api deploy to CI and fix the Astro 7 build guards Aug 28, 2026
Line wrapping and trailing commas only. Confirmed no behavior change:
stripping whitespace and trailing commas leaves all three files byte-identical
to HEAD. staticApiGuard tests pass (12/12) and verify:dist still reports 19388
contained files across 158 categories.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Pipelines

⚠️ Warnings

Your PR has failed checks. Please review the issues below and take necessary action before merging.

🚦 1 Pipeline job failed

DataDog/documentation | astro_inputs

View more details · View in GitLab

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: c6b0484 | Docs | View more details | Give us feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Architecture Everything related to the Doc backend Github Related to Github configurations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants