forked from Graylog2/graylog-ansible-role
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtravis.sh
executable file
·39 lines (33 loc) · 972 Bytes
/
travis.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
#!/usr/bin/bash
source $VIRTUAL_ENV/bin/activate
set -x
set -e
retry()
{
set +e
local result=0
local count=1
local retry_max=3
while [[ "${count}" -le "${retry_max}" ]]; do
[[ "${result}" -ne 0 ]] && {
echo -e "\\n${ANSI_RED}The command \"${*}\" failed. Retrying, ${count} of ${retry_max}.${ANSI_RESET}\\n" >&2
}
#run the command in a way that doesn't disable setting `errexit`
"${@}"
result="${?}"
if [[ $result -eq 0 ]]; then break; fi
count="$((count + 1))"
sleep 1
done
[[ "${count}" -gt "${retry_max}" ]] && {
echo -e "\\n${ANSI_RED}The command \"${*}\" failed ${retry_max} times.${ANSI_RESET}\\n" >&2
}
set -e
return "${result}"
}
while sleep 9m; do echo "=====[ $SECONDS seconds still running ]====="; done & #Bypass Travis CI's 10 minute timeout by printing to stdout every 9 minutes.
molecule create
retry molecule converge
molecule verify
molecule destroy
kill %1 #Kill background sleep loop