Pass multiple pattern args in logs-deploy.sh
[releng/global-jjb.git] / shell / jjb-verify-job.sh
1 #!/bin/bash
2 # SPDX-License-Identifier: EPL-1.0
3 ##############################################################################
4 # Copyright (c) 2017 The Linux Foundation and others.
5 #
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Eclipse Public License v1.0
8 # which accompanies this distribution, and is available at
9 # http://www.eclipse.org/legal/epl-v10.html
10 ##############################################################################
11 echo "---> jjb-verify-job.sh"
12
13 # Ensure we fail the job if any steps fail.
14 set -eu -o pipefail
15
16 jenkins-jobs -l DEBUG test --recursive -o archives/job-configs jjb/
17
18 # Sort job output into sub-directories. On large Jenkins systems that have
19 # many jobs archiving so many files into the same directory makes NGINX return
20 # the directory list slow.
21 pushd archives/job-configs
22 for letter in {a..z}
23 do
24     if [[ $(ls "$letter"* > /dev/null 2>&1) -eq 0 ]]
25     then
26         mkdir "$letter"
27         find . -maxdepth 1 -type f -name "$letter*" -exec mv {} "$letter" \;
28     fi
29 done
30 popd
31
32 if [ ! -z "$(ls -A archives/job-configs)" ]; then
33     tar cJvf archives/job-configs.tar.xz archives/job-configs
34     rm -rf archives/job-configs
35 fi