1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-10-30 23:57:50 +02:00

fix(sonar): archive result file via handleStepResults (#4227)

* Update sonarExecuteScan.groovy

* Update sonarExecuteScan.go
This commit is contained in:
Christopher Fenner
2023-02-22 12:28:17 +01:00
committed by GitHub
parent 1e242a7fd6
commit 31ee45ad30
2 changed files with 8 additions and 2 deletions

View File

@@ -195,6 +195,13 @@ func runSonar(config sonarExecuteScanOptions, client piperhttp.Downloader, runne
log.Entry().WithError(err).Warning("no scan report found")
return nil
}
// write reports JSON
reports := []piperutils.Path{
{
Target: "sonarscan.json",
Mandatory: false,
},
}
// write links JSON
links := []piperutils.Path{
{
@@ -202,7 +209,7 @@ func runSonar(config sonarExecuteScanOptions, client piperhttp.Downloader, runne
Name: "Sonar Web UI",
},
}
piperutils.PersistReportsAndLinks("sonarExecuteScan", sonar.workingDir, utils, nil, links)
piperutils.PersistReportsAndLinks("sonarExecuteScan", sonar.workingDir, utils, reports, links)
if len(config.Token) == 0 {
log.Entry().Warn("no measurements are fetched due to missing credentials")

View File

@@ -70,7 +70,6 @@ void call(Map parameters = [:]) {
withSonarQubeEnv(stepConfig.instance) {
echo "Instance is deprecated - please use serverUrl parameter to set URL to the Sonar backend."
sh "${piperGoPath} ${STEP_NAME}${customDefaultConfig}${customConfigArg}"
archiveArtifacts artifacts: "sonarscan.json", allowEmptyArchive: true
jenkinsUtils.handleStepResults(STEP_NAME, false, false)
readPipelineEnv(script: script, piperGoPath: piperGoPath)
}