diff options
author | Achilleas Pipinellis <axil@gitlab.com> | 2019-02-08 17:54:29 +0300 |
---|---|---|
committer | Achilleas Pipinellis <axil@gitlab.com> | 2019-02-08 17:54:29 +0300 |
commit | 5c844f03bc9f12ee706c08e95569a0d1b52b3c57 (patch) | |
tree | 24c7bc4a7aec880f615f669508c0e8dea8db68c3 /lib | |
parent | 887038937c072d934f574195e4c9ef923998c161 (diff) | |
parent | dec416aae4bfb7059de4284516e59b49e3825ebf (diff) |
Merge branch 'pull-stable-branches-when-on-stable-branch' into 'master'
Pull the stable product branches when on a stable docs branch
Closes #324
See merge request gitlab-com/gitlab-docs!395
Diffstat (limited to 'lib')
-rw-r--r-- | lib/task_helpers.rb | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/task_helpers.rb b/lib/task_helpers.rb index 29e7e108..941c3c96 100644 --- a/lib/task_helpers.rb +++ b/lib/task_helpers.rb @@ -1,6 +1,7 @@ require 'yaml' PRODUCTS = %W[ce ee omnibus runner debug].freeze +VERSION_FORMAT = /^(?<major>\d{1,2})\.(?<minor>\d{1,2})$/ def config # Parse the config file and create a hash. @@ -17,7 +18,20 @@ def products end def retrieve_branch(slug) - ENV.fetch("BRANCH_#{slug.upcase}", 'master') + # If we're on a stable branch, catch the version and + # assign the product branches correctly. + if version = ENV["CI_COMMIT_REF_NAME"].match(VERSION_FORMAT) + case slug + when 'ee' + "#{version[:major]}-#{version[:minor]}-stable-ee" + when 'ce', 'omnibus', 'runner' + "#{version[:major]}-#{version[:minor]}-stable" + else + 'master' + end + else + ENV.fetch("BRANCH_#{slug.upcase}", 'master') + end end def git_workdir_dirty? |