fix: the pipeline summary says what does not fail

check_buildbot does not fail the run, yet the summary printed it FAILED right above Pipeline COMPLETE. It now prints WARN and a line saying the difference does not fail the run. The total is aligned under the step durations.
This commit is contained in:
Abdessamad Derraz committed 2026-10-20 04:44:30 +02:00
1 parent eaa40d7384
commit 50790a2988
2 files changed
+40 -1

No files matched your search

+13 -1
View File
@@ -83,6 +83,10 @@ class StepResults(dict):
super().__setitem__(step, outcome)
# Steps that report without failing the run.
NON_BLOCKING = frozenset({"check_buildbot"})
def run(cmd: list[str], label: str) -> tuple[bool, str]:
"""Run a command, echoing its output as it comes. Returns (success, output).
@@ -784,15 +788,23 @@ def main() -> None:
# Summary
total_elapsed = time.monotonic() - total_start
print(f"\n{'=' * 60}")
warned = []
for step, outcome in results.items():
if outcome is SKIPPED:
print(f" {step:.<40} SKIPPED")
continue
label = "OK" if outcome else "FAILED"
if not outcome and step in NON_BLOCKING:
# Printed FAILED right above "Pipeline COMPLETE", it read as a
# contradiction: the step reports, it does not stop the run.
label = "WARN"
warned.append(step)
print(f" {step:.<40} {label:<7}{results.seconds[step]:>8.1f}s")
print(f" {'total':.<40} {total_elapsed:.1f}s")
print(f" {'total':.<40} {'':<7}{total_elapsed:>8.1f}s")
print(f"{'=' * 60}")
print(f" Pipeline {'COMPLETE' if all_ok else 'FINISHED WITH ERRORS'}")
if warned:
print(f" {', '.join(warned)} reported a difference, which does not fail the run")
print(f"{'=' * 60}")
held.close()
sys.exit(0 if all_ok else 1)
+27
View File
@@ -5526,5 +5526,32 @@ class AScraperThatCannotStartSaysWhy(unittest.TestCase):
self.assertNotIn("GITHUB_TOKEN", err)
class AStepThatCannotFailTheRunIsNotShownFailed(unittest.TestCase):
"""check_buildbot leaves all_ok alone, and the summary printed it FAILED
right above "Pipeline COMPLETE". The total also missed the duration
column by fourteen characters."""
def test_every_step_outside_all_ok_is_declared_non_blocking(self):
import pipeline
lines = (ROOT / "scripts" / "pipeline.py").read_text(encoding="utf-8").splitlines()
loose = set()
for number, line in enumerate(lines):
found = re.search(r'results\["(\w+)"\] = ok$', line.strip())
if not found:
continue
after = " ".join(lines[number + 1:number + 4])
if "all_ok" not in after and "sys.exit" not in after:
loose.add(found.group(1))
self.assertEqual(loose, set(pipeline.NON_BLOCKING))
def test_the_total_sits_under_the_durations(self):
step = f" {'x':.<40} {'OK':<7}{1.0:>8.1f}s"
total = f" {'total':.<40} {'':<7}{12.5:>8.1f}s"
self.assertEqual(len(step), len(total))
self.assertIn("{'':<7}{total_elapsed:>8.1f}s",
(ROOT / "scripts" / "pipeline.py").read_text(encoding="utf-8"))
if __name__ == "__main__":
unittest.main()