如何操纵 Jenkins 管道作业的构建结果(回到“成功")? [英] How to manipulate the build result of a Jenkins pipeline job (back to 'SUCCESS')?

查看:35
本文介绍了如何操纵 Jenkins 管道作业的构建结果(回到“成功")?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在操作 Jenkins 管道的构建结果时遇到了一些麻烦.我已将其缩小到以下问题:有人知道为什么以下 Jenkins 管道不会使构建结果成功吗?相反,构建失败.

I'm having some trouble to manipulate the build result of a Jenkins pipeline. I've narrowed it down to the following issue: anyone know why the following Jenkins pipeline doesn't make the build result SUCCESS? Instead the build fails.

print "Setting result to FAILURE"
currentBuild.result = 'FAILURE'

print "Setting result to SUCCESS"
currentBuild.result = 'SUCCESS'

推荐答案

我想这是设计使然,结果只会变得更糟"在 setResult():

I guess this is by design, "result can only get worse" in setResult():

// result can only get worse
if (result==null || r.isWorseThan(result)) {
    result = r;
    LOGGER.log(FINE, this + " in " + getRootDir() + ": result is set to " + r, LOGGER.isLoggable(Level.FINER) ? new Exception() : null);
}

那是个废话

这篇关于如何操纵 Jenkins 管道作业的构建结果(回到“成功")?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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