2
votes

We're using TeamCity with the Sonar plugin. Is there a way to fail the TeamCity build if some metric (i.e. number of Blocker issues, amount of technical debt, etc.) increases within Sonar, or if it just fails the Quality Gate? I haven't found any documentation regarding this.

2

2 Answers

1
votes

For now, the options available for this are

  1. the Build Breaker Plugin (assuming Team City is compatible with the way this plugin woks)
  2. adding a script step in your job (again, assuming TC supports it) to poll SQ in a loop for the completion of analysis report processing, then to grab the QG status and conditionally fail the build.

2018 EDIT
There is now non-blocking support for this within Jenkins Pipelines. More in the docs.

0
votes

yes you can do it using powershell scripts .Call the sonar rest api for the project using metric and metric key .Compare the result with the project if the metric value dose not match the exit from the build.