Change of the default main branch breaks branch analysis settings

One important wish from my side which made problems on upgrade from 9.7 to 9.8

Please DO NOT change the default main branch name from master to main on the upgrade path!
Especially not on LTS upgrade.
This breaks all existing configured branch analysis settings, e.g. sonar.dbcleaner.branchesToKeepWhenInactive

Hi @reitzmichnicht ,

Can you please elaborate on your problem? I noticed that the “main” branch is not automatically added to the list of “branches to keep when inactive” but I guess this is not really the problem you are facing

The default main branch name was changed in 9.8 and is supposed to impact only newly created projects. Also, this value can be changed under Administration > General > Default main branch name and can be chosen for each project individually in the UI during project creation.

Chris

Hi Christophe,

we did the upgrade from 9.7 to 9.8 without realizing that this default setting changed. So any new created project in Sonarqube had the wrong main branch setting.
I understand that you change this setting for new installations, but for existing installations I expect that the update does not touch important settings that need to stay as they existed. Its not a major issue because you can change it back after the update, but still annoying and somehow unexpected behavior.

So for 9.8 its already to late, but for LTS release I would expect that you get much complaints for this behavior.

Kind regards,
Michael

1 Like

Hi @reitzmichnicht ,

Thank you for your feedback.
Regarding the property sonar.dbcleaner.branchesToKeepWhenInactive, even though it does not contains main as the default value (we will fix that to be aligned with the other values), I don’t see how it breaks the existing branch analysis settings since main branches of projects cannot be purged.

So with new projects having a main branch named main, even if it is missing from sonar.dbcleaner.branchesToKeepWhenInactive, it will not be purged automatically

Could you explain the issue you faced with the usage of sonar.dbcleaner.branchesToKeepWhenInactive when you migrated to 9.8?

Its not an issue with the dbcleaner setting itself. But I would have assumed that any branch that is not listed there will be deleted after some inactive time. So without manual intervention by fixing the name of the master branch, all analysis would be lost after some inactive time.