Custom ALM project key

We are developing software using both Java and C# and we have opted for a Bitbucket GIT based monorepo in our CI process. Currently our build server (TeamCity) executes an analysis on the C# code using the dotnet CLI runner, while the SonarQube Scanner plugin for TeamCity runs the analysis on the Java code. In SonarQube we have set up a single project with ALM integration to Bitbucket and pull request decoration enabled on the project.

While the above setup works and we are able to see quality reports posted to our pull requests in BitBucket with inline decoration, only the SonarQube analysis results of either the Java analysis or the C# analysis are preserved under the project in SonarQube (whichever runs last in the build process)

To overcome this we tried splitting our SonarQube project into 2 distinct projects with the same underlying BitBucket repository and ALM integration/PR decoration. Now the analysis results from the build process are preserved for both the Java and C# scan in SonarQube. So far so good. However this has led to our current problem: There is no way to distinguish quality reports posted from the 2 distinct SonarQube projects, which are linked to the same Bitbucket project key. The end results are therefore the same; the last scan (be it Java or C#) from the build server is the only quality report available in Bitbucket post-build.

Unless we’ve missed something in the SonarQube configfuration, there doesn’t appear to be a way to tweak the settings to avoid the issue we are having. Would it therefore be possible to incorporate the following feature in the project configuration page in SonarQube?

  1. Give the user the ability to specify the ALM project key of the quality report posted to Bitbucket in the project settings dialog in SonarQube under Project → Settings → Pull Request Decoration. Currently it seems to be “hardcoded” to com.sonarsource.sonarqube
  2. Likewise give the user the option to specify the name of the Quality report posted to Bitbucket. Like SonarQube (C#) / SonarQube (Java).

Since Bitbucket can handle multiple analysis reports via it’s code-insight feature, we believe this would be enough to accomplish our goal of supporting both C# and Java analysis of our project.

Thanks!

Is anyone with more insight into the product able to tell if this it at all feasible?

BR

Hi @riverwinddk and thank you for your contribution :slight_smile:
The use case you describe is a typical monorepo setup. We will release the support of this kind of setup with Bitbucket Cloud within the next two months (it’s already available for GitHub, Azure DevOps and Bitbucket Server since version 8.7).
Basically, you will be able to link several SonarQube projects to the same repo and therefor, analysis reports will be distinct.

May I ask which edition of SonarQube you run?

Also, pure curiosity about your monorepo setup, may I ask why you made this choice? Is your company a big one (let’s assume big = 1000+ people)? Is your codebase large?

Hope to help.
Kind regards,
Christophe