Commit 88ed1082 authored by Peter Hutterer's avatar Peter Hutterer Committed by Benjamin Tissoires

ci-fairy: ignore a missing allow_collaboration field

Where an author files an MR against their own personal project, the
allow_collaboration field is missing. This causes a KeyError, let's
catch and ignore that.
Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
parent 306a3a5d
......@@ -1076,18 +1076,23 @@ def check_merge_request(ctx, project, merge_request_iid, junit_xml, require_allo
if exit_status == 0:
if require_allow_collaboration:
if not mr.allow_collaboration:
exit_status = 1
tcaseid = 'allow_collaboration'
tcasename = 'Check allow_collaboration checkbox is set'
message = '''
Error: This merge request does not allow edits from maintainers.
Please edit the merge request and set the checkbox to
"Allow commits from members who can merge to the target branch"
See https://docs.gitlab.com/ce/user/project/merge_requests/allow_collaboration.html'''
failures.append((tcaseid, tcasename, message))
logger.error(message)
try:
if not mr.allow_collaboration:
exit_status = 1
tcaseid = 'allow_collaboration'
tcasename = 'Check allow_collaboration checkbox is set'
message = '''
Error: This merge request does not allow edits from maintainers.
Please edit the merge request and set the checkbox to
"Allow commits from members who can merge to the target branch"
See https://docs.gitlab.com/ce/user/project/merge_requests/allow_collaboration.html'''
failures.append((tcaseid, tcasename, message))
logger.error(message)
except KeyError:
# filing an MR against master in your own personal repo
# doesn't have that checkbox
pass
if failures:
if junit_xml is not None:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment