Repository navigation
ci: smoke test dev after deploy and gate production on it - #1642
Merged
Merged
Conversation
deploy-development now waits until https://dev.essentialcsharp.com/version reports the deployed commit (az containerapp update returns before traffic shifts), then runs anonymous smoke tests from the new EssentialCSharp.Web.E2ETests project. They run inside the deploy job so they hold its concurrency group, and deploy-production needs this job, so a failure blocks promotion. Checks: /health and /alive, /version commit, home page and canonical origin, sitemap lists the full book and a chapter renders, login page captcha and external providers, and GitHub/Microsoft external login redirects carry a client id and the deployed callback. Tests skip unless E2E_BASE_URL or E2E_EXPECTED_COMMIT is set, and fail (rather than skip) on a malformed URL.
Use a non-null DeployedSite.RequiredBaseUrl (throws a descriptive error when E2E_BASE_URL is missing or malformed) and the value returned by TUnit's IsNotNull() instead of '!'.
Replace the hand-rolled retry helper with a ResilienceHandler built from HttpRetryStrategyOptions (one retry; 5xx, 408, 429, connection errors and per-attempt timeouts are transient; Retry-After honoured, capped at 30s). Other statuses, including the redirects the tests assert on, return on the first attempt. Same package the web app already uses for its HttpClients.
BenjaminMichaelis
added a commit
that referenced
this pull request
Nov 15, 2026
…#1643) ## Why #1642 made the deployed smoke tests a gate on each dev deploy. Some breakage happens **without a deploy**: expiring secrets or Key Vault access, external-login app settings, content, or the site going down. Nothing would notice those until the next push. ## What - **`Scheduled-Smoke-Test-Development.yml`** runs the same `[Category=Deployed]` tests against dev every 6 hours (`17 */6 * * *`) and on `workflow_dispatch`. - No expected commit, because dev may run any recent build between deploys. `/version` must still answer with a commit. - TRX results are uploaded on failure. - The workflow has its own concurrency group. It deliberately doesn't share `deploy-development`: a queued run in a shared group would replace a pending deployment. - **`scripts/report-scheduled-smoke-result.sh`** keeps one `smoke-test-failure` issue (the label is created on first use): | Situation | Action | |---|---| | One failure (the previous pass/fail run succeeded) | `::warning::` only, since one blip isn't an incident | | Second failure in a row | Open the issue | | Still failing with an issue open | **Edit** the issue body with the latest run (no notification every 6 h) | | A run passes with an issue open | Comment and close | | Cancelled | Nothing | - A setup failure (checkout or .NET) counts as a failure, so the reported outcome matches the run conclusion that the next run reads. - Cancelled and skipped runs don't break a failure streak. - If the open-issue lookup fails, the step fails rather than treating it as "no issue", which would risk duplicates. - Reporting only happens from `main`. GitHub only emails the last person who edited a scheduled workflow, so the issue is what makes failures visible to everyone. ## Cost and limits Each run makes about 13 requests to dev, and 2 of them count against the anonymous content limit (20/hour per IP). Each run takes about 2 minutes on `ubuntu-latest`. ## Verification - Every reporting branch tested in `DRY_RUN=true` with a fake `gh`: open, update, close, warn, cancelled, and lookup error (the step fails). - The real read-only `gh issue list` and `gh run list` queries were dry-run against this repo. - The smoke tests pass 8/8 against dev in the scheduled configuration (no expected commit). - **Not yet exercised:** the cron trigger and real issue creation. After merge, start a run with **Actions → Scheduled smoke test (Development) → Run workflow**.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Production is currently promoted as soon as
deploy-developmentfinishes, even if dev is broken.az containerapp updatealso returns about 45 s before traffic shifts to the new revision. Builds on #1639 (GET /version).What
New steps at the end of
deploy-development:scripts/wait-for-deployed-commit.shpollshttps://dev.essentialcsharp.com/versionuntil it reportsgithub.sha3 times in a row (10-minute timeout). The URL can be overridden withvars.SITE_BASE_URL. On timeout it printsaz containerapp revision list.dotnet testruns the newEssentialCSharp.Web.E2ETestsproject filtered to[Category=Deployed]. TRX results are uploaded on failure.The steps run inside
deploy-development, not in a separate job, so they hold its concurrency group, and the next push can't swap the dev image mid-test.deploy-productionalreadyneedsthis job, so a failed smoke run blocks promotion. Dev keeps the failed build until the next push; there is no automatic rollback.Checks (anonymous, read-only apart from one form post per provider)
/health,/alivereturn 200/versioncommit equalsgithub.sha/homerenders, and its canonical link uses the deployed originSiteSettings:BaseUrlmisconfigurationPOST /Identity/Account/ExternalLoginfor GitHub and Microsoft returns 302 to the provider's authorize endpoint withclient_idandredirect_uri=<site>/signin-<provider>The full OAuth round trip, secrets and consent are out of scope. Logged-in flows (login and AI chat) will follow separately. They need a dev test account and a captcha decision first.
Safety and robustness
E2E_BASE_URLorE2E_EXPECTED_COMMITis set, so the normal 3-OS PR test run is unaffected. If either is set, the tests always run, so a malformed URL fails the gate instead of skipping everything and passing./health,/aliveand/versionare exempt.Verification
/versionreturned 302 because that build predates it, which is expected. After this merges, the deploy will include/version./versionfor success, wrong-commit timeout, unreachable host (the curl error is shown) and missingjq.E2E_BASE_URLmakes all 8 fail with a clear message.