Azure DevOps task version 5 fails for sonar.branch.name

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
  • Community Edition
  • Version 10.4 (build 87286)
  • how is SonarQube deployed: zip, Docker, Helm
    Helm
  • what are you trying to achieve
    Run Sonarqube on Azure pipelines
  • what have you tried so far to achieve this

Added task version 5 and I get the following error. If use the task 4 it doesnt fail. We’re using the community version for now to test, is there a way to disable this? As I understand this feature is available on developer edition and above? Can you confirm?

Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!

##[error]ERROR: Error during SonarScanner execution

ERROR: Error during SonarScanner execution

##[error]ERROR: Validation of project failed:

o To use the property “sonar.branch.name” and analyze branches, Developer Edition or above is required. See Branch analysis for more information.

ERROR: Validation of project failed:

o To use the property “sonar.branch.name” and analyze branches, Developer Edition or above is required. See Branch analysis for more information.

Hi Melina, welcome to the community.

May I ask what language your are analyzing and the scanner setting in the extension (Standalone, MSBuild, Gradle/Maven)

Generally speaking, Community edition does not support branch or PR analysis. You can do that starting from Developer edition.

Followup questions:
Are you analyzing your main branch? What is its name? What is the main branch setting on SonarQube?

Denis

We’re using standalone.

Are you analyzing your main branch?

on PR branch

What is its name?

a branch that I created

What is the main branch setting on SonarQube?

the main branch on Sonarqube is set to main. But I cant seem to change it. Also each time I run the pipeline the results are submitted.

Thank you for your answers.

As stated above, PR and Branch analysis will only work on Developers edition and above.

My only guess is that the default behavior of the Azure DevOps extension changed in v5 compared to v4, triggering the error message when using it in a PR context.

That being said, if you need to evaluate PR analysis, you will need to move to a paid edition (regardless of extension task version).

Denis

Denis, thank you for your prompt reply.