We are using SonarQube Enterprise Edition version 10.1. Our SonarQube scans are integrated into our Azure DevOps build definitions. Since moving to SonarQube version 10.1, all branch scans are showing up in the main branch scan results in SonarQube. In Azure DevOps, we have a branch named 2309RTM and in the build definition we specify the name of the branch. However, when the SonarQube scan runs on that branch the results show up in the main branch results in SonarQube. If we run a scan on the main branch in Azure DevOps, the results are correctly displayed in the main branch results in SonarQube. The problem is that main branch results in SonarQube are overwritten by other branches - in this case 2309RTM. We can correct this by adding the sonar.branch.name=$(Build.SourceBranchName) parameter to the SonarQube step in Azure DevOps. However, this was not an issue in SonarQube version 10.0. SonarQube should automatically detect the branch name and publish the results to the correct branch analysis in SonarQube since we are using Azure Pipelines.
Hey there.
Thanks for the report. This is the first one we’ve had of a problem like this. Are you using the tasks provided by the Extension for Azure DevOps?
Yes, we are using the SonarQube extension for Azure DevOps, published by SonarSource. It is the latest version, 5.15.0.
Thanks.
This should actually not be necessary at all, as the branch name is derived from within the build pipeline. The code is here:
Can you try to print out the value of $(Build.SourceBranchName)
in your pipeline to make sure it’s set to the value you expect for the 2039RTM branch?
Hi, any news regarding this issue ? We have the same problem since we upgraded to version 10.5.
It was working fine before without setting any variable and it stopped working after update.
(Azure DevOps Server 2020)
Problem fixed by updating SonarQube Azure DevOps extensions to V5
Present Sonarqube version => 10.0.6 We are also facing the same issue , but we are using Jenkins
How to fix it for Jenkins