ADR-0001 rollback.sh: accept any 2xx in consumer health checks (204 from Woodpecker was a false-positive failure)
ci/woodpecker/push/deploy Pipeline was successful
ci/woodpecker/cron/renovate Pipeline was successful

This commit is contained in:
2026-08-02 22:15:15 -07:00
parent 325daca86b
commit 9c1f31a70e
+14 -1
View File
@@ -26,6 +26,13 @@
# is deliberate — do not bypass it by hand without actually reconciling
# data first (e.g. exporting recent writes from patroni-1 before touching
# anything).
#
# ── FIX LOG ─────────────────────────────────────────────────────────────
# First real run: consumer re-verification below flagged
# woodpecker_woodpecker-server as failed because its /healthz endpoint
# returned HTTP 204 — a legitimate "healthy, no content" response, not a
# failure. FIXED: health checks now accept any 2xx status code, matching
# the same fix applied to cutover.sh.
set -uo pipefail
REASON="${1:-<no reason given — invoked directly>}"
@@ -53,6 +60,9 @@ log() { echo "[rollback $(date +%H:%M:%S)] $*"; }
warn() { echo "[rollback WARN $(date +%H:%M:%S)] $*" >&2; }
die() { echo "[rollback FATAL $(date +%H:%M:%S)] $*" >&2; exit 1; }
# Returns success (0) if $1 looks like a 2xx HTTP status code.
is_2xx() { [[ "$1" =~ ^2[0-9][0-9]$ ]]; }
log "=== rollback.sh invoked ==="
log "Reason: ${REASON}"
@@ -248,7 +258,10 @@ for svc in "${!CONSUMER_HEALTH_URLS[@]}"; do
url="${CONSUMER_HEALTH_URLS[$svc]}"
CODE=$(curl -sk -o /dev/null -w '%{http_code}' --max-time 10 "$url")
log " ${svc} -> ${url} -> HTTP ${CODE}"
[ "$CODE" != "200" ] && { warn " ${svc} did not return 200"; CONSUMER_FAIL=1; }
if ! is_2xx "$CODE"; then
warn " ${svc} did not return a 2xx status (got ${CODE})"
CONSUMER_FAIL=1
fi
done
if [ "$CONSUMER_FAIL" -ne 0 ]; then
warn "One or more consumers did not verify healthy post-rollback. This is now a DIFFERENT problem than the original cutover attempt — legacy itself may need direct attention. Check 'docker service logs <service> --tail 100' for each flagged consumer."