fix(deploy): populate build provenance on dev (#958)#968
Conversation
Two independent bugs caused `GET /api/version` (and the NavBar Build Info dialog) to return `unknown` for every git/build field on the dev deployment: 1. `docker-compose.prod.yml` backend service had no `build.args` block, so the Dockerfile's `GIT_COMMIT` / `GIT_BRANCH` / `BUILD_DATE` etc. ARGs never received values during compose builds. Base `docker-compose.yml` carries the block, but the dev workflow builds with `-f docker-compose.prod.yml` only, not chained with base. 2. `.github/workflows/deploy-dev.yml` didn't compute and pass the git provenance env vars before invoking `docker compose build`. `scripts/deploy/start.sh` does this for local runs; the workflow was missing the equivalent block. Fix: - Add `args:` block to prod compose backend service mirroring base. - In the workflow, compute git vars from the dev VM's checkout and pass them inline on the `sudo docker compose build` invocation. Inline `sudo VAR=val …` is used rather than `sudo -E` because the default Ubuntu sudoers does not preserve `GIT_*` through `env_reset`. After deploy, dev's Build Info dialog will render the real commit and build timestamp instead of `unknown`. Related to #958 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
/review report — fine to mergeCritical findings: 0 Pass 1 (critical / blockers)
Pass 2 (informational)[I1] [I2] Workflow passes env vars to all four builds; only Scope checkPARTIAL DRIFT — disclosed and intentional. Issue #958 title says "local development"; this PR fixes the CI dev deployment. The local path was already fixed in #931 (start.sh exports + base Other categories — cleanConditional side effects · magic numbers · dead code · error handling ( 🤖 Generated by |
vybe
left a comment
There was a problem hiding this comment.
LGTM — clean two-line infra fix with right scoping. Approved per /validate-pr.
Summary
Fixes two independent bugs that left
GET /api/version(and the NavBar Build Info dialog) showingunknownfor every git/build field on the dev deployment.docker-compose.prod.ymlbackend service was missing itsbuild.argsblock. Basedocker-compose.yml:11-15declaresGIT_COMMIT/GIT_BRANCH/GIT_COMMIT_SUBJECT/GIT_COMMIT_TIMESTAMP/BUILD_DATEbuild args, but the dev workflow builds with-f docker-compose.prod.ymlonly — not chained with base — so the Dockerfile ARGs never received any values. Added the equivalent block to prod compose..github/workflows/deploy-dev.ymldidn't compute the git provenance env vars beforedocker compose build.scripts/deploy/start.sh:175-181does this for local runs; the workflow was missing the equivalent. Added a block that reads the values off the dev VM's checked-out tree and passes them inline on thesudo docker compose buildinvocation.The
sudo VAR=val …inline form is intentional rather thansudo -Ebecause Ubuntu's default sudoersenv_resetdoes not preserveGIT_*through-E.Local runs were always fine —
start.shdid both halves of the work (export + base compose carries the args). Only the CI deploy path was broken.Related to #958
Test plan
trinity-backendcontainer env after the build:unknown./api/versionon dev (authenticated) — all fields populated.unknownrows.Out of scope (follow-up in #958)
The issue also asks for a dialog UX fallback when all fields are still
unknown(true e.g. for ad-hocdocker buildwithout args) and an explanatory blurb under the dialog title. Frontend-only — not blocked on this deploy fix and would expand the PR's blast radius. Happy to send a second PR once this lands.🤖 Generated with Claude Code