From 0cbd9127d97a69bfc88ab6863949ee0d78a88bf2 Mon Sep 17 00:00:00 2001 From: codex Date: Sat, 16 May 2026 02:20:39 -0300 Subject: [PATCH] ci: include service coverage in sonar gate --- Jenkinsfile | 2 +- scripts/publish_quality_metrics.py | 2 +- scripts/publish_quality_metrics_test.py | 9 ++++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index b73abab..9adbcfa 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -112,7 +112,7 @@ spec: config_rc=$? ( cd testing - go test ./execx ./metrics ./hygiene ./orchestrator ./state ./sshutil ./ups -coverpkg=scm.bstein.dev/bstein/ananke/... -coverprofile=../build/sonar-testing.cover.out + go test ./execx ./metrics ./hygiene ./orchestrator ./service ./state ./sshutil ./ups -coverpkg=scm.bstein.dev/bstein/ananke/... -coverprofile=../build/sonar-testing.cover.out ) testing_rc=$? set -e diff --git a/scripts/publish_quality_metrics.py b/scripts/publish_quality_metrics.py index 0a12309..760e62d 100755 --- a/scripts/publish_quality_metrics.py +++ b/scripts/publish_quality_metrics.py @@ -14,7 +14,7 @@ import urllib.error import urllib.request -DEFAULT_PUSHGATEWAY_URL = "http://platform-quality-gateway.monitoring.svc.cluster.local:9091" +DEFAULT_PUSHGATEWAY_URL = "http://platform-quality-gateway.monitoring.svc.cluster.local:9091" # NOSONAR: in-cluster Pushgateway is HTTP-only. SOURCE_SCAN_ROOTS = ("cmd", "internal", "scripts", "testing") SOURCE_EXTENSIONS = {".go", ".py", ".sh"} QUALITY_SUCCESS_STATES = {"ok", "pass", "passed", "success", "compliant"} diff --git a/scripts/publish_quality_metrics_test.py b/scripts/publish_quality_metrics_test.py index dd17cc7..d7aba38 100755 --- a/scripts/publish_quality_metrics_test.py +++ b/scripts/publish_quality_metrics_test.py @@ -62,15 +62,18 @@ class PublishQualityMetricsTest(unittest.TestCase): self.thread.join(timeout=5) def test_relative_artifact_paths_are_repo_rooted(self) -> None: - repo_root = Path("/tmp/ananke-repo") + tmp_dir = tempfile.TemporaryDirectory() + self.addCleanup(tmp_dir.cleanup) + repo_root = Path(tmp_dir.name) / "ananke-repo" + absolute_coverage_path = Path(tmp_dir.name) / "coverage-percent.txt" self.assertEqual( publisher._resolve_repo_path(repo_root, "build/coverage-percent.txt"), repo_root / "build" / "coverage-percent.txt", ) self.assertEqual( - publisher._resolve_repo_path(repo_root, "/tmp/coverage-percent.txt"), - Path("/tmp/coverage-percent.txt"), + publisher._resolve_repo_path(repo_root, str(absolute_coverage_path)), + absolute_coverage_path, ) def _env_for_gate_status(self, status: int = 0) -> dict[str, str]: