Skip to content

Commit 89b5264

Browse files
talissoncostaclaude
andcommitted
chore: Address review feedback on smoke test workflow
Per review feedback: - Merge the 3 separate curl checks into a single endpoint loop - Add --max-time 30 to each curl so they don't hang indefinitely - Add timeout-minutes: 10 to the job level - Use continue-on-error: true so a smoke test failure warns but doesn't block the PR from merging (non-blocking check) - Failed checks now emit warnings instead of hard-failing — the job still exits non-zero so the status shows, but GitHub won't gate merge on it Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 9dc7d76 commit 89b5264

File tree

1 file changed

+26
-28
lines changed

1 file changed

+26
-28
lines changed

.github/workflows/frontend-pull-request.yml

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ jobs:
3939
smoke-test:
4040
name: Vercel Preview Smoke Test
4141
runs-on: ubuntu-latest
42+
timeout-minutes: 10
43+
continue-on-error: true
4244
steps:
4345
- name: Wait for Vercel deployments and smoke test
4446
env:
@@ -51,22 +53,25 @@ jobs:
5153
"Preview – flagsmith-frontend-staging"
5254
)
5355
56+
FAILED=0
57+
5458
for ENV_NAME in "${ENVIRONMENTS[@]}"; do
5559
echo "⏳ Waiting for '$ENV_NAME' deployment..."
5660
URL=""
5761
for i in $(seq 1 60); do
5862
# Find the deployment for this commit and environment
59-
DEPLOY_ID=$(gh api "repos/$REPO/deployments?sha=$SHA&environment=$(printf '%s' "$ENV_NAME" | jq -sRr @uri)&per_page=1" --jq '.[0].id // empty')
63+
DEPLOY_INFO=$(gh api "repos/$REPO/deployments?sha=$SHA&environment=$(printf '%s' "$ENV_NAME" | jq -sRr @uri)&per_page=1" --jq '.[0].id // empty')
6064
61-
if [ -n "$DEPLOY_ID" ]; then
62-
STATE=$(gh api "repos/$REPO/deployments/$DEPLOY_ID/statuses?per_page=1" --jq '.[0].state // empty')
65+
if [ -n "$DEPLOY_INFO" ]; then
66+
STATE=$(gh api "repos/$REPO/deployments/$DEPLOY_INFO/statuses?per_page=1" --jq '.[0].state // empty')
6367
if [ "$STATE" = "success" ]; then
64-
URL=$(gh api "repos/$REPO/deployments/$DEPLOY_ID/statuses?per_page=1" --jq '.[0].environment_url')
68+
URL=$(gh api "repos/$REPO/deployments/$DEPLOY_INFO/statuses?per_page=1" --jq '.[0].environment_url')
6569
echo "✅ '$ENV_NAME' deployed at: $URL"
6670
break
6771
elif [ "$STATE" = "failure" ] || [ "$STATE" = "error" ]; then
68-
echo "❌ '$ENV_NAME' deployment failed with state: $STATE"
69-
exit 1
72+
echo "⚠️ '$ENV_NAME' deployment failed with state: $STATE"
73+
FAILED=1
74+
continue 2
7075
fi
7176
fi
7277
sleep 10
@@ -77,30 +82,23 @@ jobs:
7782
continue
7883
fi
7984
80-
# Smoke test the deployment
81-
echo "🔍 Testing $URL/health ..."
82-
STATUS=$(curl -s -o /dev/null -w '%{http_code}' "$URL/health")
83-
if [ "$STATUS" != "200" ]; then
84-
echo "❌ /health returned $STATUS"
85-
exit 1
86-
fi
87-
88-
echo "🔍 Testing $URL/config/project-overrides ..."
89-
STATUS=$(curl -s -o /dev/null -w '%{http_code}' "$URL/config/project-overrides")
90-
if [ "$STATUS" != "200" ]; then
91-
echo "❌ /config/project-overrides returned $STATUS"
92-
exit 1
93-
fi
94-
95-
echo "🔍 Testing $URL/ ..."
96-
STATUS=$(curl -s -o /dev/null -w '%{http_code}' "$URL/")
97-
if [ "$STATUS" != "200" ]; then
98-
echo "❌ / returned $STATUS (this is the index page served by the Express server)"
99-
exit 1
100-
fi
85+
# Smoke test: health + config + index in a single pass
86+
for ENDPOINT in "/health" "/config/project-overrides" "/"; do
87+
echo "🔍 Testing $URL$ENDPOINT ..."
88+
STATUS=$(curl -s -o /dev/null -w '%{http_code}' --max-time 30 "$URL$ENDPOINT")
89+
if [ "$STATUS" != "200" ]; then
90+
echo "⚠️ $ENDPOINT returned $STATUS"
91+
FAILED=1
92+
fi
93+
done
10194
102-
echo "✅ All smoke tests passed for '$ENV_NAME'"
95+
echo "✅ Smoke tests done for '$ENV_NAME'"
10396
echo ""
10497
done
10598
99+
if [ "$FAILED" -ne 0 ]; then
100+
echo "⚠️ Some smoke tests failed — see above for details"
101+
exit 1
102+
fi
103+
106104
echo "🎉 All Vercel preview deployments are healthy"

0 commit comments

Comments
 (0)