Use SonarQube plugin with sonarcloud.io

Hi,

At our team, we are using OnPremise Azure DevOps server 2019 which has configured a build pipeline that uses SonarQube extension to analyze the code against sonarcloud.io.

Until recently this worker fine, the analysis was done during pull requests, uploaded to sonarcloud.io and the comments were displayed in the pull request.

As I understood from other issues raised here, there were changes in the sonar.organization and now it is required to be sent as a parameter when preparing the sonar qube analysis.

The problem is that I can’t get the SonarQube plugin to pass the organization parameter. And I can’t use the dedicated SonarCloud plugin, because our Azure DevOps server is OnPremise.

What I managed to do, is use the SonarScanner.MSBuild.exe in our build pipeline via command-line tasks (begin task before the actual MSBuild and end task after the MSBuild), supply all the necessary parameters and successfully do the analysis, which was uploaded to sonarcloud.io.

The problem with using the SonarScanner.MSBuild.exe is that I can’t figure out how to publish the analysis results (code smells, bugs, etc…) in the pull request.

So please advise on one of the following:

  1. How to make the SonarQube extension for OnPremise AzureDevops work with sonarcloud.io?
  2. Or how to publish the results of the analysis as pull request comments, when using SonarScanner.MSBuild.exe via command-line tasks during a build?

Thanks.

Hi @ild and welcome to the community !

I’m afraid but this kind of scenario is not supported, even if it worked in the past.

You have to use Azure DevOps Service along with SonarCloud, or if you want to stay on AzDo Server, then you need to use it with SonarQube.

HTH,
Mickaël

Hi @mickaelcaro and thanks for the response.

What about the second case I wrote. I managed to get it work with SonarSource.MSBuild.exe (executed as command-line tasks within the build pipeline for the pull request) which does the analysis correctly and publishes the results to sonarcloud.io.

I just can’t figure out how to publish those results as comments to the pull request with SonarSource.MSBuild.exe

Any info about that?

Thanks.