Support variable expansion on environment:auto_stop_in
What does this MR do and why?
Support variable expansion for environment:auto_stop_in
.
Implementation follows the proposal laid out in #365140 (closed)
- We loose the
auto_stop_in
validation to String type from duration parser's validation.- Renew the
environments.auto_stop_in
with variable expansion when a deployment succeeded.- Track the parser error in Sentry/Log. This is helpful to debug user errors.
Documentation changes will be covered in a separate MR.
Screenshots or screen recordings
auto_stop_in_variable_expansion
How to set up and validate locally
- On a test project in local, use the below simple ci configuration file and trigger pipeline.
.gitlab-ci.yml
image: alpine:latest
stages:
- deploy_preprod
- deploy_prod
.deploy: &deploy
script:
- echo "env is $JOB_ENVIRONMENT"
- echo "TTL is $TTL"
environment:
name: $JOB_ENVIRONMENT
auto_stop_in: $TTL
deploy_prod:
stage: deploy_prod
<<: *deploy
variables:
JOB_ENVIRONMENT: 'prod'
TTL: '14 days'
deploy_preprod:
stage: deploy_preprod
<<: *deploy
variables:
JOB_ENVIRONMENT: 'preprod'
TTL: '2 days'
- We should observe the
TTL
variable being substituted with value to the environmentauto_stop_at
field as shown in the UI in video above.
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.
Related to #365140 (closed)
Edited by Bala Kumar