Hey devs, I hope find you well.
I have a doubt about master branch. Actually, I’m using DevOps integration with Github Actions.
The documentation session, Branch analysis, tell me:
“ Adding projects by DevOps Platform copies the main branch name in SonarQube from the main branch name in your repository. See DevOps Platform Integrations in the documentation navigation for more information on adding your project from an DevOps Platform.”"
but every time that I do an analysis in a new project, my result is the branch master as main. That behave is correct?
In SonarQube v9.9 LTS, you can adjust the default main branch name to main by adjusting sonar.projectCreation.mainBranchName under the global Administration > General > Project Creation.
This will really help us a lot, but how do I fix the old projects where the main branch is master? Will I need to delete one by one and rename master to main? Or is there a bulk possibility?
You can rename a branch in existing projects if you are a project administrator by going to Project Settings > Branches and Pull Requests and using the gear icon next to the branch name. Unfortunately, you will have to do this one by one, and delete any existing branch named main.
Hopefully the ability to select a new main branch is coming in one of the next few SonarQube releases.
Thanks Colin.
I came up with an alternative by creating an automated shell script using the SonarQube Api to delete the main branch and rename the master branch to main. That alternative will help me till the ability to select a new main branch is available.