Cannot edit long-lived branches pattern

Template for a good new topic, formatted with Markdown:

  • ALM used: Azure DevOps
  • CI system used: Azure DevOps

We’ve just set up Sonar Cloud with Azure DevOps. I’ve imported our repositories into Sonar Cloud and run Azure pipeline for main- and develop branches. Some repositories have develop set as their default branch. When I go to project’s Branches -view in SonarCloud I can see that master -branch is set as short-lived branch. I also cannot edit long-lived branches pattern, since there is no pencil icon. How can I set both develop and master/main to be long-lived branches? Preferably at organization level if possible.

Hi,

Welcome to the community!

You’ll need to talk to a project admin about either making this change or granting you permissions.

For projects with the wrong main branch, and for branches with the wrong type (short-lived vs long-lived), this is not resettable. You’ll need to delete the projects / branches in question and re-analyze.

Per the docs

The first analysis [of a project] is always a main branch analysis (an analysis of the default branch of your repository, usually called main or master ).

Note that if this is just a question of branch naming, it is possible to rename a branch.

 
HTH,
Ann

Hi Ann,

Thanks! Permission issue was solved, but I’m still a little unsure how that long-lived branch should be edited. I removed project from Sonar Cloud, imported it again from Azure DevOps, and ran analysis on develop -branch which is the default for this project. Develop shows as long-lived branch just fine since it’s the default branch. At this point I edited long-lived branch section and added master -branch in the list. After that, I ran analysis on master branch. Sonar Cloud still shows master branch as short-lived. What am I doing wrong?

Regards,

:janne

Hi janne,

Can you provide a screenshot of your long-lived branch setting, as well as one of your master branch, showing the exact branch name?

 
Thx,
Ann

Hi Ann,

Now that you asked, I realized that my long-lived branch filter wasn’t correct. After changing that to (release|develop|master|main), master is also displayed as long-lived branch. Is there a way to set this default for the whole organization? I couldn’t find a place to do that.

Regards,

:janne

Hi :janne,

Unfortunately, that’s project-by-project, but it makes a lot of sense to me to have an org-level default, so I’ll make sure the Product Managers see the request.

 
Ann

Thanks Ann!

Hey @Janne_Rantala

We recently launched SonarCloud Enterprise, which includes support for organizaiton-wide config like configuring a long-lived branch pattern!