blob: 77788aa2c1df2e495242150f3ed4739396010a47 (
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
|
#!/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
os_version=${parsed_comment%%"-"*}
topo=${parsed_comment#*"-"}
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
|