Build an approval-gated production release pipeline#590
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
kelvinkipruto
force-pushed
the
claude/issue-580
branch
from
July 21, 2026 05:56
bab9f31 to
df8a3d7
Compare
kelvinkipruto
force-pushed
the
claude/issue-580
branch
from
July 21, 2026 06:16
df8a3d7 to
7884a5b
Compare
- Build once, promote by digest: build-image.yml builds immutable runtime + migrator images and outputs image@sha256 refs; deploy and release workflows promote the exact digest (never a mutable tag) - DB-independent builds: Dockerfile defaults DATABASE_URI/PAYLOAD_SECRET to build-time placeholders, so artifact creation needs no reachable DB - Approval gate: release.yml production job runs in the production GitHub environment (required reviewers) before any prod change - Single-instance migrations: dedicated migrator image runs pnpm migrate once as a one-off before traffic switches (never in every replica); migrate step precedes promote so a failure blocks the traffic switch - Bounded health endpoints: /api/health/live (process only) and /api/health/ready (time-bounded Mongo + Tika checks), wired to the Docker HEALTHCHECK and Dokku app.json liveness/readiness/startup probes and used as the post-deploy readiness gate - Docs: release-pipeline and rollback-and-restore runbooks; image rollback + mongodump/mongorestore procedures rehearsed locally Closes #580 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Extends the CodeQL permissions fix to the build-image, promote, release, and refactored deploy-dev workflows. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
kelvinkipruto
force-pushed
the
claude/issue-580
branch
from
July 21, 2026 08:23
7884a5b to
7104180
Compare
Delivers issue #580 AC1 — 'production artifact creation does not require a reachable application database'. Root cause: importing several modules opened a MongoDB connection at build time (Next collects page data during `next build`): - Four src/lib/data/*.ts modules and src/components/Newsletter/Newsletter.tsx ran a top-level `await getGlobalPayload()`. Made them resolve lazily per-call (getGlobalPayload is memoized, so no extra connections at runtime). - The subdomain-multitenant (frontend) layout and its routes were statically analyzed at build. Marked the layout + home, catch-all, and promise-detail routes `force-dynamic` (they are per-request by design and must never be prerendered). - Pinned `outputFileTracingRoot` so `.next/standalone/server.js` lands at a deterministic path (matches the Dockerfile COPY), independent of parent lockfiles (e.g. git worktrees). Verified: `next build` completes with an UNREACHABLE DATABASE_URI and emits .next/standalone/server.js; 245 integration tests pass; lint clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Closes #580
What changed
Build once, promote by digest (AC1, AC2)
image@sha256:…). Deploy/release jobs promote the exact digest — mutable tags are never deployed.DATABASE_URI/PAYLOAD_SECRETto build-time placeholders (next buildimports the config but never connects), so producing the artifact requires no reachable — or real — DB.Approval-gated production (AC3)
verify → build → staging → production. Theproductionjob runs in theproductionGitHub environment; enabling required reviewers there makes production deployment (including migrations) pause for human approval.Single-instance, observable migrations (AC4, AC5)
migrations/that the slim runner prunes) runspnpm migrateonce as a one-off container in promote.yml — never in every replica (the entrypoint runs no migrations). The migrate step runs before the promote step, so a migration failure fails the job and traffic is never switched. Forward-fix/rollback handling is documented.Bounded liveness & readiness (AC6, AC7)
GET /api/health/live— process-only, no dependency calls (so a dep outage never kills a healthy process).GET /api/health/ready— time-bounded MongoDB (mongoose ping) + Apache Tika (HTTP, skipped whenTIKA_ENABLED=0) checks;200/503.HEALTHCHECK(liveness) and the Dokku app.jsonstartup/liveness/readinessprobes, and used as the post-deploy readiness gate inpromote.yml. The timeout races the dependency call so a hung driver can't outlast the bound.Rollback & restore, rehearsed (AC8)
mongodump/mongorestoreprocedures were rehearsed locally (results recorded in the runbook).Verification (run locally)
health.int.spec.ts);tsc --noEmitclean; lint clean; all workflow YAML +app.jsonparse.mongo:7— all three migrations applied once, cleanly.mongodump→ drop →mongorestore --droprecovered the document exactly; image-by-digest run confirmed.Notes / follow-ups
staging/productionenvironments (required reviewers onproduction), plusSTAGING_DATABASE_URI/STAGING_PAYLOAD_SECRETsecrets. Documented in the runbook.dokku runalternative for network-isolated environments.🤖 Generated with Claude Code