1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-14 11:03:09 +02:00

Merge remote-tracking branch 'github/master' into HEAD

This commit is contained in:
Marcus Holl 2020-01-07 12:35:28 +01:00
commit 4578336180
3 changed files with 9 additions and 5 deletions

View File

@ -522,7 +522,7 @@ steps:
toJson: false
toHtml: false
sonarExecuteScan:
dockerImage: 'maven:3.5-jdk-8'
dockerImage: 'node:8-stretch'
instance: 'SonarCloud'
options: []
pullRequestProvider: 'GitHub'

View File

@ -69,7 +69,7 @@ class SonarExecuteScanTest extends BasePiperTest {
// asserts
assertThat('Sonar instance is not set to the default value', sonarInstance, is('SonarCloud'))
assertThat('Sonar project version is not set to the default value', jscr.shell, hasItem(containsString('sonar-scanner -Dsonar.projectVersion=1')))
assertThat('Docker image is not set to the default value', jedr.dockerParams.dockerImage, is('maven:3.5-jdk-8'))
assertThat('Docker image is not set to the default value', jedr.dockerParams.dockerImage, is('node:8-stretch'))
assertJobStatusSuccess()
}
@ -247,7 +247,7 @@ class SonarExecuteScanTest extends BasePiperTest {
// asserts
assertThat(jscr.shell, allOf(
hasItem(containsString('wget --directory-prefix .certificates/ --no-verbose http://url.to/my.cert')),
hasItem(containsString('keytool -import -noprompt -storepass changeit -keystore .sonar-scanner/jre/lib/security/cacerts -alias \'my.cert\' -file \'.certificates/my.cert\''))
hasItem(containsString('keytool -import -noprompt -storepass changeit -keystore .certificates/cacerts -alias \'my.cert\' -file \'.certificates/my.cert\''))
))
assertJobStatusSuccess()
}

View File

@ -119,13 +119,17 @@ void call(Map parameters = [:]) {
if(configuration.options instanceof String)
configuration.options = [].plus(configuration.options)
loadCertificates(configuration)
def worker = { config ->
try {
withSonarQubeEnv(config.instance) {
loadSonarScanner(config)
loadCertificates(config)
if(fileExists('.certificates/cacerts')){
sh 'mv .certificates/cacerts .sonar-scanner/jre/lib/security/cacerts'
}
if(config.organization) config.options.add("sonar.organization=${config.organization}")
if(config.projectVersion) config.options.add("sonar.projectVersion=${config.projectVersion}")
@ -222,7 +226,7 @@ private void loadCertificates(Map config) {
'-import',
'-noprompt',
'-storepass changeit',
'-keystore .sonar-scanner/jre/lib/security/cacerts'
"-keystore ${certificateFolder}cacerts"
]
if (config.customTlsCertificateLinks){
if(config.verbose){