PR 7.8 Failed to create Bitbucket Server Quality Report for commit SHA

Hi,

We are using version 7.8 of sonarqube developer edition and enabled PR analysis to our local bitbucket server.
This works fine when running an analysis locally straight on the PR with the proper parameters. However the standard way we build PR’s on our CI is by merging the source branch with the target branch first and then running the build pipeline on our jenkins server. This is quite a standard way to approach building PR’s

We noticed that this causes a failure as sonarqube tries to reference a commit sha which is obviously not on the bitbucket remote server as this merge of source and target branch is done locally on the jenkins agent only.

What is your recommendation in this case ? How can we circumvent this problem ?

I noticed this thread: Commit Id for Jenkins Change Request Builds

Actually that is the problem. Now passing in -Dsonar.scm.revision=${env.GIT_COMMIT}. However GIT_COMMIT is the unexsting merge commit sha. We need that start commit.