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

NameDescriptionTypeMandatoryDefault
nameThe name of the host alias repository.Nameoptional"helm"
versionThe version of helm to use for host tools.Stringoptional"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

NameDescriptionTypeMandatoryDefault
nameThe name of the plugin.Namerequired
integrityA mapping of helm platform name to integrity hash. Only platforms listed here will receive the plugin.Dictionary: String -> Stringrequired
strip_prefixA directory prefix to strip from the extracted plugin archive.Stringoptional""
url_templatesMapping 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 stringsrequired
versionThe version of the plugin to download.Stringrequired
yamlRelative path to plugin.yaml within the extracted archive (after strip_prefix).Stringoptional"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

NameDescriptionTypeMandatoryDefault
nameName prefix for the hub repository. Produces @{name}_toolchains.Namerequired
pluginsPlugin names (from helm.plugin() tags) to include in these toolchains.List of stringsoptional[]