Skip to content

Pin expected commit when building Leiningen from source#290

Merged
cap10morgan merged 2 commits into
masterfrom
lein/verify-clone-commit
Jun 16, 2026
Merged

Pin expected commit when building Leiningen from source#290
cap10morgan merged 2 commits into
masterfrom
lein/verify-clone-commit

Conversation

@cap10morgan

Copy link
Copy Markdown
Collaborator

Addresses official-images feedback from @yosifkit on the Leiningen 2.13.0 source-build:

We recommend to also check that this checked out commit is the expected commit id (d703e4802feb3e5c3fa9ae9f1874fb7a3a3e3030) on the off chance that the tag is changed.

What

After git clone --branch $LEIN_VERSION + git verify-tag, also assert the checked-out HEAD matches the expected commit:

git verify-tag $LEIN_VERSION && \
[ "$(git rev-parse HEAD)" = "d703e4802feb3e5c3fa9ae9f1874fb7a3a3e3030" ] && \

so a moved or re-pointed upstream tag can't slip a different commit past us (belt-and-suspenders with the existing GPG tag verification).

The expected commit is recorded per release in lein/release-commits and threaded into the template; an unknown version throws at generation time rather than silently building an unverifiable image.

Verification

  • Confirmed refs/tags/2.13.0^{} on Codeberg dereferences to d703e4802feb3e5c3fa9ae9f1874fb7a3a3e3030 (what git rev-parse HEAD resolves to after checkout).
  • Regenerated all lein Dockerfiles (bb dockerfiles); cljfmt clean; bb test 12 tests / 51 assertions, 0 failures.
  • Built the debian-bookworm-slim-11 lein image end-to-end — the commit-pin step passed and lein version reports Leiningen 2.13.0.

@cap10morgan cap10morgan requested a review from Quantisan June 16, 2026 18:02
@cap10morgan

Copy link
Copy Markdown
Collaborator Author

@Quantisan Going to go ahead and merge to free up the lein version bump, but let me know if you'd like to see any changes in here.

docker-library/official-images asked that we verify the clone's checked-out
commit matches the expected SHA, in case an upstream tag is ever moved
(belt-and-suspenders with git verify-tag).

Record the expected HEAD commit per Leiningen release in lein/release-commits
and assert it after cloning.
@cap10morgan cap10morgan force-pushed the lein/verify-clone-commit branch from 49d99dd to d963a6e Compare June 16, 2026 18:06
@cap10morgan cap10morgan merged commit 8bff627 into master Jun 16, 2026
4 checks passed
@cap10morgan cap10morgan deleted the lein/verify-clone-commit branch June 16, 2026 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant