File variables are expanded when referenced in gitlab-ci variables section
Summary
When using file variables in the "variables" section of a job in .gitlab-ci.yml the contents are being written to the new variable.
Steps to reproduce
The following gitlab-ci.yml
.deployment:
image: alpine:latest
script:
- kubectl config set-cluster ${KUBE_CLUSTER} --server=${KUBE_SERVER} --certificate-authority="${KUBE_CA}"
"Deploy to stage":
extends: .deployment
stage: deploy:stage
when: manual
variables:
KUBE_CA: $KUBE_CA_STAGE
"Deploy to prod":
extends: .deployment
stage: deploy:prod
when: manual
variables:
KUBE_CA: $KUBE_CA_PROD
The variable KUBE_CA_PROD / KUBE_CA_STAGE are file variables in Gitlab. When using the variable KUBE_CA the contents are no longer a path to a file but the content of the file.
What is the current bug behavior?
Contents of file variables are written to variables
What is the expected correct behavior?
Path of file variable is used as variable
Results of GitLab environment info
Expand for output related to GitLab environment info
System information System: Ubuntu 18.04 Proxy: no Current User: git Using RVM: no Ruby Version: 2.5.3p105 Gem Version: 2.7.9 Bundler Version:1.17.3 Rake Version: 12.3.2 Redis Version: 3.2.12 Git Version: 2.21.0 Sidekiq Version:5.2.7 Go Version: unknown
GitLab information Version: 11.11.2-ee Revision: cfdecb7c5de Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: PostgreSQL DB Version: 9.6.11 URL: https://gitlab.XXXXX.com HTTP Clone URL: https://gitlab.XXXXX.com/some-group/some-project.git SSH Clone URL: git@gitlab.XXXXX.com:some-group/some-project.git Elasticsearch: no Geo: no Using LDAP: yes Using Omniauth: yes Omniauth Providers:
GitLab Shell Version: 9.1.0 Repository storage paths:
- default: /var/opt/gitlab/git-data/repositories GitLab Shell path: /opt/gitlab/embedded/service/gitlab-shell Git: /opt/gitlab/embedded/bin/git
Results of GitLab application Check
Expand for output related to the GitLab application check
not relevant