1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-12 10:55:20 +02:00

fix(sonar): remove .sonar-scanner and .certificates folder after scan (#1481)

This commit is contained in:
Christopher Fenner 2020-04-29 11:11:23 +02:00 committed by GitHub
parent dd94ba7213
commit aab3c5989f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -56,24 +56,28 @@ void call(Map parameters = [:]) {
environment.add("PIPER_changeBranch=${env.CHANGE_BRANCH}")
environment.add("PIPER_changeTarget=${env.CHANGE_TARGET }")
}
// load certificates into cacerts file
loadCertificates(customTlsCertificateLinks: stepConfig.customTlsCertificateLinks, verbose: stepConfig.verbose)
// execute step
dockerExecute(
script: script,
dockerImage: config.dockerImage,
dockerWorkspace: config.dockerWorkspace,
dockerOptions: config.dockerOptions
) {
if(!fileExists('.git')) utils.unstash('git')
withSonarQubeEnv(stepConfig.instance) {
withCredentials(credentials) {
withEnv(environment){
sh "./piper ${STEP_NAME}${customDefaultConfig}${customConfigArg}"
try {
// load certificates into cacerts file
loadCertificates(customTlsCertificateLinks: stepConfig.customTlsCertificateLinks, verbose: stepConfig.verbose)
// execute step
dockerExecute(
script: script,
dockerImage: config.dockerImage,
dockerWorkspace: config.dockerWorkspace,
dockerOptions: config.dockerOptions
) {
if(!fileExists('.git')) utils.unstash('git')
withSonarQubeEnv(stepConfig.instance) {
withCredentials(credentials) {
withEnv(environment){
sh "./piper ${STEP_NAME}${customDefaultConfig}${customConfigArg}"
}
}
}
jenkinsUtils.handleStepResults(STEP_NAME, false, false)
}
jenkinsUtils.handleStepResults(STEP_NAME, false, false)
} finally {
def ignore = sh script: 'rm -rf .sonar-scanner .certificates', returnStatus: true
}
}
}