I am using Buildbreaker2.4 plugin in sonarQube5.6.1.
When i run the below command,
mvn sonar:sonar -Dsonar.issuesReport.html.enable=true -Dsonar.analysis.mode=publish
Buildbreaker fails with critical issues
But when i run any of the below two commands, it gets passed.
mvn sonar:sonar -Dsonar.issuesReport.html.enable=true -Dsonar.analysis.mode=issues
mvn sonar:sonar -Dsonar.issuesReport.html.enable=true -Dsonar.analysis.mode=preview
Suggest me on what might be the problem.
for fail in preview mode you have to write your plugin '@batchside' (implements PostJob).
1- load current quality gate properties for your project
WsRequest wsRequest = new GetRequest("api/qualitygates/show").setParam("id", qgId).setMediaType(MediaTypes.PROTOBUF);
2- read errors of your current analysis (in PostJobContext object)
Iterator<PostJobIssue> iterator = context.issues().iterator();
3- do your business, compare errors and thresold of your QG
4- finish in a exception and it will break the 'preview' build
throw MessageException.of("too many errors for preview mode ..");