Run SonarCloud analysis in multi-job Azure DevOps pipeline

  • ALM used: Azure DevOps
  • CI system used: Azure DevOps
  • Languages of the repository: .NET

Hi everyone,
I have a setup with a large .NET project inside Azure DevOps which is split into multiple jobs within one pipeline, e.g. one build job and a few test jobs. This was done to parallelize and speed up the pipeline as we have multiple self-hosted agents. I’ve already had SonarCloud running successfully in a “standard” pipeline like described in the SonarCloud docs.
I see that this is currently not really supported by SonarCloud so I’m trying to make it work on my own. There seem to be other people asking for support regarding this topic with a rather unsatisfactory answer, e.g. Azure Pipelines with multiple jobs splitting up build/test and sonarqube analysis.

Is there any update on this topic in 2023?
I’ve tried several things including moving the whole agent working directory with the source code and build results to the last job where the SonarCloud analysis should happen but SonarCloud always complains that no preparation was done and fails.
Knowing what SonarCloud expects to find when it starts the analysis would help me implement this but it’s hard to find this information in the documentation.

Best regards,
Markus

Hello @Novac

Please take a look at the setup of the azure pipeline we use to build sonar-dotnet.

You can see that we do something “similar”.
We run the SonarCloudPrepare task after that we build the solution and before calling SonarCloudAnalyze we download the artifacts from the test executions that were run separately before the SonarCloudAnalyze.

If I understand what you want to achieve you could do something similar.

All the best,
Čaba

Hello @Novac

Did you manage to solve your problem with the suggestion I made?

All the best,
Čaba

Hi Čaba,

sorry for the late reply, I was on vacation :slight_smile:
I’ll try your suggestion next week!

Best regards,
Markus