From 90da4a6845c11262b127a30889baf07d5ca42b32 Mon Sep 17 00:00:00 2001 From: Helen Koike Date: Fri, 29 Sep 2023 18:53:19 -0300 Subject: [PATCH] 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 Part-of: --- bin/ci/ci_run_n_monitor.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/bin/ci/ci_run_n_monitor.py b/bin/ci/ci_run_n_monitor.py index b8aa3ce..b9e26ce 100755 --- a/bin/ci/ci_run_n_monitor.py +++ b/bin/ci/ci_run_n_monitor.py @@ -76,7 +76,7 @@ def pretty_wait(sec: int) -> None: def monitor_pipeline( project, pipeline, - target_job: Optional[str], + target_job: str, dependencies, force_manual: bool, stress: bool, @@ -86,14 +86,13 @@ def monitor_pipeline( target_statuses: dict[int, str] = defaultdict(str) 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: to_cancel = [] for job in pipeline.jobs.list(all=True, sort="desc"): # 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": enable_job(project, job, True) @@ -115,7 +114,7 @@ def monitor_pipeline( if job.status == "manual": enable_job(project, job, False) - elif target_job and job.status not in [ + elif job.status not in [ "canceled", "success", "failed", @@ -123,8 +122,7 @@ def monitor_pipeline( ]: to_cancel.append(job) - if target_job: - cancel_jobs(project, to_cancel) + cancel_jobs(project, to_cancel) if stress: for job_name, status in stress_status_counter.items(): @@ -220,6 +218,7 @@ def parse_args() -> None: "--target", metavar="target-job", help="Target job regex. For multiple targets, separate with pipe | character", + required=True, ) parser.add_argument( "--token", -- 2.7.4