ci(pegasus): keep Jenkinsfile under LOC gate
This commit is contained in:
parent
1a6397fca6
commit
fe83ebca09
19
Jenkinsfile
vendored
19
Jenkinsfile
vendored
@ -64,18 +64,15 @@ spec:
|
||||
disableConcurrentBuilds()
|
||||
buildDiscarder(logRotator(daysToKeepStr: '30', numToKeepStr: '200', artifactDaysToKeepStr: '30', artifactNumToKeepStr: '120'))
|
||||
}
|
||||
|
||||
triggers {
|
||||
pollSCM('H/5 * * * *')
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Checkout') {
|
||||
steps {
|
||||
checkout scm
|
||||
}
|
||||
}
|
||||
|
||||
stage('Collect SonarQube evidence') {
|
||||
steps {
|
||||
container('quality-tools') {
|
||||
@ -110,7 +107,6 @@ import json
|
||||
import os
|
||||
import urllib.parse
|
||||
import urllib.request
|
||||
|
||||
host = os.getenv('SONARQUBE_HOST_URL', '').strip().rstrip('/')
|
||||
project_key = os.getenv('SONARQUBE_PROJECT_KEY', '').strip()
|
||||
token = os.getenv('SONARQUBE_TOKEN', '').strip()
|
||||
@ -135,7 +131,6 @@ PY
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Collect Supply Chain evidence') {
|
||||
steps {
|
||||
container('quality-tools') {
|
||||
@ -174,7 +169,6 @@ EOF
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
report_path = Path(os.getenv('QUALITY_GATE_IRONBANK_REPORT', 'build/ironbank-compliance.json'))
|
||||
if report_path.exists():
|
||||
raise SystemExit(0)
|
||||
@ -192,7 +186,6 @@ PY
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Backend unit tests') {
|
||||
steps {
|
||||
container('go-tester') {
|
||||
@ -252,7 +245,6 @@ EOF
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Frontend unit tests') {
|
||||
steps {
|
||||
container('node-tester') {
|
||||
@ -307,7 +299,6 @@ EOF
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Run quality gate') {
|
||||
steps {
|
||||
container('publisher') {
|
||||
@ -332,7 +323,6 @@ EOF
|
||||
python3 - <<'PY'
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
Path("build/gate-summary.json").write_text(
|
||||
json.dumps(
|
||||
{
|
||||
@ -361,7 +351,6 @@ PY
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Publish test metrics') {
|
||||
steps {
|
||||
container('publisher') {
|
||||
@ -372,7 +361,6 @@ PY
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Enforce quality gate') {
|
||||
steps {
|
||||
container('publisher') {
|
||||
@ -389,19 +377,16 @@ PY
|
||||
echo "quality gate failed with rc=${gate_rc}" >&2
|
||||
fail=1
|
||||
fi
|
||||
|
||||
enabled() {
|
||||
case "$(printf '%s' "${1:-}" | tr '[:upper:]' '[:lower:]')" in
|
||||
1|true|yes|on) return 0 ;;
|
||||
*) return 1 ;;
|
||||
esac
|
||||
}
|
||||
|
||||
if enabled "${QUALITY_GATE_SONARQUBE_ENFORCE:-1}"; then
|
||||
sonar_status="$(python3 - <<'PY'
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
path = Path("build/sonarqube-quality-gate.json")
|
||||
if not path.exists():
|
||||
print("missing")
|
||||
@ -423,7 +408,6 @@ PY
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
ironbank_required=0
|
||||
if enabled "${QUALITY_GATE_IRONBANK_REQUIRED:-0}"; then
|
||||
ironbank_required=1
|
||||
@ -435,7 +419,6 @@ PY
|
||||
supply_status="$(python3 - <<'PY'
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
path = Path("build/ironbank-compliance.json")
|
||||
if not path.exists():
|
||||
print("missing")
|
||||
@ -445,7 +428,6 @@ try:
|
||||
except Exception: # noqa: BLE001
|
||||
print("error")
|
||||
raise SystemExit(0)
|
||||
|
||||
status = payload.get("status")
|
||||
if isinstance(status, str) and status.strip():
|
||||
print(status.strip().lower())
|
||||
@ -472,7 +454,6 @@ PY
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if [ "${fail}" -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user