通过脚本返回代码失败/不稳定 [英] Failure / Unstable via Script Return Code
问题描述
我想获得 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://
还有许多插件可以做到这一点,包括:
There are also a number of plugins that can do that same, including:
- 文本查找器插件一>.
- 构建插件失败(它可以设置任何状态),但您需要将它与 条件构建步骤 插件.
- Groovy 插件(将需要找出完整的 Groovy 代码).
- Groovy 构建后插件(带有设置构建结果的简单方法).
这篇关于通过脚本返回代码失败/不稳定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!