-
-
Notifications
You must be signed in to change notification settings - Fork 97
Add build information tracking to health check endpoint #1975
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds build version tracking to the health check endpoint by pulling a SHA from multiple sources, updates the Docker build to embed that SHA into a file and environment, and ensures the CI workflow passes the SHA through to build and deploy steps.
- Introduce
getBuildInfo()in the health check controller and include its output in the/isAliveresponse with a timestamp. - Extend
Dockerfile.prodto accept aBUILD_SHAbuild argument, set it as an environment variable, and write it to aBUILD_INFOfile. - Enhance the GitHub Actions workflow to capture
BUILD_SHA, update action versions, debug-build variables, and pass the SHA into the Docker build and ECS deploy.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| backend/controllers/healthCheck.controller.js | Added getBuildInfo() and enriched /isAlive response with build info |
| backend/Dockerfile.prod | Added BUILD_SHA arg, ENV BUILD_SHA, and BUILD_INFO file write |
| .github/workflows/aws-backend-deploy.yml | Captured BUILD_SHA, upgraded actions, and wired it through build/deploy |
Comments suppressed due to low confidence (1)
backend/controllers/healthCheck.controller.js:6
- The new
getBuildInfo()function has multiple code paths (env var, file read, Git fallback). It would be valuable to add unit tests covering each scenario (valid SHA, missing file, Git unavailable, etc.).
function getBuildInfo() {
| HealthCheckController.isAlive = (_, res) => { | ||
| const buildInfo = getBuildInfo(); | ||
| res.status(200).send(`I'm Alive! Build: ${buildInfo} - ${new Date().toISOString()}`); |
Copilot
AI
Jun 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling getBuildInfo() on every request performs synchronous file I/O and possibly spawns Git processes each time. Consider reading and caching the build info once at startup to avoid per-request overhead.
| HealthCheckController.isAlive = (_, res) => { | |
| const buildInfo = getBuildInfo(); | |
| res.status(200).send(`I'm Alive! Build: ${buildInfo} - ${new Date().toISOString()}`); | |
| cachedBuildInfo = getBuildInfo(); | |
| HealthCheckController.isAlive = (_, res) => { | |
| res.status(200).send(`I'm Alive! Build: ${cachedBuildInfo} - ${new Date().toISOString()}`); |
- Change healthCheck message to be cached
Co-authored-by: Copilot <[email protected]>
JackHaeg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much for making these changes, @trillium! This looks good. Approved :)
Fixes #1860
What changes did you make and why did you make them?
Improved Backend Deployment Process:
Enhanced Docker Setup:
Better Health Check System:
You can test the health check endpoint with these commands:
Why these changes were made:
Screenshot of
actionspanel:Backend Build and Deploy Screenshot
Builds successfully when triggered with
backendBuildThis change affects backend infrastructure and health check endpoint response only - no visual changes to the website frontend."