Repository navigation
fix(ci): fail deploy verification on degraded health and Azure log lookup errors - #437
Conversation
…okup errors The deploy health and smoke steps accepted any body containing a status key, or any HTTP 200, but /health returns 200 with status=degraded by design. Require .status == "healthy" via jq in all four deploy workflows, warming the lazy DB init through a public /api/ route on the HTTP transports first. The Azure log step queried the hardcoded cudly-rg default instead of the per-environment resource group and swallowed ResourceGroupNotFound with || true. Use the Terraform resource_group_name output and let lookup errors fail the step. Closes #217
|
Warning Review limit reached
This review includes 5 billable files and costs up to $1.25.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 23 minutes for your next included review. View limit detailsLimit details: You’ve used the included review currently available. Your 62 included PR review attempts over the past 7 days set your current allowance at 1 review per hour. Review configuration: ⚙️ Run configurationConfiguration used: Repository: LeanerCloud/cloud-commitments-platform/.coderabbit.yaml Review profile: CHILL Plan: Essentials Run ID: 📒 Files selected for processing (5)
Comment |
|
Independent adversarial review (Opus 5.5) at b069c70: MERGE. All 4 deploy workflows require jq -e '.status == "healthy"' (degraded, wrong-case, array and concatenated JSON pass on main but fail here; empty, HTML, non-JSON and 503 fail on both); the Azure log step uses the TF resource_group_name output with no || true; retries are bounded; the warm-up GET /api/auth/check-admin is read-only, and any /api path triggers ensureDB, so a route rename can't break it. This head is b069c70 plus a merge of main (#440, the red-main fix); workflow files are unchanged. Follow-ups: #438. |
Summary
Deployment verification now fails when the app reports
degraded, and the Azure log diagnostic queries the real per-environment resource group and fails on lookup errors.Root cause
Test health endpointonly grepped for a"status"key, so{"status":"degraded"}passed.Run smoke testsonly checked for HTTP 200, butinternal/server/health.goalways returns 200 and carries the verdict in the body.Check Container App logsusedenv.RESOURCE_GROUP(defaultcudly-rg), not thecudly-<env>-rggroup Terraform creates, and|| trueswallowedResourceGroupNotFound.Fix
jq -e '.status == "healthy"'. The top-level status is onlyhealthywhen config_store and auth_store are healthy and migrations are healthy or disabled (health.go), so this covers the required component checks.GET /api/auth/check-admin(public, read-only). On the HTTP server/healthnever callsensureDB, so without a warm-up request a fresh deploy would staydegraded(config_storepending, auth_store not initialized, exactly the payload in the issue) and the stricter check would fail every deploy. The warm-up result is ignored (|| true) on purpose;/healthstays the gate. Lambda needs no warm-up becauseHandleLambdaEventrunsensureDBfor every event,/healthincluded.build-and-deployexposes the Terraformresource_group_nameoutput as a job output; the log step uses it, errors if either output is empty, and no longer has|| true, so a failedaz containerapp logs showfails the step. The now-unusedRESOURCE_GROUPenv var and its README/header docs are removed.Regression test
There is no workflow test harness in this repo, so I extracted the
run:blocks of the two steps from deploy-azure.yml with PyYAML (sleeps set to 0, URL substituted) and ran them underbash -eagainst a local HTTP server that returns 200 with a given status:jq expression against sample payloads (
jq -e '.status == "healthy"'):The log-step change could not be exercised locally (needs Azure credentials and a deployed app); it has not been run.
Verification
actionlintv1.7.12 (the version pinned in .pre-commit-config.yaml), native binary: clean on alldeploy-*.yml.pre-commit runon the changed files: zizmor, markdownlint, trivy, whitespace and secrets hooks pass. Theactionlinthook was skipped (SKIP=actionlint) because it runs through Docker and the local Docker daemon is hung; the native binary at the same version was run instead.Closes #217