File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,11 @@ node ("docker-light") {
99 }
1010 stage("Maven Build") {
1111 withSonarQubeEnv {
12+ mySonarOpts="-Dsonar.login=${env.SONAR_AUTH_TOKEN} -Dsonar.host.url=${env.SONAR_HOST_URL}"
13+ if ("${env.CHANGE_BRANCH}") {
14+ mySonarOpts="$mySonarOpts -Dsonar.pullrequest.key=${env.CHANGE_ID} -Dsonar.pullrequest.base=${env.CHANGE_TARGET} -Dsonar.pullrequest.branch=${env.CHANGE_BRANCH}"
15+ }
16+ echo("Sonar Options are: $mySonarOpts")
1217 sh "docker run --rm \
1318 --pull always \
1419 --volume ${sourceDir}:/source \
@@ -17,12 +22,7 @@ node ("docker-light") {
1722 bash -c \"apt-get update && \
1823 apt-get install -y git && \
1924 pushd /source && \
20- export MY_SONAR_OPTS=\"-Dsonar.login=${env.SONAR_AUTH_TOKEN} -Dsonar.host.url=${env.SONAR_HOST_URL}\" \
21- if [[ ! -z ${env.CHANGE_BRANCH} ]]; then \
22- MY_SONAR_OPTS+=-Dsonar.pullrequest.key=${env.CHANGE_ID} -Dsonar.pullrequest.base=${env.CHANGE_TARGET} -Dsonar.pullrequest.branch=${env.CHANGE_BRANCH} \
23- fi \
24- echo \"Sonar Options are: ${env.MY_SONAR_OPTS}\" \
25- /opt/maven-basis/bin/mvn --batch-mode clean install sonar:sonar ${MY_SONAR_OPTS}\""
25+ /opt/maven-basis/bin/mvn --batch-mode clean install sonar:sonar $mySonarOpts\""
2626 }
2727 }
2828 slack(true)
You can’t perform that action at this time.
0 commit comments