I have a rest_config.yaml file which looks loke this:
host: abcd
apiKey: abcd
secretKey: abcd
I want to import these in my .gitlab-ci.yaml file and use them as my environment variable. How do I do so?
I have a rest_config.yaml file which looks loke this:
host: abcd
apiKey: abcd
secretKey: abcd
I want to import these in my .gitlab-ci.yaml file and use them as my environment variable. How do I do so?
If your yaml file is part of the checked out repository on which the gitlab-ci.yaml pipeline operates, said pipeline can read the file in a script:
section, as I illustrated here.
That script: section can set environment variables.
And you can pass variables explicitly between jobs
build:
stage: build
script:
- VAR1=foo
- VAR2=bar
- echo export VAR1="${VAR1}" > $CI_PROJECT_DIR/variables
- echo export VAR2="${VAR2}" >> $CI_PROJECT_DIR/variables
artifacts:
paths:
- variables
test:
stage: test
script:
- source $CI_PROJECT_DIR/variables
- echo VAR1 is $VAR1
- echo VAR2 is $VAR2
build: stage: build script: - VAR1=foo
test: stage: test script: