X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=blobdiff_plain;f=shell%2Fjjb-verify-job.sh;h=5ed12e2a408e77db29ee20d55ce3d572b1b9e304;hb=a770b3ba329ee6e1738948495959b821b912e3b5;hp=d7a9e3139386c376d665b38c36e0a9fadb6116b0;hpb=4f69d87cabcbd08da63baf6a4ba205a8ce9fdd38;p=releng%2Fglobal-jjb.git diff --git a/shell/jjb-verify-job.sh b/shell/jjb-verify-job.sh index d7a9e313..5ed12e2a 100644 --- a/shell/jjb-verify-job.sh +++ b/shell/jjb-verify-job.sh @@ -10,8 +10,7 @@ ############################################################################## echo "---> jjb-verify-job.sh" -# Ensure we fail the job if any steps fail. -set -eu -o pipefail +set -eufo pipefail # shellcheck disable=SC1090 source ~/lf-env.sh @@ -21,23 +20,25 @@ lf-jjb-check-ascii lf-activate-venv jenkins-job-builder -jenkins-jobs -l DEBUG test --recursive -o archives/job-configs --config-xml jjb/ +jenkins-jobs 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 -# the directory list slow. -pushd archives/job-configs -for letter in {a..z} -do - if [[ $(ls "$letter"* > /dev/null 2>&1) -eq 0 ]] - then - mkdir "$letter" - find . -maxdepth 1 -type f -name "$letter*" -exec mv {} "$letter" \; - fi -done -popd +# Enable 'globbing' +set +f +# NGINX is very sluggish with directories containing large numbers of objects +# Add another directory level named {a..z} and move directories to them. +# Directories beginning with {0..9} or {A..Z} are left at the top level. +( cd archives/job-configs + for letter in {a..z}; do + if ls -d $letter* > /dev/null 2>&1; then + mkdir .tmp + mv $letter* .tmp + mv .tmp $letter + fi + done +) -if [ -n "$(ls -A archives/job-configs)" ]; then - tar cJvf archives/job-configs.tar.xz archives/job-configs - rm -rf archives/job-configs -fi +( cd archives + echo "INFO: Archiving $(find job-configs -name \*.xml | wc -l) job configurations" + tar -cJf job-configs.tar.xz job-configs + rm -rf job-configs +)