-
Notifications
You must be signed in to change notification settings - Fork 21
/
scale-ci-linter
executable file
·36 lines (33 loc) · 1.13 KB
/
scale-ci-linter
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
set -eo pipefail
templates_path="$PWD/jjb/dynamic"
if [ $# -eq 0 ] ; then
pushd $templates_path
for template in $(ls $templates_path); do
if [[ "$template" != "README.md" ]]; then
echo "--------------------------------"
echo "Running the linter for $template"
echo "--------------------------------"
yamllint -d "{extends: relaxed, rules: {line-length: {max: 200}}}" $templates_path/$template
echo "--------------------------------"
echo "Running jenkins-jobs test for $template"
echo "--------------------------------"
jenkins-jobs -l ERROR test $templates_path/$template >/dev/null
fi
done
popd
else
if test -f $1 ; then
echo "--------------------------------"
echo "Running the linter for $1"
echo "--------------------------------"
yamllint -d "{extends: relaxed, rules: {line-length: {max: 200}}}" $1
echo "--------------------------------"
echo "Running jenkins-jobs test for $1"
echo "--------------------------------"
jenkins-jobs -l ERROR test $1 >/dev/null
else
echo "ERROR: File $1 not found"
exit 1
fi
fi