From d750f21e802a7650947c243e74294340e93cc5cd Mon Sep 17 00:00:00 2001 From: jenkins Date: Mon, 20 Apr 2026 11:01:15 -0300 Subject: [PATCH] ci(atlasbot): discover junit/coverage artifacts robustly --- scripts/publish_test_metrics.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/scripts/publish_test_metrics.py b/scripts/publish_test_metrics.py index 445467b..86e8bab 100755 --- a/scripts/publish_test_metrics.py +++ b/scripts/publish_test_metrics.py @@ -220,6 +220,22 @@ def main() -> int: source_root = Path(os.getenv("SOURCE_ROOT", "atlasbot")) build_dir = Path(os.getenv("BUILD_DIR", "build")) + if not junit_path.exists(): + junit_candidates = sorted(build_dir.glob("junit*.xml")) + if junit_candidates: + junit_path = junit_candidates[0] + if not coverage_path.exists(): + for candidate in ( + build_dir / "coverage.json", + build_dir / "coverage-summary.json", + build_dir / "coverage" / "coverage-summary.json", + ): + if candidate.exists(): + coverage_path = candidate + break + print(f"[metrics] junit_path={junit_path} exists={junit_path.exists()}") + print(f"[metrics] coverage_path={coverage_path} exists={coverage_path.exists()}") + totals = _load_junit(junit_path) test_cases = _load_junit_cases(junit_path) coverage_pct = _load_coverage_percent(coverage_path) @@ -275,10 +291,6 @@ def main() -> int: ) + "\n" else: payload += f'platform_quality_gate_test_case_result{{suite="{suite}",test="__no_test_cases__",status="skipped"}} 1\n' - payload += "\n".join( - f'platform_quality_gate_test_case_result{{suite="{suite}",test="{_escape_label(test_name)}",status="{_escape_label(test_status)}"}} 1' - for test_name, test_status in test_cases - ) + "\n" payload += "\n".join( f'atlasbot_quality_gate_checks_total{{suite="{suite}",check="{check_name}",result="{check_status}"}} 1' for check_name, check_status in checks.items()