From 0cd4f5d8c5fc52e167cd19ab00bddec4f7f0c190 Mon Sep 17 00:00:00 2001 From: Thanh Ha Date: Fri, 26 May 2017 16:52:32 -0400 Subject: [PATCH] Make sure we fail if scripts fail Rather then allowing the scripts to continue we should immediately fail the scripts if an error occurs. Change-Id: Ide1d02df950b434d24d7e60675ba73639bded33f Signed-off-by: Thanh Ha --- shell/create-netrc.sh | 4 ++++ shell/jjb-install.sh | 3 +++ shell/jjb-merge-job.sh | 3 +++ shell/jjb-verify-job.sh | 3 +++ shell/lftools-install.sh | 3 +++ shell/logs-deploy.sh | 4 ++++ 6 files changed, 20 insertions(+) diff --git a/shell/create-netrc.sh b/shell/create-netrc.sh index 4a15e3b6..b4fd045c 100644 --- a/shell/create-netrc.sh +++ b/shell/create-netrc.sh @@ -8,6 +8,10 @@ # which accompanies this distribution, and is available at # http://www.eclipse.org/legal/epl-v10.html ############################################################################## +echo "---> create-netrc.sh" + +# Ensure we fail the job if any steps fail. +set -eu -o pipefail NEXUS_URL="${NEXUS_URL:-$NEXUSPROXY}" CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \ diff --git a/shell/jjb-install.sh b/shell/jjb-install.sh index 63d16947..6eea3adf 100644 --- a/shell/jjb-install.sh +++ b/shell/jjb-install.sh @@ -10,6 +10,9 @@ ############################################################################## echo "---> jjb-install.sh" +# Ensure we fail the job if any steps fail. +set -eu -o pipefail + virtualenv "$WORKSPACE/.virtualenvs/jjb" # shellcheck source=./.virtualenvs/jjb/bin/activate disable=SC1091 source "$WORKSPACE/.virtualenvs/jjb/bin/activate" diff --git a/shell/jjb-merge-job.sh b/shell/jjb-merge-job.sh index d3db1910..4a8d23aa 100644 --- a/shell/jjb-merge-job.sh +++ b/shell/jjb-merge-job.sh @@ -10,4 +10,7 @@ ############################################################################## echo "---> jjb-merge-job.sh" +# Ensure we fail the job if any steps fail. +set -eu -o pipefail + jenkins-jobs update --recursive --delete-old --workers 4 jjb/ diff --git a/shell/jjb-verify-job.sh b/shell/jjb-verify-job.sh index bfa2622a..cc0aa0b9 100644 --- a/shell/jjb-verify-job.sh +++ b/shell/jjb-verify-job.sh @@ -10,6 +10,9 @@ ############################################################################## echo "---> jjb-verify-job.sh" +# Ensure we fail the job if any steps fail. +set -eu -o pipefail + jenkins-jobs -l DEBUG test --recursive -o archives/job-configs jjb/ # Sort job output into sub-directories. On large Jenkins systems that have diff --git a/shell/lftools-install.sh b/shell/lftools-install.sh index 527a7345..06fbe03b 100644 --- a/shell/lftools-install.sh +++ b/shell/lftools-install.sh @@ -10,6 +10,9 @@ ############################################################################## echo "---> lftools-install.sh" +# Ensure we fail the job if any steps fail. +set -eu -o pipefail + virtualenv "$WORKSPACE/.virtualenvs/lftools" # shellcheck source=./.virtualenvs/lftools/bin/activate disable=SC1091 source "$WORKSPACE/.virtualenvs/lftools/bin/activate" diff --git a/shell/logs-deploy.sh b/shell/logs-deploy.sh index e5c990a4..fa31f2bc 100644 --- a/shell/logs-deploy.sh +++ b/shell/logs-deploy.sh @@ -8,6 +8,10 @@ # which accompanies this distribution, and is available at # http://www.eclipse.org/legal/epl-v10.html ############################################################################## +echo "---> logs-deploy.sh" + +# Ensure we fail the job if any steps fail. +set -eu -o pipefail set -x # Trace commands for this script to make debugging easier. -- 2.16.6