helm_import rules.

Rules

Repository Rules

helm_import

load("@rules_helm//helm:helm_import.bzl", "helm_import")

helm_import(name, chart, version)

A rule that allows pre-packaged Helm charts to be used within Bazel.

ATTRIBUTES

NameDescriptionTypeMandatoryDefault
nameA unique name for this target.Namerequired
chartA Helm chart's .tgz file.LabeloptionalNone
versionThe version fo the helm chartStringoptional""

helm_import_repository

load("@rules_helm//helm:helm_import.bzl", "helm_import_repository")

helm_import_repository(name, chart_name, repository, sha256, url, version)

A rule for fetching external Helm charts from an arbitrary URL or repository.

With bzlmod, the helm_charts extension in @rules_helm//helm:extensions.bzl fetches oci:// charts with this rule and stores the digest it looks up in MODULE.bazel.lock.

The repository exposes the chart as a helm_import target. The target takes its name and version from the Chart.yaml of the chart, not from the file name or the tag of the url. A chart fetched from oci://.../cert-manager:1.19.4 has the version v1.19.4 if its Chart.yaml says so, and helm push uses that version as the tag. The name can use letters, digits, -, . and _, and the version the same characters and +. Neither the chart name nor the repository name can be license or package_metadata. The target is aliased to the repository name, so @<name> resolves to it, unless the chart has the same name as the repository. The repository also describes the chart for supply-chain tooling built on package_metadata:

  • //:package_metadata identifies the chart by purl, pkg:oci/... for a chart from an OCI registry and pkg:generic/... with the download_url and sha256 checksum otherwise. It is the default_package_metadata of the repository.
  • //:license declares the chart's license, the SPDX identifier named by the licenses or artifacthub.io/license annotation of Chart.yaml or recognized in the LICENSE file shipped with the chart. It is NOASSERTION when neither is available. The license file, if any, is kept next to the chart as the license text.

ATTRIBUTES

NameDescriptionTypeMandatoryDefault
nameA unique name for this repository.Namerequired
chart_nameChart name to import. Must be set if repository is specifiedStringoptional""
repositoryChart repository url where to locate the requested chart. Mutually exclusive with url.Stringoptional""
sha256The expected SHA-256 hash of the chart imported. For an oci:// url, a chart already in the repository cache is then fetched without any request to the registry.Stringoptional""
urlThe url where a chart can be directly downloaded. Mutually exclusive with chart_name, repository, and versionStringoptional""
versionSpecify a version constraint for the chart version to use. Must be set if repository is specified.Stringoptional""