...
Use this Jenkinsfile
for inspiration:
Note |
---|
Only Branch Analysis is working: Due to missing feature https://issues.jenkins.io/browse/JENKINS-66581 pull request analysis is currently not possible |
Code Block | ||
---|---|---|
| ||
pipeline { agent any environment { scannerHome = tool name: 'scanner', type: 'hudson.plugins.sonar.SonarRunnerInstallation' } stages { stage('branch analysis') { when { not { changeRequest() } } steps { withSonarQubeEnv('sonar-cloud') { sh "${scannerHome}/bin/sonar-scanner -Dsonar.branch.name=${env.BRANCH_NAME}" } } } // NOT WORKING: https://issues.jenkins.io/browse/JENKINS-66581 stage('PR analysis') { when { changeRequest() } steps { withSonarQubeEnv('sonar-cloud') { sh "${scannerHome}/bin/sonar-scanner \ -Dsonar.pullrequest.key=${env.CHANGE_ID} \ -Dsonar.pullrequest.base=${env.CHANGE_TARGET} \ -Dsonar.pullrequest.branch=${env.CHANGE_BRANCH}" } } } } } |
...