Repository navigation
feat(deploy): deploy staging from the rc/* release candidate, production from a v* tag - #185
Merged
Merged
Conversation
…ion from a v* tag The owner's decision of 2026-11-14: staging deploys every release candidate, production deploys from the release tag behind reviewers, and main never deploys. An environment's branch rule is checked against the run's own ref, and a workflow_run always runs on main, so staging restricted to rc/* cannot be reached from workflow_run alone. - ci.yml: a release-candidate pull request (head rc/* in this repository) runs everything, whatever its diff: its gate is what lets the commit reach staging, and release-plz builds it on whatever main was. - deploy.yml: a green ci on such a pull request plans `dispatch`; the new dispatch job (actions: write, no secret) starts deploy.yml again with workflow_dispatch ON the rc branch, for that commit, and that run deploys. A manual run deploys the commit it runs from; the `ref` input is replaced by `sha`, the commit the branch must still be at. The deploy build stops saving a cache no later run could read. - plan-deploy.sh: dispatch only for this repository's rc/<name> pull request with THRUST_DEPLOY_ENABLED true; staging only from refs/heads/rc/<name>, production only from refs/tags/v<version> whose commit is on main; one segment after the prefix, as the rulesets match; a branch that moved since the dispatch skips. - verify-bundle.sh takes the bundle's source ref and asks for exactly that, refusing any ref but rc/<name> and v<version> before asking gh; the action passes the run's own ref. - fetch-previous-assets.sh looks only at artifacts of this repository's own runs on an rc/* branch or a v* tag, and verifies each on the ref its run was on. - cicd.md and deploy.md describe the new trigger, the branch rules and the release App now live; PLAN.md records what was built and why it differs from the first sketch. Tests: test-plan-deploy.sh over every combination (1344 workflow_run, 2304 workflow_dispatch), test-verify-bundle.sh and test-fetch-previous-assets.sh with must-fail refs; 22 hand mutants of the three scripts, each caught by its test. Refs: #49 Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Nov 15, 2026
Closed
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
PR 2 of the CI/CD plan (
.agents/plans/cicd-review/PLAN.md), following the owner's decision of 2026-11-14:rc/<timestamp>branch, or anrc/manual-*one).v*release tag, behind the reviewers.mainnever deploys.How a release candidate reaches staging
The obvious design,
deploy.ymlon aworkflow_runofcifiltered torc/**, can't work. GitHub checks an environment's branch rule against the run's own ref, and aworkflow_runalways runs onmain. So oncestagingtakes onlyrc/*, aworkflow_rundeploy would be refused.Instead:
ciruns on the release-candidate PR in full, whatever its diff. The diff againstmainis onlyCHANGELOG.mdand the version, but itsgateis what lets the commit reach staging. Also, release-plz builds the candidate on whatevermainwas, whether or notmain's own run passed.When that run is green,
deploy.ymlplansdispatch. A newdispatchjob runsgh workflow run deploy.yml --ref <rc branch> -f environment=staging -f sha=<commit>. It hasactions: writeand no secret.The dispatched run is on
rc/*, sostagingaccepts it. It checks everything again:rc/<name>of this repository;cirun takes over;gatepassed;Then it builds, attests and deploys as before.
A dispatch is one of the two events a workflow's own token may start a run with, so no App token is needed here.
I rejected adding a push trigger on
rc/**toci.yml. It would run the full suite twice per candidate, once for the push and once for the PR. It would also put twogatereports on one commit, andassert-sha-checks.shrequires every report to be SUCCESS, so a PR run still in progress would block the deploy.Changes
ci.ymlrc/*runs everythingdeploy.ymlworkflow_runofcionrc/**; newdispatchjob. A manual run deploys the commit it runs from. Therefinput is replaced bysha, the commit the branch must still be at. The deploy build stops saving a cache no later run could read (a cache is readable only from its own ref, and every candidate is a new branch)plan-deploy.shdispatchonly for this repository'src/<name>PR, and only whileTHRUST_DEPLOY_ENABLEDistrue(kept as the off switch for the automatic path). Staging only fromrefs/heads/rc/<name>. Production only fromrefs/tags/v<version>whose commit is onmain. One path segment after the prefix, matching the rulesets:rc/a/bis not protected by them, so it's refusedverify-bundle.shghfor exactly that ref. Any ref other thanrc/<name>orv<version>is refused beforeghis asked. The action passes the run's own reffetch-previous-assets.shhead_repository_id == repository_id, so never a fork's) on anrc/*branch or av*tag, and verifies each on the ref its run was oncicd.md,deploy.md,PLAN.mdTests
test-plan-deploy.shchecks every combination: 1,344workflow_runand 2,304workflow_dispatch(10,097 checks). The expected answer is restated in the test, not read from the script.test-verify-bundle.shcovers 12 refs that must be refused without askinggh:main, a feature branch,rc/a/b, a PR ref, bare names and look-alikes.test-fetch-previous-assets.shcovers refs that don't deploy, a fork's artifact named like ours, and a newer fork artifact that must not hide ours.ci-scriptstest and everydepsguard, withshas dash;lint-workflow.sh;actionlint.Not verified until it runs
rc/*branch. chore(release): v0.1.0 #184 is open, but itsciran before this change. The first release-candidate PR after the merge will show it. WithTHRUST_DEPLOY_ENABLEDstill unset, it plansskip.assets-upload-sessionfailure (chore(cd): deploy pipeline per ADR-0110 round 29 (expand, deploy 100 %, smoke, auto-rollback) #49).Owner steps after merging
Restrict
stagingandstaging-do-lifecycletorc/*branches. I held this back until now because it would refuse today'smain-based runs:PUTreplaces an environment's protection rules, sostaging-do-lifecycle's body repeats its required reviewer (you):Refs: #49
🤖 Generated with Claude Code