Now you don't fail if you're trying to test a mesa/mesa MR pipeline and
gitlab takes more than 10s to create it. And you don't have to wait 10
seconds to get things started (aka see if your regex was right) if you're
testing a user/mesa fork pipeline.
Fixes:
941d92408ee5 ("bin/ci_run_n_monitor: automatically pick MR pipelines when they exist")
Closes: #9894
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25810>
else:
if not REV:
REV = check_output(['git', 'rev-parse', 'HEAD']).decode('ascii').strip()
- # Look for an MR pipeline first
- cur_project = gl.projects.get("mesa/mesa")
- pipe = wait_for_pipeline(cur_project, REV, timeout=10)
- if not pipe:
- # Fallback to a pipeline in the user's fork
- cur_project = get_gitlab_project(gl, args.project)
- pipe = wait_for_pipeline(cur_project, REV)
+ mesa_project = gl.projects.get("mesa/mesa")
+ user_project = get_gitlab_project(gl, args.project)
+ (pipe, cur_project) = wait_for_pipeline([mesa_project, user_project], REV)
print(f"Revision: {REV}")
print(f"Pipeline: {pipe.web_url}")
)
-def wait_for_pipeline(project, sha: str, timeout=None):
+def wait_for_pipeline(projects, sha: str, timeout=None):
"""await until pipeline appears in Gitlab"""
- print(f"⏲ for the pipeline to appear in {project.path_with_namespace}..", end="")
+ project_names = [project.path_with_namespace for project in projects]
+ print(f"⏲ for the pipeline to appear in {project_names}..", end="")
start_time = time.time()
while True:
- pipelines = project.pipelines.list(sha=sha)
- if pipelines:
- print("", flush=True)
- return pipelines[0]
+ for project in projects:
+ pipelines = project.pipelines.list(sha=sha)
+ if pipelines:
+ print("", flush=True)
+ return (pipelines[0], project)
print("", end=".", flush=True)
if timeout and time.time() - start_time > timeout:
print(" not found", flush=True)
- return None
+ return (None, None)
time.sleep(1)
cur_project = get_gitlab_project(gl, "mesa")
print(f"Revision: {args.rev}")
- pipe = wait_for_pipeline(cur_project, args.rev)
+ (pipe, cur_project) = wait_for_pipeline([cur_project], args.rev)
print(f"Pipeline: {pipe.web_url}")
gather_results(cur_project, pipe)