fix(ci): embed commit hash in OCI build (footer no longer 'unknown') #72

Merged
vas2000-work merged 1 commit from fix/ci-embed-git-sha into main 2026-06-05 23:09:20 +02:00
Owner

The SPA version footer showed git hash unknown on staging.

Cause

build.rs derives the hash via git rev-parse, but the OCI image build context has no .git, so it fell back to unknown. CI already passes --build-arg GIT_SHA=$GITHUB_SHA, but only the final (image-label) stage declared ARG GIT_SHA; the builder stage where dx build runs never saw it.

Fix

  • Declare ARG GIT_SHA in the builder stage and export it as an env so build.rs can read it.
  • build.rs now prefers GIT_SHA (shortened to 12 chars), falling back to git rev-parse for local/dev builds.

Build date already resolved via date in the builder, so only the hash needed wiring. No workflow change needed (the build-arg was already passed). The OCI build workflow on this PR validates the Dockerfile end to end.

The SPA version footer showed git hash `unknown` on staging. ## Cause `build.rs` derives the hash via `git rev-parse`, but the OCI image build context has no `.git`, so it fell back to `unknown`. CI already passes `--build-arg GIT_SHA=$GITHUB_SHA`, but only the final (image-label) stage declared `ARG GIT_SHA`; the builder stage where `dx build` runs never saw it. ## Fix - Declare `ARG GIT_SHA` in the builder stage and export it as an env so `build.rs` can read it. - `build.rs` now prefers `GIT_SHA` (shortened to 12 chars), falling back to `git rev-parse` for local/dev builds. Build date already resolved via `date` in the builder, so only the hash needed wiring. No workflow change needed (the build-arg was already passed). The OCI build workflow on this PR validates the Dockerfile end to end.
fix(ci): embed the commit hash in the OCI build so the footer is not "unknown"
All checks were successful
Check / clippy + fmt + tests (pull_request) Successful in 41s
Create release / Create release from merged PR (pull_request) Has been skipped
4a8866de12
The SPA footer showed git hash "unknown" on staging. build.rs derives the hash with `git rev-parse`, but the OCI image build context has no `.git`, so it fell back to "unknown". CI already passes `--build-arg GIT_SHA=$GITHUB_SHA`, but only the final image-label stage declared the ARG. Declare `ARG GIT_SHA` in the builder stage and export it as an env, and have build.rs prefer `GIT_SHA` (shortened to 12 chars) over the git command, falling back to git for local/dev builds. Build date already resolves via `date` in the builder, so only the hash needed wiring.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
vas2000-work deleted branch fix/ci-embed-git-sha 2026-06-05 23:09:21 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/mokosh-apps!72
No description provided.