Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2017-11-20 19:16:45 +0300
committerRémy Coutable <remy@rymai.me>2017-11-21 17:31:23 +0300
commit0fbd919a23c48967f6001a18210bda3679dd9179 (patch)
treeb799e6757456bc14958fc8bbd47cf1e63923ab5b
parentff47c04b0ec3cce68e2dd3c9b6b06aed40e04784 (diff)
Try to find the merge-base against FETCH_HEAD which represents the canonical master
Signed-off-by: Rémy Coutable <remy@rymai.me>
-rw-r--r--.gitlab-ci.yml2
-rw-r--r--lib/gitlab/ee_compat_check.rb23
2 files changed, 12 insertions, 13 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index d4b375696c2..2f149ef9a35 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -419,7 +419,7 @@ ee_compat_check:
retry: 0
artifacts:
name: "${CI_JOB_NAME}_${CI_COMIT_REF_NAME}_${CI_COMMIT_SHA}"
- when: on_failure
+ when: always
expire_in: 10d
paths:
- ee_compat_check/patches/*.patch
diff --git a/lib/gitlab/ee_compat_check.rb b/lib/gitlab/ee_compat_check.rb
index efc2e46d289..dd0d0c61805 100644
--- a/lib/gitlab/ee_compat_check.rb
+++ b/lib/gitlab/ee_compat_check.rb
@@ -31,7 +31,7 @@ module Gitlab
def check
ensure_patches_dir
- generate_patch(ce_branch, ce_patch_full_path)
+ generate_patch(branch: ce_branch, patch_path: ce_patch_full_path, remote: DEFAULT_CE_PROJECT_URL)
ensure_ee_repo
Dir.chdir(ee_repo_dir) do
@@ -71,14 +71,14 @@ module Gitlab
FileUtils.mkdir_p(patches_dir)
end
- def generate_patch(branch, patch_path)
+ def generate_patch(branch:, patch_path:, remote:)
FileUtils.rm(patch_path, force: true)
- find_merge_base_with_master(branch: branch)
+ find_merge_base_with_master(branch: branch, remote: remote)
step(
- "Generating the patch against origin/master in #{patch_path}",
- %w[git diff --binary origin/master...HEAD]
+ "Generating the patch against FETCH_HEAD in #{patch_path}",
+ %w[git diff --binary FETCH_HEAD...HEAD]
) do |output, status|
throw(:halt_check, :ko) unless status.zero?
@@ -116,9 +116,9 @@ module Gitlab
end
def ee_branch_compat_check!
- step("Checking out origin/#{ee_branch_found}", %W[git checkout -b #{ee_branch_found} FETCH_HEAD])
+ step("Checking out #{ee_branch_found}", %W[git checkout -b #{ee_branch_found} FETCH_HEAD])
- generate_patch(ee_branch_found, ee_patch_full_path)
+ generate_patch(branch: ee_branch_found, patch_path: ee_patch_full_path, remote: EE_REPO_URL)
unless check_patch(ee_patch_full_path).zero?
puts
@@ -134,7 +134,6 @@ module Gitlab
def check_patch(patch_path)
step("Checking out master", %w[git checkout master])
step("Resetting to latest master", %w[git reset --hard origin/master])
- step("Fetching CE/#{ce_branch}", %W[git fetch #{ce_repo_url} #{ce_branch}])
step(
"Checking if #{patch_path} applies cleanly to EE/master",
# Don't use --check here because it can result in a 0-exit status even
@@ -173,8 +172,8 @@ module Gitlab
def merge_base_found?
step(
- "Finding merge base with master",
- %w[git merge-base origin/master HEAD]
+ "Finding merge base with FETCH_HEAD",
+ %w[git merge-base FETCH_HEAD HEAD]
) do |output, status|
if status.zero?
puts "Merge base was found: #{output}"
@@ -183,7 +182,7 @@ module Gitlab
end
end
- def find_merge_base_with_master(branch:)
+ def find_merge_base_with_master(branch:, remote:)
# Start with (Math.exp(3).to_i = 20) until (Math.exp(6).to_i = 403)
# In total we go (20 + 54 + 148 + 403 = 625) commits deeper
depth = 20
@@ -193,7 +192,7 @@ module Gitlab
# Repository is initially cloned with a depth of 20 so we need to fetch
# deeper in the case the branch has more than 20 commits on top of master
fetch(branch: branch, depth: depth)
- fetch(branch: 'master', depth: depth, remote: DEFAULT_CE_PROJECT_URL)
+ fetch(branch: 'master', depth: depth, remote: remote)
merge_base_found?
end