diff --git a/helm/private/repositories.bzl b/helm/private/repositories.bzl index 6353343..6a59b41 100644 --- a/helm/private/repositories.bzl +++ b/helm/private/repositories.bzl @@ -61,7 +61,7 @@ def _helm_toolchain_repository_impl(repository_ctx): repository_ctx.name, )) - return { + attrs_for_reproducibility = { "integrity": results.integrity, "name": repository_ctx.name, "platform": repository_ctx.attr.platform, @@ -70,6 +70,16 @@ def _helm_toolchain_repository_impl(repository_ctx): "urls": repository_ctx.attr.urls, } + # Bazel <8.3.0 lacks repository_ctx.repo_metadata + if not hasattr(repository_ctx, "repo_metadata"): + return attrs_for_reproducibility + + reproducible = repository_ctx.attr.integrity != "" + return repository_ctx.repo_metadata( + reproducible = reproducible, + attrs_for_reproducibility = {} if reproducible else attrs_for_reproducibility, + ) + helm_toolchain_repository = repository_rule( implementation = _helm_toolchain_repository_impl, doc = "A repository rule for generating a Helm toolchain definition", @@ -148,6 +158,12 @@ def _helm_plugin_repository_impl(repository_ctx): repository_ctx.name, )) + # Bazel <8.3.0 lacks repository_ctx.repo_metadata + if not hasattr(repository_ctx, "repo_metadata"): + return None + + return repository_ctx.repo_metadata(reproducible = repository_ctx.attr.integrity != "") + helm_plugin_repository = repository_rule( implementation = _helm_plugin_repository_impl, doc = "A repository rule for downloading a Helm plugin and generating a helm_plugin target.", @@ -303,6 +319,12 @@ def _helm_toolchain_repository_hub_impl(repository_ctx): toolchain_type = str(repository_ctx.attr.toolchain_type), )) + # Bazel <8.3.0 lacks repository_ctx.repo_metadata + if not hasattr(repository_ctx, "repo_metadata"): + return None + + return repository_ctx.repo_metadata(reproducible = True) + helm_toolchain_repository_hub = repository_rule( doc = ( "Generates a toolchain-bearing repository that declares a set of other toolchains from other " +