Conversation
Previously, the existing toolchain configuration directed all target
platforms to a single artifact repository (e.g., @helm_tool//:tool).
This base repository used host platform detection to download a single
binary. Consequently, cross-compilation and remote execution failed
when the execution platform architecture differed from that of the host.
This commit enables cross-compilation by isolating artifacts into
platform-specific repositories:
- The `download_tool` macro iterates over `_TOOLS_BY_RELEASE` to
instantiate independent repositories for each OS and architecture
combination (e.g., @helm_tool_linux_arm64).
- The base repository fallback is removed to prevent host-architecture
leakage in remote execution environments.
- The `native.toolchain` declarations point to
`@{tool_repo}_{os}_{arch}//:tool`, directing Bazel to fetch the
artifact repository matching the requested execution platform.
- An `analysistest` suite in `toolchain_test.bzl` verifies that
`linux_amd64` and `linux_arm64` constraints resolve to their
respective architectural repositories.
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.
Previously, the existing toolchain configuration directed all target platforms to a single artifact repository (e.g., @helm_tool//:tool). This base repository used host platform detection to download a single binary. Consequently, cross-compilation and remote execution failed when the execution platform architecture differed from that of the host.
This commit enables cross-compilation by isolating artifacts into platform-specific repositories:
download_toolmacro iterates over_TOOLS_BY_RELEASEto instantiate independent repositories for each OS and architecture combination (e.g., @helm_tool_linux_arm64).native.toolchaindeclarations point to@{tool_repo}_{os}_{arch}//:tool, directing Bazel to fetch the artifact repository matching the requested execution platform.analysistestsuite intoolchain_test.bzlverifies thatlinux_amd64andlinux_arm64constraints resolve to their respective architectural repositories.