ci: require independent approval before production deploy

PA
9h ago
+484-4

Add a CircleCI hold before real production deploys for OPS-332. The existing environment picker stays in place. prod:*, its prod:all alias and customer-specific production deploys require approval. Dev, QA, sandbox and the exact prod:demonstration target keep their current behavior.

After the hold, a read-only job checks who approved it through the CircleCI API and compares that person's mapped GitHub account with the authenticated GitHub sender of the release tag push. A click in CircleCI (or an API approval) by the release-tag pusher does not reach the production job. Git commit authorship, Git tagger text and the deploy requester aren't used as proof. The check binds the approval to that deployment and the tag/commit/archive digest. The production job checks the archive digest before unpacking or deploying it.

Merge decision: OK to merge before the live pilot. If the new gate blocks a real production deploy, we'll fix the CircleCI deploy setup and retry. The restricted read context, credential, reviewer mappings, and trusted-ref enforcement still need live verification; artifacts without release provenance will stop at the gate, including older rollback candidates. Merging does not itself deploy anything or change AWS roles. This decision supersedes the pre-merge recommendation in the generated review summary below.

Verification: Four Node fixture tests passed, including a known non-author, the tag pusher, unknown and invalid approval records, altered tag, legacy artifact and untrusted tag event. Parsed both workflow files and checked shell syntax, hold dependencies and real-prod/demo/sandbox routing. No live CircleCI approval or deployment was run. Separate from the Cypress and CodeQL ruleset change and the Cubic PR.


Summary by cubic

Requires every real production deploy to pass an independent human approval, so the release-tag pusher can't approve their own rollout. Release metadata lookups now authenticate through the E2E GitHub App with a short-lived, repo-scoped Contents: read token instead of anonymous API calls.

  • prod:*, prod:all, and customer prod targets pause at a new "Approve production release" hold; dev, QA, sandbox, and prod:demonstration keep their current path.
  • The verifier maps the CircleCI approver to a GitHub account via an admin-maintained identity list, rejects the tag pusher, and binds the approval to the exact workflow, tag, and artifact digest; the deploy job re-checks the archive digest before unpacking.
  • Artifacts now record tag-push provenance; previously published artifacts lack it and fail closed, so plan a fresh release and an approved rollback artifact before enabling.

Before merge

  • Provision and pilot the restricted app-frontend-production-approval-read context (read-only artifact role, read-scoped CircleCI token, verified approver mappings) before merging.
  • Confirm exempt paths (prod:demonstration, sandbox) still route through the old job without the hold, and that the workflow and verifier load from a trusted protected ref.
  • Confirm both the tag publisher and approval verifier can reach the existing GH App variables so release lookups never fall back to anonymous requests.

Summary by CodeRabbit

  • New Features
    • Production deployments now require approval from an eligible approver, with checks that the release matches the approved target and workflow.
    • Production deploys verify release provenance and artifact integrity before deployment. The prod:demonstration target remains outside this approval flow.
  • Documentation
    • Added a production deployment runbook covering approval requirements, release checks, credentials, and pilot requirements.