Bzlmod extensions
Module Extensions
helm
helm = use_extension("@rules_helm//helm:extensions.bzl", "helm")
helm.host_tools(name, version)
helm.plugin(name, integrity, strip_prefix, url_templates, version, yaml)
helm.toolchain(name, plugins)
TAG CLASSES
host_tools
An extension for creating a host alias repository that provides a shorter name for the host platform's helm binary.
An example of defining and using host tools:
helm = use_extension("@rules_helm//helm:extensions.bzl", "helm")
helm.host_tools(name = "helm")
use_repo(helm, "helm")
# Then you can use @helm//:helm in your BUILD files
Attributes
| Name | Description | Type | Mandatory | Default |
|---|---|---|---|---|
| name | The name of the host alias repository. | Name | optional | "helm" |
| version | The version of helm to use for host tools. | String | optional | "4.2.0" |
plugin
An extension tag for declaring Helm plugins.
Plugins are downloaded per-platform and made available to helm.toolchain() tags that reference them by name. Only platforms listed in integrity (and url_templates) will receive the plugin.
An example of declaring the helm-diff plugin and wiring it into a named toolchain:
helm = use_extension("@rules_helm//helm:extensions.bzl", "helm")
helm.host_tools()
helm.plugin(
name = "diff",
version = "3.15.5",
strip_prefix = "diff",
url_templates = {
"darwin-arm64": ["https://github.com/databus23/helm-diff/releases/download/v{version}/helm-diff-macos-arm64.tgz"],
"linux-amd64": ["https://github.com/databus23/helm-diff/releases/download/v{version}/helm-diff-linux-amd64.tgz"],
},
integrity = {
"darwin-arm64": "sha256-KJmZ7wY3gAcWFzK5R9+TfQlaRfEXzJ7hDNRC8NgIDog=",
"linux-amd64": "sha256-ToJjCrKyMxfAOeezsWYF95qKwPPSKHPg1G6pzZgN2o4=",
},
)
helm.toolchain(
name = "with_diff",
plugins = ["diff"],
)
use_repo(helm, "helm", "helm_toolchains", "with_diff_toolchains")
register_toolchains("@helm_toolchains//:all")
Attributes
| Name | Description | Type | Mandatory | Default |
|---|---|---|---|---|
| name | The name of the plugin. | Name | required | |
| integrity | A mapping of helm platform name to integrity hash. Only platforms listed here will receive the plugin. | Dictionary: String -> String | required | |
| strip_prefix | A directory prefix to strip from the extracted plugin archive. | String | optional | "" |
| url_templates | Mapping of helm platform name to a list of URL templates for downloading the plugin on that platform. Only {version} is substituted; spell the platform name into the URL string directly. Every key in integrity must have a matching entry here. | Dictionary: String -> List of strings | required | |
| version | The version of the plugin to download. | String | required | |
| yaml | Relative path to plugin.yaml within the extracted archive (after strip_prefix). | String | optional | "plugin.yaml" |
toolchain
Define a named set of helm toolchains with specific plugins.
Creates an independent hub repository @{name}_toolchains containing toolchains for the default helm version with the specified plugins baked in. Only platforms where all referenced plugins are available will have toolchains generated.
The hub is not registered automatically — call register_toolchains explicitly, or use a Starlark transition to override toolchain resolution.
helm = use_extension("@rules_helm//helm:extensions.bzl", "helm")
helm.plugin(name = "diff", ...)
helm.toolchain(
name = "with_diff",
plugins = ["diff"],
)
use_repo(helm, "with_diff_toolchains")
register_toolchains("@with_diff_toolchains//:all")
Attributes
| Name | Description | Type | Mandatory | Default |
|---|---|---|---|---|
| name | Name prefix for the hub repository. Produces @{name}_toolchains. | Name | required | |
| plugins | Plugin names (from helm.plugin() tags) to include in these toolchains. | List of strings | optional | [] |