Long-lived branches pattern regex doesn't work

  • ALM used GitHub
  • CI system used Github Workflow
  • Scanner command used : ./gradlew build sonarqube --info
  • Languages of the repository: Java

I cannot get the long-lived branch working for me.

For example in order to make the abc.com or any branch with name .org suffix as long-lived branch I have tried following and none works.

1 .(org|com)$
2 \.(org|com)$
3 \.(org|com)
4 abc.com

Before posting here I have also tried the possible solutions to similar problems posted on this portal including defining the regex first and the creating and pushing the branch.
No matter what I tried the branches always get listed as Short lived branches.

What I am essentially trying to achieve is to have a regex ending with
.com, .org and have branches named like abc.com, abc.org scanned as long lived branches.

Hello and Welcome to this SonarSource community forum

Could you please trying with a pattern like .*\.(com|org) ?

Please note that the long-lived branch regex will not change existing Short-lived branches into Long-lived.
The long-lived branch is created on its first analysis

I hope this helps

Eric

1 Like

Thanks Eric,

That did solve my issue.

As you might have noticed I tried regex pattern $ to suggest that the regex must end with the provided string but it didn’t work.
Is there a reference to regex pattern allowed and to validate the same?