-
Notifications
You must be signed in to change notification settings - Fork 32
Description
When upgrading from rules_helm 0.13.0 to 0.20.1, we found that the @helm//:helm target created by helm.host_tools() is defined as a plain source file:
Generated BUILD.bazel in @helm repository
exports_files(["helm"])
This causes integration issues with tools that expect proper executable targets with standard Bazel providers. While the symlink technically works, it's not optimal for toolchain-aware contexts.
The current approach for accessing the helm binary leaves users with unclear options:
- @helm//:helm - Plain file, non-executable target
- @helm_linux_amd64//:helm - Platform-specific, requires manual platform detection
- @rules_helm//helm:current_toolchain - Toolchain resolver, but not an executable target
Proposed Solution
Add a helm_binary() rule that provides proper executable access to the helm toolchain:
Example usage in a BUILD.bazel file
load("@rules_helm//helm:defs.bzl", "helm_binary")
helm_binary(
name = "helm",
)
This would:
- Leverage the existing toolchain infrastructure
- Provide proper DefaultInfo and FilesToRunProvider
- Handle platform resolution automatically via toolchains
- Be extensible for future enhancements (env vars, flags, etc.)
- Follow patterns established by other mature rule sets (rules_go, rules_rust)
Implementation Approach
I'd like to contribute this fix if you're open to it. My plan would be:
- Add helm/private/helm_binary.bzl implementing the rule
- Export it from helm/defs.bzl
- Update documentation with migration guidance from helm.host_tools()
- Add tests for the new rule
The implementation would be straightforward - resolve the toolchain and expose the binary with proper providers.
Questions before I proceed:
- Does this approach align with the rules_helm roadmap?
- Should helm.host_tools() be deprecated in favor of this?
- Any specific requirements for the rule API or behavior?
Context
- rules_helm: 0.20.1
- Bazel: 8.x (Bzlmod)
- Use case: Integrating helm CLI into development environments (bazel_env.bzl)
Looking forward to your feedback!