Skip to content

Commit 0c057e9

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 0c057e9

1 file changed

Lines changed: 27 additions & 28 deletions

File tree

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

Lines changed: 27 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,26 @@ 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+
RESULT=$(gh api "repos/$REPO/deployments/$DEPLOY_INFO/statuses?per_page=1" --jq '.[0] | "\(.state // "") \(.environment_url // "")"')
67+
STATE=$(echo "$RESULT" | cut -d' ' -f1)
6368
if [ "$STATE" = "success" ]; then
64-
URL=$(gh api "repos/$REPO/deployments/$DEPLOY_ID/statuses?per_page=1" --jq '.[0].environment_url')
69+
URL=$(echo "$RESULT" | cut -d' ' -f2-)
6570
echo "✅ '$ENV_NAME' deployed at: $URL"
6671
break
6772
elif [ "$STATE" = "failure" ] || [ "$STATE" = "error" ]; then
68-
echo "❌ '$ENV_NAME' deployment failed with state: $STATE"
69-
exit 1
73+
echo "⚠️ '$ENV_NAME' deployment failed with state: $STATE"
74+
FAILED=1
75+
continue 2
7076
fi
7177
fi
7278
sleep 10
@@ -77,30 +83,23 @@ jobs:
7783
continue
7884
fi
7985
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
86+
# Smoke test: health + config + index in a single pass
87+
for ENDPOINT in "/health" "/config/project-overrides" "/"; do
88+
echo "🔍 Testing $URL$ENDPOINT ..."
89+
STATUS=$(curl -s -o /dev/null -w '%{http_code}' --max-time 30 "$URL$ENDPOINT")
90+
if [ "$STATUS" != "200" ]; then
91+
echo "⚠️ $ENDPOINT returned $STATUS"
92+
FAILED=1
93+
fi
94+
done
10195
102-
echo "✅ All smoke tests passed for '$ENV_NAME'"
96+
echo "✅ Smoke tests done for '$ENV_NAME'"
10397
echo ""
10498
done
10599
100+
if [ "$FAILED" -ne 0 ]; then
101+
echo "⚠️ Some smoke tests failed — see above for details"
102+
exit 1
103+
fi
104+
106105
echo "🎉 All Vercel preview deployments are healthy"

0 commit comments

Comments
 (0)