Multiple Status Checks in Azure DevOps Pull Request

We have a mono repo which links to multiple Sonar Projects. Our CI build is setup to build these as separate stages so is able to publish the Sonar Scans separately and they appear correctly in Sonar.

However in the Azure DevOps Pull Request the status check (SonarCloud/quality gate) is only set to the value of the last Scan to occur. I think this happen on the SonarCloudPublish@3 task.

I do notice that the Extensions tab is able to display both scans and says Quality Gate passed/failed (Project Name)

Would it be possible to allow this task to be configurable as to what the status check will be published as e.g. SonarCloud/custom name

This would allow for policies to be wrote for each of the projects but more importantly stop our current issue of the last one published wins.

From looking at some old posts I’ve seen the following two Jira Tickets linked to this but the links don’t appear to be accessible externally so I’m not sure if they are for the same case, MMF-2137 & MMF-2258.

Hey there.

It sounds to me like your projects aren’t configured as a monorepo. When projects are configured as a monorepo, you will get distinct status check names.

Taking a look at these docs, is this how you setup your projects?

You can also check your Project Administration > General Settings > Project Binding to see if the binding is configured a monorepo.

It’s not possible to convert existing projects to a monorepo – except for one. See this post here.

Yes this looks to be my issue, one of the projects is bound but the other isn’t.

I’ll give these docs a read and see if it’s possible to convert that.

1 Like

Yes the one already bound was luckily the one with all the history. The new one had been created by the scanning process of the new project rather than through SonarQube Cloud.

For anyone else doing this, delete the unbound project then recreate it through the Web UI by Create Project > New Mono Repo > Select the project. You will then see both projects show as bound to the Azure DevOps Project.

The Status Check is then published as SonarCloud/quality_gate_project_key

I did hit a weird cache bug it seems. So instead of delete the project i moved it sideways by changing the project key. I then created the new project as above and gave it a slightly different description to. The new project still showed the Name of the one that got renamed not the new name and also didn’t show as bound.

As I had a backup already I deleted the project and recreated it again and this time it showed as bound and with the correct name.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.