Repository navigation
Conversation
`helm_import_repository` now generates a `package_metadata` target next to each imported chart and sets it as the `package_metadata` of the `helm_import` target, so supply-chain tooling can identify charts that come from outside the workspace. The chart is identified by an `oci` purl whose `repository_url` and `tag` qualifiers carry where the chart was fetched from and its version. The purl is built by a new `helm_import_package_metadata` macro exported from `//helm:defs.bzl`, which the generated BUILD file loads instead of loading `@package_metadata` directly: a repo created with `use_repo_rule` resolves labels through the calling module's repo mapping, so a direct load fails in every workspace that does not itself depend on `package_metadata`. Bazel 8.0.0 renamed the `applicable_licenses` common attribute to `package_metadata`, so on Bazel 7 the generated `helm_import` sets `applicable_licenses` instead. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
`//:package_metadata` identifies rules_helm by the purl `pkg:bazel/rules_helm@<version>`, and `REPO.bazel` makes it the `default_package_metadata` of every target in the module. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
abrisco
reviewed
Nov 6, 2026
abrisco
left a comment
Collaborator
There was a problem hiding this comment.
Sorry for the delay here, I'll take a look this weekend!
This branch has not been deployed
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.
helm_import_repositorynow generates apackage_metadatatarget next to each imported chart and sets it as thepackage_metadataof thehelm_importtarget, so SBOM and license tooling built on bazel-contrib/supply-chain can identify charts that come from outside the workspace.A chart is identified by an
ocipurl whoserepository_urlandtagqualifiers carry where the chart was fetched from and its version:url = "https://charts.bitnami.com/bitnami/postgresql-14.0.5.tgz"pkg:oci/postgresql?repository_url=https:%2F%2Fcharts.bitnami.com%2Fbitnami&tag=14.0.5repository = "https://charts.jetstack.io",chart_name = "trust-manager",version = "v0.24.0"pkg:oci/trust-manager?repository_url=https:%2F%2Fcharts.jetstack.io&tag=v0.24.0url = "oci://public.ecr.aws/karpenter/karpenter:1.9.0"pkg:oci/karpenter?repository_url=oci:%2F%2Fpublic.ecr.aws%2Fkarpenter&tag=1.9.0With
url,repository_urlis the chart's parent path; withrepository, it is the repository itself.Bazel 8.0.0 renamed the
applicable_licensescommon attribute topackage_metadata, so on Bazel 7 the generatedhelm_importsetsapplicable_licensesinstead; thepackage_metadatatarget itself is the same.The purl is built by a new
helm_import_package_metadatamacro, exported from@rules_helm//helm:defs.bzl, which the generatedBUILD.bazelloads instead of loading@package_metadatadirectly. A repo created withuse_repo_ruleresolves labels through the calling module's repo mapping, so a direct load fails in every workspace that does not itself depend onpackage_metadata. Going throughrules_helmkeeps that dependency on therules_helmside, as the newbazel_dep(name = "package_metadata", version = "0.0.13").The module itself declares its metadata too:
//:package_metadatacarriespkg:bazel/rules_helm@0.34.0frompurl.bazel(module_name(), module_version()), andREPO.bazelmakes it thedefault_package_metadataof every target in the module.Testing
From a scratch module that depends on
rules_helm(throughlocal_path_override) but not onpackage_metadata,bazel buildof charts imported withurland withrepositorysucceeds on Bazel 9.3.1 and 7.7.2, andbazel query --output=buildshows thepackage_metadatatarget and thehelm_importtarget referencing it (throughapplicable_licenseson 7.7.2). In this repository,bazel build //helm/... //docs:helm_importandbazel run //:buildifier.checkpass, and thehelm_testextension'spostgresqlandtrust-managerrepos carry the purls above. The OCI registries reject anonymous token requests from my network, so the OCI imports in//tests/with_external_depsare left to CI.repo(default_package_metadata = ...)inREPO.bazelandmodule_name()/module_version()in a BUILD file work on Bazel 7.7.2, 8.0.0 and 9.3.1 (checked in a scratch module, where the default reaches the targets on 7.7.2 asapplicable_licenses); here,bazel query 'deps(//helm:current_toolchain, 1)'lists//:package_metadata.🤖 Generated with Claude Code