Repository navigation
feat(deploy): keep the previous release's web files, and write the deploy down - #167
Merged
Merged
Conversation
…ploy down The deployed Worker now serves the web app, and a deploy keeps the web files of the release before it. ADR-0011 has a missing hashed file answered 200 text/html (the single-page fallback), so a tab opened on release N-1 that asks for one of its scripts after release N has gone out gets HTML where it expected JavaScript. Each deploy therefore uploads the new release's files and the previous release's, never more than those two. - wrangler.deploy.toml gets [assets] (single-page fallback, the same run_worker_first list as worker-dev.sh); the parity test checks both. - The build job builds the web app and puts it in the attested bundle with the Worker. - The deploy fetches the previous release's bundle from the artifacts API (unexpired, from a run on main, newest), verifies its attestation, unpacks it with a script that refuses links, special files, absolute and .. paths and another commit's BUILD_SHA, and merges the two sets of files (merge-assets.sh). A previous release it cannot read is a failure, except where the first deploy has none. - After the smoke, a control asks the deployed Worker for scripts only the previous release had and requires JavaScript with the previous release's bytes; a failure rolls back like a failed smoke. The checker is shown to flag a text/html answer. - GH_TOKEN is withheld from wrangler, the smoke and the expand step, as the Cloudflare secrets are from the fetch. - docs/src/architecture/deploy.md is the runbook (environments, first deploy, ordinary and DO-lifecycle deploys, the rollback drill, rolling back by hand, rotating the token); cicd.md and infra.md say what is deployed now; ADR-0110 and ADR-0101 and QUESTIONS.md record the round-30 answers, including that GitHub OIDC was not achieved and a scoped API token stands in; G-36 records what is covered only against stand-ins. The staging run is still to do: it needs the infrastructure repo's issues 1015 to 1017, the owner's variables and secrets, and the first deploy with first_deploy_skip_smoke. The issue stays open: acceptance criteria 2, 4 and 5 are runtime controls on staging, shown so far only against stand-ins. Refs: #49 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The merge of main brought in the deletion of RL_CREATE (its binding, its variable and its namespace id), which left the runbook asking for a variable the renderer no longer knows and for three rate-limit namespaces where two are used. Refs: #49 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
The last of the four PRs for the deploy pipeline (ADR-0110, issue #49). #153, #154 and #165 are merged.
The deployed Worker now serves the web app, and a deploy keeps the web files of the release before it. ADR-0011 has a missing hashed file answered
200 text/html(the single-page fallback), so a tab opened on release N-1 that asks for one of its scripts after N has gone out gets HTML where it expected JavaScript. Each deploy uploads the new release's files and the previous release's, never more than those two.wrangler.deploy.tomlgets[assets]: single-page fallback, and the samerun_worker_firstlist asscripts/worker-dev.sh. The parity test checks the list is the same, and thatwrangler.tomlhas no[assets].buildjob builds the web app and puts it in the attested bundle with the Worker.fetch-previous-assets.sh): unexpired artifacts from a run onmain, newest first, thengh attestation verify(verify-bundle.sh) andunpack-bundle.sh, which refuses links, special files, absolute and..paths and aBUILD_SHAthat is another commit's. A pull request from a fork can upload an artifact under any name, so the name is not trusted.merge-assets.shthen merges the two sets of files. A previous release it cannot read is a failure; the first deploy, which has none, is the one case that goes without.check-asset-retention.shasks the deployed Worker for scripts only the previous release had, and requires200, a JavaScript content type and the previous release's bytes. A failure rolls back as a failed smoke does. The checker is shown to flag atext/htmlanswer (issue AC 5).GH_TOKENis withheld from wrangler, the smoke and the expand step, the way the Cloudflare secrets are from the fetch. Each fake in the test reports which secrets it could see.docs/src/architecture/deploy.mdis the runbook (environments, first deploy, ordinary and DO-lifecycle deploys, the rollback drill, rolling back by hand, rotating the token).cicd.mdandinfra.mdno longer say there is no CD. ADR-0110 and ADR-0101 andQUESTIONS.mdrecord the round-30 answers, including that GitHub OIDC was not achieved: a scoped API token in each environment's secrets stands in, by the owner's decision of 2026-11-13. G-36 indocs/src/testing/status.mdrecords what is covered only against stand-ins.Refs, not Fixes
This PR refers to the issue in a
Refs:footer and leaves it open. The issue's acceptance criteria 2, 4 and 5 are runtime controls on staging; they are shown so far only against a stand-in Cloudflare. Merging this finishes the build, not the issue. Say so if you want a closing keyword added before you merge, or close the issue by hand after the staging drill passes.Verified
Under dash, all green:
check-deps,check-topology(and--self-test),check-placement,check-plane-500andcheck-acceptance-list(and their self-tests),render-wrangler --self-test,lint-workflowondeploy.ymland the action, every.github/scripts/tests/test-*.shof theci-scriptsjob,test_active_version.pyandtest_merge_assets.py(1028 checks, 200 seeded pairs).mdbook buildhas noERRORline and no orphan page (withmdbook-mermaidnot installed, so its preprocessor was switched off for the check).Mutation: the scripts of this PR were broken one exact way each, 46 times by hand, and every mutant fails its own test. One survived at first (the link-text check in
unpack-bundle.sh, which the type-letter check made redundant), and now has its own case. The driver is not in the repo, so CI does not re-run them (G-36).Not verified, and what settles it
None of this has run against a real Cloudflare account, so these are open until the first staging deploy and the drill:
wrangler deployments list --jsonandwrangler versions list --jsongh attestation verifyagainst a real bundle built onmainGITHUB_TOKENreading an environment's protection rulesverify-caagainst a real Origin CA leafunpack-bundle.sh(the tests ran on macOS tar; this PR's CI is the first run on GNU tar)Left for the owner after this merges: infrastructure issues 1015 to 1017, the environments' variables and secrets, then the first deploy with
first_deploy_skip_smokeand the injected-failure drill (deploy.md).🤖 Generated with Claude Code