bin/ci_run_n_monitor: error out if both --project and --pipeline-url are passed
authorEric Engestrom <eric@igalia.com>
Tue, 29 Aug 2023 17:15:47 +0000 (18:15 +0100)
committerMarge Bot <emma+marge@anholt.net>
Tue, 29 Aug 2023 19:27:22 +0000 (19:27 +0000)
Signed-off-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24937>

bin/ci/ci_run_n_monitor.py

index 7445273..4dc4e78 100755 (executable)
@@ -259,7 +259,16 @@ def parse_args() -> None:
         help="URL of the pipeline to use, instead of auto-detecting it.",
     )
 
-    return parser.parse_args()
+    args = parser.parse_args()
+
+    # argparse doesn't support groups inside add_mutually_exclusive_group(),
+    # which means we can't just put `--project` and `--rev` in a group together,
+    # we have to do this by heand instead.
+    if args.pipeline_url and args.project != parser.get_default("project"):
+        # weird phrasing but it's the error add_mutually_exclusive_group() gives
+        parser.error("argument --project: not allowed with argument --pipeline-url")
+
+    return args
 
 
 def find_dependencies(target_job: str, project_path: str, sha: str) -> set[str]: