From 940e9db50c5572352938d8139bec588d639ba92c Mon Sep 17 00:00:00 2001 From: Denys Fedoryshchenko Date: Tue, 12 Nov 2024 21:03:19 +0200 Subject: [PATCH] fix(checkout): Do not consider failed job as infra failure In some conditions, when job is itself test result (some regressions cause that), we must fail on it as failed test, if it is set in --test argument, to bisect correctly. Signed-off-by: Denys Fedoryshchenko --- kcidev/subcommands/checkout.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/kcidev/subcommands/checkout.py b/kcidev/subcommands/checkout.py index 4e011bc..cf8c6c3 100644 --- a/kcidev/subcommands/checkout.py +++ b/kcidev/subcommands/checkout.py @@ -121,7 +121,9 @@ def watch_jobs(baseurl, token, treeid, jobfilter, test): continue time_local = time.localtime() click.echo(f"Current time: {time.strftime('%Y-%m-%d %H:%M:%S', time_local)}") - click.secho(f"Total tree nodes {len(nodes)} found.", fg="green") + click.secho( + f"Total tree nodes {len(nodes)} found. Jobfilter: {jobfilter}", fg="green" + ) # Tricky part in watch is that we might have one item in jobfilter (job, test), # but it might spawn multiple nodes with same name @@ -130,7 +132,6 @@ def watch_jobs(baseurl, token, treeid, jobfilter, test): for node in nodes: if node["name"] == test: test_result = node["result"] - break if node["name"] in jobfilter: result = check_node(node) if result == "DONE": @@ -144,7 +145,8 @@ def watch_jobs(baseurl, token, treeid, jobfilter, test): if isinstance(joblist, list) and node["name"] in joblist: joblist.remove(node["name"]) color = "red" - if test: + # if test is same as job, dont indicate infra-failure if test job fail + if test and test != node["name"]: # if we have a test, and prior job failed, we should indicate that click.secho( f"Job {node['name']} failed, test can't be executed", @@ -168,11 +170,12 @@ def watch_jobs(baseurl, token, treeid, jobfilter, test): if not test_result and time.time() - jobs_done_ts < 60: continue - if test_result == "pass": + if test_result and test_result == "pass": click.secho(f"Test {test} passed", fg="green") sys.exit(0) - else: - click.secho(f"Test {test} failed", fg="red") + elif test_result: + # ignore null, that means result not ready yet + click.secho(f"Test {test} failed: {test_result}", fg="red") sys.exit(1) click.echo(f"\rRefresh in 30s...", nl=False)