Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fields are empty after execution #6

Open
khauser opened this issue Feb 9, 2023 · 3 comments
Open

Fields are empty after execution #6

khauser opened this issue Feb 9, 2023 · 3 comments

Comments

@khauser
Copy link

khauser commented Feb 9, 2023

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
@hydeenoble
Copy link
Owner

Hello, @khauser I will try replicating this issue and get back to you.

@khauser
Copy link
Author

khauser commented Mar 10, 2023

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

@hydeenoble
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants