mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-20 13:50:11 +01:00
bin/ci_run_n_monitor: automatically pick MR pipelines when they exist
When an MR has been created, we usually want to run the jobs in the MR pipeline so that reviewers see that things work as expected. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25153>
This commit is contained in:
parent
f398f0fb44
commit
941d92408e
2 changed files with 10 additions and 3 deletions
|
|
@ -315,10 +315,13 @@ if __name__ == "__main__":
|
|||
pipe = cur_project.pipelines.get(pipeline_id)
|
||||
REV = pipe.sha
|
||||
else:
|
||||
cur_project = get_gitlab_project(gl, args.project)
|
||||
if not REV:
|
||||
REV = check_output(['git', 'rev-parse', 'HEAD']).decode('ascii').strip()
|
||||
pipe = wait_for_pipeline(cur_project, REV)
|
||||
cur_project = gl.projects.get("mesa/mesa")
|
||||
pipe = wait_for_pipeline(cur_project, REV, timeout=10)
|
||||
if not pipe:
|
||||
cur_project = get_gitlab_project(gl, args.project)
|
||||
pipe = wait_for_pipeline(cur_project, REV)
|
||||
|
||||
print(f"Revision: {REV}")
|
||||
print(f"Pipeline: {pipe.web_url}")
|
||||
|
|
|
|||
|
|
@ -30,13 +30,17 @@ def read_token(token_arg: Optional[str]) -> str:
|
|||
)
|
||||
|
||||
|
||||
def wait_for_pipeline(project, sha: str):
|
||||
def wait_for_pipeline(project, sha: str, timeout=None):
|
||||
"""await until pipeline appears in Gitlab"""
|
||||
print(f"⏲ for the pipeline to appear in {project.path_with_namespace}..", end="")
|
||||
start_time = time.time()
|
||||
while True:
|
||||
pipelines = project.pipelines.list(sha=sha)
|
||||
if pipelines:
|
||||
print("", flush=True)
|
||||
return pipelines[0]
|
||||
print("", end=".", flush=True)
|
||||
if timeout and time.time() - start_time > timeout:
|
||||
print(" not found", flush=True)
|
||||
return None
|
||||
time.sleep(1)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue