I have a simple request but can't find any sample code for it.
Suppose I want to set an environment variable depending on the branch name. Something like this (though I know this code doesn't work)
variables:
rules:
- if: '$CI_COMMIT_BRANCH != "master"'
variables:
env: "dev"
- if: '$CI_COMMIT_BRANCH == "master"'
variables:
env: "prod"
stackName: projectA-${env}
So the stackName or other variables can use ${env}
as suffix in the name and I can also use ${env}
in jobs , scripts or stages
How can I set it?