如何处理Jenkins管道作业的生成结果? [英] How to manipulate the build result of a Jenkins pipeline job?

查看:98
本文介绍了如何处理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():

// 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天全站免登陆