0424f743d0eba6c61871edeea14996b8ed337f8d
[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 --python python3 --venv-file /tmp/.jjb_venv \
22     jenkins-job-builder setuptools==65.7.0 urllib3~=1.26.15
23
24 jenkins-jobs test --recursive -o archives/job-configs --config-xml jjb/
25
26 # Enable 'globbing'
27 set +f
28 # NGINX is very sluggish with directories containing large numbers of objects
29 # Add another directory level named {a..z} and move directories to them.
30 # Directories beginning with {0..9} or {A..Z} are left at the top level.
31 (   cd archives/job-configs
32     for letter in {a..z}; do
33         if ls -d "$letter"* > /dev/null 2>&1; then
34             mkdir .tmp
35             mv "$letter"* .tmp
36             mv .tmp "$letter"
37         fi
38     done
39 )
40
41 (   cd archives
42     echo "INFO: Archiving $(find job-configs -name \*.xml | wc -l) job configurations"
43     tar -cJf job-configs.tar.xz job-configs
44     rm -rf job-configs
45 )