-if [ ! -z "$(ls -A archives/job-configs)" ]; then
- tar cJvf archives/job-configs.tar.xz archives/job-configs
- rm -rf archives/job-configs
-fi
+lf-activate-venv jenkins-job-builder
+
+jenkins-jobs test --recursive -o archives/job-configs --config-xml jjb/
+
+# 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
+)
+
+( 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
+)