From 5fbc6d0d5c9b161c6ac52721cf6fa07d9b6b4a97 Mon Sep 17 00:00:00 2001 From: codex Date: Sun, 4 Oct 2026 08:42:35 -0500 Subject: [PATCH] ci: keep quality report handling in its own script --- Jenkinsfile | 48 ++-------------------------------- scripts/report_quality_gate.sh | 46 ++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 46 deletions(-) create mode 100755 scripts/report_quality_gate.sh diff --git a/Jenkinsfile b/Jenkinsfile index bfecff7..8e1271a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -320,52 +320,8 @@ EOF stage('Run quality gate') { steps { container('publisher') { - sh ''' - 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 - ''' + sh 'sh scripts/report_quality_gate.sh' + } } } diff --git a/scripts/report_quality_gate.sh b/scripts/report_quality_gate.sh new file mode 100755 index 0000000..0b928d8 --- /dev/null +++ b/scripts/report_quality_gate.sh @@ -0,0 +1,46 @@ +#!/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