summaryrefslogtreecommitdiff
path: root/bin/ci
diff options
context:
space:
mode:
authorGuilherme Gallo <guilherme.gallo@collabora.com>2023-11-01 01:36:07 -0300
committerMarge Bot <emma+marge@anholt.net>2023-11-08 02:18:17 +0000
commitf8b83520221fa52a4f661f5bbf118d60e3468881 (patch)
treeed9db7284ff2078991556115e1fef556efe7b6d9 /bin/ci
parente74238af4233f8db3431d8612a770a3ee7b81062 (diff)
ci/bin: Print a summary list of dependency and target jobs
We already print all the detected target jobs from regex and its dependencies. But for more complex regexes the list can be cumbersome, and an aggregate list of dependencies and targets can be more value, so add these prints as well. This is what looks like: ``` Running 10 dependency jobs: alpine/x86_64_lava_ssh_client, clang-format, debian-arm64, debian-testing, debian/arm64_build, debian/x86_64_build, debian/x86_64_build-base, kernel+rootfs_arm64, kernel+rootfs_x86_64, rustfmt Running 15 target jobs: a618_gl 1/4, a660_gl 1/2, intel-tgl-skqp, iris-amly-egl, iris-apl-deqp 1/3, iris-cml-deqp 1/4, iris-glk-deqp 1/2, iris-kbl-deqp 1/3, lima-mali450-deqp:arm64, lima-mali450-piglit:arm64 1/2, panfrost-g52-gl:arm64 1/3, panfrost-g72-gl:arm64 1/3, panfrost-t720-gles2:arm64, panfrost-t860-egl:arm64, zink-anv-tgl ``` Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25940>
Diffstat (limited to 'bin/ci')
-rwxr-xr-xbin/ci/ci_run_n_monitor.py29
1 files changed, 23 insertions, 6 deletions
diff --git a/bin/ci/ci_run_n_monitor.py b/bin/ci/ci_run_n_monitor.py
index 0be9c1d48dc..46a627a4dad 100755
--- a/bin/ci/ci_run_n_monitor.py
+++ b/bin/ci/ci_run_n_monitor.py
@@ -21,7 +21,7 @@ from concurrent.futures import ThreadPoolExecutor
from functools import partial
from itertools import chain
from subprocess import check_output
-from typing import Literal, Optional
+from typing import TYPE_CHECKING, Iterable, Literal, Optional
import gitlab
from colorama import Fore, Style
@@ -33,6 +33,9 @@ from gitlab_common import (
)
from gitlab_gql import GitlabGQL, create_job_needs_dag, filter_dag, print_dag
+if TYPE_CHECKING:
+ from gitlab_gql import Dag
+
GITLAB_URL = "https://gitlab.freedesktop.org"
REFRESH_WAIT_LOG = 10
@@ -293,6 +296,24 @@ def parse_args() -> None:
return args
+def print_detected_jobs(
+ target_dep_dag: "Dag", dependency_jobs: Iterable[str], target_jobs: Iterable[str]
+) -> None:
+ def print_job_set(color: str, kind: str, job_set: Iterable[str]):
+ print(
+ color + f"Running {len(job_set)} {kind} jobs: ",
+ "\n",
+ ", ".join(sorted(job_set)),
+ Fore.RESET,
+ "\n",
+ )
+
+ print(Fore.YELLOW + "Detected target job and its dependencies:", "\n")
+ print_dag(target_dep_dag)
+ print_job_set(Fore.MAGENTA, "dependency", dependency_jobs)
+ print_job_set(Fore.BLUE, "target", target_jobs)
+
+
def find_dependencies(target_jobs_regex: re.Pattern, project_path: str, iid: int) -> set[str]:
gql_instance = GitlabGQL()
dag = create_job_needs_dag(
@@ -303,14 +324,10 @@ def find_dependencies(target_jobs_regex: re.Pattern, project_path: str, iid: int
if not target_dep_dag:
print(Fore.RED + "The job(s) were not found in the pipeline." + Fore.RESET)
sys.exit(1)
- print(Fore.YELLOW)
- print("Detected job dependencies:")
- print()
- print_dag(target_dep_dag)
- print(Fore.RESET)
dependency_jobs = set(chain.from_iterable(d["needs"] for d in target_dep_dag.values()))
target_jobs = set(target_dep_dag.keys())
+ print_detected_jobs(target_dep_dag, dependency_jobs, target_jobs)
return target_jobs.union(dependency_jobs)