Repository navigation
ci(bluegreen): run the two-colour cutover acceptance criterion in ci (#656) - #811
Merged
Merged
Conversation
This was referenced Nov 7, 2026
athvin
marked this pull request as ready for review
November 7, 2026 21:46
#656's criteria 1 and 2, run against the `ci` namespace on `er-dev` for the first time. The blue/green stack shipped across 14 PRs each verified by content on `main`; "zero-downtime cutover" was a design claim until now because running the criterion by hand is a dozen commands with a timing-sensitive loop in the middle — the shape of thing that stays un-run. MEASURED, both directions, with both colours pinned to identical digests so the only variable is the selector move: blue -> green 116 requests, 0 non-2xx (helm upgrade 35s) green -> blue 98 requests, 0 non-2xx (helm upgrade 29s) The loop covers a document route (er-web /login) and the API (er-api /healthz), because the issue's criterion distinguishes them. It deliberately does NOT request `/_next/static/<build-id>/…`: a 404 there after a flip is the known residual risk D-BLUEGREEN accepts, and counting it would fail a cutover that worked. Three bugs found while writing it, each of which would have produced a confident wrong answer: - `svc/er-web` listens on 3000, not 80. Port-forwarding 80 returns 000 for every request, which is indistinguishable from a total outage. - the frontend health route is `/api/healthz`, not `/api/health`. - `date +%3N` is GNU-only; on macOS it emits a literal `.3N` and EXITS 0, so a `|| fallback` never fires and every timestamp is silently garbage. The concurrency guard is load-bearing rather than defensive: deploy.yml runs its own three-phase cutover against this namespace on every qualifying merge, so the script asserts the helm revision advanced by exactly its own two upgrades and aborts otherwise. A number produced while two actors moved the colour is not a measurement. Also corrects the issue's rollback claim by measuring it. The asymmetry it describes is real — pre-retire rollback is a selector move, post-retire needs the replica count back — but both are seconds: a scale-up from zero reached ready in 7s, because deploy-retire-colour.sh scales rather than deletes and the image stays cached on the node. That is the reason the script leaves both colours up. Aurora, the issue's other stated constraint: DatabaseConnections went 7 -> 9 across the exercise and ServerlessDatabaseCapacity never moved off 0.5 ACU. The second colour costs ~2 connections, which is immaterial at this size. Namespace left exactly as found: blue live, green at replicas=0. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
athvin
force-pushed
the
issue/656-bluegreen-cutover
branch
from
November 7, 2026 21:47
2e08df9 to
862cdaf
Compare
`infra-platform/references/coverage.md` carries a generated table of which scripts reference each path under infra/k8s, and bluegreen-acceptance.sh drives `helm upgrade` against infra/k8s/charts/er-platform — so it belongs in the `charts` row. Regenerated, not hand-edited. The gate was right and the drift was mine: `agent skills (lint + drift)` failed on the PR, and main was green on the two commits before my rebase base, so this was never a pre-existing break. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
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 #656
What
Runs #656's criteria 1 and 2 against
cioner-devfor the first time, andleaves
scripts/ci/bluegreen-acceptance.shbehind so the criterion isre-runnable after any change to the deploy path.
Criteria 3 and 4 are not in this PR — they need a release through
images.yml, which only runs onpush: branches: [main]. Split to #813with the reasoning.
Why
The blue/green stack shipped across 14 PRs, each verified by content on
main,and the end-to-end criterion the plan specified was never executed. "Zero-downtime
cutover" was a design claim rather than a measurement.
Proof
Ran the script against the live namespace, both directions, with both colours
pinned to identical digests so the only variable is the selector move:
helm upgradeblue → greengreen → bluescripts-home-checkok (91 scripts). The namespace was left exactly as found:blue live,
web-api-greenatreplicas=0.Risk & rollback
Risk: the script mutates a live namespace — it scales the inactive colour up
and moves
color.active. Confined toci, which CI owns, and it refuses toreport a measurement if another actor moved the release mid-window.
Rollback:
git revert <merge-sha>removes the script; it changes nodeployed behaviour. The namespace needed nothing undone — the exercise restored
it to blue-live/green-retired, as found.
Post-merge note:
ciis now green-live/blue-retired. Not a remnant of this —the
deployrun on70f31c54(#756's merge, 21:41Z) performed its own cutoverand took the Helm release 129 → 131. My measurement ended at 129 and its
concurrency guard confirmed revisions 125 → 127 → 129 were all mine, which is
exactly the case that guard exists to distinguish.
Post-merge ledger
Closed by: agent · session
77317896-77a9-4b7f-966e-2d180637edf7onbrians-MacBook-Pro· 2026-11-07T22:10:20Zmainis green with this change on it — the merge SHA, and the runthat proves it. A later head SHA with this commit as an ancestor counts;
a cancelled run with zero jobs does not:
e730e6e6—rust,infra,frontend,devcontainerallsuccesson that SHA.imagesbuilt, or correctly never ran because nothing that goes intoan image changed:
n/a — correctly never ran.The diff is.claude/skills/…/coverage.md+scripts/ci/bluegreen-acceptance.sh; no image input changed, andimagesis absent from the merge SHA's run list rather than having been cancelled.deployconverged — proved by a line the running process emitted, notby the image digest and not by the workflow conclusion:
n/a — no deploy exists to converge.deploy.ymlfires onworkflow_runafterimages, which never ran.deploy,drift,kind's nightly leg) is green, or knowingly red for a reason that is notthis change:
deployn/a as above.driftandkindare nightly, not per-merge: both last concludedsuccess(59d3f60e, 2026-11-07 06:01Z and 06:44Z). Not green on this SHA, because neither runs on one — stated rather than ticked as if it were.Donethrough the automation rather than byhand, and the issue closed: Blue/green: run a real two-colour cutover in the ci namespace (the acceptance criterion never exercised) #656 is
CLOSED / COMPLETEDand its card readsDone, both via the automation — no hand edit.(a skill, a reference, memory) — or nothing new was learned: the
bluegreen-programmemory now carries the measured table, the three harness traps (service ports 3000/8000 not 80;/api/healthz;date +%3Nexiting 0 on macOS), the rollback-mechanism correction, and the concurrency-guard rule. The re-runnable form isscripts/ci/bluegreen-acceptance.shin the tree.Specific to this change
deferred — #813. Neither is reachablefrom a branch (
images.ymlispush: branches: [main], anddeploy.ymlfires on
workflow_runafter it), so both need a release onmain.Blue/green criteria 3 and 4: the expand case, and the preflight refusal (both need a release on main) #813 carries the reasoning and a cheaper alternative for criterion 4.
Context — plan, discoveries, measurements, files
Plan
same, is there quota headroom.
concurrency guard against
deploy.yml.Discoveries
Three bugs in my own harness, each of which would have produced a confident
wrong answer:
svc/er-weblistens on 3000, not 80. Port-forwarding 80 returns000forevery request — indistinguishable from a total outage, and it cost a diagnosis
pass before I noticed the service had healthy endpoints all along.
/api/healthz, not/api/health.date +%3Nis GNU-only. On macOS it emits a literal.3Nand exits 0, soa
|| fallbacknever fires and every timestamp is silently garbage.The issue's rollback claim is right in magnitude but not in mechanism. It
says "the old colour never stopped running, so this should be seconds". That
holds only between cutover and retire —
deploy-retire-colour.shscales the oldcolour to zero afterwards, which is the steady state I found the namespace in
(only blue running). So a real rollback is a scale-up, not a selector move.
Measured anyway: ready in 7s from
replicas=0, because that script scalesrather than deletes and the image stays cached on the node. Both paths are
seconds; the reasons differ.
Criteria 3 and 4 need a merge to
main, not a branch.images.ymlispush: branches: [main]with apaths:filter, anddeploy.ymlfires onworkflow_runafter it. There is no branch path to acideploy, so neitherremaining criterion can be exercised from this PR.
make checkcannot pre-empt the deploy preflight, which is the point of it.The preflight is the
er-schema-migratehook runninger-server migrate --expect-additive, and it compares the compiled catalogagainst a live store.
make checkhas no Postgres (that ismake check-e2e),so a retype is self-consistent in the catalog and passes the PR gate — the
refusal can only happen at deploy. That makes criterion 4 genuinely reachable,
and also disruptive: it needs a deliberately breaking schema change on
main,which leaves the deploy path refusing for everyone until reverted.
Measurements
Every number with the command that produced it.
Cutover, criterion 1 —
bash scripts/ci/bluegreen-acceptance.sh:Rollback, criterion 2 — the same script, run again:
Post-retire rollback cost —
kubectl scale deploy/web-api-green --replicas=1then
rollout status: 7s to ready from zero.Aurora (the issue's first stated constraint: two colours double connection
establishment against an instance that may be at 0 ACU) —
aws cloudwatch get-metric-statistics --namespace AWS/RDS:DatabaseConnections7 → 9 across the exercise;ServerlessDatabaseCapacitynever left 0.5 ACU. The second colour costs ~2connections. Immaterial at this size, and worth re-checking at load.
Namespace quota (the issue's second constraint:
limits.cpu40, cutover ~5)—
kubectl get resourcequota: 2500m used of 40 before the exercise. Ample.Files
scripts/ci/bluegreen-acceptance.sh— new; the whole diff.Nothing else changed. The deploy scripts it drives
(
deploy-read-colour.sh,deploy-inactive-colour.sh,deploy-cutover.sh,deploy-retire-colour.sh) were already correct and are untouched.