.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()
Konstantinos Natsakis committed
Nov 1, 2019 at 11:38 UTC
2657f911421a8c4861abf8ebc3a51700bdf34524
2 files changed
+31
-5
.travis.yml
+4
-5
@@ -10,7 +10,8 @@ matrix:
10
allow_failures:
11
- env: ALLOW_SOFT_FAILURE_HERE=true
12
13
-
13
+before_install:
14
+ - source .travis/utils.sh
15
16
# Install dependencies for all, once
17
#
@@ -493,10 +494,9 @@ jobs:
494
- echo "Last commit:" && git log -1
495
- echo "GIT Describe:" && git describe
496
- echo "packaging/version:" && cat packaging/version
496
- - docker info
497
- packaging/docker/check_login.sh
498
&& 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
500
&& packaging/docker/publish.sh
501
after_failure: post_message "TRAVIS_MESSAGE" "<!here> Docker image publishing failed"
502
@@ -591,9 +591,8 @@ jobs:
591
- echo "Last commit:" && git log -1
592
- echo "GIT Describe:" && git describe
593
- echo "packaging/version:" && cat packaging/version
594
- - docker info
594
- packaging/docker/check_login.sh
596
- && travis_wait 20 packaging/docker/build.sh
595
+ && tick packaging/docker/build.sh
596
&& packaging/docker/publish.sh
597
after_failure: post_message "TRAVIS_MESSAGE" "<!here> Nightly docker image publish failed"
598
.travis/utils.sh
new
+27
@@ -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
+}