Azure DevOps Server Quality fails for any SQ Project in ADO Project with multiple git repos

Hi,

We’ve been using SQ integrated with Azure DevOps Server for quite a while now and I want to enable the quality gates to stop merges to master when analysis fails.

I have successfully enabled this on our master branch in a repo by adding the “Requires approval from additional services” value of “SonarQube/quality gate” on the master branch policy.

However, this issue is that in the ADO Project we have 4 different repos - each with their own SQ project, but if any of the 4 SQ projects fails then all quality gates fail for the master branch policy in any of the repos. I have made sure that the build each reference the correct SQ project.

Right now, if SQ projects “project1”, “project2” and “project3” pass but “project4” fails, merges for the first three projects complain that the quality gate has failed and are blocked.

Am I doing something wrong? Is there a way to limit the quality gate in ADO to just check the specific SQ project?

Versions:

  • SQ: 8.7.1
  • ADO: 2019 (Dev17.M153.5)

Hi,

Your version is past EOL. You should upgrade to either the latest version or the current LTS at your earliest convenience. Your upgrade path is:

8.7.1 → 8.9.6 → 9.3 (last step optional)

You may find the Upgrade Guide helpful.

If your error persists after upgrade, please come back to us.

 
Ann

Hi,

This morning I have upgraded to 8.9.6 and the issue is still there.

Thanks

Mark

Hey Mark.

I would reckon that the same repo is being referenced in the project settings (Project Settings > Pull Request Decoration) – although that’s just a guess.

Would you be able to share some screenshot(s) demonstrating the issue? I’m having a hard time wrapping my head around the details (are multiple builds triggering from 1 PR? Is it really entirely separate repositories, or a monorepo?)

Hi Colin,

It is on one ADO project with 3 git repos in. One repo is old code which totally fails SQ analysis. I do not have a quality branch policy on that repo.

Two new repos have quality gates on. Attached are some screen shots to explain the issue.

You can see here the repo has 3 branches. The one I want to merge is “feature/sq-ci-test” which has passed analysis:

Strangely, it doesn’t show any entries in the “Pull requests” tab, should it?:

Here you can see in ADO that the merge cannot complete because ADO thinks the analysis has failed:

And here is the quality gate defined on the “master” as a branch policy:

Any help you can provide will be appreciated!

Mark

Hey @MarkJEverest

Yes, there ought to be an entry.

What I see so far is that you are successfully executing branch analysis, but not pull request analysis. The former shouldn’t result in anything being reported on your PR, while the latter will. This can happen a few ways, but the usual suspects are:

  • In your pipeline, you are manually configuring sonar.branch.name – this shuts off automatic configuration of the Pull Request analysis parameters
  • You are not running a PR build – in fact, I think this is the most likely culprit, as we we can see there’s no build policy in this screenshot

As noted in the documentation on Azure DevOps Integration:

Ensuring your pull requests are automatically analyzed

Ensure all of your pull requests get automatically analyzed by adding a build validation branch policy on the target branch.

Hi Colin - great thanks - I’ll do some digging and report back.

1 Like

Hi Colin,

You are quite correct! When I’ve added a Build Policy with the correct CI build the merge requests are now allowed.

Thanks very much for your help!

Mark

1 Like

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