Skip to content

fix(version): populate /version/ git_sha and built_at in deployed envs (#1366)#1371

Merged
jonfroehlich merged 1 commit into
masterfrom
1366-version-build-info
Jun 22, 2026
Merged

fix(version): populate /version/ git_sha and built_at in deployed envs (#1366)#1371
jonfroehlich merged 1 commit into
masterfrom
1366-version-build-info

Conversation

@jonfroehlich

Copy link
Copy Markdown
Member

Follow-up to #1366. On the deployed servers, /version/ reported "git_sha": "unknown" and "built_at": "unknown".

Root causes

  1. git was never installed in the image. docker-entrypoint.sh runs git rev-parse to capture the deployed SHA, but the Dockerfile only installed imagemagick / ghostscript / sqlite3 — so the command always failed → git_sha: "unknown".
  2. git's "dubious ownership" guard. On the servers /code/.git is apache:makelab-owned while the container runs as root; even with git installed, git rev-parse would refuse with "detected dubious ownership in repository".
  3. built_at was also unknown because the build-info step only runs at container start, and the live prod container predates Add a JSON version/build-info endpoint (e.g. /version/) to make the deployed code version easy to check #1366 — code updates reach it via the bind-mount + autoreload, but the entrypoint never re-ran, so build-info.json was never written.

Fix

  • Install git in the Dockerfile.
  • Run git -c safe.directory=/code -C /code rev-parse --short HEAD in the entrypoint (-c is process-local — no global git config side effects).
  • The Dockerfile change forces an image rebuild on the next deploy → docker compose up -d recreates the container → the entrypoint re-runs and writes build-info.json.

Verification (local)

Ran the exact entrypoint commands in the container:

{"git_sha": "09d6f2f", "built_at": "2026-06-22T15:14:10+00:00"}

and /version.json then reported both. build-info.json remains gitignored.

Bumps version to 2.17.2.

🤖 Generated with Claude Code

#1366)

The /version/ endpoint reported git_sha and built_at as "unknown" on the
servers. Two root causes in the build-info capture:

- git was never installed in the image, so `git rev-parse` in
  docker-entrypoint.sh always failed -> git_sha "unknown".
- Even with git present, /code/.git is apache:makelab-owned on the servers
  while the container runs as root, so git's "dubious ownership" guard would
  refuse to run rev-parse.

Installs git in the Dockerfile and runs `git -c safe.directory=/code -C /code
rev-parse`. The Dockerfile change also forces an image rebuild on the next
deploy, so the entrypoint re-runs and actually writes build-info.json (the
live container predated #1366, hence built_at was unknown too).

Verified locally: the entrypoint commands now write a real short SHA +
timestamp and /version.json reflects both. build-info.json stays gitignored.

Bumps version to 2.17.2.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jonfroehlich jonfroehlich merged commit ba8d908 into master Jun 22, 2026
3 checks passed
@jonfroehlich jonfroehlich deleted the 1366-version-build-info branch June 22, 2026 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant