ci(version): pass COMMIT_DATE and BUILD_DATE build-args so dates bake (FJ-25) #29
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "ci/version-dates-buildargs-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?
What
FJ-25 (follow-up to PR #28): wire the CI + Dockerfile build inputs so the
fj versionshort SHA and commit date actually bake into published binaries.PR #28 merged the Rust half (
crates/fj/build.rsreadsCOMMIT_DATE/BUILD_DATEenv and bakesFJ_COMMIT_DATE/FJ_BUILD_DATE;crates/fj/src/version.rsshows them on the default line, in-v, and in--json). Those changes are inmain. But the build pipeline never setsCOMMIT_DATE/BUILD_DATE, so a real CI build still prints the unchangedfj v0.7.1line. This PR supplies those inputs, completing acceptance criterion 6 (and, by extension, criterion 1 for CI builds).Changes
.forgejo/workflows/build-binary.ymlandbuild-binary-windows.yml: the "Compute build metadata" step now also computescommit_date(git show -s --format=%cI HEAD) andbuild_date(date now), emits both as step outputs, and the build step passes them todocker buildx buildas--build-arg COMMIT_DATE=.../--build-arg BUILD_DATE=.... The latest-train manifest'sbuilt_atreuses the samebuild_dateoutput so the binary's baked build date and the manifest agree.oci-build/Dockerfileandoci-build/Dockerfile.windows: acceptARG 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}.This branch is based on current
main, so PR #27's Windows OpenSSL-vendoring changes (v1.1.0builder image, vendored-OpenSSL note) are preserved.Verification
docker buildx build --target binarywithGIT_SHA/COMMIT_DATE/BUILD_DATEset produced a binary whose default line isfj v0.7.1 (abc12345 2026-05-28), with full RFC3339commit date/build dateunder-vand matching fields in--json. A local build with the args empty keeps the cleanfj v0.7.1line.Note on issue State
Bare
#FJ-25reference only (noState Donetrailer) per repo commit policy: the Forgejo VCS integration applies trailer commands at push time, so aState Donetrailer would resolve the issue while this PR is still open. State moves to Done after a human merges.🤖 Generated with Claude Code
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>