Implement nested expanding environment name and url for deployments
What does this MR do and why?
We support variables for YAML attributes of environment:name
and environment:https://docs.gitlab.com/ee/ci/yaml/#environmenturl
. However, we expand those variables by only 1-level.
In this MR, we start supporting infinite level expansion.
These changes are behind a FF ci_expand_environment_name_and_url
(#358831 (closed))
Related to #293674 (closed)
How to set up and validate locally
- Use this example CI config:
production:
script:
- echo $CI_COMMIT_REF_SLUG
- echo $ENVIRONMENT_NAME
- echo $STACK_NAME
- echo $MAIN_DOMAIN
- echo $CI_ENVIRONMENT_NAME
- echo $CI_ENVIRONMENT_URL
variables:
ENVIRONMENT_NAME: ${CI_COMMIT_REF_SLUG}
STACK_NAME: appname-${ENVIRONMENT_NAME}
MAIN_DOMAIN: ${STACK_NAME}.example.com
environment:
name: ${ENVIRONMENT_NAME}
url: https://${MAIN_DOMAIN}
- Run the pipeline.
Output:
It looks fine because they are expanded in the Runner side.
- See the
/-/environments
path of the project
Notice that there is not an "Open" button because the URL was not properly parsed.
- Enable the FF
ci_expand_environment_name_and_url
See the /-/environments
path of the project
Notice that there is an "Open" button.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Furkan Ayhan