Module: Mesa
Branch: main
Commit: 76be39ca6dbcfb62f1ef5194661c765cc97620c7
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=76be39ca6dbcfb62f1ef5194661c765cc97620c7

Author: Eric Engestrom <[email protected]>
Date:   Mon Nov 27 17:47:58 2023 +0000

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: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26381>

---

 bin/ci/ci_run_n_monitor.py | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

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}")

Reply via email to