ERROR: Validation of project failed o To use the property "sonar.branch.name" and analyze branches

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    ADO task “Prepare Analysis Configuration ver:5.0”
  • how is SonarQube deployed: zip, Docker, Helm
    Not sure about this because is managed by a different department, my best guess would be Docker because for other solutions Docker is the standard
  • what are you trying to achieve
    ystem-wide we were downgraded from SonarQube “Developer Edition” to “Community Edition” since then we are experiencing the error from the title of this threat, see below snippet, and more importantly is creating a failure in the SonarQube task “Run code Analysis”

##[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.

  • what have you tried so far to achieve this
    Researching on the internet found the next powershell script but there isn’t much context on how it should be implemented, see below snippet, because is it through a variable passing a “command call” for removing the usage of “sonar.branch.name” but this should be pick-up by a task from what I know by working with ADO:
$params = "$env:SONARQUBE_SCANNER_PARAMS" -replace '"sonar.branch.name":"[\w,/,-]*"\,?'
Write-Host "##vso[task.setvariable variable=SONARQUBE_SCANNER_PARAMS]$params"

When I do implement this task all the Unit-test fails, so the unit test task hangs until ADO by timeout closes the Pipeline run

Maybe should I Add this task before the “Prepare Analysis Configuration” task and afterwards pass the variable $param to the “advance” section of the Task “Prepare Analysis Configuration”? see screenshot below:

All help will be super welcome!

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

Hey there.

If you’re using Community Edition, it will only be possible to run SonarQube analysis on your default branch in Azure DevOps. Are you analyzing the default branch here?

Hi @Colin thanks for answering (desperate for help)

We are analyzing branches_0.0.0.0 and not the “main”, so with each new release we have a repo in which we add a new branch in the form of Release_1.0.0.0, then Release_1.1.0.0 and subsequently, these branches are the ones we point to analyze in sonarqube,

Question is there a way to disable “sonar.branch.name” in the Sonarqube instance configurations/settings? i.e, the instance that runs in the Server or Cluster in which is hosted

From what I have provided on this thread plus my answer, do you see any possible way to avoid having this “sonar.branch.name” error?

Wish you a great day!