Skip to content

Commit 4990b2d

Browse files
authored
fix(sonar): allign groovy part of Sonar step with common piperExecuteBin (#5157)
* add some logging to Vault login * allign groovy part of the sonar step * Revert "add some logging to Vault login" This reverts commit d1738c1.
1 parent 7b7ba77 commit 4990b2d

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

vars/sonarExecuteScan.groovy

+10-8
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,19 @@ void call(Map parameters = [:]) {
6565
writePipelineEnv(script: script, piperGoPath: piperGoPath)
6666
withEnv(environment) {
6767
influxWrapper(script) {
68-
piperExecuteBin.credentialWrapper(config, credentialInfo) {
69-
if (stepConfig.instance) {
70-
withSonarQubeEnv(stepConfig.instance) {
71-
echo "Instance is deprecated - please use serverUrl parameter to set URL to the Sonar backend."
68+
try {
69+
piperExecuteBin.credentialWrapper(config, credentialInfo) {
70+
if (stepConfig.instance) {
71+
withSonarQubeEnv(stepConfig.instance) {
72+
echo "Instance is deprecated - please use serverUrl parameter to set URL to the Sonar backend."
73+
sh "${piperGoPath} ${STEP_NAME}${customDefaultConfig}${customConfigArg}"
74+
}
75+
} else {
7276
sh "${piperGoPath} ${STEP_NAME}${customDefaultConfig}${customConfigArg}"
73-
jenkinsUtils.handleStepResults(STEP_NAME, false, false)
74-
readPipelineEnv(script: script, piperGoPath: piperGoPath)
7577
}
76-
} else {
77-
sh "${piperGoPath} ${STEP_NAME}${customDefaultConfig}${customConfigArg}"
7878
}
79+
} finally {
80+
jenkinsUtils.handleStepResults(STEP_NAME, false, false)
7981
}
8082
}
8183
}

0 commit comments

Comments
 (0)