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
069f2d34
Commit
069f2d34
authored
Sep 29, 2016
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Draft a quick CE->EE merge check rake task
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
8776d9a3
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
109 additions
and
0 deletions
+109
-0
.gitlab-ci.yml
.gitlab-ci.yml
+7
-0
lib/tasks/ce_to_ee_merge_check.rake
lib/tasks/ce_to_ee_merge_check.rake
+6
-0
lib/tasks/gitlab/dev.rake
lib/tasks/gitlab/dev.rake
+96
-0
No files found.
.gitlab-ci.yml
View file @
069f2d34
...
@@ -210,6 +210,13 @@ rake brakeman: *exec
...
@@ -210,6 +210,13 @@ rake brakeman: *exec
rake flay
:
*exec
rake flay
:
*exec
license_finder
:
*exec
license_finder
:
*exec
rake downtime_check
:
*exec
rake downtime_check
:
*exec
rake ce_to_ee_merge_check
:
<<
:
*exec
only
:
-
branches
except
:
-
tags
-
master
rake db:migrate:reset:
rake db:migrate:reset:
stage
:
test
stage
:
test
...
...
lib/tasks/ce_to_ee_merge_check.rake
0 → 100644
View file @
069f2d34
desc
'Checks if the branch would apply cleanly to EE'
task
ce_to_ee_merge_check: :environment
do
return
if
defined?
(
Gitlab
::
License
)
Rake
::
Task
[
'gitlab:dev:ce_to_ee_merge_check'
].
invoke
end
lib/tasks/gitlab/dev.rake
0 → 100644
View file @
069f2d34
namespace
:gitlab
do
namespace
:dev
do
desc
'Checks if the branch would apply cleanly to EE'
task
ce_to_ee_merge_check: :environment
do
ce_repo
=
ENV
[
'CI_BUILD_REPO'
]
ce_branch
=
ENV
[
'CI_BUILD_REF_NAME'
]
ee_repo
=
'https://gitlab.com/gitlab-org/gitlab-ee.git'
ee_branch
=
"
#{
ce_branch
}
-ee"
ee_dir
=
'gitlab-ee-merge-check'
puts
"
\n
=> Cloning
#{
ee_repo
}
into
#{
ee_dir
}
\n
"
`git clone
#{
ee_repo
}
#{
ee_dir
}
--depth 1`
Dir
.
chdir
(
ee_dir
)
do
puts
"
\n
=> Fetching
#{
ce_repo
}
/
#{
ce_branch
}
\n
"
`git fetch
#{
ce_repo
}
#{
ce_branch
}
--depth 1`
# Try to merge the current tested branch to EE/master...
puts
"
\n
=> Merging
#{
ce_repo
}
/
#{
ce_branch
}
into
#{
ee_repo
}
/master
\n
"
`git merge --ff-only FETCH_HEAD`
exit
0
if
$?
.
success?
# Try to merge a possible <branch>-ee branch to EE/master...
puts
"
\n
=> Merging
#{
ee_repo
}
/
#{
ee_branch
}
into
#{
ee_repo
}
/master
\n
"
`git merge --ff-only
#{
ee_branch
}
`
# The <branch>-ee doesn't exist
if
$?
.
exitstatus
==
1
puts
<<-
MSG
.
strip_heredoc
\n
=================================================================
The
#{
ce_branch
}
branch cannot be merged without conflicts to the
current EE/master, and no
#{
ee_branch
}
branch was detected in
the EE repository.
Please create a
#{
ee_branch
}
branch that includes changes
#{
ce_branch
}
but also specific changes than can be applied cleanly
to EE/master.
You can create this branch as follow:
1. In the EE repo:
$ git fetch origin
$ git fetch
#{
ce_repo
}
#{
ce_branch
}
$ git checkout -b
#{
ee_branch
}
FETCH_HEAD
$ git rebase origin/master
2. At this point you will likely have conflicts, solve them, and
continue/finish the rebase.
3. You can squash all the original
#{
ce_branch
}
commits into a
single "Port of
#{
ce_branch
}
to EE".
4. Push your branch to
#{
ee_repo
}
:
$ git push origin
#{
ee_branch
}
=================================================================
\n
MSG
exit
1
end
# The <branch>-ee cannot be merged cleanly to EE/master...
unless
$?
.
success?
puts
<<-
MSG
.
strip_heredoc
\n
=================================================================
The
#{
ce_branch
}
branch cannot be merged without conflicts to
EE/master, and even though the
#{
ee_branch
}
branch exists in the EE
repository, it cannot be merged without conflicts to EE/master.
Please update the
#{
ee_branch
}
, push it again to
#{
ee_repo
}
, and
retry this job.
=================================================================
\n
MSG
exit
2
end
puts
"
\n
=> Merging
#{
ce_repo
}
/
#{
ce_branch
}
into
#{
ee_repo
}
/master
\n
"
`git merge --ff-only FETCH_HEAD`
exit
0
if
$?
.
success?
# The <branch>-ee can be merged cleanly to EE/master, but <branch> still
# cannot be merged cleanly to EE/master...
puts
<<-
MSG
.
strip_heredoc
\n
=================================================================
The
#{
ce_branch
}
branch cannot be merged without conflicts to EE, and
even though the
#{
ee_branch
}
branch exists in the EE repository and
applies cleanly to EE/master, it doesn't prevent conflicts when
merging
#{
ce_branch
}
into EE.
We may be in a complex situation here.
=================================================================
\n
MSG
exit
3
end
end
end
end
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