bzzzm / rules_helm

Bazel rules for producing Helm charts

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rules_helm

Bazel rules for producing helm charts

Setup

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

# See releases for urls and checksums
http_archive(
    name = "rules_helm",
    sha256 = "{sha256}",
    urls = ["https://github.com/abrisco/rules_helm/releases/download/{version}/rules_helm-v{version}.tar.gz"],
)

load("@rules_helm//helm:repositories.bzl", "helm_register_toolchains", "rules_helm_dependencies")

rules_helm_dependencies()

helm_register_toolchains()

Rules

helm_import

helm_import(name, chart, version)

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

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
chart A Helm chart's .tgz file. Label optional None
version The version fo the helm chart String optional ""

helm_import_repository

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

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

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this repository. Name required
chart_name Chart name to import. String optional ""
repo_mapping A dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.<p>For example, an entry "@foo": "@bar" declares that, for any time this repository depends on @foo (such as a dependency on @foo//some:target, it should actually resolve that dependency within globally-declared @bar (@bar//some:target). Dictionary: String -> String required
repository Chart repository url where to locate the requested chart. String required
sha256 The expected SHA-256 hash of the chart imported. String optional ""
url The url where the chart can be directly downloaded. String optional ""
version Specify a version constraint for the chart version to use. String optional ""

helm_install

helm_install(name, install_name, package)

Produce a script for performing a helm install action

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
install_name The name to use for the helm install command. The target name will be used if unset. String optional ""
package The helm pacage to install. Label required

helm_lint_test

helm_lint_test(name, chart)

A rule for performing helm lint on a helm package

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
chart The helm package to run linting on. Label required

helm_package

helm_package(name, chart, deps, images, stamp, templates, values)

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
chart The Chart.yaml file of the helm chart Label optional None
deps Other helm packages this package depends on. List of labels optional []
images @rules_docker//container:push.bzl%container_push targets. List of labels optional []
stamp Whether to encode build information into the helm actions. Possible values:

- stamp = 1: Always stamp the build information into the helm actions, even in --nostamp builds. This setting should be avoided, since it potentially kills remote caching for the target and any downstream actions that depend on it.

- stamp = 0: Always replace build information by constant values. This gives good build result caching.

- stamp = -1: Embedding of build information is controlled by the --[no]stamp flag.

Stamped targets are not rebuilt unless their dependencies change.
Integer optional -1
templates All templates associated with the current helm chart. E.g., the ./templates directory List of labels optional []
values The values.yaml file for the current package. Label optional None

helm_push

helm_push(name, package)

Produce a script for pushing all docker images used by a helm chart

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
package The helm package to upload images from. Label required

helm_reinstall

helm_reinstall(name, install_name, package)

Produce a script for performing a helm uninstall and install actions

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
install_name The name to use for the helm install command. The target name will be used if unset. String optional ""
package The helm pacage to reinstall. Label required

helm_toolchain

helm_toolchain(name, helm)

A helm toolchain

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
helm A helm binary Label required

helm_uninstall

helm_uninstall(name, install_name)

Produce a script for performing a helm uninstall action

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
install_name The name to use for the helm install command. The target name will be used if unset. String optional ""

HelmPackageInfo

HelmPackageInfo(chart, images, metadata)

A provider for helm packages

FIELDS

Name Description
chart File: The result of helm package
images list[Target]: A list of @rules_docker//container:push.bzl%container_push targets
metadata File: A json encoded file containing metadata about the helm chart

helm_chart

helm_chart(name, images, deps, tags, install_name)

Rules for producing a helm package and some convenience targets.

target rule
{name}.push helm_push
{name}.install helm_install
{name}.uninstall helm_uninstall
{name}.reinstall helm_reinstall

PARAMETERS

Name Description Default Value
name The name of the helm_package target. none
images A list of container_push targets []
deps A list of helm package dependencies. None
tags Tags to apply to all targets. []
install_name The helm install name to use. name will be used if unset. None

helm_register_toolchains

helm_register_toolchains(version, helm_url_templates)

Register helm toolchains.

PARAMETERS

Name Description Default Value
version The version of Helm to use "3.8.1"
helm_url_templates A list of url templates where helm can be downloaded. ["https://get.helm.sh/helm-v{version}-{platform}.{compression}"]

rules_helm_dependencies

rules_helm_dependencies()

Defines helm dependencies

helm_lint_aspect

helm_lint_aspect(name)

An aspect for running helm lint on helm package targets

ASPECT ATTRIBUTES

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required

About

Bazel rules for producing Helm charts


Languages

Language:Starlark 73.7%Language:Python 15.9%Language:Smarty 9.6%Language:Shell 0.9%