'Variables in gitlab pipeline don't seem to be available to helm file being deployed

I'm trying to deploy a helm file using gitlab ci/cd process, and it seems like variables aren't being provided correctly.

I've added some echo statements to make sure the runner knew about it:

echo $CI_ENVIRONMENT_NAME
devplatform
$ echo $DOCKER_REGISTRY
1234abcd.dkr.ecr.us-west-2.amazonaws.com
$ echo $CI_PROJECT_NAME
gitlab-project
$ echo $CI_COMMIT_SHA
7d3f491cf........7c73f65daec4d
$ export IMAGE_NAME="$DOCKER_REGISTRY/$CI_PROJECT_NAME"
$ export IMAGE_TAG=$CI_COMMIT_SHA
$ echo $IMAGE_NAME
abcd1234.dkr.ecr.us-west-2.amazonaws.com/gitlabproject
$ echo $IMAGE_TAG
7d3f491.........3100e7c73f65daec4d
$ gl-helmfile --environment $CI_ENVIRONMENT_NAME --namespace $CI_ENVIRONMENT_NAME --state-values-set image_name="$DOCKER_REGISTRY/$CI_PROJECT_NAME",image_tag=$CI_COMMIT_SHA sync

however when gl-helmfile deployes the helmfile, which has some values being set using "env" (such as "env $APP_PORT"), the resulting pods have blank values for things using "env". The only way I've been able to get around this is by setting blank values in values file, like

image_tag="" image_name="" app_port=""

and then setting the helmfile to use .Values.image_name, and then using:

--state-values-set image_name="$DOCKER_REGISTRY/$CI_PROJECT_NAME",image_tag=$CI_COMMIT_SHA

Is there a way to get environmental variables passed to helm during deployment?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source