Bitbucket PR no coverage values from SonarCloud

Template for a good new topic, formatted with Markdown:

  • ALM used : Bitbucket
  • CI system used : Jenkins
  • Scanner command used when applicable (private details masked)
mvn -B sonar:sonar -Dsonar.projectKey=gohbf-backend -Dsonar.organization=teamhbf -Dsonar.login=$SONARCLOUD_APIKEY$BRANCH_NAME
  • Languages of the repository : Java
  • Only if the SonarCloud project is public, the URL
    • And if you need help with pull request decoration, then the URL to the PR too
  • Error observed (wrap logs/code around with triple quotes ``` for proper formatting)
  • Steps to reproduce
  • Potential workaround

Here’s how we do things today:

  1. We have one Bitbucket repo named X which contains a top-level Maven module. Inside X are 6 other Maven modules, call them a…f.
  2. When a X code change is pushed to a branch for PR, 6 builds are kicked off, each via a Jenkinsfile (Jenkins pipeline build).
  3. Each of the above builds reports separately to SonarCloud, one per module.

I believe that the disconnect is that Bitbucket in a PR wants SonarCloud numbers on a per repo basis, but we’re generating 6 different numbers that do not roll up to the repository level. Ideally, if I change only module, say c, only a c build would be kicked off, and only c numbers would be reported back to Bitbucket for display on the PR.

Should we be building (always) the entire repo in a Jenkins pipeline (rather than 6), or can we cause Bitbucket to trigger one of the 6 submodule builds specific to the change? It seems that Bitbucket only wants to integrate with Jenkins at the whole repo level, not at the submodule level. Same with SonarCloud.



Having multiple analysis per repository is currently not supported.

Yes. You should have one build pipeline, one sonarcloud analysis per repository. Then the widget will show the data for all the code changes in the PR.

Note that support for multiple analysis per repo is already available for Github and Azure dev ops. The support for Bitbucket Cloud is on our roadmap. It should be available in the coming months.


Thank you … this confirms what I was seeing.

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