-
Notifications
You must be signed in to change notification settings - Fork 25
/
validate_master_cfg.sh
executable file
·92 lines (81 loc) · 1.75 KB
/
validate_master_cfg.sh
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
set -o posix
err() {
echo >&2 "ERROR: $*"
exit 1
}
usage() {
echo "Usage: $0 -e <DEV|PROD>"
exit 0
}
ENVIRONMENT=""
while getopts ":e:" opt; do
case ${opt} in
e )
ENVIRONMENT=$OPTARG
;;
\? )
usage
;;
: )
usage
;;
esac
done
if [[ -z "$ENVIRONMENT" ]]; then
usage
fi
case $ENVIRONMENT in
DEV)
IMAGE="quay.io/mariadb-foundation/bb-master:dev_master"
;;
PROD)
IMAGE="quay.io/mariadb-foundation/bb-master:master"
;;
*)
err "Unknown environment: $ENVIRONMENT. Use DEV or PROD."
;;
esac
mkdir -p master-credential-provider
[[ -f master-private.cfg ]] ||
ln -s master-private.cfg-sample master-private.cfg
[[ -f master-config.yaml ]] ||
ln -s master-config.yaml-sample master-config.yaml
if command -v podman >/dev/null; then
RUNC=podman
else
if command -v docker >/dev/null; then
RUNC=docker
else
err "need a container system (docker/podman)"
fi
fi
command -v python3 >/dev/null ||
err "python3 command not found"
python3 define_masters.py
echo "Checking master.cfg"
$RUNC run -i -v "$(pwd):/srv/buildbot/master" \
-w /srv/buildbot/master \
$IMAGE \
buildbot checkconfig master.cfg
echo -e "done\n"
# not checking libvirt config file (//TEMP we need to find a solution
# to not check ssh connection)
for dir in autogen/* \
master-bintars \
master-docker-nonstandard \
master-docker-nonstandard-2 \
master-galera \
master-nonlatent \
master-protected-branches \
master-web; do
echo "Checking $dir/master.cfg"
$RUNC run -i -v "$(pwd):/srv/buildbot/master" \
-w /srv/buildbot/master \
$IMAGE \
bash -c "cd $dir && buildbot checkconfig master.cfg"
echo -e "done\n"
done