X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=blobdiff_plain;f=shell%2Fjjb-verify-job.sh;h=8dd50f7fb686017948502ad39454aee1f8efb01b;hb=0d623ea91ba7dab654e7c9026b10f25f6786ff43;hp=bfa2622a0f9a1f8cb7fc2b577c57b374b778d2e6;hpb=851b0b6d0cfe84e986548fd596a9b2f18413fefd;p=releng%2Fglobal-jjb.git diff --git a/shell/jjb-verify-job.sh b/shell/jjb-verify-job.sh index bfa2622a..8dd50f7f 100644 --- a/shell/jjb-verify-job.sh +++ b/shell/jjb-verify-job.sh @@ -1,5 +1,5 @@ #!/bin/bash -# @License EPL-1.0 +# SPDX-License-Identifier: EPL-1.0 ############################################################################## # Copyright (c) 2017 The Linux Foundation and others. # @@ -10,7 +10,10 @@ ############################################################################## echo "---> jjb-verify-job.sh" -jenkins-jobs -l DEBUG test --recursive -o archives/job-configs jjb/ +# Ensure we fail the job if any steps fail. +set -eu -o pipefail + +jenkins-jobs -l DEBUG test --recursive -o archives/job-configs --config-xml jjb/ # Sort job output into sub-directories. On large Jenkins systems that have # many jobs archiving so many files into the same directory makes NGINX return @@ -18,11 +21,15 @@ jenkins-jobs -l DEBUG test --recursive -o archives/job-configs jjb/ pushd archives/job-configs for letter in {a..z} do - ls "$letter"* > /dev/null 2>&1 - if [[ "$?" -eq 0 ]] + if [[ $(ls "$letter"* > /dev/null 2>&1) -eq 0 ]] then mkdir "$letter" - find . -type f -maxdepth 1 -name "$letter*" -exec mv {} "$letter" \; + find . -maxdepth 1 -type f -name "$letter*" -exec mv {} "$letter" \; fi done popd + +if [ -n "$(ls -A archives/job-configs)" ]; then + tar cJvf archives/job-configs.tar.xz archives/job-configs + rm -rf archives/job-configs +fi