Skip to content

ci(release): stateless release rings v1 — build once, promote digests beta → prod, rollback = deploy older record #10049

Closed

Description

@Git-on-my-level

Goal

Make releases hard to break, easy to deploy, and cheap to operate for a very small team:

main merge ──► build once ──► release record
                                  ├─► dev    — auto
                                  ├─► beta   — auto: newest record → beta lane (real beta-channel users)
                                  └─► prod   — manual: deploy prod <release_id>
                                               (GitHub environment gate, same digests)

We promote artifacts, not branches. Every merge to main builds service images once and writes an immutable release record. Beta serves that record to real beta users automatically; prod deploys the same digests behind a GitHub environment approval gate. Rollback is deploying an older release record through the same command.

Scope — read this first. This is v1: stateless release rings. It covers backend, backend-listen, pusher, llm-gateway, and agent-proxy. It does not make GPU-service changes (Parakeet, diarizer, VAD, NLLB) beta-safe — those keep their existing deploy paths and beta calls the same GPU endpoints prod uses today. #10057 is a blocking follow-up before this system can be said to protect the full transcription path.

Design revision (2026-07-20): this issue originally specified protected beta/prod release branches, a nightly sync bot, a custom release coordinator, and a signed release-vector ledger. That design was reviewed and replaced with the lean model below — same safety goals, a fraction of the machinery. Durable principles live in docs/runbooks/release-process.md; this issue tracks sequencing and status.

Why

The transcription incident (run 29641667073) showed that "test in beta first" is unenforceable while prod deploys rebuild from source at deploy time and validation happens after mutation. The fix is immutable artifact promotion and native platform controls, not new branch topology or bespoke release machinery.

Prescriptions

  1. Build once, promote digests. Beta and prod deploy the exact same repository@sha256:...; prod never rebuilds, re-resolves a branch, or deploys a mutable tag. No main SHA deploys directly to prod; only a beta-soaked record is prod-eligible.
  2. Promote artifacts, not branches. No beta/prod branches, no sync bots, no standing bot credentials.
  3. Deploy and rollback are one command. deploy <ring> <release_id> — rollback is the same command with an older ID, so it is exercised on every release and cannot rot.
  4. Pin everything, deployably. Image digests, Secret Manager secret versions (never latest), and rendered config stored as immutable objects. A record must be able to restore state, not merely verify it — hashes alone cannot restore anything.
  5. Beta is a ring, not a lab. Real beta-channel users on shared production data stores, one release ahead of prod. Real traffic is the acceptance signal; synthetic checks stay cheap.
  6. Native controls over bespoke machinery. GitHub environment protection, Cloud Run no-traffic revisions + traffic shifting, Helm revisions, GCS versioned buckets with conditional writes.
  7. Never remove a deploy path before its replacement has shipped for real.

State model: three GCS object shapes (no service, no database)

// records/<release_id>.json — immutable, deployable inputs
{
  "release_id": "2026-07-20.1",
  "git_sha": "…",
  "eligibility_run_id": "…",
  "images": { "backend": "gcr.io/...@sha256:…", "pusher": "…" },
  "helm_values": { "backend-listen": "gs://…/values/<id>/backend-listen.yaml#sha256:…" },
  "run_config": { "backend": "gs://…/run/<id>/backend.yaml#sha256:…" },
  "secret_versions": { "OPENAI_API_KEY": "projects/…/versions/42" },
  "created_at": "…"
}
  • rings/<ring>/active.json — current serving record, previous verified record, hold/quarantine flag. Written with ifGenerationMatch compare-and-swap; deploy serialization itself is a GitHub Actions concurrency: deploy-<ring> group.
  • receipts/<ring>/<release_id>/<run>.json — append-only: what actually happened (Cloud Run revisions/traffic, Helm revisions, verification/restore results). Write-only audit trail — no reconciler gets built on top of it.

The record is the only input a prod-capable deploy accepts — no free-form SHA, branch, tag, image, or Helm revision.

Deploy flow (one workflow, with a reliable failure branch)

  1. Resolve the record; refuse anything else.
  2. Snapshot the ring's active serving state (receipt) before any mutation.
  3. Cloud Run: no-traffic revisions from recorded digests → smoke check → shift traffic.
  4. GKE: apply recorded digests + values, wait for rollout, verify (deploy_status_report.py).
  5. Deterministic failure before/immediately after the traffic switch → automatically restore the pre-mutation snapshot (Cloud Run: shift traffic back; GKE: one helm rollback attempt). If restoration also fails: write partial_mutation with the exact component diff, leave state visible, page. No recursive recovery.
  6. A failed record is marked held in active.json so beta auto-deploy does not retry the same bad candidate.

