Skip to content

Commit b56be24

Browse files
Write the rollback out as its own block, with no secret lookup
Copilot review: 'the same block with one flag swapped' still ran step 2, which resolves an ENABLED version of ORIGIN_SECRET and exits when there is none. If the secret was disabled or deleted during the incident - a plausible thing to have happened, and a plausible reason to be rolling back - set -e would abort before --remove-secrets ever ran, leaving the gate armed at exactly the moment it has to come off. The rollback is now its own block that depends on nothing but the currently serving revision: no in-flight check (waiting for a build is the wrong trade when the gate is the outage) and no secret lookup at all. It ends by reading the verdict back, and the note that removing the Worker binding is not a rollback moved next to it. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PBQdMbboxo59sSThGSbfke
1 parent 34f1604 commit b56be24

1 file changed

Lines changed: 32 additions & 6 deletions

File tree

docs/reference/api.md

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -548,12 +548,38 @@ gcloud run services describe "$SERVICE" $LOC --format="value(status.traffic)"
548548
)
549549
```
550550
551-
**Rolling back** is the same block with `--remove-secrets=ORIGIN_SECRET` in
552-
place of `--update-secrets` (step 2 then has nothing to resolve) and a
553-
`disarm-` suffix. It must stay executable in the worst state the service can be
554-
in, which is why step 1 warns rather than refuses — and when the gate is causing
555-
an outage, step 0's wait is the wrong trade: skip it, disarm, and re-check
556-
afterwards.
551+
**Rolling back** is its own block, not the one above with a flag swapped. It has
552+
to run in the worst state the service can be in — which includes the secret
553+
having been disabled or deleted during the incident, so it must not look the
554+
secret up at all. Nothing here depends on anything but the currently serving
555+
revision:
556+
557+
```bash
558+
(
559+
set -euo pipefail
560+
SERVICE=anyplot-api
561+
LOC="--project=anyplot --region=europe-west4"
562+
563+
# No in-flight check and no secret lookup: when the gate is the outage, waiting
564+
# for a build is the wrong trade, and step 2 above would abort here on a
565+
# disabled version — leaving the gate armed at the moment it must come off.
566+
SERVING=$(gcloud run services describe "$SERVICE" $LOC --format=json \
567+
| python3 -c "import json,sys; d=json.load(sys.stdin); \
568+
print(next(x['revisionName'] for x in d['status']['traffic'] if x.get('percent')==100))")
569+
IMAGE=$(gcloud run revisions describe "$SERVING" $LOC --format="value(spec.containers[0].image)")
570+
test -n "$IMAGE" || { echo "could not resolve the serving image"; exit 1; }
571+
572+
SUFFIX="disarm-$(date -u +%Y%m%d%H%M)"
573+
gcloud run services update "$SERVICE" $LOC --image="$IMAGE" \
574+
--remove-secrets=ORIGIN_SECRET --revision-suffix="$SUFFIX"
575+
gcloud run services update-traffic "$SERVICE" $LOC --to-revisions="$SERVICE-$SUFFIX=100"
576+
577+
curl -s "https://api.anyplot.ai/health" # expect "off" or "off-seen"
578+
)
579+
```
580+
581+
Removing the Worker's binding is **not** a rollback — while the service is armed
582+
that takes the apex route down rather than freeing it. Roll back here first.
557583
558584
**Rotating the secret** means changing two sides that must agree, and the gate
559585
accepts exactly one value — so there is no overlap window. Roll back first,

0 commit comments

Comments
 (0)