Break build on quality gate failure in VSTS

How can I break the build if the sonar qube quality gate has been failed. In earlier version there was a task “SonarQube for MSBuild - Begin Analysis” in which there’s an option for Break build on failure … But in new version its not showing.

So currently even if the project has failed quality gate it passes the build , pull requests are merged.

Can any one help me out on this?

Hi there !

There’s a good hint on this in the documentation of the VSTS extension:

How do I break the build base on the quality gate status?
This is not possible with the new version of the extension (4.0) if you are using the most up-to-date versions of the tasks. We believe that breaking a CI build is not the right approach. Instead, we are providing pull request decoration (to make sure that one does not introduce issues when merging his/her code) and we’ll soon add a way to check the quality gate as part of a Release process.

Hi Nicolas,

With this decoration , the pull requests can not be merged without passing build using build policies. But since the build is passing without passing quality gate … we are still merging faulty builds … unless a reviewer manually dis approve the failing build

1 Like

is there any possible way to fail build if sonar analysis failed?