Skip to content

Commit fe88d99

Browse files
feat: expose the built commit SHA in /health
Redeploying AppSail is a separate manual step from pushing to main, and whether a given fix is actually live has been genuinely ambiguous multiple times tonight -- deployment timestamps alone don't say which commit they pulled. The CI image build now bakes the commit SHA in as a build arg; /health reports it as git_sha so a redeploy can be confirmed by comparing it against the latest commit on main, instead of guessing from timing.
1 parent 660136c commit fe88d99

3 files changed

Lines changed: 10 additions & 0 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ jobs:
9191
context: ./backend
9292
push: true
9393
platforms: linux/amd64
94+
build-args: |
95+
GIT_SHA=${{ github.sha }}
9496
tags: |
9597
ghcr.io/sarmahighoncode/kaval-api:latest
9698
ghcr.io/sarmahighoncode/kaval-api:${{ github.sha }}

‎backend/Dockerfile‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
FROM python:3.12-slim
22
WORKDIR /srv/backend
3+
# Bakes the built commit into the image so /health can report exactly what's
4+
# running -- redeploying is a separate manual step from pushing to main, and
5+
# "is my fix actually live" has cost real debugging time more than once.
6+
ARG GIT_SHA=unknown
7+
ENV KAVAL_GIT_SHA=$GIT_SHA
38
COPY requirements.txt requirements-catalyst.txt ./
49
RUN pip install --no-cache-dir -r requirements.txt \
510
# --no-deps: zcatalyst-sdk pins typing-extensions~=4.12.1, which conflicts

‎backend/app/main.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,4 +203,7 @@ def health() -> dict:
203203
"zcql_connected": zcql_ok,
204204
"smartbrowz_enabled": smartbrowz,
205205
"voice_endpoints": ["/api/voice/stt", "/api/voice/tts"],
206+
# Baked in at Docker build time (see Dockerfile's GIT_SHA build arg) --
207+
# "unknown" means this image predates that change, not that it failed.
208+
"git_sha": __import__("os").environ.get("KAVAL_GIT_SHA", "unknown"),
206209
}

0 commit comments

Comments
 (0)