Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
b2373e3d
Commit
b2373e3d
authored
Oct 31, 2017
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure the ee-compat-check uses the correct patch URL for forks
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
c598283a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
15 deletions
+16
-15
lib/gitlab/ee_compat_check.rb
lib/gitlab/ee_compat_check.rb
+13
-11
lib/tasks/gitlab/dev.rake
lib/tasks/gitlab/dev.rake
+3
-4
No files found.
lib/gitlab/ee_compat_check.rb
View file @
b2373e3d
...
@@ -2,8 +2,8 @@
...
@@ -2,8 +2,8 @@
module
Gitlab
module
Gitlab
# Checks if a set of migrations requires downtime or not.
# Checks if a set of migrations requires downtime or not.
class
EeCompatCheck
class
EeCompatCheck
DEFAULT_CE_
REPO
=
'https://gitlab.com/gitlab-org/gitlab-ce.git
'
.
freeze
DEFAULT_CE_
PROJECT_URL
=
'https://gitlab.com/gitlab-org/gitlab-ce
'
.
freeze
EE_REPO
=
'https://gitlab.com/gitlab-org/gitlab-ee.git'
.
freeze
EE_REPO
_URL
=
'https://gitlab.com/gitlab-org/gitlab-ee.git'
.
freeze
CHECK_DIR
=
Rails
.
root
.
join
(
'ee_compat_check'
)
CHECK_DIR
=
Rails
.
root
.
join
(
'ee_compat_check'
)
IGNORED_FILES_REGEX
=
/(VERSION|CHANGELOG\.md:\d+)/
.
freeze
IGNORED_FILES_REGEX
=
/(VERSION|CHANGELOG\.md:\d+)/
.
freeze
PLEASE_READ_THIS_BANNER
=
%Q{
PLEASE_READ_THIS_BANNER
=
%Q{
...
@@ -17,14 +17,16 @@ module Gitlab
...
@@ -17,14 +17,16 @@ module Gitlab
============================================================
\n
============================================================
\n
}
.
freeze
}
.
freeze
attr_reader
:ee_repo_dir
,
:patches_dir
,
:ce_
repo
,
:ce_branch
,
:ee_branch_found
attr_reader
:ee_repo_dir
,
:patches_dir
,
:ce_
project_url
,
:ce_repo_url
,
:ce_branch
,
:ee_branch_found
attr_reader
:failed_files
attr_reader
:
job_id
,
:
failed_files
def
initialize
(
branch
:,
ce_
repo:
DEFAULT_CE_REPO
)
def
initialize
(
branch
:,
ce_
project_url:
DEFAULT_CE_PROJECT_URL
,
job_id:
nil
)
@ee_repo_dir
=
CHECK_DIR
.
join
(
'ee-repo'
)
@ee_repo_dir
=
CHECK_DIR
.
join
(
'ee-repo'
)
@patches_dir
=
CHECK_DIR
.
join
(
'patches'
)
@patches_dir
=
CHECK_DIR
.
join
(
'patches'
)
@ce_branch
=
branch
@ce_branch
=
branch
@ce_repo
=
ce_repo
@ce_project_url
=
ce_project_url
@ce_repo_url
=
"
#{
ce_project_url
}
.git"
@job_id
=
job_id
end
end
def
check
def
check
...
@@ -59,8 +61,8 @@ module Gitlab
...
@@ -59,8 +61,8 @@ module Gitlab
step
(
"
#{
ee_repo_dir
}
already exists"
)
step
(
"
#{
ee_repo_dir
}
already exists"
)
else
else
step
(
step
(
"Cloning
#{
EE_REPO
}
into
#{
ee_repo_dir
}
"
,
"Cloning
#{
EE_REPO
_URL
}
into
#{
ee_repo_dir
}
"
,
%W[git clone --branch master --single-branch --depth=200
#{
EE_REPO
}
#{
ee_repo_dir
}
]
%W[git clone --branch master --single-branch --depth=200
#{
EE_REPO
_URL
}
#{
ee_repo_dir
}
]
)
)
end
end
end
end
...
@@ -132,7 +134,7 @@ module Gitlab
...
@@ -132,7 +134,7 @@ module Gitlab
def
check_patch
(
patch_path
)
def
check_patch
(
patch_path
)
step
(
"Checking out master"
,
%w[git checkout master]
)
step
(
"Checking out master"
,
%w[git checkout master]
)
step
(
"Resetting to latest master"
,
%w[git reset --hard origin/master]
)
step
(
"Resetting to latest master"
,
%w[git reset --hard origin/master]
)
step
(
"Fetching CE/
#{
ce_branch
}
"
,
%W[git fetch
#{
ce_repo
}
#{
ce_branch
}
]
)
step
(
"Fetching CE/
#{
ce_branch
}
"
,
%W[git fetch
#{
ce_repo
_url
}
#{
ce_branch
}
]
)
step
(
step
(
"Checking if
#{
patch_path
}
applies cleanly to EE/master"
,
"Checking if
#{
patch_path
}
applies cleanly to EE/master"
,
# Don't use --check here because it can result in a 0-exit status even
# Don't use --check here because it can result in a 0-exit status even
...
@@ -237,7 +239,7 @@ module Gitlab
...
@@ -237,7 +239,7 @@ module Gitlab
end
end
def
patch_url
def
patch_url
"
https://gitlab.com/gitlab-org/gitlab-ce/-/jobs/
#{
ENV
[
'CI_JOB_ID'
]
}
/artifacts/raw/ee_compat_check/patches/
#{
ce_patch_name
}
"
"
#{
ce_project_url
}
/-/jobs/
#{
job_id
}
/artifacts/raw/ee_compat_check/patches/
#{
ce_patch_name
}
"
end
end
def
step
(
desc
,
cmd
=
nil
)
def
step
(
desc
,
cmd
=
nil
)
...
@@ -304,7 +306,7 @@ module Gitlab
...
@@ -304,7 +306,7 @@ module Gitlab
# In the EE repo
# In the EE repo
$ git fetch origin
$ git fetch origin
$ git checkout -b
#{
ee_branch_prefix
}
origin/master
$ git checkout -b
#{
ee_branch_prefix
}
origin/master
$ git fetch
#{
ce_repo
}
#{
ce_branch
}
$ git fetch
#{
ce_repo
_url
}
#{
ce_branch
}
$ git cherry-pick SHA # Repeat for all the commits you want to pick
$ git cherry-pick SHA # Repeat for all the commits you want to pick
You can squash the `
#{
ce_branch
}
` commits into a single "Port of
#{
ce_branch
}
to EE" commit.
You can squash the `
#{
ce_branch
}
` commits into a single "Port of
#{
ce_branch
}
to EE" commit.
...
...
lib/tasks/gitlab/dev.rake
View file @
b2373e3d
...
@@ -5,10 +5,9 @@ namespace :gitlab do
...
@@ -5,10 +5,9 @@ namespace :gitlab do
opts
=
opts
=
if
ENV
[
'CI'
]
if
ENV
[
'CI'
]
{
{
# We don't use CI_REPOSITORY_URL since it includes `gitlab-ci-token:xxxxxxxxxxxxxxxxxxxx@`
ce_project_url:
ENV
[
'CI_PROJECT_URL'
],
# which is confusing in the steps suggested in the job's output.
branch:
ENV
[
'CI_COMMIT_REF_NAME'
],
ce_repo:
"
#{
ENV
[
'CI_PROJECT_URL'
]
}
.git"
,
job_id:
ENV
[
'CI_JOB_ID'
]
branch:
ENV
[
'CI_COMMIT_REF_NAME'
]
}
}
else
else
unless
args
[
:branch
]
unless
args
[
:branch
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment