Home Ask Login Register

Developers Planet

Your answer is one click away!

Ivan February 2016

Fail VSTS build if SonarQube fails quality gate

We use VSTS build with standard SonarQube build steps:

  • SonarQube for MsBuild - Begin Analysis
  • ... build
  • SonarQube for MsBuild - End Analysis

Some time after build I can see Analysis results in SonarQube - whether it Passed or Failed quality gate. But the VSTS build is successful even if quality gate is Failed.

Is there a way to fail a VSTS build if quaility gate is failed?

Following this: http://docs.sonarqube.org/display/SONAR/Breaking+the+CI+Build I've tried looking for report-task.txt file, but I can't see it anywhere.

I can probably just run MSBuild.SonarQube.Runner.exe as command-line build step, as described here: http://docs.sonarqube.org/display/SONAR/Analyzing+with+SonarQube+Scanner+for+MSBuild#AnalyzingwithSonarQubeScannerforMSBuild-AnalyzingfromtheCommandLine

But I thought I should first try standard Build Steps for SonarQube


Wes MacDonald February 2016

Here is a link to failing the build on quality gate violations with 5.3 or later, it uses the SonarQube for MSBuild - Begin Analysis task


This updated task is not available with TFS 2015 Update 1 but is available in Update 2 RC1 and VSTS (VSO).

Regards, Wes

Post Status

Asked in February 2016
Viewed 3,086 times
Voted 8
Answered 1 times


Leave an answer

Quote of the day: live life