Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
gitlab-ci
Manage
Activity
Members
Labels
Plan
Jira
Code
Merge requests
5
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SECO Northern Europe
Yocto
infrastructure
gitlab-ci
Commits
7ce0fd74
Commit
7ce0fd74
authored
3 years ago
by
Jonas Höppner
Browse files
Options
Downloads
Patches
Plain Diff
CI: merge_gitlab_ci: Improve error handling.
parent
04cd24f2
No related branches found
No related tags found
1 merge request
!107
CI: deploy_gitlab_ci: Move one-time code to own function as reference
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
merge_gitlab_ci.py
+28
-6
28 additions, 6 deletions
merge_gitlab_ci.py
with
28 additions
and
6 deletions
merge_gitlab_ci.py
+
28
−
6
View file @
7ce0fd74
...
@@ -139,9 +139,20 @@ def main():
...
@@ -139,9 +139,20 @@ def main():
if
branch
is
None
:
if
branch
is
None
:
branch
=
project
.
default_branch
branch
=
project
.
default_branch
print
(
"
Try to merge {}({}) into {} ({})
"
.
format
(
args
.
submodule
,
args
.
revision
,
project
.
name
,
branch
)
)
mr
=
find_integration_merge_request
(
mr
=
find_integration_merge_request
(
project
,
args
.
submodule
,
args
.
revision
,
branch
project
,
args
.
submodule
,
args
.
revision
,
branch
)
)
if
mr
is
None
:
sys
.
exit
(
"
ERROR: Failed to find the integration MR.
"
)
# TODO if this ever happens, why ever, we could call
# deploy_gitlab_ci again to create a new integration
# commit or make sure the change is already integrated.
print
(
"
Merge {}!{}: {}
"
.
format
(
project
.
name
,
mr
.
iid
,
mr
.
title
))
print
(
"
Merge {}!{}: {}
"
.
format
(
project
.
name
,
mr
.
iid
,
mr
.
title
))
# Wait until GitLab has checked merge status
# Wait until GitLab has checked merge status
...
@@ -157,13 +168,24 @@ def main():
...
@@ -157,13 +168,24 @@ def main():
)
)
if
not
merged
:
if
not
merged
:
sys
.
exit
(
print
(
"
Integration MR could not be merged. You have two possibilities to fix
"
"
Integration MR could not be merged.
"
"
this:
\n
"
"
To fix this:
\n
"
"
1. Checkout the MR and rebase it on the current master manually, or
\n
"
"
1. Checkout the MR {}!{} and merge it manually.
\n
"
"
2. Delete the MR (Edit -> Delete in the MR UI)
\n
"
"
2. Manually merge the follow up MRs in the following project:
"
.
format
(
"
In either case restart this job afterwards in order to get it merged.
"
project
.
name
,
mr
.
iid
)
)
)
found
=
False
for
p2
in
args
.
projects
+
[
args
.
project
]:
if
p2
==
p
:
found
=
True
continue
if
not
found
:
continue
print
(
"
{}
"
.
format
(
p2
.
name
))
sys
.
exit
()
print
(
"
Successfully merged
"
)
print
(
"
Successfully merged
"
)
exit
()
exit
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment