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

Merged
David merged 2 commits from ci/version-dates-buildargs-FJ-25 into main 2026-05-29 02:46:14 +02:00
Owner

What

FJ-25 (follow-up to PR #28): wire the CI + Dockerfile build inputs so the fj version short SHA and commit date actually bake into published binaries.

PR #28 merged the Rust half (crates/fj/build.rs reads COMMIT_DATE/BUILD_DATE env and bakes FJ_COMMIT_DATE/FJ_BUILD_DATE; crates/fj/src/version.rs shows them on the default line, in -v, and in --json). Those changes are in main. But the build pipeline never sets COMMIT_DATE/BUILD_DATE, so a real CI build still prints the unchanged fj v0.7.1 line. This PR supplies those inputs, completing acceptance criterion 6 (and, by extension, criterion 1 for CI builds).

Changes

  • .forgejo/workflows/build-binary.yml and build-binary-windows.yml: the "Compute build metadata" step now also computes commit_date (git show -s --format=%cI HEAD) and build_date (date now), emits both as step outputs, and the build step passes them to docker buildx build as --build-arg COMMIT_DATE=... / --build-arg BUILD_DATE=.... The latest-train manifest's built_at reuses the same build_date output so the binary's baked build date and the manifest agree.
  • 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}.

This branch is based on current main, so PR #27's Windows OpenSSL-vendoring changes (v1.1.0 builder image, vendored-OpenSSL note) are preserved.

Verification

docker buildx build --target binary with GIT_SHA/COMMIT_DATE/BUILD_DATE set produced a binary whose default line is fj v0.7.1 (abc12345 2026-05-28), with full RFC3339 commit date / build date under -v and matching fields in --json. A local build with the args empty keeps the clean fj v0.7.1 line.

Note on issue State

Bare #FJ-25 reference only (no State Done trailer) per repo commit policy: the Forgejo VCS integration applies trailer commands at push time, so a State Done trailer would resolve the issue while this PR is still open. State moves to Done after a human merges.

🤖 Generated with Claude Code

## What FJ-25 (follow-up to PR #28): wire the CI + Dockerfile build inputs so the `fj version` short SHA and commit date actually bake into published binaries. PR #28 merged the Rust half (`crates/fj/build.rs` reads `COMMIT_DATE`/`BUILD_DATE` env and bakes `FJ_COMMIT_DATE`/`FJ_BUILD_DATE`; `crates/fj/src/version.rs` shows them on the default line, in `-v`, and in `--json`). Those changes are in `main`. But the build pipeline never sets `COMMIT_DATE`/`BUILD_DATE`, so a real CI build still prints the unchanged `fj v0.7.1` line. This PR supplies those inputs, completing acceptance criterion 6 (and, by extension, criterion 1 for CI builds). ## Changes - `.forgejo/workflows/build-binary.yml` and `build-binary-windows.yml`: the "Compute build metadata" step now also computes `commit_date` (`git show -s --format=%cI HEAD`) and `build_date` (`date now`), emits both as step outputs, and the build step passes them to `docker buildx build` as `--build-arg COMMIT_DATE=...` / `--build-arg BUILD_DATE=...`. The latest-train manifest's `built_at` reuses the same `build_date` output so the binary's baked build date and the manifest agree. - `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}`. This branch is based on current `main`, so PR #27's Windows OpenSSL-vendoring changes (`v1.1.0` builder image, vendored-OpenSSL note) are preserved. ## Verification `docker buildx build --target binary` with `GIT_SHA`/`COMMIT_DATE`/`BUILD_DATE` set produced a binary whose default line is `fj v0.7.1 (abc12345 2026-05-28)`, with full RFC3339 `commit date` / `build date` under `-v` and matching fields in `--json`. A local build with the args empty keeps the clean `fj v0.7.1` line. ## Note on issue State Bare `#FJ-25` reference only (no `State Done` trailer) per repo commit policy: the Forgejo VCS integration applies trailer commands at push time, so a `State Done` trailer would resolve the issue while this PR is still open. State moves to Done after a human merges. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
ci(version): pass COMMIT_DATE and BUILD_DATE build-args so dates bake (FJ-25)
All checks were successful
Check / fmt + clippy + build + tests (pull_request) Successful in 38s
caca9e697a
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 ci/version-dates-buildargs-FJ-25
All checks were successful
Check / fmt + clippy + build + tests (pull_request) Successful in 39s
Create release / Create release from merged PR (pull_request) Has been skipped
9193089535
David merged commit 416715c44d into main 2026-05-29 02:46:14 +02:00
David deleted branch ci/version-dates-buildargs-FJ-25 2026-05-29 02:46:14 +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
pandoras-box/forgejo-cli!29
No description provided.