Running a fallback command
In some workflows, you may want to execute a command only when a previous command has failed. As one example, you may want to run an alerts script if your tests fail.
By default, CodeShip exits a build once their is a failure of any kind,
which means when any command reports back a status code other than
However, by wrapping your commands in an ``on fail'' script, you can
create a fallback conditionality and then exit your build appropriately
To run another command if an earlier one fails you can use the following bash syntax
YOUR_COMMAND || (OTHER_COMMAND && exit 1)
This will still fail the build, but will let you execute another command first. If you are looking for a more flexible solution, take a look at ensure_called.sh.