From 9c1f31a70e0a9cef2cac2ea9e0e561478f857611 Mon Sep 17 00:00:00 2001 From: admin Date: Sun, 2 Aug 2026 22:15:15 -0700 Subject: [PATCH] ADR-0001 rollback.sh: accept any 2xx in consumer health checks (204 from Woodpecker was a false-positive failure) --- postgresql/cutover/rollback.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/postgresql/cutover/rollback.sh b/postgresql/cutover/rollback.sh index d0e7d26..e4f4114 100644 --- a/postgresql/cutover/rollback.sh +++ b/postgresql/cutover/rollback.sh @@ -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:-}" @@ -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 --tail 100' for each flagged consumer."