SonarQube 7.2 - branches not working (at all)

Hello everyone,

in our Company we have the following issue with our SonarQube Server.
We used to run SonarQube in Version 6.2 Community Edition. We then updated to v6.7.5 without issues and then to v7.2 again without any re
ported issues during the update processes. We then activated our trial-license for the Developer Edition.

Until now we were unable to get the branching feature in our Projects to work. We tried a few things. And as far as we have seen, the database (MySql) only creates master-branches altough we correctly send the branch-name to the server. We tried it on existing projects as well as on newly created project instances.

Thanks in advance for any help or recommendations

Hi

Could you elaborate on that? Specifically what did you try (specific analysis parameters would be helpful) and what were the results (i.e. show us your analysis logs)?

 
Ann

Hey Ann,
Our sonar.properties are the default values
We use maven in our projects to push the files to our server. We used the <sonar.branch.name> property and followed the branch settings as described here (https://docs.sonarqube.org/display/SONAR/Branch+Analysis).

Please find attached, the snippet from our pom.xml and the log from “mvn sonar:sonar”, that the server got from the execution. Please note that I replaced the company-related information as well as my machines information with a “*” where necessary.

If you need any additional information please let us know.

Thanks Simon

mvn_log.txt (10.3 KB)
sonar_pomxml.txt (818 Bytes)

Additionally here is the context, the server got after the exection (as I found it under “Background Tasks” in the Project directory)

sonar_context.txt (5.4 KB)

Hi,

I see this in your context:

- sonar.branch.name=feature/init
- sonar.branch.target=feature/init

You seem to have misunderstood the use of sonar.branch.target. The docs say:

Name of the branch where you intend to merge your short-lived branch at the end of its life. If left blank, this defaults to the master branch…

Since you probably don’t intend to merge this branch into itself, you should either not provide sonar.branch.target and let it default to master, or provide the name of some other long-lived branch.

 
HTH,
Ann

Hi.
Thanks for the reply. That was definately a mistake. But i did try that just once. Did try it without the target, with devlop as target and even with master set as target explicitly. None of them worked. Still only get my master branch to show in the overview.

Hi,

You’re going to have to give us some specifics (e.g. the exact analysis command) before we can help you.

 
Ann

Attached is the output from running sonar-scanner. Hope this is what you need.

Thank you for your patience.

sonar-scanner.txt (5.7 KB)

Hi,

I was looking for your analysis command, not your analysis log. Nonetheless, I’ve just taken a look at the pom properties you sent earlier, and I see that you’re setting branch and target in the pom. Could you try a run where they’re removed from the pom, and instead included in the analysis command line. Then from that run send us

  • the analysis command line (e.g. mvn sonar:sonar -Dsonar.branch.name...)
  • the analysis log

 
Ann

Hi
Removed the branch-stuff from the pom.xml and added it to the maven command line.

mvn sonar:sonar -Dsonar.log.level=DEBUG -Dsonar.branch.name=feature/init -Dsonar.verbose=true -B > analysis.txt

analysis.txt (11.3 KB)

Hi,

I spun up my 7.2 DE instance and tried this, first analyzing master, and then mvn sonar:sonar -Dsonar.branch.name=feature/init, and it worked for me:

Selection_117

And then I went back to your very first post and noticed this for the first time (emphasis added):

So… I need to verify: you’re taking as evidence that branch analysis isn’t working what you see in the database? Because you should treat the DB like an impenetrable black box.

 
Ann

Hi,

no we just checked the database as branching did not work for us. The thing is, that when we try analyzing the sonar-branches and go to the project dashboar, there is no dropdown-menu that allows us to choose the branches that were analyzed, but rather the “+”-icon that opens the popup containing information on how to add branches.
That is why we think that the branch analysis is not working. As we unfortunately have no way of switching to other branches.

Simon

Hi Simon,

Is the analysis date on your master/main project dashboard updated when you attempt to analyze a branch? Have you checked your background tasks?

 
Ann

Hi Ann,
the analysis date is updated as I can see in the upper right corner of the dashboard. Also checked the background tasks and they exist.

Simon

Hi Simon,

Let’s back up. When you go to Administration > Marketplace does it say “You are currently running a Developer Edition” in the top-left?

 
Ann

Hi Ann,

yes Marketplace shows me that we are running Developer Edition.

Simon

Hi @simontischler,

Would you mind running a branch analysis, using Maven or sonar-scanner, and adding command line parameter -Dsonar.scanner.dumpToFile=sonar.properties. This will dump all configured properties in this file.

Then could you please remove sensitive data (like values of sonar.login / sonar.password) and share it with us?

To me the problem is on scanner side. If branch configuration was correctly enabled/configured, you should see in logs:

Branch name: feature/init, type: SHORT

Hi Julien,

I just ran maven with the option you provided and there is no branch name or anything branch related in the log files. But please see for yourself in the attached properties-file.

Thanks Simon
sonar.properties.txt (37.6 KB)

How have you passed the branch configuration? Setting sonar.branch.name property in the root pom.xml or on the command line?

Sry, forgot that I have commented out the line in our root pom.xml file (from trying to pass the branch argument via the command line), after adding that to the scan the sonar.properties file now has a line
sonar.branch.name=feature/init
But no type:SHORT or something like that