Skip to content

Commit

Permalink
[JENKINSFILE] use scanner home
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinab25 authored Apr 13, 2022
1 parent aa9a21b commit ed60311
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ pipeline {
not { buildingTag() }
}
tools {
tool 'SonarQubeScanner'
jdk 'Java11'
}
steps {
script {
def scannerHome = tool 'SonarQubeScanner';
withSonarQubeEnv('Sonarqube') {
sh "sonar-scanner -Dsonar.sources=src/main/java/ -Dsonar.test.exclusions=**/src/test/** -Dsonar.coverage.exclusions=**/src/test/** -Dsonar.java.checkstyle.reportPaths=target/checkstyle-result.xml -Dsonar.java.pmd.reportPaths=target/pmd.xml -Dsonar.coverage.jacoco.xmlReportPaths=target/site/jacoco/jacoco.xml -Dsonar.java.spotbugs.reportPaths=target/spotbugsXml.xml -Dsonar.host.url=${SONAR_HOST_URL} -Dsonar.login=${SONAR_AUTH_TOKEN} -Dsonar.java.binaries=target/classes -Dsonar.projectKey=${GIT_NAME}-${BRANCH_NAME} -Dsonar.projectName=${GIT_NAME}-${BRANCH_NAME}"
sh "export PATH=$PATH:${scannerHome}/bin; sonar-scanner -Dsonar.sources=src/main/java/ -Dsonar.test.exclusions=**/src/test/** -Dsonar.coverage.exclusions=**/src/test/** -Dsonar.java.checkstyle.reportPaths=target/checkstyle-result.xml -Dsonar.java.pmd.reportPaths=target/pmd.xml -Dsonar.coverage.jacoco.xmlReportPaths=target/site/jacoco/jacoco.xml -Dsonar.java.spotbugs.reportPaths=target/spotbugsXml.xml -Dsonar.host.url=${SONAR_HOST_URL} -Dsonar.login=${SONAR_AUTH_TOKEN} -Dsonar.java.binaries=target/classes -Dsonar.projectKey=${GIT_NAME}-${BRANCH_NAME} -Dsonar.projectName=${GIT_NAME}-${BRANCH_NAME}"
sh '''try=2; while [ \$try -gt 0 ]; do curl -s -XPOST -u "${SONAR_AUTH_TOKEN}:" "${SONAR_HOST_URL}api/project_tags/set?project=${GIT_NAME}-${BRANCH_NAME}&tags=${SONARQUBE_TAGS},${BRANCH_NAME}" > set_tags_result; if [ \$(grep -ic error set_tags_result ) -eq 0 ]; then try=0; else cat set_tags_result; echo "... Will retry"; sleep 60; try=\$(( \$try - 1 )); fi; done'''
}
}
Expand Down

0 comments on commit ed60311

Please sign in to comment.