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.host.url=https://sonar-ias.company.net \
              -Dsonar.login=${settings.SONAR_TOKEN} \
              -Dsonar.javascript.lcov.reportPaths=coverage/webapp/lcov.info \
              -Dsonar.pullrequest.bitbucketserver.serverUrl=https://bitbucket.atlassian.company.com \
              -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=${WEBHOOK_SETTINGS.pullRequest.id} \
              -Dsonar.pullrequest.branch=${WEBHOOK_SETTINGS.pullRequest.fromRef.id.split("/")[-1]} \
              -Dsonar.pullrequest.base=${WEBHOOK_SETTINGS.pullRequest.toRef.id.split("/")[-1]}

This is what I get on SonarQube

Capture

And this is what i get on Bitbucket

Untitled

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.

EDIT:
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?