Azure DevOps pull request quality gate status check

I would like to be able to configure SonarCloud integration with Azure DevOps such that I can integrate the quality gate status check to block pull request completion, but without the decoration of pull request with issue comments. Is that possible? I am able to get both to work, but would like to disable the creation of comments and only keep the quality gate status check. The documentation below implies that you must have decoration enabled for the status check to work. Is there no option to turn off the comments decoration?

Hi @raf and welcome to the community !

No this is not currently possible.

Mickaël

Are there any plans for this? We are also interested in having the passing Quality Gate as a required policy, so PR’s are blocked when they don’t meet the gate.

Hi @AdeZwart ,
The possibility of deactivating PR comments and keeping only the Quality Gate status is something we are looking to, not in our close scope for now (no ETA though).

We are also interested in having the passing Quality Gate as a required policy, so PR’s are blocked when they don’t meet the gate.

If I understand correctly your use case, you can do that by setting a “Status Checks” branch policy on your main branch. You will find the SonarCloud Quality Gate there.

Hope to help :slight_smile:
Kind regards,
Christophe

1 Like

I’m looking for a way to enable Sonar status check in ADO, but I can’t see it in my “Status to check” dropdown. Should I import some additional extension? (I did import “SonarQube” extension and use it in the pipeline).

I checked a lot of documentation and all says to simply select from the dropdown, but how can I import it to my ADO instance?

@Sergey_Machel Maybe try to run a first analysis of your code using SonarQube. If the extension is installed, you should see the quality gate in the dropdown :wink:

Analysis is running couple months already, but still it is not visible

@Sergey_Machel does the analysis run automatically on a PR?

Not yet due to inability to configure quality gates. It is running, though, at nightly build every day.

Hi @Sergey_Machel

To see the Quality Gate status name in the combo, you need to complete one first PullRequest analysis (with the proper trigger).

You can still try to write by hand the name : SonarCloud/quality gate , not sure if it will have any good effect though.

HTH,
Mickaël

Got it, will be enforcing this staff over the weekend, thanks.

@mickaelcaro I tried setting SonarQube/quality gate status check manually - still it doesn’t work, says that it iss “Waiting”.
NOTE: We are using enterprise, on-prem version, not cloud.

So SonarQube then ? Or you’re talking about your Azure DevOps instance ?

Yes, Sonar is on prem

Looks like I found the problem: I need to set up PR Decoration

1 Like

Glad you found the problem @Sergey_Machel :slight_smile:
Just out of curiosity : what version of SonarQube do you use?
In the latest version (9.0) we now detect that your PR decoration is not set and help you configure it properly :wink:

Thanks,
Christophe

1 Like

We are on 7.9.3 yet (

My issue is I want to fail the build when the validation fails.
Spec,
on-Prem TFS 2017 Update 2
on-Prem SonaQube Enterprise edition, version 9.1
As of now I get the validation report like the following :
image

The problem is the build is still successful and from TFS branch policies page, I don’t see Status Checks to add a Status Policy
image

What do I need to do, the main goal of doing this was to have a gate and block merges?

Hi Machel,

Could you please share on how to setup PR decoration, I tried setting SonarQube/quality gate status manually but still it doesn’t work, says that it is “Waiting”.

Thanks,
Gopi