Here is my problematic in the context of SonarQube cloud :
I have X regular Github repositories, and on SonarQube side, each of them are configured in order to be incrementally fed with Sonar scanner, I.E. running commande `mvn -f ./pom.xml sonar:sonar …`, whenever our CI run
We’ve decided to merge those X repositories into one of them, to eventually have a mono repo
On SonarQube cloud side, is it possible to change the configuration of the selected host repository in order to turn it into a mono repo one, while keeping the feeding with scanner runs from our CI ?
Is there any documentation that could explain that ?
What are the primary results you want out of a monorepo construction in SonarQube?
To adjust to the new structure, you don’t need to explicitly convert them to a monorepo construction inside Sonarqube. Here’s some steps you can follow:
In the new monorepo CI pipeline, add a Maven scan job per component, pointing projectBaseDir at the right subdirectory
Each job uses the same sonar.projectKey as the original project
Analysis keeps flowing to the existing SonarCloud projects keeping history intact
No SonarCloud reconfiguration required
With this approach history of the projects is kept intact.
However, one benefit of a monorepo construction in SonarQube is the ability to post the PR status check to Github using the unique context string [Project Name] SonarCloud Code Analysis rather than the generic SonarCloud Code Analysis. Without a monorepo construction GitHub treats that as a single status, each component’s analysis overwrites the previous one. Only the last scanner job to finish shows up on the PR.
If you need that functionality, you would need to go through this process:
Go through the monorepo wizard pointing at the new monorepo repo
The one existing SonarCloud project already bound to that repo (if any) gets converted automatically, it keeps its history
All other components must be created as new projects and they start fresh with no history
Update CI to use the new project keys per component
This gets the monorepo UI grouping and proper per-component PR quality gates, but sacrifices history on all but one project.