Later SLO degradation pages a human and offers one-command rollback — never automatic (flapping trap).

Compatibility (load-bearing: beta and prod share live data)

  • Schema/data changes: expand → dual read/write → backfill → contract; never destructive in one release.
  • Every concurrently serving record — current prod through newest beta (prod may lag by several records, not one) — must operate correctly against live data. Hold promotion when ring skew exceeds the supported window.
  • Record + artifact retention ≥ rollback window (30 days); destructive cleanup only after the oldest retained record expires.

Promotion criteria (start; tighten by ratchet)

A record is prod-eligible after serving beta for the soak window (default: overnight) with no new Sentry crash groups, fallback/error rates in bounds, and a minimum exposure floor (active sessions, streamed minutes, routing samples) — a quiet night must not qualify a release. Operator-checked first, scripted later.

Implementation ladder (each step ships and is useful alone)

  • 1a. Pin secret versions everywhere latest appears (ExternalSecrets, Cloud Run secret refs).
  • 1b. Switch gcp_backend.yml image references from short-SHA tags to digests.
  • 1c. Prod gate, fully paired: GitHub environment prod with required reviewers plus a prod-only OIDC identity bound to repo + environment, explicit workflow/ref guards, and CODEOWNERS + required checks on .github/workflows/. Environment approval alone is not a barrier — any future merged workflow could request the environment.
  • 2. Build-once + deployable release record (rendered values/config as immutable objects, not hashes) written on every main merge; nothing consumes it yet.
  • 3. Unified deploy <ring> <release_id> workflow with the failure branch above (snapshot → auto-restore → partial_mutation → quarantine). First rollback drill = deploying yesterday's record to beta. Legacy build-at-deploy path deleted only after several real prod releases on the new path.
  • 4. Beta ring: beta lane in runtime_env.yaml + Helm values, beta stateless services at beta endpoints, desktop/mobile beta builds pointed at them (desktop beta currently mixes dev backend hosts with prod data — fix here), auto-deploy of newest non-held record, soak criteria + exposure floor in the promotion script.
  • 5. Cleanup: remove remaining arbitrary-ref prod-capable paths one at a time; publish beta/promote/rollback/break-glass runbook; quarterly read-only audit of environment protections, workflow permissions, identities, record-bucket retention.

Explicitly out of scope / dropped / deferred

  • GPU services → Investigate beta-ring strategy for GPU services (Parakeet, diarizer, VAD, NLLB) #10057 (blocking before claiming full transcription-path coverage).
  • Protected beta/prod release branches + nightly sync bot (replaced by records + environment gates).
  • Custom coordinator / signed ledger / state-machine service (replaced by the three GCS object shapes).
  • Separate beta GCP project and beta data stores (beta users are real users on real data).
  • Synthetic signed-client acceptance harness (real beta traffic is the signal).
  • Mobile store rollout automation — stores are roll_forward_only. macOS is also roll_forward_only today: desktop_promote_prod.yml is explicitly roll-forward-only and update feeds choose the newest release. Channel-pointer restore becomes a declared recovery class only after a tested pointer-rollback path lands.
  • Incremental builds (compose unchanged digests from the prior record): deferred until build time actually hurts; when done, keyed on a content hash of each component's full input tree — never path filters, which silently ship stale code in a monorepo with shared utils/.

Non-goals

  • Making main a release branch again (precise form: no main SHA deploys directly to prod; only a beta-soaked immutable record is prod-eligible).
  • Treating a successful unit/CI run as beta acceptance.
  • Allowing a manual production deploy to rebuild from an arbitrary current SHA.

References

Activity

  1. changed the title [-]ci(release): promote main → beta nightly and beta → prod manually via protected release branches[/-] [+]ci(release): build once, promote immutable digests through beta ring to prod; rollback = deploy older release[/+] on Jul 19, 2026
  2. changed the title [-]ci(release): build once, promote immutable digests through beta ring to prod; rollback = deploy older release[/-] [+]ci(release): stateless release rings v1 — build once, promote digests beta → prod, rollback = deploy older record[/+] on Jul 19, 2026
  3. Git-on-my-level commented on Jul 22, 2026

    @Git-on-my-level
    MemberAuthor

    Design retired rather than built: .github/scripts/check_release_rings.py lists release_rings.yaml, release-record.yml, and deploy-release-ring.yml under OBSOLETE_RELEASE_RING_SOURCES, and #10237 'SCA-14: retire backend beta release ring' merged 2026-07-21. Current thinking lives in #10338 / #10339.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions