don't fail jenkins build if execute shell fails

Ben picture Ben · Jan 18, 2013 · Viewed 164.6k times · Source

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?

Answer

Quolonel Questions picture Quolonel Questions · Sep 9, 2014

To stop further execution when command fails:

command || exit 0

To continue execution when command fails:

command || true