Integrating Azure DevOps Pipelines

Hi everyone.

I’m in the process of integrating Azure DevOps 2019 with SonarQube 7.7 Comunity Edition. I have used the Sonar Docker version, and I have deployed it in AKS (Azure Kubernetes). The applications in which I’m going to use it are Maven.

When doing a test from my laptop, the process works and the results are published in Sonarqube, but when I try to do it from Azure DevOps, using the Plugin provided for it, I get the following error:

Is a Developer version or higher required? Or I can use the Comunity Edition version

18:00:37.0139801Z [INFO] --- sonar-maven-plugin:3.6.0.1398:sonar (default-cli) @ elastic-customer-lookup ---
18:00:37.8242416Z [INFO] SonarQube version: 7.7.0
18:00:37.9719022Z [INFO] Default locale: "en_US", source code encoding: "windows-1252" (analysis is platform dependent)
18:00:39.0327599Z [INFO] Load global settings
18:00:39.3014969Z [INFO] Load global settings (done) | time=250ms
18:00:39.3015519Z [INFO] Server id: 655688BF-AWpvckwdaTFP-bLeBRU_
18:00:39.3832977Z [INFO] User cache: C:\Users\VssAdministrator\.sonar\cache
18:00:39.3833890Z [INFO] Load/download plugins
18:00:39.3834108Z [INFO] Load plugins index
18:00:39.6389995Z [INFO] Load plugins index (done) | time=250ms
18:00:45.0334756Z [INFO] Load/download plugins (done) | time=5650ms
18:00:45.7099271Z [INFO] Process project properties
18:00:45.7175373Z [INFO] Execute project builders
18:00:45.7404101Z [INFO] Execute project builders (done) | time=15ms
18:00:45.7625539Z [INFO] ------------------------------------------------------------------------
18:00:45.7629691Z [INFO] BUILD FAILURE
18:00:45.7629988Z [INFO] ------------------------------------------------------------------------
18:00:45.7630165Z [INFO] Total time:  01:49 min
18:00:45.7630567Z [INFO] Finished at: 18:00:45Z
18:00:45.7630719Z [INFO] ------------------------------------------------------------------------
18:00:45.7639895Z [ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.6.0.1398:sonar (default-cli) on project elastic-customer-lookup: Validation of project reactor failed:
18:00:45.7652913Z [ERROR]   o To use the property "sonar.branch.name", the branch plugin is required but not installed. See the documentation of branch support: https://redirect.sonarsource.com/doc/branches.html.
18:00:45.7653374Z [ERROR] -> [Help 1]
18:00:45.7655381Z [ERROR] 
18:00:45.7657531Z [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
18:00:45.7658654Z [ERROR] Re-run Maven using the -X switch to enable full debug logging.
18:00:45.7661417Z [ERROR] 
18:00:45.7662574Z [ERROR] For more information about the errors and possible solutions, please read the following articles:
18:00:45.7662981Z [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
18:00:45.8339139Z C:\ProgramData\chocolatey\lib\maven\apache-maven-3.6.0\bin\mvn.cmd failed with return code: 1
18:00:45.8340229Z Could not retrieve code analysis results - Maven run failed.
18:00:46.0088938Z No test result files matching d:\a\1\s\**\target\site\jacoco\jacoco.xml were found, so publishing JUnit test results is being skipped.
18:00:46.0102132Z [command]C:\windows\system32\cmd.exe /D /S /C "C:\ProgramData\chocolatey\lib\maven\apache-maven-3.6.0\bin\mvn.cmd -f d:\a\1\s\elastic-customer-lookup\pom.xml --settings elastic-customer-lookup/settings.xml verify"

Hi,

I believe branch name is being passed automatically, which is causing the analysis failure. That should be fixed in 7.8.

 
Ann

Hi.

Which component is passing the name of the branch. The Sonarquebe de Azure plugin, the Maven plugin, or does the Sonarqube server require it? Because when I run the process without using Azure Devops it works.

Regards,

Yup. That’s the part that’s passing it. :roll_eyes:

What do you think I could do or try to solve the problem?

I’m seeing the same issue using the Azure DevOps plugin with SonarQube 7.7.0 attempting to analyze .NET Core and .NET MVC projects, using the “master” branch.

@ganncamp you mentioned it should be fixed in version 7.8 but do you have an expected release date or intermediate workaround? I see on the “SonarQube Roadmap” that “SonarQube v7.9 is the next LTS version with a planned release early July.” but no mention of a 7.8 release. Thanks!

Hi @Daniel_Brown. In my case, I uninstalled the Sonar plugin from the Azure DevOps, and Im executing the sonar analysis directly from maven . In that case, that works

@ganncamp any updates on this?

I’ve updated our SonarQube server to 7.8.0.26217 but the Azure DevOps extension has not been updated since May. I get a different error now, stating that “To use the property “sonar.branch.name” and analyze branches, Developer Edition or above is required.” I am aware that in the community edition, you are limited to one branch – which is fine but I’m getting that error on the master branch.

It seems that the Azure DevOps extension is still passing the “sonar.branch.name” parameter automatically, and the server isn’t handling the fact even though the parameter is being sent, it’s the master branch that should be permitted.

Hi,

Could you please check that master is the default branch of your repo ?

In the ‘Repos’ -> ‘Branches’ menu on the left pane, master should have a ‘default’ tag.

my-branches

Thanks.

Mickaël