How can I set the content of a pipeline variable by condition like:
variables:
CI_IS_DEV_BRANCH: $CI_COMMIT_BRANCH == "dev"
In case of having several jobs like
build:
stage: build
rules:
- if: '$CI_COMMIT_BRANCH == "dev"'
they could be simplified by
build:
stage: build
rules:
- if: $CI_IS_DEV_BRANCH
If the dev branch name gets changed to “develop” only one line needs to be changed.
This is just a simple example to demonstrate my question.
Update:
Or even more like (to catch “dev” and “develop”):
variables:
CI_IS_DEV_BRANCH: $CI_COMMIT_BRANCH =~ "/^dev.*"
Minor improvement, but does not really answer my question:
BTW:
Similar question with no helpful answer: