Merge branch '46519-remove-ce-prefix-suffix-in-check-ce' into 'master'

Resolve "ee_compat_check should remove `ce-` prefix or `-ce` suffix as ee-specific check"

Closes #46519

See merge request gitlab-org/gitlab-ce!20532
This commit is contained in:
Rémy Coutable 2018-07-11 09:25:54 +00:00
commit d2ea56a870

View file

@ -138,15 +138,23 @@ module Gitlab
def ee_branch_presence_check! def ee_branch_presence_check!
ee_remotes.keys.each do |remote| ee_remotes.keys.each do |remote|
[ce_branch, ee_branch_prefix, ee_branch_suffix].each do |branch| output, _ = step(
_, status = step("Fetching #{remote}/#{branch}", %W[git fetch #{remote} #{branch}]) "Searching #{remote}",
%W[git ls-remote #{remote} *#{minimal_ee_branch_name}*])
if status.zero? branches =
@ee_remote_with_branch = remote output.scan(%r{(?<=refs/heads/|refs/tags/).+}).sort_by(&:size)
@ee_branch_found = branch
return true next if branches.empty?
end
end branch = branches.first
step("Fetching #{remote}/#{branch}", %W[git fetch #{remote} #{branch}])
@ee_remote_with_branch = remote
@ee_branch_found = branch
return true
end end
puts puts
@ -271,6 +279,10 @@ module Gitlab
@ee_patch_full_path ||= patches_dir.join(ee_patch_name) @ee_patch_full_path ||= patches_dir.join(ee_patch_name)
end end
def minimal_ee_branch_name
@minimal_ee_branch_name ||= ce_branch.sub(/(\Ace\-|\-ce\z)/, '')
end
def patch_name_from_branch(branch_name) def patch_name_from_branch(branch_name)
branch_name.parameterize << '.patch' branch_name.parameterize << '.patch'
end end