Bitbucket Server is not Decorating PRs

I can’t seem to get the PR Decorations working on BitBucket Server. Using SonarQube Enterprise vs 8.1 and Bitbucket server vs 6.10.

              -Dsonar.projectKey=webapp \
              -Dsonar.sources=. \
              -Dsonar.login=${settings.SONAR_TOKEN} \
              -Dsonar.javascript.lcov.reportPaths=coverage/webapp/ \
              -Dsonar.pullrequest.bitbucketserver.serverUrl= \
              -Dsonar.pullrequest.bitbucketserver.project=${WEBHOOK_SETTINGS.pullRequest.fromRef.repository.project.key} \
              -Dsonar.pullrequest.bitbucketserver.repository=${WEBHOOK_SETTINGS.pullRequest.fromRef.repository.slug} \
              -Dsonar.pullrequest.bitbucketserver.headSha=${env.GIT_COMMIT} \
              -Dsonar.scm.revision=${env.GIT_COMMIT} \
              -Dsonar.pullrequest.key=${} \
              -Dsonar.pullrequest.branch=${"/")[-1]} \

This is what I get on SonarQube


And this is what i get on Bitbucket


I have tried so many things but to no avail, is there anything I am doing wrong and or missing? Any help would be greatly appreciated! If you could point me to some documentation that would help solve the problem.

I have found the problem. Sonarqube is getting the wrong headsha, it always gets the headsha of the pipeline and not the pull request … maybe this is a bug, maybe it’s me… maybe its Maybelline.

Found the answer, replace all instances of ${env.GIT_COMMIT} with the commit hash of the from branch. However this will not work if you do not have Dsonar.scm.revision equal to the commit hash of the from branch.

Hey @dannyazzawi,

What tool are you using for the actual build/analysis? Jenkins?