Backend: Support inherited variables with rules and dotenv
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Problem to solve
There are limited options to conditionally run jobs in the same pipeline based on the output of previous jobs. With v13 environment variables can be inherited via artifacts:reports:dotenv
report. These reports are currently not evaluated in rules syntax on subsequent jobs.
- https://docs.gitlab.com/ee/ci/variables/#inherit-environment-variables
- https://docs.gitlab.com/ee/ci/yaml/#rules
Proposal
Evaluated inherited variables from report artifacts in rules.
build:
stage: build
script:
- echo "BUILD_VERSION=prod" >> build.env
artifacts:
reports:
dotenv: build.env
deploy:
stage: deploy
rules:
- if: '$BUILD_VERSION == "prod"'
when: always
script:
- echo $BUILD_VERSION
dependencies:
- build
This would allow additional logic the script in build
to output different env variables which can then be evaluated.
Note - whoever pick this issue up should look into the following dup to validate if the feature will support parent/child pipelines as well
Links / references
Likely also related to 215100. Where the rules currently also don't apply to existing artifacts.