We’ve covered this multiple times. Here’s one excerpt, emphasis added:
It seems you want develop to act as the primary branch in the project currently under consideration. The rules are the same:
Analyze develop without passing a sonar.branch.name parameter. Since branch names are picked up automatically by the integrations, you may need to run this first analysis manually.
Via the SonarQube Cloud UI, rename the main branch to develop
Analyze as normal. Further analyses of the sonar.branch.name=develop branch will land in the project’s primary branch
I assume you’re asking here about which branch the PR is compared to? If so, it’s largely a question of making sure the prerequisites are in place.
This particular question was about a brand new project. From trial and error we have created the following process, but its still not perfect.
First we edit the bitbucket main branch setting to develop. This has to be done before anything else.
we add the repo into sonar cloud.
We add the two required sonar properties in the pom.xml of the parent and add the bitbucket pipeline yml with “master” replaced with “develop” via PR. (pipeline yml comes from the sonar “wizard”
When we push the PR, it results in an analysis.
When we merge the PR, it results in another analysis
Lastly we checkout develop branch locally, and run the mvn sonar command locally (sing the parameters given in the “wizard”
We have had some unpredictable results.
For some projects, the PR doesnt show up in the list of PRs in sonar.io, but the develop branch does not, some times its the other way round. usually, we delete the project from sonar, and try again, but we have not come up with a reliable set of steps.
Tomorrow ill review the projects we have to try to spot a pattern.