Repository navigation
fix: build git 2.56.1 from the official source tarball [TAR-265] - #78
Conversation
Amazon Linux 2023 ships git 2.50.1, which hits BUG: builtin/pack-objects.c:4453 when fetching into the repository-listener's partial clones. Build the pinned upstream release instead and fail docker_verify on any other version.
Up to standards ✅🟢 Issues
|
There was a problem hiding this comment.
Pull Request Overview
The build-stage package selection may prevent the image from building because the development dependency requires full libcurl while curl-minimal provides the conflicting package. This should be resolved before merging.
Codacy also found:
- A Dockerfile warning about package metadata not being cleaned from the build stage.
- A Dockerfile warning about the parameterized base image lacking an explicit version (the Makefile supplies pinned arguments).
Test suggestions
- Each produced image reports exactly Git 2.56.1 and can execute git ls-remote over HTTPS.
- A tarball with an incorrect SHA-256 digest causes the build to fail.
- The source-built installation provides Git and preserves the expected SSH, unzip, useradd, and tini functionality across all image variants.
Prompt proposal for missing tests
Consider implementing these tests if applicable:
1. A tarball with an incorrect SHA-256 digest causes the build to fail.
TIP Add review instructions in .codacy/instructions/review.md, or an AGENTS.md, so the reviewer knows your conventions.
TIP How was this review? Give us feedback
| ARG GIT_VERSION | ||
| ARG GIT_SHA256 | ||
| RUN \ | ||
| dnf -y install --allowerasing gcc make tar xz curl-minimal zlib-devel libcurl-devel expat-devel && \ |
There was a problem hiding this comment.
🔴 HIGH RISK
The Git build can fail during package installation because libcurl-devel requires full libcurl while curl-minimal requires the conflicting minimal package. Consider installing curl instead of curl-minimal in the build stage.
TIP React 👍 if this review is right, or reply with what's wrong and how it could be better to help improve the reviewer.
There was a problem hiding this comment.
Pull Request Overview
The download step can hang indefinitely if a mirror accepts the connection but stalls during transfer, preventing the configured fallback from being attempted. Add a transfer timeout so mirror failover remains reliable.
Test suggestions
- Build succeeds using the pinned tarball and rejects a checksum mismatch.
- Download falls back to the secondary mirror when the primary mirror fails.
- The resulting images report exactly Git 2.56.1 and expose Git over HTTPS.
- Git is installed at the expected /usr locations and remains usable in all image targets.
Prompt proposal for missing tests
Consider implementing these tests if applicable:
1. Build succeeds using the pinned tarball and rejects a checksum mismatch.
2. Download falls back to the secondary mirror when the primary mirror fails.
3. The resulting images report exactly Git 2.56.1 and expose Git over HTTPS.
4. Git is installed at the expected /usr locations and remains usable in all image targets.
TIP Add review instructions in .codacy/instructions/review.md, or an AGENTS.md, so the reviewer knows your conventions.
TIP How was this review? Give us feedback
| RUN \ | ||
| dnf -y install --allowerasing gcc make tar xz diffutils curl-minimal zlib-devel libcurl-devel expat-devel && \ | ||
| for mirror in https://cdn.kernel.org https://mirrors.edge.kernel.org; do \ | ||
| curl -fsSL --retry 5 --retry-all-errors --connect-timeout 20 -o /tmp/git.tar.xz \ |
There was a problem hiding this comment.
🟡 MEDIUM RISK
A mirror that accepts the connection but stalls while sending the tarball can hang the build indefinitely, preventing fallback to the second mirror. Consider adding a transfer timeout to the curl command.
TIP React 👍 if this review is right, or reply with what's wrong and how it could be better to help improve the reviewer.
Base 7.0.1 (Amazon Linux 2023) replaced the git-core PPA build (git 2.56.1) with AL2023's
git-corerpm, which is git 2.50.1 and has no newer version in any maintained rpm repo. After repository-listener 17.6.16 picked it up,git fetchinto the listener's partial clones (--filter=tree:0/blob:none) started failing in prod withBUG: builtin/pack-objects.c:4453: should_include_obj should only be called on existing objects. That line is the 2.50.x position of the check run byindex-pack --promisor→pack-objects --exclude-promisor-objects-best-effort. TAR-265Makefile(sha256 cross-checked against kernel.org'ssha256sums.ascon two mirrors).NO_RUST(Rust stays optional until Git 3.0) and downloaded from cdn.kernel.org, with mirrors.edge.kernel.org as fallback./usr, so/usr/bin/gitand/etc/gitconfigstay where the rpm put them.docker_verifyfails unless the image reports exactly the pinned git version, and runs agit ls-remoteover https.Trade-off: Docker Scout doesn't see a source-built git, so git CVEs no longer fail
docker_scan. BumpingGIT_VERSIONis a manual step now.Rollout:
jre17-7.0.2To verify:
docker_build+docker_verify+docker_scangreengit fetch --all --prune --forceinto an existing partial clone succeeds