SonarCloud analysis in an Azure Pipelines multi-stage build

Is there a way to run SonarCloud analysis on an already built project? Our build process is split into multiple stages so that testing (unit, integration, security, etc.) can be run as parallel stages to reduce build time. I can’t get SonarCloud to work if I’m downloading the build artifacts after the fact, even if I run all the prep steps. It also can’t report unit test coverage since I’m running that in a separate stage from the build as well.

Any suggestions?

Hi @thisjustin816 and welcome to the community !

What the is language of your project ? For most of the case, we strongly encourage to run the analysis during the build itself, you will then ensure that no artifact will be published if a Quality Gate has not passed, or if the execution of the analysis has failed.

Technically speaking, SonarCloud will need all the reports (for coverage for example) to be put in a specific directory that you provide using relevant properties (sonar.*.coverage.reportPaths usually), and it will also need to find source files at the place where they have been declared.


Hi Mickael,

It’s .net and typescript. It is run during the same build. I’m just splitting it into stages.

Is there somewhere where it’s documented exactly what SonarCloud needs to find the files?