.travis.yml: Prevent nightly jobs from timing out (again) (#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()
This commit is contained in:
Konstantinos Natsakis 2019-11-01 11:38:25 +02:00 committed by GitHub
parent 590c835f7d
commit 2657f91142
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 5 deletions

View File

@ -10,7 +10,8 @@ matrix:
allow_failures:
- env: ALLOW_SOFT_FAILURE_HERE=true
before_install:
- source .travis/utils.sh
# Install dependencies for all, once
#
@ -493,10 +494,9 @@ jobs:
- echo "Last commit:" && git log -1
- echo "GIT Describe:" && git describe
- echo "packaging/version:" && cat packaging/version
- docker info
- packaging/docker/check_login.sh
&& echo "Switching to latest master branch, to pick up tagging if any" && git checkout master && git pull
&& travis_wait 20 packaging/docker/build.sh
&& tick packaging/docker/build.sh
&& packaging/docker/publish.sh
after_failure: post_message "TRAVIS_MESSAGE" "<!here> Docker image publishing failed"
@ -591,9 +591,8 @@ jobs:
- echo "Last commit:" && git log -1
- echo "GIT Describe:" && git describe
- echo "packaging/version:" && cat packaging/version
- docker info
- packaging/docker/check_login.sh
&& travis_wait 20 packaging/docker/build.sh
&& tick packaging/docker/build.sh
&& packaging/docker/publish.sh
after_failure: post_message "TRAVIS_MESSAGE" "<!here> Nightly docker image publish failed"

27
.travis/utils.sh Normal file
View File

@ -0,0 +1,27 @@
#!/usr/bin/env bash
# Prevent travis from timing out after 10 minutes of no output
tick() {
(while true; do sleep 300; echo; done) &
local PID=$!
disown
"$@"
local RET=$?
kill $PID
return $RET
}
retry() {
local tries=$1
shift
local i=0
while [ "$i" -lt "$tries" ]; do
"$@" && return 0
sleep $((2**((i++))))
done
return 1
}