pegasus/scripts/report_quality_gate.sh
codex 5fbc6d0d5c
All checks were successful
Tests / Declarative: Post Actions passed: 155
ci: keep quality report handling in its own script
2026-10-04 08:42:35 -05:00

47 lines
966 B
Bash
Executable File

#!/bin/sh
# Generate a gate report, including an explicit failure if tooling cannot start.
set -eu
mkdir -p build
set +e
apt-get update
apt_rc=$?
if [ "${apt_rc}" -eq 0 ]; then
apt-get install -y --no-install-recommends golang-go nodejs npm
apt_rc=$?
fi
if [ "${apt_rc}" -eq 0 ]; then
python -m testing.pegasus_gate report
gate_rc=$?
else
gate_rc="${apt_rc}"
fi
set -e
if [ ! -f build/gate-summary.json ]; then
python3 - <<'PY'
import json
from pathlib import Path
Path("build/gate-summary.json").write_text(
json.dumps(
{
"ok": False,
"issues": [
{
"check": "gate_glue",
"path": "Jenkinsfile",
"detail": "quality gate dependencies or report command failed before summary generation",
}
],
"file_count": 0,
"backend_coverage": {},
"frontend_coverage": {},
},
indent=2,
sort_keys=True,
)
+ "\n",
encoding="utf-8",
)
PY
fi
printf '%s\n' "${gate_rc}" > build/quality-report.rc