Monorepo Quality Gate Status Azure DevOps

  • ALM used (GitHub, Bitbucket Cloud, Azure DevOps)
    Azure DevOps
  • CI system used (Bitbucket Cloud, Azure DevOps, Travis CI, Circle CI
    Azure DevOps
  • Languages of the repository
    C# & TypeScript/JavaScript
  • Error observed
    Azure DevOps Quality Gate Status not updating and stays in pending state

Hi,

I’m currenlty having an issue with implementing a validation of the quality gate status in Azure DevOps for a monorepo being scanned by SonarCloud, the status stays in a pending state even if comments are applied to the PR from SonarCloud.

We are scanning multiple projects in each PR, what we do get if the quality gate passes is:

image

But as you see the status of the overall quality gate check is still pending, can someone at SonarSource check the backend logs and let me know if the API calls to Azure DevOps are generating any errors that might indicate what is causing this to fail, as it works fine for anything not in a monorepo.

Let me know if you want any further information.

Hey there.

You’ll need to remove the general one from your branch policies now that you have your project configured as a monorepo (which at some point in the past, probably wasn’t configured as such). When configured as a monorepo, a project has no “overall quality gate check” – but rather two separate ones, one for each project in the monorepo.

Hi Colin,

Thanks for the info, just for clarity then, I’m guessing the solution then is to configure multiple status checks for each project point to their path in the monorepo so only the projects getting built end up with a required status check?

Hi Collin,

Is there any way I can find out what the correct status name is to add to the policy?

Looking in the Azure DevOps API the only thing I have found is quality_gate_sonarCloudProjectKey, but this doesn’t seem to work.

I can’t find anything in the SonarCloud documentation around quality gates for monorepos either.

If anyone has any suggestions or can point me to some kind of logs somewhere where I can diagnose this irritating issue that would be great.

Interesting discovery though, when no status check is added for the PR, SonarCloud can post the status fine, if I add a status check the status post from SonarCloud doesn’t appear in the list of statuses, the list contains all statuses sent to that PR even if the dont apply to it.

Hey there.

That sounds right – to be honest, it’s news to me that you can set a path filter for status checks (I’m thrilled that’s the case now, I wish GitHub would do something similar…)

You should never need to guess the name – once the repo has been successfully decorated by the check once, it should appear in the ** Status to check** dropdown.

(those latter two being from after I converted the project into a monorepo and ran two builds with two project keys).

Is the issue that these aren’t showing up at all, or that you’re trying to configure things before the status checks are sent for the first time?

Thanks for getting back to me @Colin,

And thanks for the extra info, no the issue is when you set the status check (either optional or required), it sits there on a waiting status. But if I remove or disable the status check SonarCloud posts to the PR absolutely fine, albeit I can’t fail the PR if the quality gate doesn’t succeed.

Whats interesting is if i query the Azure DevOps PR statuses API I can see what statuses are posted to the PR, with the status check enabled the SonarCloud quality gate status isn’t in the output, take off the status check and it shows up in the list.

I’m wondering if there is anything in the SonarCloud side in the logs that would indicate either an issue your side or if i need to speak to MS about this.