Pull-request decoration fails when analyzing merged github code

SonarQube 8.4.2-developer from docker image. Jenkins runs build of code merged from PR to target branch, but the resulting git-hash does not match either the source branch or the target. Users will see a warning alert on the analysis page: Pull request decoration did not happen. Commit '750bab35fad3ca976425c79c945913cc08af52c9' not found in pull request '32'


This is as expected; SonarQube can’t decorate a commit/PR that doesn’t exist in the ALM.

And I’m pretty sure there are some other threads kicking around where people have dealt with the scenario.


As it turns out, configuration of our Jenkins pipelines have several variations. In one case, the PR builds the merged code; in the other case, the source branch is built. If the source branch cannot be merged to the target, Jenkins refuses to build. But the developer needs to have branches built and analyzed when they are part of a PR. However, it seems that using the setting where just the branch builds results in the target branch not getting pulled, so the alert shows a missing git ref.

I’ve also just run an analysis on a different project where the merged branch built and “decorated” successfully, and got the other alert stating “Creating an analysis summary for GitHub Pull Request has failed. Please check the permission configuration and the connectivity to GitHub.” and yet when I look at the PR conversation in GitHub, I do see: