更新:较新版本的Jenkins支持设置不稳定的退出代码.有关详细信息,请参阅
here(感谢@Pedro和@gib)
@H_301_1@我没试过这个.
@H_301_1@原答案如下:
@H_301_1@不可以.脚本退出代码不会在Jenkins中生成UNSTABLE构建结果.
@H_301_1@设置UNSTABLE构建结果的唯一方法是通过Jenkins以编程方式.
@H_301_1@这就是jenkins的test harness部分.
@H_301_1@您还可以直接从脚本使用Jenkins CLI来设置当前正在执行的构建的结果.您的脚本不是返回特定的退出代码,而是执行Jenkins CLI命令.有关详细信息,请在您自己的服务器上转到http://< your-server> / cli / command / set-build-result
@H_301_1@还有一些插件可以做到这一点,包括:
@H_301_1@> Text-finder plugin.
> Fail the build plugin(它可以设置任何状态),但您需要与Conditional Build Step插件一起使用.
> Groovy plugin(需要弄清楚完整的Groovy代码).
> Groovy post-build plugin(附带简单的方法来设置构建结果).
> Fail the build plugin(它可以设置任何状态),但您需要与Conditional Build Step插件一起使用.
> Groovy plugin(需要弄清楚完整的Groovy代码).
> Groovy post-build plugin(附带简单的方法来设置构建结果).