ci(version): pass COMMIT_DATE and BUILD_DATE build-args so dates bake (FJ-25) #41

Closed
David wants to merge 2 commits from feat/version-sha-date-FJ-25 into main
Owner

The default fj version line gains the short SHA and commit date only when build.rs sees COMMIT_DATE/BUILD_DATE env. build.rs cannot derive them itself (the Docker build does not copy .git), so CI must pass them exactly the way GIT_SHA already flows. The prior commit added the build.rs / version.rs side; this wires the build inputs.

Both build-binary.yml and build-binary-windows.yml compute commit_date (git show -s --format=%cI HEAD) and build_date (date now) in the "Compute build metadata" step, emit them as step outputs, and pass both to docker buildx build as --build-arg. The latest-train manifest's built_at now reuses the same build_date output so the binary's baked build date and the manifest agree.

Both oci-build/Dockerfile and oci-build/Dockerfile.windows accept ARG COMMIT_DATE/ARG BUILD_DATE and ENV them into the real-source build stage alongside GIT_SHA/FJ_TRAIN. A local just build-docker leaves them empty, so the version line stays the clean fj v{version}.

Verified by docker buildx build with the new args: the exported binary prints fj v0.7.1 (0ac836df 2026-05-28) on the default line and carries both full RFC3339 dates in -v and --json.

#FJ-25

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com

The default `fj version` line gains the short SHA and commit date only when build.rs sees `COMMIT_DATE`/`BUILD_DATE` env. build.rs cannot derive them itself (the Docker build does not copy `.git`), so CI must pass them exactly the way `GIT_SHA` already flows. The prior commit added the build.rs / version.rs side; this wires the build inputs. Both `build-binary.yml` and `build-binary-windows.yml` compute `commit_date` (`git show -s --format=%cI HEAD`) and `build_date` (`date now`) in the "Compute build metadata" step, emit them as step outputs, and pass both to `docker buildx build` as `--build-arg`. The latest-train manifest's `built_at` now reuses the same `build_date` output so the binary's baked build date and the manifest agree. Both `oci-build/Dockerfile` and `oci-build/Dockerfile.windows` accept `ARG COMMIT_DATE`/`ARG BUILD_DATE` and `ENV` them into the real-source build stage alongside `GIT_SHA`/`FJ_TRAIN`. A local `just build-docker` leaves them empty, so the version line stays the clean `fj v{version}`. Verified by `docker buildx build` with the new args: the exported binary prints `fj v0.7.1 (0ac836df 2026-05-28)` on the default line and carries both full RFC3339 dates in `-v` and `--json`. #FJ-25 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ci(version): pass COMMIT_DATE and BUILD_DATE build-args so dates bake (FJ-25)
Some checks failed
Check / fmt + clippy + build + tests (pull_request) Has been cancelled
3133c3288d
The default `fj version` line gains the short SHA and commit date only when build.rs sees `COMMIT_DATE`/`BUILD_DATE` env. build.rs cannot derive them itself (the Docker build does not copy `.git`), so CI must pass them exactly the way `GIT_SHA` already flows. The prior commit added the build.rs / version.rs side; this wires the build inputs.

Both `build-binary.yml` and `build-binary-windows.yml` compute `commit_date` (`git show -s --format=%cI HEAD`) and `build_date` (`date now`) in the "Compute build metadata" step, emit them as step outputs, and pass both to `docker buildx build` as `--build-arg`. The latest-train manifest's `built_at` now reuses the same `build_date` output so the binary's baked build date and the manifest agree.

Both `oci-build/Dockerfile` and `oci-build/Dockerfile.windows` accept `ARG COMMIT_DATE`/`ARG BUILD_DATE` and `ENV` them into the real-source build stage alongside `GIT_SHA`/`FJ_TRAIN`. A local `just build-docker` leaves them empty, so the version line stays the clean `fj v{version}`.

Verified by `docker buildx build` with the new args: the exported binary prints `fj v0.7.1 (0ac836df 2026-05-28)` on the default line and carries both full RFC3339 dates in `-v` and `--json`.

#FJ-25

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Merge branch 'main' into feat/version-sha-date-FJ-25
All checks were successful
Create release / Create release from merged PR (pull_request) Has been skipped
Check / fmt + clippy + build + tests (pull_request) Successful in 37s
ee54614fa5
David closed this pull request 2026-06-06 21:39:30 +02:00
All checks were successful
Create release / Create release from merged PR (pull_request) Has been skipped
Check / fmt + clippy + build + tests (pull_request) Successful in 37s

Pull request closed

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
pandoras-box/forgejo-cli!41
No description provided.