执行jenkins postbuild脚本时是否有关于作业状态的信息 [英] Is there information available when executing jenkins postbuild script about job status

查看:280
本文介绍了执行jenkins postbuild脚本时是否有关于作业状态的信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果构建失败,我需要运行某些shell命令.是否有任何传递给shell的包含此类信息的变量?或者也许我可以在文件中找到它?

I need to run certain shell command if build fails. Is there any variable passed to shell that contains such info? Or maybe I can find it in file?

我需要这样的东西:

if [ $build_status == "FAIL" ]
  then
    do_the_magic
fi

我已经打印了env,没有什么可以直接说明构建失败.

I have already printed env and there is nothing that would directly say that build failed.

推荐答案

您正在寻找有条件的构建步骤插件.添加条件步骤(单个)"作为最后一个构建步骤,并使用当前构建状态"作为条件.我喜欢这个插件,但是还没有使用这个特殊条件.

You are looking for the Conditional Build Step Plugin. Add a "Conditional step (single)" as your last build step and use "Current Build Status" for your condition. I like this plugin, but havent't used this particular condition yet.

这篇关于执行jenkins postbuild脚本时是否有关于作业状态的信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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