feat(health): include build version in health response#21
Conversation
There was a problem hiding this comment.
Pull request overview
Adds build/version traceability to the API health endpoints by including a version field in the /health/live and /health/ready JSON response, sourced from runtime deployment metadata.
Changes:
- Add
versionfield to health check JSON response, resolved fromAPP_BUILD_VERSIONwith assembly version fallback. - Stamp deployments with a CI-derived build version (
runNumber.runAttempt-sha7) via the API deploy GitHub Actions workflow.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/ModularMonolith/CleanArchitecture.Api/HealthChecks/HealthCheckResponseWriter.cs |
Adds version to health payload and implements version resolution logic (env var → assembly informational/version → "unknown"). |
.github/workflows/api-ci-cd.yml |
Computes a CI build version and injects it into the deployed container as APP_BUILD_VERSION. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| var payload = new | ||
| { | ||
| status = report.Status.ToString(), | ||
| version = ApplicationVersion, | ||
| totalDuration = report.TotalDuration.TotalMilliseconds, |
There was a problem hiding this comment.
The new version field is added to the health JSON payload, but current integration tests only assert the status property. Add/extend tests to assert version is present and that APP_BUILD_VERSION (when set for the test host) overrides the assembly version fallback, to prevent regressions in this traceability feature.
Summary\n- add �ersion field to /health/live and /health/ready JSON payload\n- resolve version from APP_BUILD_VERSION env var, fallback to assembly informational version\n- stamp deployment runtime with CI build version (
unNumber.runAttempt-sha7) in API deploy workflow\n\n## Why\nThis provides deterministic release traceability after each CI/CD run and makes it easy to verify what version is live from health endpoints.