BuildBreaker在问题和预览模式下不会失败,但在发布模式下会失败-SonarQube5.6.1 [英] BuildBreaker Does not fails in issues and preview mode but fails in publish mode - SonarQube5.6.1

查看:114
本文介绍了BuildBreaker在问题和预览模式下不会失败,但在发布模式下会失败-SonarQube5.6.1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在sonarQube5.6.1中使用Buildbreaker2.4插件.

I am using Buildbreaker2.4 plugin in sonarQube5.6.1.

当我运行以下命令时,

mvn sonar:sonar -Dsonar.issuesReport.html.enable=true -Dsonar.analysis.mode=publish

Buildbreaker失败并出现关键问题

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.

推荐答案

如果在预览模式下失败,则必须编写插件"@batchside"(实现PostJob).

1-为您的项目加载当前质量的门属性

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-读取当前分析的错误(在PostJobContext对象中)


2- read errors of your current analysis (in PostJobContext object)

Iterator<PostJobIssue> iterator = context.issues().iterator();


3-开展业务,比较您的QG的错误和建议
4-在例外情况下完成,它将破坏预览"版本

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 ..");

这篇关于BuildBreaker在问题和预览模式下不会失败,但在发布模式下会失败-SonarQube5.6.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