Files
supply-intelligence/scripts/gateway_closure_rollback.sh

34 lines
1.1 KiB
Bash
Raw Permalink Normal View History

2026-05-12 18:49:52 +08:00
#!/usr/bin/env bash
set -euo pipefail
BASE_URL="${BASE_URL:-http://127.0.0.1:8080}"
need() {
command -v "$1" >/dev/null 2>&1 || {
echo "missing required command: $1" >&2
exit 1
}
}
need curl
need python3
echo "[1/3] pause gateway runtime"
curl -fsS -X POST "$BASE_URL/internal/supply-intelligence/gateway/runtime/pause"
echo
echo "[2/3] fetch runtime status for rollback assessment"
status=$(curl -fsS "$BASE_URL/internal/supply-intelligence/gateway/runtime-status")
echo "$status"
echo "[3/3] operator checklist"
python3 <<'PY'
print('''Manual rollback checklist:
1. Confirm runtime paused and record pending_retry_events / failed_events.
2. Inspect GET /internal/supply-intelligence/gateway/package-changes for the affected event IDs.
3. If a replacement package is prepared, publish the replacement package-event and verify admission-state.
4. If the bad event must remain blocked, keep runtime paused until manual remediation is completed.
5. After remediation, call POST /internal/supply-intelligence/gateway/runtime/resume and rerun gateway_closure_inspect.sh.
''')
PY