SonarQube Developer Edition not detecting all branches

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension) SonarQube Developer Edition 9.8.0.63668
  • what are you trying to achieve Branch analysis
  • what have you tried so far to achieve this Integrated with Azure Devops pipeline, created a project in Sonarqube and use the project key in Maven Build
    Only main branch is detected in sonarqube, not other branches.
    My sonar.property file is almost blank, haven’t configured anything. Could you please advice how to get all branches in Sonarqube?
    Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!

Hey there.

Is there a build running on your branches where the SonarQube tasks have been configured?

This typically means making sure you’ve added a build validation branch policy on the target branch.

  • If so, please attach logs from a pipeline run on a branch
  • It might also be useful to include the Azure DevOps Pipeline YAML in your reply.

Actually I have 2 branches, main and dev. My Main branch is detected in SonarQube and its working fine. But dev branch is not detected, should i add sonar.branch.name to get dev branch?

Hey there.

I wouldn’t reccomend adding sonar.branch.name. Can you add the details requested in my last reply?

Hello @colin,

Sorry for the late response. Please find the Pipeline yaml and log files.

When i use sonar.branch.name, My pull request are failing. Basically I want to do analaysis for my DEV and MAIN branch
logs_1161.zip (36.2 KB)

This seems like your issue!

trigger:
  branches:
    include:
    - none

If you want to trigger the pipeline on main and dev, you want a trigger more like this:

# specific branch build
trigger:
  branches:
    include:
    - main
    - dev

No need to worry about sonar.branch.name – the SonarQube Extension for Azure DevOps should handle that for you.

Noted on this. It’s working fine for me thanks.

1 Like