Two jobs in same build pipeline in Azure Devops publish sonar results with the same name overwriting each other

We have this project in Azure Devops: https://dev.azure.com/mirkadev/TwoSonarProblem/_build
It has one repo, that contains two projects. The projects are built individually in different jobs in the same Azure devops build pipeline.

On master branch we have build validation policy, so the build pipeline is run for each pull request.

When the build is run and we go the the build output we see both sonarcloud validations.

When we go to the branch policies to set the sonar status policy, we see only one output called projectname/codecoverage.

The sonar check in the build jobs seem to output the results with the same name and the later job to finish effectively overwrites the status of the first one.

Hi @mathiasr ,

Sorry for the late reply.

There are 2 things to distinguish here :

  • The “Extensions” tab on your build summary : This is filled by the SonarCloud Azure DevOps extension itself : when an analysis is pushed to SonarCloud, a task (Publish Quality Gate result) is polling our system in order to know if the background process of that analysis has finished or not : once done, the report is posted on this summary, as you can see on your screenshot.

  • The what we’re calling “Pull Request decoration” : this will be inside your Pull Request on Azure, and SonarCloud will post comments on your PR and post the status of the Quality Gate as a 3rd party check.

That being saiid, both projects that you have on your PR targets the same SonarCloud project ?

Thanks.
Mickaël

Hi,

The two projects inside the PR target different projects in Sonarcloud. You can see them here:
https://sonarcloud.io/dashboard?id=TwoSonarProblem-Project1
https://sonarcloud.io/dashboard?id=TwoSonarProblem-Project2

Thanks,
Mathias

Thanks.

Do those 2 projects have the “mono-repository” feature enabled ?

You can check in the Administration → General Settings → General menu