ci(ananke): align metrics publisher args with current script interface

This commit is contained in:
codex 2026-04-20 08:48:06 -03:00
parent b1f3dd1d4e
commit 861c7dacd3

47
Jenkinsfile vendored
View File

@ -156,13 +156,6 @@ PY
failed_runs="$(awk -F= '$1=="failed"{print $2}' build/quality-gate.state 2>/dev/null | tail -n1)"
[ -n "${ok_runs}" ] || ok_runs=0
[ -n "${failed_runs}" ] || failed_runs=0
gate_rc="$(cat build/quality-gate.rc 2>/dev/null || echo 1)"
tests_passed=0
tests_failed=1
if [ "${gate_rc}" -eq 0 ]; then
tests_passed=1
tests_failed=0
fi
coverage_percent="$(python3 - <<'PY'
import re
from pathlib import Path
@ -173,33 +166,7 @@ values = [float(match.group(1)) for match in re.finditer(r"([0-9]+(?:\\.[0-9]+)?
print(values[-1] if values else 0.0)
PY
)"
source_lines_over_500="$(python3 - <<'PY'
from pathlib import Path
root = Path(".")
skip = {".git", ".venv", "venv", "build", "dist", "node_modules", "__pycache__", ".pytest_cache"}
suffixes = {".go", ".py", ".sh", ".json", ".yaml", ".yml"}
count = 0
for path in root.rglob("*"):
if not path.is_file():
continue
if any(part in skip for part in path.parts):
continue
if path.name != "Jenkinsfile" and path.suffix.lower() not in suffixes:
continue
try:
lines = sum(1 for _ in path.open("r", encoding="utf-8", errors="ignore"))
except OSError:
continue
if lines > 500:
count += 1
print(count)
PY
)"
check_status="failed"
if [ "${gate_rc}" -eq 0 ]; then
check_status="ok"
fi
printf '%s\n' "${coverage_percent}" > build/coverage-percent.txt
python3 scripts/publish_quality_metrics.py \
--pushgateway-url "${PUSHGATEWAY_URL}" \
--job-name platform-quality-ci \
@ -207,17 +174,7 @@ PY
--trigger jenkins \
--local-ok "${ok_runs}" \
--local-failed "${failed_runs}" \
--tests-passed "${tests_passed}" \
--tests-failed "${tests_failed}" \
--tests-error 0 \
--tests-skipped 0 \
--coverage-percent "${coverage_percent}" \
--source-lines-over-500 "${source_lines_over_500}" \
--check "tests:${check_status}" \
--check "hygiene:${check_status}" \
--check "lint:${check_status}" \
--check "coverage:${check_status}" \
--check "gate:${check_status}"
--coverage-percent-file build/coverage-percent.txt
'''
}
}