ci(version): pass COMMIT_DATE and BUILD_DATE build-args so dates bake (FJ-25) #41
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/version-sha-date-FJ-25"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The default
fj versionline gains the short SHA and commit date only when build.rs seesCOMMIT_DATE/BUILD_DATEenv. build.rs cannot derive them itself (the Docker build does not copy.git), so CI must pass them exactly the wayGIT_SHAalready flows. The prior commit added the build.rs / version.rs side; this wires the build inputs.Both
build-binary.ymlandbuild-binary-windows.ymlcomputecommit_date(git show -s --format=%cI HEAD) andbuild_date(date now) in the "Compute build metadata" step, emit them as step outputs, and pass both todocker buildx buildas--build-arg. The latest-train manifest'sbuilt_atnow reuses the samebuild_dateoutput so the binary's baked build date and the manifest agree.Both
oci-build/Dockerfileandoci-build/Dockerfile.windowsacceptARG COMMIT_DATE/ARG BUILD_DATEandENVthem into the real-source build stage alongsideGIT_SHA/FJ_TRAIN. A localjust build-dockerleaves them empty, so the version line stays the cleanfj v{version}.Verified by
docker buildx buildwith the new args: the exported binary printsfj v0.7.1 (0ac836df 2026-05-28)on the default line and carries both full RFC3339 dates in-vand--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 (0ac836df2026-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>Pull request closed