ci: collect sonar coverage in go container

This commit is contained in:
codex 2026-05-15 14:28:44 -03:00
parent c84bb14771
commit 2affec9bbd

16
Jenkinsfile vendored
View File

@ -97,14 +97,22 @@ spec:
stage('Collect SonarQube evidence') { stage('Collect SonarQube evidence') {
steps { steps {
container('quality-tools') { container('go-tester') {
sh '''#!/usr/bin/env bash sh '''#!/usr/bin/env bash
set -euo pipefail set -euo pipefail
mkdir -p build mkdir -p build
export GOFLAGS='-buildvcs=false' export GOFLAGS='-buildvcs=false'
if [ ! -s build/coverage.out ]; then set +e
go test ./... -coverprofile=build/coverage.out go test ./... -coverprofile=build/coverage.out
fi coverage_rc=$?
set -e
printf '%s\n' "${coverage_rc}" > build/sonarqube-coverage.rc
'''
}
container('quality-tools') {
sh '''#!/usr/bin/env bash
set -euo pipefail
mkdir -p build
args=( args=(
"-Dsonar.host.url=${SONARQUBE_HOST_URL}" "-Dsonar.host.url=${SONARQUBE_HOST_URL}"
"-Dsonar.login=${SONARQUBE_TOKEN}" "-Dsonar.login=${SONARQUBE_TOKEN}"