fix(jax): stamp JAX wheels with the real source commit hash - #6979
Open
WBobby wants to merge 1 commit into
Open
Conversation
Resolve the hash on the host instead of inside the container, where git rejects the runner-owned checkout and silently yields an empty hash. Signed-off-by: Yanyao Wang <wangyanyao@msn.com>
✅ All Checks Passed — Ready for Review
📖 Need help? See the Policy FAQ for details on every check and how to fix failures. |
|
🎉 All checks passed! This PR is ready for review. |
ScottTodd
reviewed
Jul 29, 2026
Comment on lines
+247
to
+254
| # Resolved on the host: the container runs as root against a | ||
| # runner-owned checkout, where git rejects the repo as dubiously owned. | ||
| JAXLIB_GIT_HASH="$(git rev-parse HEAD)" | ||
| if [[ ! "${JAXLIB_GIT_HASH}" =~ ^[0-9a-f]{40}$ ]]; then | ||
| echo "::error::refusing to build: jax-source HEAD resolved to '${JAXLIB_GIT_HASH}'" | ||
| exit 1 | ||
| fi | ||
| echo "jaxlib_git_hash=${JAXLIB_GIT_HASH}" |
Member
There was a problem hiding this comment.
The if and echo here look unnecessary, remove?
- If
python build/build.pywants to rejectJAXLIB_GIT_HASHvalues that don't match some pattern, that should be up to it. Keep workflows as simple as possible: https://github.com/ROCm/TheRock/blob/main/docs/development/style_guides/github_actions_style_guide.md#prefer-python-scripts-over-inline-bash - Commands are already echo'd by default in github actions, no need to also run
echomanually like this
Comment on lines
+247
to
+248
| # Resolved on the host: the container runs as root against a | ||
| # runner-owned checkout, where git rejects the repo as dubiously owned. |
Member
There was a problem hiding this comment.
Could the container itself apply ownership settings for the checkout to fix instead? Again, prefer to keep workflows as simple as possible. Every single line of bash in a workflow should be scrutinized. Treat workflows as recipes for users to run. You wouldn't ask a user to run any of this code... right? Users should just run scripts in sequence. Same for workflows.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
jaxlib_git_hashwas resolved by agitcall that ran inside the manylinuxcontainer, where git rejects the runner-owned checkout as dubiously owned. The
command substitution failed silently, so every JAX plugin wheel from these two
workflows was published without a git hash while the job stayed green.
Issue: #6978
Technical Details
This change:
the step, and forwards it with
--env JAXLIB_GIT_HASH. Without the--envthereference inside the single-quoted script would be an unset container variable,
i.e. the same empty value by a different route.
a red job instead of a silently unstamped wheel.
set -ealready coversgitexiting non-zero; the regex covers git succeeding with unexpected output.
safe.directory=*in the container viaGIT_CONFIG_COUNT/GIT_CONFIG_KEY_0/GIT_CONFIG_VALUE_0, mirroringdockerfiles/build_manylinux_x86_64.Dockerfile. This is defence in depth for anyother git caller in the image; the hash itself no longer depends on it.
The inner script is otherwise untouched, and stays single-quoted because
$(rocm-sdk path --root)and$(pwd)must be evaluated in the container. Both therelease and CI workflows carried the identical line and are changed identically.
Test Plan
Dispatched
multi_arch_build_linux_jax_wheels.ymlon this branch for a singlematrix cell (
build_mode=manylinux,python_version=3.14,jax_ref=rocm-jaxlib-v0.10.0,rocm_version=7.15.0a20260728,release_type=dev,tests skipped), then inspected the published wheel.
Test Result
Run 30425080495,
success in 49m37s. All 15 steps succeeded, the native v0.9.1 step was skipped as
expected, and
dubious ownershipappears 0 times in the log.The hash is resolved on the host and reaches Bazel intact:
jaxlib_git_hash=98a16bf22b1cf8384b730e835d785cb0c68033d5
'build' options: ... --//jaxlib/tools:jaxlib_git_hash=98a16bf22b1cf8384b730e835d785cb0c68033d5
That sha is
refs/heads/rocm-jaxlib-v0.10.0in ROCm/jax, confirmed withgit ls-remote.jax_rocm7_plugin/version.pyin the published wheel, before and after:_release_version_git_hash20260728)'0.10.0+rocm7.15.0a20260728'None'0.10.0+rocm7.15.0a20260728''98a16bf22b1cf8384b730e835d785cb0c68033d5'Submission Checklist