Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions helm/extensions.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ def _helm_impl(module_ctx):
helm_host_alias_repository(
name = host_tools_attrs.name,
toolchain_repo_prefix = "helm_toolchains__{}".format(host_tools_attrs.version),
version = host_tools_attrs.version,
)

return module_ctx.extension_metadata(
Expand Down
27 changes: 21 additions & 6 deletions helm/private/repositories.bzl
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
"""Helm dependencies"""

load(
"//helm/private:versions.bzl",
"DEFAULT_HELM_VERSION",
)

_HELM_TOOLCHAIN_BUILD_CONTENT = """\
load("@rules_helm//helm:helm_toolchain.bzl", "helm_toolchain")

Expand Down Expand Up @@ -221,17 +226,23 @@ def _helm_host_alias_repository_impl(repository_ctx):
ext = ".exe" if is_windows else ""

repository_ctx.file("BUILD.bazel", """# @generated by @rules_helm//helm/private/repositories.bzl
load("@bazel_lib//lib:copy_file.bzl", "copy_file")

package(default_visibility = ["//visibility:public"])
exports_files(["helm{ext}"])
""".format(
ext = ext,
))

repository_ctx.symlink("../{prefix}_{platform}_bin/helm{ext}".format(
copy_file(
Comment thread
manuelnaranjo marked this conversation as resolved.
name = "helm",
src = "@{prefix}_{platform}_bin//:helm_bin",
out = "helm-{version}{ext}",
is_executable = True,
allow_symlink = True,
)
""".format(
prefix = repository_ctx.attr.toolchain_repo_prefix,
platform = _platform(repository_ctx),
ext = ext,
), "helm{ext}".format(ext = ext))
version = repository_ctx.attr.version,
))

helm_host_alias_repository = repository_rule(
implementation = _helm_host_alias_repository_impl,
Expand All @@ -243,6 +254,10 @@ helm_host_alias_repository = repository_rule(
doc = "The name prefix for binary repos to symlink to. The host alias constructs the full repo name as {prefix}_{platform}_bin.",
mandatory = True,
),
"version": attr.string(
doc = "The version of helm to use for host tools.",
default = DEFAULT_HELM_VERSION,
),
},
)

Expand Down
Loading