I'd love to fail! Unfortunately, if there are exceptions in my deploy environment, I still pass!
My pipeline logs into a server, then runs the deploy script:
deploy.sh reads:
#!/bin/bash
#
# Deploy 2.0
#
# Runs from within Pipelines. Do not run manually.
# Set high expectations so that Pipelines fails on an error or exit 1
set -o pipefail
# Deploy code
echo "cd to /path/to/repo"
cd /path/to/repo
if [ -z "$(git status --porcelain)" ]; then
# Working directory clean
git checkout master
git pull origin master
git log -1
exit
else
# Uncommitted changes
echo "Uncommited changes. Failing..."
exit 1
fi
With `exit 1`, I'd expect my pipeline to fail, but it doesn't. I'm guessing that because the script accurately runs `exit 1` it doesn't fail?
Any ideas on how to intentionally fail a pipeline from within a bash script?