通过脚本返回代码失败/不稳定 [英] Failure / Unstable via Script Return Code

查看:31
本文介绍了通过脚本返回代码失败/不稳定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想获得 jenkins 构建作业的结果,要么失败(红色),要么不稳定(黄色),要么成功(绿色)...

I would like to get the result of my jenkins build job either failed (red), unstable (yellow) or successfull (green)...

如果我从我的 shell 脚本中返回非零值,我只会失败.是否有任何返回码导致不稳定?

If i return non zero from my shell script i can only get failed. Is there any return code which produces unstable ?

推荐答案

更新: 较新版本的 Jenkins 支持设置 unstable 的退出代码.有关详细信息,请参阅此处(感谢@Pedro 和 @gib)

Update: Newer versions of Jenkins support exit codes that would set unstable. For more info, please refer here (thanks @Pedro and @gib)

我没有测试这个.

I did not test this.

以下原始答案:

没有.脚本退出代码不会在 Jenkins 中产生 UNSTABLE 构建结果.

No. A script exit code will not produce UNSTABLE build result in Jenkins.

设置 UNSTABLE 构建结果的唯一方法是通过 Jenkins 以编程方式.

The only way to set UNSTABLE build result is programmatically through Jenkins.

这就是测试工具 詹金斯的部分确实如此.

This is what the test harness portion of Jenkins does.

您还可以使用 Jenkins CLI 直接从您的脚本中设置当前正在执行的构建的结果.不是返回特定的退出代码,而是让您的脚本执行 Jenkins CLI 命令.有关详细信息,请在您自己的服务器上转到 http:///cli/command/set-build-result

还有许多插件可以做到这一点,包括:

There are also a number of plugins that can do that same, including:

这篇关于通过脚本返回代码失败/不稳定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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