helm-subenv
helm-subenv copied to clipboard
Fields are empty after execution
values.yaml
icm:
icm-as:
image:
repository: "${ICM_TEST_IMAGE}"
environment.sh
#!/usr/bin/env bash
ICM_TEST_IMAGE="whatever"
After executing source ./environment.sh
and helm subenv -f values.yaml
the env variable is replaced with an empty string.
My base image for execution is ubuntu-20.4-DS1_v2-adopt-adoptium-jdk
with the following RUN cmd to install helm:
RUN apk add --no-cache ca-certificates bash git openssh curl \
&& wget -q https://storage.googleapis.com/kubernetes-release/release/${KUBE_LATEST_VERSION}/bin/linux/amd64/kubectl -O /usr/local/bin/kubectl \
&& chmod +x /usr/local/bin/kubectl \
&& wget -q https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz -O - | tar -xzO linux-amd64/helm > /usr/local/bin/helm \
&& chmod +x /usr/local/bin/helm
Hello, @khauser I will try replicating this issue and get back to you.
Thanks in advance For now I use envsubst directly without any helm plugin:
set -o allexport
source environment.sh
set +o allexport
# puts envs into a comma separated list with dollar signs
env_list=$(env | cut -d '=' -f 1 | sed 's/^/\$/;s/$/,/' | tr -d '\n' | sed 's/,$//')
# now only env variables are replaced in values template
envsubst "${env_list}" < ./values.tmpl | tee values.yaml
So far, I have been able to detect that the helm-subenv plugin doesn't see environment variables created using only the source
command. For environment variables to be accessible/visible to the plugin, export
has to be used.
something like:
export ICM_TEST_IMAGE=somevalue
this would work.