7d679bd1e1b48cde86c1e1707e4b719569bbb680
[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 set -eufo pipefail
14
15 # shellcheck disable=SC1090
16 source ~/lf-env.sh
17
18 lf-git-validate-jira-urls
19 lf-jjb-check-ascii
20
21 lf-activate-venv jenkins-job-builder
22
23 jenkins-jobs test --recursive -o archives/job-configs --config-xml jjb/
24
25 # Enable 'globbing'
26 set +f
27 # NGINX is very sluggish with directories containing large numbers of objects
28 # Add another directory level named {a..z} and move directories to them.
29 # Directories beginning with {0..9} or {A..Z} are left at the top level.
30 (   cd archives/job-configs
31     for letter in {a..z}; do
32         if ls -d "$letter"* > /dev/null 2>&1; then
33             mkdir .tmp
34             mv "$letter"* .tmp
35             mv .tmp "$letter"
36         fi
37     done
38 )
39
40 (   cd archives
41     echo "INFO: Archiving $(find job-configs -name \*.xml | wc -l) job configurations"
42     tar -cJf job-configs.tar.xz job-configs
43     rm -rf job-configs
44 )