feat(deploy): production gate tied to the promotion PR (replaces the staging marker files) #96
Loading…
Reference in a new issue
No description provided.
Delete branch "jfraeys/feat/promotion-gate"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Production deploys are operator-run (CI only validates and opens the promotion PR #77; nothing reacts to a merge into prod). The only guard was local marker files that CI runs on ephemeral runners can never create, so
./setup --confirm-prodwas effectively always the type-'deploy' bypass.New gate (scripts/lib/setup/promotion.sh), no secrets read:
Otherwise the deploy is refused, with the reason and the fix.
--confirm-prodstill allows an emergency bypass, only by typing 'deploy'; every bypass is appended to ~/.local/state/infra/emergency-deploys.log.Wiring
setup: promotion_gate replaces check_staging_markers for production workspaces (staging workspaces pass as before; the typed workspace-name confirmation stays).scripts/deploy-services.sh: the default (production) inventory is gated before it loads the vault or mints keys; deploys with their own -i (DR) are not gated.scripts/promote-prod.sh(new): verify, show the read-only Terraform plan, ask, then run./setup --workspace linode --confirm-prod.scripts/tests/test-promotion.sh.Tested: 19 cases against a throwaway git repo and a fake PR list: approved; main moved past the approved commit; PR merged a different or non-descendant commit; descendant with only non-deploy changes approved; descendant that changed roles/ refused and names the file; PR not merged; no validated commit in the body; only PRs into prod count; no PR; API unavailable; staging workspaces pass; refusal without the flag; bypass needs the typed word and logs only then; the staged-paths regex matches every path in staging-validate.yml's push trigger and no docs path. deploy-services.sh with the API unavailable stops at the gate before the vault load or any key mint. shellcheck -S error is clean (docker).
Behaviour change: after this merges, deploy-services.sh and ./setup --confirm-prod on production refuse unless the promotion PR was merged for the commit you have checked out, or you use the typed emergency bypass. The old staging-marker code is removed in #97 (stacked on this).
🤖 Generated with Claude Code