Skip to content

This Helm plugin allows you to substitute the environment variables specified in your helm values file with their respective values in the environment from within a CICD pipeline.

License

Notifications You must be signed in to change notification settings

hydeenoble/helm-subenv

Repository files navigation

helm-subenv

License MIT GitHub release Artifact Hub

This Helm plugin allows you to substitute the environment variables specified in your helm values file with their respective values in the environment from within a CICD pipeline.

Install

The installation itself is simple as:

helm plugin install https://github.com/hydeenoble/helm-subenv.git

You can install a specific release version:

helm plugin install https://github.com/hydeenoble/helm-subenv.git --version <release version>

To use the plugin, you do not need any special dependencies. The installer will download the latest release with prebuilt binary from GitHub releases.

Usage

Single file usage

helm subenv -f <path to values file>

Multiple files usage

helm subenv -f <path to values file> -f <path to values file> -f <path to values file>

Directory usage

The plugin can also be used to recursively substitute environment variables in all the files in a specified directory.

helm subenv -f <path to directory>

Mix files and directories

You can also decide to mix files and directories:

helm subenv -f <path to values file> -f <path to directory>

Example

Sample helm values file:

# values.yaml

image:
  repository: $REGISTRY/$IMAGE_NAME
  tag: $IMAGE_TAG

Environment variables configured in your environment (this should most likely be configured with your CI environment):

REGISTRY => docker.com
IMAGE_NAME => helm-subenv
IMAGE_TAG => test

Substitute Env:

helm subenv -f values.yaml

Result:

image:
  repository: docker.com/helm-subenv
  tag: test

Note: If the value of the environment variable does not exist, it will be replaced with an empty string. For instance, from the above example, if IMAGE_TAG does not exist as an environment variable in the environment the result would have been:

image:
  repository: docker.com/helm-subenv
  tag:

Uninstall

helm plugin remove subenv

Testing locally

To test locally, run the command below to build and run the binary:

You need to have Go installed. Make sure to set $GOPATH

go build -o subenv && ./subenv -f </path/to/values/file>

License

MIT

About

This Helm plugin allows you to substitute the environment variables specified in your helm values file with their respective values in the environment from within a CICD pipeline.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published