From 16922846065584cb7180e9568fcac23cd1042e43 Mon Sep 17 00:00:00 2001 From: codex Date: Tue, 21 Apr 2026 22:09:05 -0300 Subject: [PATCH] ci(ananke): run sonar and supply-chain scans --- Jenkinsfile | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index c609b62..54c9fe6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -24,6 +24,13 @@ spec: volumeMounts: - name: workspace-volume mountPath: /home/jenkins/agent + - name: quality-tools + image: registry.bstein.dev/bstein/quality-tools:sonar8.0.1-trivy0.70.0-arm64 + command: ["cat"] + tty: true + volumeMounts: + - name: workspace-volume + mountPath: /home/jenkins/agent volumes: - name: workspace-volume emptyDir: {} @@ -62,6 +69,27 @@ spec: stage('Collect SonarQube evidence') { steps { + container('quality-tools') { + sh '''#!/usr/bin/env bash + set -euo pipefail + mkdir -p build + args=( + "-Dsonar.host.url=${SONARQUBE_HOST_URL}" + "-Dsonar.token=${SONARQUBE_TOKEN}" + "-Dsonar.projectKey=${SONARQUBE_PROJECT_KEY}" + "-Dsonar.projectName=${SONARQUBE_PROJECT_KEY}" + "-Dsonar.sources=." + "-Dsonar.exclusions=**/.git/**,**/build/**,**/dist/**,**/node_modules/**,**/.venv/**,**/__pycache__/**,**/coverage/**,**/test-results/**,**/playwright-report/**" + "-Dsonar.test.inclusions=**/tests/**,**/testing/**,**/*_test.go,**/*.test.ts,**/*.test.tsx,**/*.spec.ts,**/*.spec.tsx" + ) + [ -f build/coverage.out ] && args+=("-Dsonar.go.coverage.reportPaths=build/coverage.out") + set +e + sonar-scanner "${args[@]}" | tee build/sonar-scanner.log + rc=${PIPESTATUS[0]} + set -e + printf '%s\n' "${rc}" > build/sonarqube-analysis.rc + ''' + } container('publisher') { sh ''' set -eu @@ -100,6 +128,34 @@ PY stage('Collect Supply Chain evidence') { steps { + container('quality-tools') { + sh '''#!/usr/bin/env bash + set -euo pipefail + mkdir -p build + set +e + trivy fs --no-progress --format json --output build/trivy-fs.json --scanners vuln,secret,misconfig --severity HIGH,CRITICAL . + trivy_rc=$? + set -e + if [ ! -s build/trivy-fs.json ]; then + cat > build/ironbank-compliance.json < build/ironbank-compliance.json + ''' + } container('publisher') { sh ''' set -eu