SonarQube Community with azure pipeline

Hello, Good afternoon

I testing the version community with the Azure Pipeline and when exec the Build I Get the error. I know that sonarqube developer edition it work because feature have ‘Branch analises’.
In Community edition exist any solution to execute analise in CI? In my case I have three pipelines, DEV, HOMOLOG, PROD.

Thanks,

Hi @altamirdiascassiano

Not sure to have 100% understood your question, but, as a summary :

SonarQube Community : Azure pipelines will work on master branch only
SonarQube Developer : Azure pipelines will work on master branches, other branches and for PR decoration
SonarCloud : Work like the SQ Developer edition.

Does that answer your question ?

Thanks.
Mickaël

Hi Mickaël,

Thanks for answear.

I my case I need undestand if sonarqube community can analise another branch.For exemplo I need analise the branch Homologation, and then analise Branch Production, but using only a project.

thanks

No you can’t with the Community Edition.

Mickaël

Mickaël, thank very much.

i am trying with community edition, but it throws “To use the property “sonar.branch.name” and analyze branches, Developer Edition or above is required”, i am not even assigning that property.

==============================================================================
/home/vsts/work/_tasks/SonarQubeAnalyze_6d01813a-9589-4b15-8491-8164aeb38055/4.11.0/sonar-scanner/bin/sonar-scanner --from=ScannerAzureDevOps/4.11.0
INFO: Scanner configuration file: /home/vsts/work/_tasks/SonarQubeAnalyze_6d01813a-9589-4b15-8491-8164aeb38055/4.11.0/sonar-scanner/conf/sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarScanner 4.4.0.2170
INFO: Java 11.0.8 AdoptOpenJDK (64-bit)
INFO: Linux 5.3.0-1034-azure amd64
INFO: User cache: /home/vsts/.sonar/cache
INFO: Scanner configuration file: /home/vsts/work/_tasks/SonarQubeAnalyze_6d01813a-9589-4b15-8491-8164aeb38055/4.11.0/sonar-scanner/conf/sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: Analyzing on SonarQube server 7.9.1
INFO: Default locale: "en", source code encoding: "UTF-8"
INFO: Load global settings
INFO: Load global settings (done) | time=351ms
INFO: Server id: FCFBD87A-AWwawC3bOmqzgPdlu3EJ
INFO: User cache: /home/vsts/.sonar/cache
INFO: Load/download plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=308ms
INFO: Load/download plugins (done) | time=25903ms
INFO: Process project properties
INFO: Execute project builders
INFO: Execute project builders (done) | time=3ms
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 38.736s
INFO: Final Memory: 8M/34M
INFO: ------------------------------------------------------------------------
##[error]ERROR: Error during SonarScanner 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: Error during SonarScanner 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]The process '/home/vsts/work/_tasks/SonarQubeAnalyze_6d01813a-9589-4b15-8491-8164aeb38055/4.11.0/sonar-scanner/bin/sonar-scanner' failed with exit code 2
Finishing: SonarQubeAnalyze

this is my pipeline config

  - task: SonarQubePrepare@4
    inputs:
      SonarQube: 'sonar-dev'
      scannerMode: 'CLI'
      configMode: 'manual'
      cliProjectKey: 'asd'
      cliProjectName: 'proy-name'
      cliProjectVersion: '$(node -p "require(''./package'').version")-$(Build.SourceBranchName)'
      cliSources: '.'
      extraProperties: |
        # Info required for Sonar 
        sonar.sources=src
        sonar.language=typescript
        sonar.sourceEncoding=UTF-8
        
        sonar.typescript.tsconfigPath=tsconfig.json
        # Variables
        sonar.projectDate=$(Date:yyyyMMdd)
        sonar.analysis.revision=$(Rev:.r)
        sonar.analysis.branch=$(Build.SourceBranchName)
        sonar.analysis.buildid=$(Build.BuildId)

        # Repository info
        sonar.links.homepage=https://dev.azure.com/org/proy/_git/repo
  - task: SonarQubeAnalyze@4
  - task: SonarQubePublish@4
    inputs:
      pollingTimeoutSec: '600'

here it says that property is automatically assigned, how can i remove it?

https://docs.sonarqube.org/latest/analysis/scan/sonarscanner-for-azure-devops/

Branches

When a build is run on a branch of your project, the extension automatically configures the analysis to be pushed to the relevant project branch in SonarQube. The same build definition can apply to all your branches, whatever type of Git repository you are analyzing,

if it is not possible to remove this property, the only option is to use with a Sonar Docker container, rigth?