Fix construct release environments vars script
What does this MR do and why?
Fix construct release environments vars script
Use CI_COMMIT_REF_NAME instead of CI_COMMIT_REF_SLUG, because the the later one does some string conversions per our document (https://docs.gitlab.com/ee/ci/variables/predefined_variables.html). This breaks the current regex, make it hard to understand and lead to possible confusion in the future.
Ref: gitlab-com/gl-infra/delivery#20371 (closed)
Detailed explanation
From our docs about CI_COMMIT_REF_SLUG
:
https://docs.gitlab.com/ee/ci/variables/predefined_variables.html
CI_COMMIT_REF_NAME
in lowercase, shortened to 63 bytes, and with everything except0-9
anda-z
replaced with-
. No leading / trailing-
. Use in URLs, host names and domain names.
So, an example:
- If the tag is v17.2.0-rc42-ee
-
CI_COMMIT_REF_NAME
is the same - v17.2.0-rc42-ee -
CI_COMMIT_REF_SLUG
converts all.
to be-
, so its value is v17-2-0-rc42-ee. Because of that, it does not the regex of the script anymore, so it producesENVIRONMENT=v17-2-0-rc42-security
, which is unexpected.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Testing
In a test repository, I tested on all 3 cases of CI_COMMIT_REF_NAME
:
Stable branch
https://gitlab.com/dat.tang.gitlab/test-gitlab-ci/-/pipelines/1377363729
RC version tag
https://gitlab.com/dat.tang.gitlab/test-gitlab-ci/-/pipelines/1377364815
Release version tag
https://gitlab.com/dat.tang.gitlab/test-gitlab-ci/-/pipelines/1377365759
Merge request reports
Activity
added groupdelivery typebug labels
added pipelinetier-1 label
added Category:Delivery devopsplatforms sectionplatforms labels
removed Category:Delivery devopsplatforms pipelinetier-1 sectionplatforms labels
added Category:Delivery devopsplatforms sectionplatforms labels
assigned to @dat.tang.gitlab
- A deleted user
added backend label
1 Message CHANGELOG missing: If this merge request needs a changelog entry, add the
Changelog
trailer to the commit message you want to add to the changelog.If this merge request doesn't need a CHANGELOG entry, feel free to ignore this message.
Reviewer roulette
Category Reviewer Maintainer backend @rliu-gl
(UTC-4, 6 hours behind author)
@mc_rocha
(UTC-4, 6 hours behind author)
~"Tooling" Reviewer review is optional for ~"Tooling" @garyh
(UTC-5, 7 hours behind author)
Please refer to documentation page for guidance on how you can benefit from the Reviewer Roulette, or use the GitLab Review Workload Dashboard to find other available reviewers.
If needed, you can retry the
danger-review
job that generated this comment.Generated by
DangerEdited by Ghost Userrequested review from @mc_rocha
requested review from @dbalexandre and removed review request for @mc_rocha
added 1 commit
- 0e9b9d2b - Fix construct release environments vars script
- Resolved by Dat Tang
@dbalexandre : Reviewer roulette chose you!
For your context, this is not a change to the GitLab Rail codebase or its functionality. It is used to build the environment variables for the trigger job for a tool that groupdelivery used to validate changes in stable branches called
release environments
.- Where the script is used https://gitlab.com/gitlab-org/gitlab/-/blob/a4893e6226f8dd84e7bf23e5be3091c511ad2a49/.gitlab/ci/release-environments/main.gitlab-ci.yml#L46
- Trigger job: https://gitlab.com/gitlab-org/gitlab/-/blob/a4893e6226f8dd84e7bf23e5be3091c511ad2a49/.gitlab/ci/release-environments/main.gitlab-ci.yml#L73
mentioned in issue gitlab-com/gl-infra/delivery#20371 (closed)
requested review from @bala.kumar
changed milestone to %17.3
added pipeline:mr-approved label
added pipelinetier-3 label