Sonar PR analysis and multiple branches

Must-share information (formatted with Markdown):

  • SonarQube Version 9.3 (build 51899)
  • Jenkins 2.346.2 (https://www.jenkins.io/)
  • maven-3.6.3
  • org.sonarsource.scanner.maven:sonar-maven-plugin:jar:3.9.1.2184
    We have PR analysis set up with the sonarqube as below.
    -Dsonar.pullrequest.key=${env.CHANGE_ID} -Dsonar.pullrequest.branch=${env.CHANGE_BRANCH} -Dsonar.pullrequest.base=${env.CHANGE_BASE}
    This works well, when the PRs are raised against the master branch(Main Branch).
    However, we do follow release branches for PROD. Sometimes, in regression, we have to fix an issue on the release branch, for which the PR analysis fails because the env.CHANGE_BASE in this case is a release branch and for which the base analysis was never done. I am trying to understand how should we set up PR analysis. Wonder what others do in such case?

Hey there.

What are the symptoms of the “failure” – an error? an unexpected quality gate?

:warning: Make sure you upgrade to SonarQube v9.9 LTS soon, not only to benefit from our Best LTS Ever™, but because soon we will systematically ask users to upgrade when they ask questions about earlier versions of SonarQube, which are now considered unsupported. :smiley: