Sonar branches are not deleted

Managing inactive branches at a project level

You can set a branch to Keep when inactive at the project level from the Branches tab at Project Settings > Branches and Pull Requests. Here, you can also turn off protection for a branch so it will be deleted when it’s inactive for the number of days that have been specified in the global settings at Administration > General Settings > Housekeeping > Number of days before deleting inactive branches.

this functionality is not working for our projects in Sonarqube 9.9, there are so many branches more than 6 months and they are not protected, but still those branches are not getting deleted automatically.

can anyone help us on this issue

Hey there.

The trigger to clean up old branches is that the project gets analyzed. Has the project been analyzed within the last six monhts?

yes @Colin The project is being analyzed, but still old branches not getting deleted

Thanks. Can you share a screenshot showing as much (branches that have both been analyzed recently and very old unprotected branches that have not been cleaned up).

Hi @Colin

I am attaching a screenshot of few branches which are not protected and there are lot many projects older than 3 months

For this project, I don’t see anything wrong yet. The oldest analysis is 1 month old and the last analysis 5 days ago. It’s possible that the analysis only reached 1 month old in the last 5 days. Any other examples?

Have you also confirmed the setting here has the expected value (default 30)?

Yes @Colin There are few more example projects, i am adding you the screenshot for your reference

Yes, i can also confirm the setting that has expected the value 30 days and attaching the screenshot of the same

Thanks.

It looks like there’s no recent analysis (and most analyses were performed before SonarQube 9.9 LTS was even released!)

If you run a new analysis on this project, what happens? Are the branches cleaned up?

Did you upgrade from a previous version of SonarQube to this one, and if so what was your upgrade path?