From 76be39ca6dbcfb62f1ef5194661c765cc97620c7 Mon Sep 17 00:00:00 2001 From: Eric Engestrom Date: Mon, 27 Nov 2023 17:47:58 +0000 Subject: ci_run_n_monitor: allow picking a pipeline by its MR It picks the latest pipeline from the MR; if you want another pipeline, use `--pipeline-url`. Part-of: --- bin/ci/ci_run_n_monitor.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'bin') diff --git a/bin/ci/ci_run_n_monitor.py b/bin/ci/ci_run_n_monitor.py index 20e9798ad99..0ef46c4f453 100755 --- a/bin/ci/ci_run_n_monitor.py +++ b/bin/ci/ci_run_n_monitor.py @@ -298,6 +298,11 @@ def parse_args() -> None: "--pipeline-url", help="URL of the pipeline to use, instead of auto-detecting it.", ) + mutex_group1.add_argument( + "--mr", + type=int, + help="ID of a merge request; the latest pipeline in that MR will be used.", + ) args = parser.parse_args() @@ -372,11 +377,14 @@ if __name__ == "__main__": pipe = cur_project.pipelines.get(pipeline_id) REV = pipe.sha else: - REV = check_output(['git', 'rev-parse', REV]).decode('ascii').strip() - 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) + projects = [mesa_project] + if args.mr: + REV = mesa_project.mergerequests.get(args.mr).sha + else: + REV = check_output(['git', 'rev-parse', REV]).decode('ascii').strip() + projects.append(get_gitlab_project(gl, args.project)) + (pipe, cur_project) = wait_for_pipeline(projects, REV) print(f"Revision: {REV}") print(f"Pipeline: {pipe.web_url}") -- cgit v1.2.3