Hey there, I’m new to SonarCloud and a little confused/frustrated by the branch recognition features.
I don’t think my use case is unusual - in fact, I’ve seen it in 3-5 other posts. I want to analyze main (my default branch), develop, and any release branches. This allows me to run SonarCloud scans as I merge features into develop, create releases, etc. The corresponding regex pattern would be (main|develop|release).*
I saw in another post that “Once a branch is created, its type cannot change [ . . . ] the develop
branch already existed as a short-living branch before you set the pattern. The only way to make develop
a long-living branch is by deleting it, and then running a new analysis.”
First of all, I don’t see any clear way to trigger running a new analysis from SonarCloud. It seems to be based entirely on webhooks from GitHub (my source control provider).
I saw in yet another post a similar explanation that “I think issue is that SonarQube project was created after Develop branch existed, and thus updating the RegEx does not have an impact on its status as long-lived, unfortunately.”
So, I tried to work with the recommendations above. I deleted the SonarCloud project entirely, I deleted the develop branch from my repo entirely, and I recreated the project. Before I created the develop branch again, I set the long-living branch pattern to (main|develop|release).*
which I tested with regex to ensure it would work.
As can be seen below, the branch was not detected when I created it nor when I added a commit with a few changes.
I also can’t see the develop branch in this drop down.
My honest feedback is that this is frustrating and unacceptable behavior of the software. I can’t find a reasonable explanation as to why I shouldn’t be able to alter the long-living branches after the fact other than “sorry, that’s not how it works”. I’ve now got a handful of bogus PR’s and bogus commits in my repo due to trying to resolve this issue. I also don’t understand why I can’t see any of my “short-lived” branches such as develop to be able to run scans on them.
Any support would be much appreciated.