Can I have two long-lived branches to be monitored?

Hi all,

I know that the main branch is set asa a long-lived branch by default. However, I have a team that doesn’t use the main branch. Can I add another one to be monitored by SonarCloud. If not, can I change to a specific branch name? Let’s say the production branch

Hi!

You can set as many long-lived branches as you want. Just edit the long-lived branches pattern in your project to cover the branch names you want to set.

Default is: (branch|release)-.*

Change the regular expression to match “production” or any other branch name.

Best regards.

@acalero Would it be something like (branch|production|release)-* ?

That will match any branch starting with “branch-”, “production-” and “release-”, for instance:

branch-1.7
release-4.3
production-5.2

I suggest you to use:
(branch|production|release).*

Or even remove the branch and release option if you are not using those name conventions for any branch…

Notice that if the branch already exists as a short-lived-branch you will have to remove it.

Best regards.

1 Like

Does this work at the project level? For example, I only want special branch configuration for my project A and B. And project C has different one.

Thank you

Yes, in fact this setting on SonarCloud is only available at project level.

You must set the pattern for each project to change default behavior.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.