From 29990912877df91d3854bc10710cfe3974a8b935 Mon Sep 17 00:00:00 2001 From: Helen Koike Date: Fri, 10 Nov 2023 18:41:42 -0300 Subject: [PATCH] ci/ci_run_n_monitor: abort when target gets skipped when a target receives skipped state it is because some of the dependencies failed, abort the script and print the reason Signed-off-by: Helen Koike Part-of: --- bin/ci/ci_run_n_monitor.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/bin/ci/ci_run_n_monitor.py b/bin/ci/ci_run_n_monitor.py index 4c14d1d5a7a..20e9798ad99 100755 --- a/bin/ci/ci_run_n_monitor.py +++ b/bin/ci/ci_run_n_monitor.py @@ -102,6 +102,7 @@ def monitor_pipeline( target_id = None while True: + deps_failed = [] to_cancel = [] for job in pipeline.jobs.list(all=True, sort="desc"): # target jobs @@ -130,6 +131,8 @@ def monitor_pipeline( # run dependencies and cancel the rest if job.name in dependencies: enable_job(project, job, "dep", True) + if job.status == "failed": + deps_failed.append(job.name) else: to_cancel.append(job) @@ -164,6 +167,18 @@ def monitor_pipeline( ): return None, 1 + if ( + {"skipped"}.intersection(target_statuses.values()) + and not {"running", "pending"}.intersection(target_statuses.values()) + ): + print( + Fore.RED, + "Target in skipped state, aborting. Failed dependencies:", + deps_failed, + Fore.RESET, + ) + return None, 1 + if {"success", "manual"}.issuperset(target_statuses.values()): return None, 0