Skip to content

fix(build): propagate errors out of the libgit2 cross-build loop - #9165

Merged
klesh merged 2 commits into
apache:mainfrom
AkerBP:fix/libgit2-cross-build-loop-error-propagation
Sep 24, 2026
Merged

klesh merged 2 commits into
apache:mainfrom
AkerBP:fix/libgit2-cross-build-loop-error-propagation

Conversation

@lrf-nitro

Copy link
Copy Markdown
Contributor

The for-loop that cross-compiles libgit2 for aarch64 and x86_64 had no 'set -e'. If either arch's cmake/make chain failed, the failure was only visible as a broken '&&' chain within that single loop iteration; the surrounding for-loop has no error propagation of its own, so it silently moved on to the next arch and the whole RUN step still exited 0 even though one architecture's libgit2 was never installed under /usr/local/deps. The real failure would then only surface later, confusingly, in the unrelated 'build' stage as a pkg-config "libgit2 not found" error when that architecture's (missing) directory was needed.

Add 'set -e;' to the loop so any future per-arch build failure fails the image build immediately and visibly, at the point where it actually occurs, instead of being masked.

No behavior change on the success path: verified both aarch64 and x86_64 libgit2 (with .pc files) are still produced under /usr/local/deps after this change, building the 'builder' stage natively on an arm64 host.

⚠️ Pre Checklist

Please complete ALL items in this checklist, and remove before submitting

  • I have read through the Contributing Documentation.
  • I have added relevant tests.
  • I have added relevant documentation.
  • I will add labels to the PR, such as pr-type/bug-fix, pr-type/feature-development, etc.

Summary

What does this PR do?

Does this close any open issues?

Closes xx

Screenshots

Include any relevant screenshots here.

Other Information

Any other information that is important to this PR.

The aarch64/x86_64 cross-build for-loop had no 'set -e', so a cmake/make
failure for one arch was silently swallowed and the loop moved on to the
next, leaving that arch's libgit2 missing from /usr/local/deps while the
RUN step still exited 0.

Verified both aarch64 and x86_64 libgit2 still build successfully after
this change (native arm64 build of the 'builder' stage).

@klesh klesh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
Thanks for your contribution.

@klesh
klesh merged commit c5de409 into apache:main Sep 24, 2026
7 checks passed
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.

2 participants