summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorEric Engestrom <eric@igalia.com>2023-05-24 22:58:28 +0100
committerMarge Bot <emma+marge@anholt.net>2023-05-26 00:12:03 +0000
commit9ce717ab31f24faf0a15ba09e8f3efcd78929508 (patch)
treeda136430d5b7be3e8f9f4c2392dc9f587f31966b /bin
parent0539dec10f1c1efcb2c18858cc0aad3630211a7b (diff)
downloadmesa-9ce717ab31f24faf0a15ba09e8f3efcd78929508.tar.gz
mesa-9ce717ab31f24faf0a15ba09e8f3efcd78929508.tar.bz2
mesa-9ce717ab31f24faf0a15ba09e8f3efcd78929508.zip
ci_run_n_monitor: add ability to specify the pipeline to use, instead of auto-detecting it
The auto-detection code currently looks for a repo called "mesa" in the current user's fork (ie. the user providing the api token), which is great for the common use case, but sometimes needs to be able to be overridden, such as when running a pipeline in another fork than one's own, when working with someone else in their fork. Signed-off-by: Eric Engestrom <eric@igalia.com> Acked-by: David Heidelberg <david.heidelberg@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23230>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/ci/ci_run_n_monitor.py26
1 files changed, 22 insertions, 4 deletions
diff --git a/bin/ci/ci_run_n_monitor.py b/bin/ci/ci_run_n_monitor.py
index 6cfc61a6410..512b34cb342 100755
--- a/bin/ci/ci_run_n_monitor.py
+++ b/bin/ci/ci_run_n_monitor.py
@@ -26,6 +26,8 @@ from colorama import Fore, Style
from gitlab_common import get_gitlab_project, read_token, wait_for_pipeline
from gitlab_gql import GitlabGQL, create_job_needs_dag, filter_dag, print_dag
+GITLAB_URL = "https://gitlab.freedesktop.org"
+
REFRESH_WAIT_LOG = 10
REFRESH_WAIT_JOBS = 6
@@ -240,6 +242,10 @@ def parse_args() -> None:
"--rev", metavar="revision", help="repository git revision (default: HEAD)"
)
parser.add_argument(
+ "--pipeline-url",
+ help="URL of the pipeline to use, instead of auto-detecting it.",
+ )
+ parser.add_argument(
"--token",
metavar="token",
help="force GitLab token, otherwise it's read from ~/.config/gitlab-token",
@@ -277,18 +283,30 @@ if __name__ == "__main__":
token = read_token(args.token)
- gl = gitlab.Gitlab(url="https://gitlab.freedesktop.org",
+ gl = gitlab.Gitlab(url=GITLAB_URL,
private_token=token,
retry_transient_errors=True)
- cur_project = get_gitlab_project(gl, "mesa")
-
REV: str = args.rev
if not REV:
REV = check_output(['git', 'rev-parse', 'HEAD']).decode('ascii').strip()
print(f"Revision: {REV}")
- pipe = wait_for_pipeline(cur_project, REV)
+
+ if args.pipeline_url:
+ assert args.pipeline_url.startswith(GITLAB_URL)
+ url_path = args.pipeline_url[len(GITLAB_URL):]
+ url_path_components = url_path.split("/")
+ project_name = "/".join(url_path_components[1:3])
+ assert url_path_components[3] == "-"
+ assert url_path_components[4] == "pipelines"
+ pipeline_id = int(url_path_components[5])
+ cur_project = gl.projects.get(project_name)
+ pipe = cur_project.pipelines.get(pipeline_id)
+ else:
+ cur_project = get_gitlab_project(gl, "mesa")
+ pipe = wait_for_pipeline(cur_project, REV)
print(f"Pipeline: {pipe.web_url}")
+
deps = set()
if args.target:
print("🞋 job: " + Fore.BLUE + args.target + Style.RESET_ALL)