Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormattab <matthieu.aubry@gmail.com>2014-04-30 15:02:48 +0400
committermattab <matthieu.aubry@gmail.com>2014-04-30 15:02:48 +0400
commit5f168c7acdd8f51a186c1c76fb79ce5aa3b199dd (patch)
tree20b54dc36c10da9345fde119b049ae6ebcc2ab82 /tests/angularjs
parent4c6b37239501349011d8d4e7320f3856afa968f7 (diff)
Prevent some random build failures when connectivity fails, by calling travis_retry which retries up to 3 times
https://travis-ci.org/piwik/piwik/jobs/23570274 https://travis-ci.org/piwik/piwik/jobs/23912462 http://blog.travis-ci.com/2013-05-20-network-timeouts-build-retries/
Diffstat (limited to 'tests/angularjs')
-rwxr-xr-xtests/angularjs/scripts/install-ubuntu.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/angularjs/scripts/install-ubuntu.sh b/tests/angularjs/scripts/install-ubuntu.sh
index b16894061a..d0e319d81b 100755
--- a/tests/angularjs/scripts/install-ubuntu.sh
+++ b/tests/angularjs/scripts/install-ubuntu.sh
@@ -1,3 +1,26 @@
+# Prevent random build failures by retrying 3 times
+# Source: https://github.com/travis-ci/travis-build/blob/fc4ae8a2ffa1f2b3a2f62533bbc4f8a9be19a8ae/lib/travis/build/script/templates/header.sh#L104
+travis_retry() {
+ local result=0
+ local count=1
+ while [ $count -le 3 ]; do
+ [ $result -ne 0 ] && {
+ echo -e "\n${RED}The command \"$@\" failed. Retrying, $count of 3.${RESET}\n" >&2
+ }
+ "$@"
+ result=$?
+ [ $result -eq 0 ] && break
+count=$(($count + 1))
+ sleep 1
+ done
+
+ [ $count -eq 3 ] && {
+ echo "\n${RED}The command \"$@\" failed 3 times.${RESET}\n" >&2
+ }
+
+ return $result
+}
+
DIR=`dirname $0`
cd $DIR
travis_retry sudo apt-get -qq install python-software-properties