Skip to content

Commit c86eab6

Browse files
Fix check-risk-block to check S3 for override before blocking (#63)
## Summary `check-risk-block.sh` was unconditionally blocking on HIGH risk with `exit 1` — it never checked whether an override had been signed. The approve-override workflow writes `override.json` to S3, but nothing was reading it. Now checks for `override.json` in the plan bucket before blocking. If an override exists, the apply proceeds. This is why the override workflow succeeded but the retriggered apply still failed. ## Test plan - [ ] Merge → this PR itself will be LOW/MEDIUM risk (no infra changes) → auto-applies - [ ] Re-run the blocked apply from #62 → override.json exists → apply proceeds
1 parent a05efb2 commit c86eab6

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

scripts/check-risk-block.sh

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#!/bin/sh
2-
# Block apply if risk is HIGH or FAILED.
2+
# Block apply if risk is HIGH or FAILED, unless an override exists.
33
#
44
# Usage: check-risk-block.sh <risk_level>
55
#
66
# Exits 0 if safe to apply, 1 if blocked.
7-
# Slack notification is handled by notify-high-risk.sh in the review step —
8-
# no duplicate alert here.
7+
# On HIGH risk, checks S3 for an override.json signed by the apply-gate Lambda.
8+
# Requires: PLAN_BUCKET, GITHUB_REPOSITORY, GITHUB_RUN_ID env vars.
99

1010
set -e
1111

@@ -17,5 +17,15 @@ if [ "$RISK" != "HIGH" ] && [ "$RISK" != "FAILED" ] && [ -n "$RISK" ]; then
1717
exit 0
1818
fi
1919

20-
echo "Auto-apply blocked (risk=${RISK})."
20+
# Check for a signed override in S3
21+
PLAN_PREFIX="plans/${GITHUB_REPOSITORY}/${GITHUB_RUN_ID}"
22+
OVERRIDE_KEY="${PLAN_PREFIX}/override.json"
23+
24+
if aws s3 ls "s3://${PLAN_BUCKET}/${OVERRIDE_KEY}" > /dev/null 2>&1; then
25+
echo "Override found: s3://${PLAN_BUCKET}/${OVERRIDE_KEY}"
26+
echo "Proceeding with HIGH risk apply."
27+
exit 0
28+
fi
29+
30+
echo "Auto-apply blocked (risk=${RISK}). No override found."
2131
exit 1

0 commit comments

Comments
 (0)