Skip to content

ci(docker-release): pass GIT_SHA build-arg to image builds - #20

Merged
cbayram merged 1 commit into
pinpredict:mainfrom
cbayram:ci/pass-git-sha-buildarg
Jun 8, 2026
Merged

ci(docker-release): pass GIT_SHA build-arg to image builds#20
cbayram merged 1 commit into
pinpredict:mainfrom
cbayram:ci/pass-git-sha-buildarg

Conversation

@cbayram

@cbayram cbayram commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

What

Add --build-arg GIT_SHA=${SHORT_SHA} to the shared docker-release.yml buildx invocation, alongside the existing APP_VERSION build-arg.

Why

The per-repo 0.0.X version is a build-ID — it increments independently per ECR repo, so a service running on parallel lanes (e.g. trader-tools stable vs trader-tools-dev) gets divergent numbers, and a matching number never guarantees matching code. The git commit is identical iff the code is identical, so it's the reliable "is this the same build across lanes?" signal — and the thing a /api/version endpoint should surface.

SHORT_SHA (7-char) is already computed for the secondary :<version>-<sha> ECR tag, so this just threads the same value through as a build-arg.

Blast radius

None for existing services. Docker warns on an unused --build-arg but never fails, so any Dockerfile that doesn't declare ARG GIT_SHA simply ignores it. Opt-in per service.

First consumer

trader-tools backend (pinpredict/trader-tools#645) declares ARG GIT_SHA and bakes it to a runtime env → surfaced at /api/version as commit and in the UI version tooltip. Until this lands, that field is gracefully omitted.

The build already stamps APP_VERSION (the resolved per-repo 0.0.X). Also
pass the git short-SHA so images can surface the exact commit they were
built from at runtime. Unlike the per-repo version (an independent build-ID
that diverges across a service's parallel lanes), the commit is identical
iff the code is identical — the reliable cross-lane "same build?" signal.

SHORT_SHA is already computed for the secondary `:<ver>-<sha>` ECR tag, so
this just threads it through as a build-arg. Dockerfiles that don't declare
`ARG GIT_SHA` ignore it (Docker warns on unused build-args, never fails),
so this is a no-op for every service except those that opt in.

First consumer: trader-tools backend (bakes GIT_SHA → /api/version `commit`).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@cbayram
cbayram merged commit f8ad4b1 into pinpredict:main Jun 8, 2026
2 checks passed
@cbayram
cbayram deleted the ci/pass-git-sha-buildarg branch June 8, 2026 21:52
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