For PR, Dsonar.pullrequest.branch How can we populate branch name dynamically

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension) : 9.2
  • what are you trying to achieve - We wanted to have PR scan and we are using Jenkins MultiBranch Pipeline and Dsonar.pullrequest.branch is not taking the branch name instead its taking PR-Number

How Jenkins can identify dynamically the PullRequest Branch name??

Current configuration

                            " -Dsonar.pullrequest.key=${jenkins.CHANGE_ID}" +
			" -Dsonar.pullrequest.branch=${jenkins.BRANCH_NAME}" +
			" -Dsonar.pullrequest.base=${jenkins.CHANGE_TARGET}" +

Logs
mvn sonar:sonar -Dsonar.pullrequest.key=3 -Dsonar.sources=src/ ‘-Dsonar.java.binaries=*’ '= -Dsonar.pullrequest.branch=PR-3 -Dsonar.pullrequest.base=release

If you look at here “Dsonar.pullrequest.branch=PR-3” and I was assuming that we should get GIT PR Branch Name instead of PR number when Jenkins Multi branch pipeline is created.

You’re probably looking for CHANGE_BRANCH

Thanks Colin. Let me try with CHANGE_BRANCH and will try it out