blob: 4949cb2c8802e907bd3de3382111e4e15d51110a (
plain)
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
|
#!/bin/bash
set -o errexit
set -o nounset
set -o pipefail
echo "Detecting requested OpenStack branch and topology type in gerrit comment"
parsed_comment=$(echo $GERRIT_EVENT_COMMENT_TEXT | sed -n 's/^.*check-opnfv\s*//p')
parsed_comment=$(echo $parsed_comment | sed -n 's/\s*$//p')
if [ ! -z "$parsed_comment" ]; then
if echo $parsed_comment | grep -E '^[a-z]+-(no)?ha'; then
IFS='-' read -r -a array <<< "$parsed_comment"
os_version=${array[0]}
topo=${array[1]}
echo "OS version detected in gerrit comment: ${os_version}"
echo "Topology type detected in gerrit comment: ${topo}"
else
echo "Invalid format given for scenario in gerrit comment: ${parsed_comment}...aborting"
exit 1
fi
else
echo "No scenario given in gerrit comment, will use default (master OpenStack, noha)"
os_version='master'
topo='noha'
fi
echo "Writing variables to file"
cat > detected_snapshot << EOI
OS_VERSION=$os_version
TOPOLOGY=$topo
SNAP_CACHE=$HOME/snap_cache/$os_version/$topo
EOI
|