Hi folks,
Usually, if a shell script in a Jankins build throws an error, the build fails automatically. In this post I talk briefly about a technique for running a shell script in your Jenkins CI pipeline without causing the build to fail if the shell script throws an error.
The technique is to use code like the following:
sh(""" set +e /your/script/that/may-or-may-not-fail.sh set -e """)
set +e is the default way that bash runs. That is, if a command throws an error, bash displays it, but continues with the script.
set -e forces the script to exit if there’s an error.
That’s all for now. Till next time, happy software development.