ci: add preview smoke test for frontend PRs#7192
ci: add preview smoke test for frontend PRs#7192talissoncosta wants to merge 14 commits intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 3 Skipped Deployments
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7192 +/- ##
=======================================
Coverage 98.29% 98.29%
=======================================
Files 1351 1351
Lines 50752 50752
=======================================
Hits 49885 49885
Misses 867 867 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Failures now warn instead of hard-failing individual endpoints. The job still exits non-zero so the PR check shows a warning, but continue-on-error prevents it from blocking merge. Also consolidates the 3 separate curl checks into a single endpoint loop. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The state and environment_url were fetched in 2 separate calls to the same endpoint. Now parsed from a single response — halves the API calls per poll iteration. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
0c057e9 to
06cd573
Compare
/health, /admin, /metrics and /sales-dashboard are now only reachable via internal.flagsmith.com (VPN). Public preview URLs return 404 for these paths. Keep /config/project-overrides (Express server-side route, proves the server is running) and / (proves static files are deployed). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
0ab5559 to
c7492fd
Compare
|
Update: the previous approach produced false positives — it was testing URLs before Vercel finished deploying, hitting the stale previous build. Rewrote to a two-phase approach:
Also dropped |
The Deployments API approach failed for "Ignored Build Step" skips — Vercel creates no deployment for the SHA, and stores SHAs as the ref field so branch-name queries also returned nothing. Parse the preview URLs directly from the Vercel bot PR comment, which is always present and has working URLs regardless of whether a build ran. Added pull-requests:read permission for comment access. Dropped /health from the checked endpoints — now behind VPN (internal.flagsmith.com only) and returns 404 on public URLs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Grep pattern widened from `flagsmith-frontend[^ )]*` to `[^ )]*vercel\.app` — resilient to project renames - Index page check now validates the response body contains 'Flagsmith', catching broken deployments that serve error pages with 200 status. Single curl call for both status + body. Closes #7262 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Previous approach tested preview URLs immediately, producing false positives when Vercel was still deploying (the stale previous build responded 200). Two-phase approach: 1. Wait for Vercel deployment statuses to leave 'pending' — polls the commit status API until all Vercel-related checks complete. Handles real builds (waits for success/failure), skipped builds (immediately complete), and build failures (reports + exits). 2. Parse frontend preview URLs from the Vercel bot PR comment (now guaranteed up-to-date) and curl them with status + content validation. Trade-off: slower (waits for Vercel build, typically 2-8 min) but correct — no false positives. Contributes to #7262 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Filter statuses by 'flagsmith-frontend' instead of 'Vercel' so docs deployments don't block the wait - Poll up to 30s for the Vercel bot comment after deployments complete (handles timing gap between deploy finish and comment update) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Zaimwa9
left a comment
There was a problem hiding this comment.
Last blocking point to me is the continue-on-error that defeats the purpose of blocking the deployment if the target is unhealthy.
I'd separate 2 cases:
- We couldn't check because of timeout, no statuses or no comment (we don't know but nothing hints in not deploying) => this would be acceptable to skip
- We managed to send a request to vercel and it failed, the app is clearly down => here we block deployment
I'm unsure how to achieve this but I think we could leverage on the exit status (0 when we want to continue; 1 => we block)
| name: Vercel Preview Smoke Test | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 15 | ||
| continue-on-error: true |
There was a problem hiding this comment.
I'm just worried that this would let the deployment happen in case it raised a real error
|
Closing — the approach is too brittle. Scraping the Vercel bot's PR comment to extract the preview URL means our CI depends on a third-party comment format we don't control, and silently breaks if Vercel changes it. If we ever want this check, it should pull the preview URL from a reliable source (Vercel API, deployment status, or a job output from Vercel's own check) rather than parsed markdown. |
Changes
Contributes to #7262
Vercel Preview Smoke Test
Adds a smoke test job to the frontend PR workflow. On every PR that touches
frontend/**, the job waits for Vercel to finish deploying, then verifies the preview is healthy.How it works
Phase 1 — Wait for Vercel deployments:
flagsmith-frontendchecks (scoped to frontend only — won't wait for docs)pending(real builds: waits for completion; skipped builds: immediately done)Phase 2 — Smoke test the preview:
flagsmith-frontend-*URLs from the Vercel bot PR comment (short poll with 30s buffer for comment update timing)GET /config/project-overrides— Express server is runningGET /— static files deployed + response body contains "Flagsmith" (content validation)Properties
continue-on-error: true, failures warn but don't gate mergetimeout-minutes: 15on the job,--max-time 30on each curlgh api+curlReview feedback addressed
--max-time 30)continue-on-error: true)/health(behind VPN, returns 404 on public URLs)/How did you test this code?
🤖 Generated with Claude Code