I need to properly integrate Sonar Qube into my Azure DevOps pipeline, but I get an error with the community version. How is it possible for the following pipeline to work in this version? I get an error of:
##[error]ERROR: Error during SonarScanner execution
Unfortunately, since several years, it is no longer possible to analyse more than the main branch with community edition. Neither branch nor PR analysis are supported in community edition. Analysis of feature branches, maintenance branches, and pull requests is part of commercial developer edition.
A work around for branch analyses of very small projects would be to set up a separate SonarQube project for each branch. You would need to define a new sonar.key for each branch - e.g. projectname.branchname. IMHO not a real solution for any more than a playground.
Thanks for the reply.
I did that test of creating a project in my local instance of SonarQube and placed that key in the pipeline but I still had the same error. How should that section of the pipeline be? In my case I placed the following:
inputs:
SonarQube: ‘SonarQubeConnection’
scannerMode: ‘MSBuild’
projectKey: ‘crm’
projectName: ‘CRM’
extraProperties: |
sonar.projectVersion=$(Build.BuildId)
sonar.sourceEncoding=UTF-8
sonar.cs.opencover.reportsPaths=/coverage.opencover.xml
sonar.coverage.exclusions=/Migrations/**
sonar.branch.name=$(Build.SourceBranchName)
Even if I never did it myself, I would give it a try with
`projectKey: "crm_$(Build.SourceBranchName)"
and you need to remove the property sonar.branch.name. Hopefully, your branch is then recogniced as default branch (as it is the first branch in the SonarQube project) and analyzed.