Short lived branches are not deleted in the Cloud version

Hi

According to docs https://docs.sonarqube.org/latest/branches/branches-faq/ the short-lived branches should be deleted after 30 days. Unfortunately, it does not work (for me) - on my way too long list of short-lived branches there are positions annotated as “2 months ago”. I suspect it could be a bug.

Is ther a way to delete all short-lived branches at once?

The doc says that the branch TTL can be changed in “Configuration -> General -> Number of days before purging inactive short living branches” - I cannot find such option in the cloud version :frowning: are there dfferences between standard (on-premise) and cloud version?

2 Likes

Hi,

I suspect the stale short-lived branches that are not getting deleted are not targeting the default branch of the project. Is that correct? Please confirm.

We’ve discovered a bug: the housekeeping job that deletes stale branches only affects branches depending on the default branch of the project. https://jira.sonarsource.com/browse/SONAR-11439

I’m not aware of an easy way to bulk-delete stale branches. You can delete branches one by one using the UI, or using the Web API /api/project_branches/delete, possibly in combination with /api/project_branches/list to get a list of branch names filtered by type and analysis date.

Yes, it describes my case.
Thank you for investigating this issue.

Hello,

What about the question
==> is there any dfference between SonarQube and SonarCloud regarding the branch TTL configuration as I cannot find such option in SonarCloud?
As per SonarCloud documentation: Short-lived branches are deleted automatically after 30 days with no analysis. This can be updated in Configuration > General > Number of days before purging inactive short living branches . Source: https://sonarcloud.io/documentation/branches/branches-faq/

any updates on this topic?

@janos This is still an issue, I keep having to go in and manualy clear out branches. The option to purge inactive branches in general setting just isnt there.

Any updates?

Still happening…
Are Sonar people aware of this?

We are very much aware. I don’t have a ticket number or a specific timeline, but based on related discussions, I think there’s a very good chance we will address this in the coming months. I will keep this thread posted when we have more news.

2 Likes

Thank you Janos!

thanks @janos waiting for your update here