I am having trouble with dynamically passing one of two file based variables to a job.
I have defined two file variables in my CI/CD settings that contain my helm values for deployments to developement and production clusters. They are typical yaml syntax, their content does not really matter.
baz:
  foo: bar
I have also defined two jobs for the deployment that depend on a general deployment template .deploy.
.deploy:
  variables:
    DEPLOYMENT_NAME: ""
    HELM_CHART_NAME: ""
    HELM_VALUES: ""
  before_script:
    - kubectl ...
  script: 
    - helm upgrade $DEPLOYMENT_NAME charts/$HELM_CHART_NAME
      --install
      --atomic
      --debug
      -f $HELM_VALUES
The specialization happens in two jobs, one for dev and one for prod.
deploy:dev:
  extends: .deploy
  variables:
    DEPLOYMENT_NAME: my-deployment
    HELM_CHART_NAME: my-dev-chart
    HELM_VALUES: $DEV_HELM_VALUES # from CI/CD variables
deploy:prod:
  extends: .deploy
  variables:
    DEPLOYMENT_NAME: my-deployment
    HELM_CHART_NAME: my-prod-chart
    HELM_VALUES: $PROD_HELM_VALUES # from CI/CD variables
The command that fails is the one in the script tag of .deploy. If I pass in the $DEV_HELM_VALUES or $PROD_HELM_VALUES, the deployment is triggered. However if I put in the $HELM_VALUES as described above, the command fails (Error: "helm upgrade" requires 2 arguments, which is very misleading).
The problem is that the $HELM_VALUES that are accessed in the command are already the resolved content of the file, whereas passing the $DEV_HELM_VALUES or the $PROD_HELM_VALUES directly works with the -f syntax.
This can be seen using echo in the job's output:
echo "$DEV_HELM_VALUES"
/builds/my-company/my-deployment.tmp/DEV_HELM_VALUES
echo "$HELM_VALUES"
baz:
  foo: bar
How can I make sure the $HELM_VALUES only point to one of the files, and do not contain the files' content?
