Skip to content

Commit 2657f91

Browse files
authored
.travis.yml: Prevent nightly jobs from timing out (again) (netdata#7238)
* .travis.yml: Add tick() and retry() functions * .travis.yml: Remove superfluous 'docker info' commands The docker info command is ran during the install phase. There is no need to run it again * .travis.yml: Use the tick() function instead of travis_wait()
1 parent 590c835 commit 2657f91

File tree

2 files changed

+31
-5
lines changed

2 files changed

+31
-5
lines changed

.travis.yml

+4-5
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ matrix:
1010
allow_failures:
1111
- env: ALLOW_SOFT_FAILURE_HERE=true
1212

13-
13+
before_install:
14+
- source .travis/utils.sh
1415

1516
# Install dependencies for all, once
1617
#
@@ -493,10 +494,9 @@ jobs:
493494
- echo "Last commit:" && git log -1
494495
- echo "GIT Describe:" && git describe
495496
- echo "packaging/version:" && cat packaging/version
496-
- docker info
497497
- packaging/docker/check_login.sh
498498
&& echo "Switching to latest master branch, to pick up tagging if any" && git checkout master && git pull
499-
&& travis_wait 20 packaging/docker/build.sh
499+
&& tick packaging/docker/build.sh
500500
&& packaging/docker/publish.sh
501501
after_failure: post_message "TRAVIS_MESSAGE" "<!here> Docker image publishing failed"
502502

@@ -591,9 +591,8 @@ jobs:
591591
- echo "Last commit:" && git log -1
592592
- echo "GIT Describe:" && git describe
593593
- echo "packaging/version:" && cat packaging/version
594-
- docker info
595594
- packaging/docker/check_login.sh
596-
&& travis_wait 20 packaging/docker/build.sh
595+
&& tick packaging/docker/build.sh
597596
&& packaging/docker/publish.sh
598597
after_failure: post_message "TRAVIS_MESSAGE" "<!here> Nightly docker image publish failed"
599598

.travis/utils.sh

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env bash
2+
3+
# Prevent travis from timing out after 10 minutes of no output
4+
tick() {
5+
(while true; do sleep 300; echo; done) &
6+
local PID=$!
7+
disown
8+
9+
"$@"
10+
local RET=$?
11+
12+
kill $PID
13+
return $RET
14+
}
15+
16+
retry() {
17+
local tries=$1
18+
shift
19+
20+
local i=0
21+
while [ "$i" -lt "$tries" ]; do
22+
"$@" && return 0
23+
sleep $((2**((i++))))
24+
done
25+
26+
return 1
27+
}

0 commit comments

Comments
 (0)