ci/ci_run_n_monitor: make --target mandatory

There is no point running without a target, just make it mandatory and
simplify the script.

Use ".*" to run all targets.

Signed-off-by: Helen Koike <helen.koike@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25473>
This commit is contained in:
Helen Koike
2023-09-29 18:53:19 -03:00
committed by Marge Bot
parent 633c08688b
commit 90da4a6845

View File

@@ -76,7 +76,7 @@ def pretty_wait(sec: int) -> None:
def monitor_pipeline( def monitor_pipeline(
project, project,
pipeline, pipeline,
target_job: Optional[str], target_job: str,
dependencies, dependencies,
force_manual: bool, force_manual: bool,
stress: bool, stress: bool,
@@ -86,14 +86,13 @@ def monitor_pipeline(
target_statuses: dict[int, str] = defaultdict(str) target_statuses: dict[int, str] = defaultdict(str)
stress_status_counter = defaultdict(lambda: defaultdict(int)) stress_status_counter = defaultdict(lambda: defaultdict(int))
if target_job: target_jobs_regex = re.compile(target_job.strip())
target_jobs_regex = re.compile(target_job.strip())
while True: while True:
to_cancel = [] to_cancel = []
for job in pipeline.jobs.list(all=True, sort="desc"): for job in pipeline.jobs.list(all=True, sort="desc"):
# target jobs # target jobs
if target_job and target_jobs_regex.match(job.name): if target_jobs_regex.match(job.name):
if force_manual and job.status == "manual": if force_manual and job.status == "manual":
enable_job(project, job, True) enable_job(project, job, True)
@@ -115,7 +114,7 @@ def monitor_pipeline(
if job.status == "manual": if job.status == "manual":
enable_job(project, job, False) enable_job(project, job, False)
elif target_job and job.status not in [ elif job.status not in [
"canceled", "canceled",
"success", "success",
"failed", "failed",
@@ -123,8 +122,7 @@ def monitor_pipeline(
]: ]:
to_cancel.append(job) to_cancel.append(job)
if target_job: cancel_jobs(project, to_cancel)
cancel_jobs(project, to_cancel)
if stress: if stress:
for job_name, status in stress_status_counter.items(): for job_name, status in stress_status_counter.items():
@@ -220,6 +218,7 @@ def parse_args() -> None:
"--target", "--target",
metavar="target-job", metavar="target-job",
help="Target job regex. For multiple targets, separate with pipe | character", help="Target job regex. For multiple targets, separate with pipe | character",
required=True,
) )
parser.add_argument( parser.add_argument(
"--token", "--token",