如果执行 shell 失败,不要让 jenkins 构建失败 [英] don't fail jenkins build if execute shell fails

查看:47
本文介绍了如果执行 shell 失败,不要让 jenkins 构建失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为构建过程的一部分,我将 git commit 作为执行 shell 步骤运行.但是,如果工作区中没有变化,Jenkins 将导致构建失败.这是因为 git 在没有要提交的更改时返回错误代码.如果是这种情况,我想中止构建,或者只是将其标记为不稳定.有什么想法吗?

As part of my build process, I am running a git commit as an execute shell step. However, if there are no changes in the workspace, Jenkins is failing the build. This is because git is returning an error code when there are no changes to commit. I'd like to either abort the build, or just mark it as unstable if this is the case. Any ideas?

推荐答案

命令失败时停止进一步执行:

To stop further execution when command fails:

<代码>命令 ||退出0

命令失败时继续执行:

<代码>命令 ||真实

这篇关于如果执行 shell 失败,不要让 jenkins 构建失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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