I add SonarQube extension to my build chain CICD on my azure devops and connect to a SonarQube server (community version 7.9), then I execute my CICD for an angular project (develop branch).
I got an error as below:
> ERROR: Error during SonarQube Scanner execution
> ERROR: Validation of project reactor failed:
> o To use the property "sonar.branch.name" and analyze branches, Developer Edition or above is required. See https://redirect.sonarsource.com/doc/branches.html for more information.
> ERROR:
> ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.
> /home/vsts/work/_tasks/SonarQubeAnalyze_6d01813a-9589-4b15-8491-8164aeb38055/4.6.3/sonar-scanner/bin/sonar-scanner failed with return code: 1
it is not us trying to use the commercial feature, it is the VSTS (azure-Devops) task automatically adds sonar.branch.name and I havenât found a way to remove/disable adding sonar.branch.name
The SonarQube Scanner did not complete successfully
14:10:14.201 Post-processing failed. Exit code: 1
The process âD:\Agents\A1_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.8.0\classic-sonar-scanner-msbuild\SonarScanner.MSBuild.exeâ failed with exit code 1
For anyone using Azure Pipelines and running into this issue, you can also work around by running sonar from the command line, or create your own Build Task: Create a Custom Build Task.
Here are simple cmd tasks for your pipelines:
- task: CmdLine@2
displayName: 'Install Sonar Tools and Start Scanner'
inputs:
script: |
echo Installing sonarScanner tool
dotnet tool install --global dotnet-sonarscanner
echo Start Scanner
dotnet-sonarscanner begin /k:"CreditCards" /d:sonar.host.url="https://YourSonarWebsite.com" /d:sonar.login="Token00000000000000000000000000000000000"
##
## Do The Build
##
- task: CmdLine@2
displayName: 'Collect Sonar results and Upload'
inputs:
script: |
echo Run Sonar End
dotnet-sonarscanner end /d:sonar.login="Token00000000000000000000000000000000000"
Glad my comment was helpful. I used the cmd line sonar execution as a stop gap while I looked into the community plugin mentioned above. I did get the plugin approved and installed. It has been working almost without issue. (I had to purge the elastic search cache shortly after activating.)
I would recommend getting the community plugin if you can, having branch analysis and using the out of the box build tasks will be better in the long term.
Can you please elaborate on the issue you are facing?
The support for branches is available in the Developer Edition.
You should be able to analyze your main branch with the Community Edition. The only constraint I know is that the branch you analyze should be the âdefaultâ branch.
Thanks Chris for responding. We are using SVN for source control where our java code is kept. the java code is build through gradle. We are using sonarqube community edition in azure devops pipeline to analyze the codebase .
I am getting the error as below.
[Error: To use the property âsonar.branch.nameâ and analyze branches you need sonar developer edition.
I am not sure how do we determine the main branch in svn?
Main âbranchâ on SVN is the trunk (this is provided with the Build.SourceBranch environment variable, from the agent). Any other branch cannot be analyzed.