Commit Hash Error doing PR Analysis and Decoration - Bitbucket Cloud

We are getting an error trying to do PR Analysis on our system. The error in Sonar says “Failed to create Bitbucket Cloud Quality Report for commit SHA ‘’”.

Sonarqube version: 8.9.0.43852 Enterprise
Scanner version: 4.6.2.2472
Repository: Bitbucket Cloud/Git

Our build system is Jenkins pipelines. We self host Jenkins and Sonarqube in Azure; and use Bitbucket cloud.

We cannot get the PR to decorate with errors, along with this error. Also, it looks like the response to the webhook from Sonar is correct, but our build for an intentionally failed PR (to test) won’t fail. This same test worked for our older 7.6 community version with the PR analysis plugin, and also on our current test system with newer 8.9 Sonar.

See error attached. Thank you!

image

Hi,

Welcome to the community!

Are you analyzing the PR as checked out, or as it would be post-merge? I.e. are you doing a local merge commit? If so, that commit won’t exist in the DevOps Platform & so SonarQube won’t be able to decorate it.

 
Ann

Hi,

Thank you! We are looking into your suggestion now. We found a possible related issue on the Jenkins boards as well. https://issues.jenkins.io/browse/JENKINS-62783

Bil

1 Like

The problem was found, it was the Jenkins Pipeline build job which was breaking, using an incorrect git hash. The Jenkins pipeline makes multiple repository pulls and overwrites some of the environment variables being used.

Sonar was working fine as it should.

A key document found for this insight was this: Commit Id for Jenkins Change Request Builds

Also, noted that for Sonar 8.9 there is a parameter “sonar.scm.revision” for “Overrides the revision, for instance the Git sha1, displayed in analysis results. By default value is provided by the CI environment or guessed by the checked-out sources” that could be helpful. In this project’s scenario the environment variables were reassigned to correct ones.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.