Is a pipeline needed to analyze pull requests and branches in Azure DevOps?

Which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)?

  • SonarQube Enterprise Edition / Version 8.3.1 (build 34397)
  • Azure DevOps cloud

What are you trying to achieve?

  • Use SonarQube to analyze pull request in Azure DevOps
  • Use SonarQube to analyze branches in Azure DevOps

What have you tried so far to achieve this?
Today we can analyze pull requests with a Pipeline, but I would like to know if there’s a way to do it without pipelines.

Thanks!

Hi @jmsanchezcb !
By “pipeline”, you mean by using “Azure DevOps Pipeline”? If so, yes you can always trigger the analysis and the pull request decoration from the command line of your build machine. Please refer to https://docs.sonarqube.org/latest/analysis/pull-request/

Hope this helps.
Kind regards,
Christophe

Yes, by pipeline I mean Azure DevOps pipeline :).

Going back to my original question, is possible to get pull requests analyzed in Azure DevOps without using a pipeline? I ask because I dont see any reference to pipelines in the link you provided, but the only way I found to get the pull request analyzed was by adding a policy in my branch (in Azure DevOps) to tell to use a pipeline (the pipeline that has the SonarQube tasks configured obviously :slight_smile: ).

Sorry Christophe, I misread your answer. So is possible to analyze pull requests without pipelines, just need to trigger the pull request decoration from the command line.

Is an Azure DevOps pipeline required to do it following the steps from https://docs.sonarqube.org/latest/analysis/pull-request/ and https://docs.sonarqube.org/latest/analysis/pr-decoration/ ? These links dont talk about pipelines but I ended creating one to get this working, so I wonder if there’s something I am missing.
Thanks!

To understand properly : what is your use case here? Do you need to analyze your pull request with another CI tool ? What kind of project do you need to analyze?

If you don’t use an Azure Pipeline to build your project, you need to directly use the sonar scanner on your build machine and pass the needed parameters to the scanner to let SonarQube know about your pull request and decorate it.

HTH,
Christophe

Thanks for your answer. I didnt see pipelines mentioned in the documentation so was wonder if there’s a better way to do it. To me this is a useful clarification, we have a good number of apps.

Thanks!

Regarding the Pull Request Decoration, in what screen should the Analysis Parameters be configured?. See the section" Analysis Parameters" in https://docs.sonarqube.org/latest/analysis/pull-request/

To be sure i’m helpful here, please give me some context on what you’re trying to achieve :

  • What is your use case?
  • Do you need to analyze your pull request with another CI tool ?
  • What kind of project do you need to analyze?
  • What edition of SonarQube are you using?

Cheers,
Christophe