How to use the Build Breaker on sonarqube 5.1+ if

2019-04-09 10:29发布

问题:

I am using Jenkins Continuous Integration server and Sonarqube for code coverage. I want to make sure that if the issues in the project reach a threshold value of Quality Gate, the project build should fail. I have installed Build Breaker plugin in Sonarqube. I read somewhere that it applies on each and every project by default and sends build failed report to CI server(Jenkins in my case).

But this is not happening. My project builds are successful on CI server even if the issues have reached threshold value.

I am not able to use Build Breaker as it doesn't provides any parameters or something to configure it. The problem looks like this:

Please help me to configure this, so that I can send a failed build status to my CI server. If it is not possible in any way, then please let me know if there is any notification mechanism to at least notify developers about issues that have reached threshold.

回答1:

The Build Breaker stopped working in SonarQube 5.2. You now have 2 ways to implement the Build Breaker functionality:

  • the community supported plugin
  • the api/qualitygates/project_status web service (developed in 5.3). You can then easily create your own script to check the quality gate status of a given project

For a bit of context, here's why SonarSource thinks the Build Breaker shouldn't be used



回答2:

I see you are using sonarqube 5.1 and Jenkins. Pre-commit build breaking with build breaker stopped working in sonarqube 5.1. (See: http://sonarqube-archive.15.x6.nabble.com/Sonarqube-and-Build-Breaker-Plugin-td5034703.html)

I think this has been resolved as of 5.4 but am unsure.

Mike