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

chore(sonar): set proper error categories (#2358)

* expose GetExitCode

* set error category for user issues

* fix typo

* Update command.go

Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
This commit is contained in:
Christopher Fenner
2020-11-16 14:54:22 +01:00
committed by GitHub
parent 2a5514c116
commit e8c74a4867

View File

@@ -89,6 +89,10 @@ func sonarExecuteScan(config sonarExecuteScanOptions, _ *telemetry.CustomData, i
influx.step_data.fields.sonar = false
if err := runSonar(config, &client, &runner); err != nil {
if log.GetErrorCategory() == log.ErrorUndefined && runner.GetExitCode() == 2 {
// see https://github.com/SonarSource/sonar-scanner-cli/blob/adb67d645c3bcb9b46f29dea06ba082ebec9ba7a/src/main/java/org/sonarsource/scanner/cli/Exit.java#L25
log.SetErrorCategory(log.ErrorConfiguration)
}
log.Entry().WithError(err).Fatal("Execution failed")
}
influx.step_data.fields.sonar = true