I know that there is no "new project" button on SonarQube UI. However, I have two branches of the same project that I want to do analysis on. The thing is that since the project names are the same, SonarQube will upload the analysis results of the two branches into the same project on SonarQube Server. How do I configure SonarQube so that one branch will upload analysis results to one project and the other branch will upload results to another project on SonarQube server?
Branch analysis is available as part of Developer Edition and more. Branch analysis allows you to: analyze long-lived branches. analyze short-lived branches. notify external systems when the status of a short-lived branch is impacted.
You must simply analyze the branch that you want to be your main without any sonar.branch.name parameter. This creates by default in SonarQube a branch named master.
On your project, go to Administration / Branches & Pull Requests. There, you will see in the top-right corner a text like this: "Long living branches pattern: (branch|release)-. * ". That means that when the name of the branch starts with branch- or release- , then it will be considered a long-living branch.
You might want to look at this part of the Sonar documentation, specifically at the sonar.branch parameter. It seems to be designed for what you want to do, and is working that way for us.
As the sonar.branch parameter is deprecated and the Developer Edition costs money, one possible option it to use the already mentioned branch plugin for SonarQube Community Edition (LGPL).
Update: seems like the repo is gone, not sure why. Active fork can be found here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With