Skip to content
Snippets Groups Projects
Commit 5ee69ab9 authored by Tim Jaacks's avatar Tim Jaacks
Browse files

mirror_mr_pipeline: fix error when no pipeline found

This case should trigger a new pipeline instead of reporting an error.
parent e69d303e
No related branches found
No related tags found
1 merge request!244mirror_mr_pipeline: fix error when no pipeline found
Pipeline #52072 passed with stage
in 2 minutes and 42 seconds
......@@ -85,26 +85,29 @@ def main():
try:
pipelines = get_pipelines(project, args.commit, "^" + args.ref)
pipeline = pipelines[0]
except LookupError as e:
sys.exit(str(e))
# Wait for pipeline termination
print("Pipeline: %s" % pipeline.web_url)
if pipeline.status not in TERMINATED_STATES:
print("Waiting for completion", end="")
while pipeline.status not in TERMINATED_STATES:
print(".", end="", flush=True)
time.sleep(1)
pipeline = project.pipelines.get(pipeline.id, retry_transient_errors=True)
print("")
print("Result: %s" % pipeline.status, flush=True)
# Mirror result in success/failure case
if pipeline.status == "success":
sys.exit(0)
elif pipeline.status == "failed":
sys.exit(1)
# Wait for pipeline termination
print("Pipeline: %s" % pipeline.web_url)
if pipeline.status not in TERMINATED_STATES:
print("Waiting for completion", end="")
while pipeline.status not in TERMINATED_STATES:
print(".", end="", flush=True)
time.sleep(1)
pipeline = project.pipelines.get(
pipeline.id, retry_transient_errors=True
)
print("")
print("Result: %s" % pipeline.status, flush=True)
# Mirror result in success/failure case
if pipeline.status == "success":
sys.exit(0)
elif pipeline.status == "failed":
sys.exit(1)
except LookupError:
pass
# Else start a new pipeline on given ref
try:
......
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