Skip to content

Release environments - extract env name from tags

What does this MR do and why?

Currently, the release environment name is extracted from the branch name:

ENV['CI_COMMIT_REF_SLUG'].sub("-ee", "")

However, now the release environment pipeline is also triggered by a tagging pipeline, where the ENV['CI_COMMIT_REF_SLUG' can also be the tag. Thus, it can have one of these formats:

  • v17.1.0-rc42-ee
  • v17.0.2-ee
  • 17-0-stable-ee

This MR makes it possible to extract the environment name (e.g. 17-0-stable) from all the three scenarios.

Close gitlab-com/gl-infra/delivery#20320 (closed)

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.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

The change can be tested locally by pry:

[4] pry(main)> input="v17.1.0-rc42-ee" 
=> "v17.1.0-rc42-ee"
[5] pry(main)> input.match(/^v?([\d]+)\.([\d])+\.[\d]+[\d\w-]*-ee$/)
=> #<MatchData "v17.1.0-rc42-ee" 1:"17" 2:"1">
[6] pry(main)> input="v17.0.2-ee" 
=> "v17.0.2-ee"
[7] pry(main)> input.match(/^v?([\d]+)\.([\d])+\.[\d]+[\d\w-]*-ee$/)
=> #<MatchData "v17.0.2-ee" 1:"17" 2:"0">
Edited by Dat Tang

Merge request reports