diff options
author | Achilleas Pipinellis <axil@gitlab.com> | 2019-01-24 16:30:29 +0300 |
---|---|---|
committer | Achilleas Pipinellis <axil@gitlab.com> | 2019-01-24 16:35:14 +0300 |
commit | e4ad79e65da6bc899b23ca1295edc455887a68c3 (patch) | |
tree | 72f2510eecd7fee221cee95b06e9578d82d81d41 /lib/task_helpers.rb | |
parent | 27bb6ffe526f20a98c71b8143314fcd5c8558339 (diff) |
Pull the stable product branches when on a stable docs branch
This ensures that when on a docs stable-version branch,
the respective product branches are set up correctly.
Closes https://gitlab.com/gitlab-com/gitlab-docs/issues/324
Diffstat (limited to 'lib/task_helpers.rb')
-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..c9c78472 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 = /^(\d{1,2})\.(\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 right BRANCH_* variable. + if version = ENV["CI_COMMIT_REF_NAME"].match(VERSION_FORMAT) + case slug + when 'ee' + "#{version[1]}-#{version[2]}-stable-ee" + when 'ce', 'omnibus', 'runner' + "#{version[1]}-#{version[2]}-stable" + else + 'master' + end + else + ENV.fetch("BRANCH_#{slug.upcase}", 'master') + end end def git_workdir_dirty? |