Skip to content
Snippets Groups Projects
Commit 7ce0fd74 authored by Jonas Höppner's avatar Jonas Höppner
Browse files

CI: merge_gitlab_ci: Improve error handling.

parent 04cd24f2
No related branches found
No related tags found
1 merge request!107CI: deploy_gitlab_ci: Move one-time code to own function as reference
...@@ -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()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment