From 33404a777295d39ccbfa5e2133f59e52930beced Mon Sep 17 00:00:00 2001 From: Attilio Borello Date: Tue, 9 May 2017 09:19:12 +0200 Subject: [PATCH 1/2] added retry function to tests script --- .semaphoreci/tests.sh | 3 ++- .semaphoreci/vars | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/.semaphoreci/tests.sh b/.semaphoreci/tests.sh index 15bb0fa6b..2a586ccf6 100755 --- a/.semaphoreci/tests.sh +++ b/.semaphoreci/tests.sh @@ -1,5 +1,6 @@ #!/usr/bin/env bash set -e -make test-unit && make test-integration +make test-unit +ci_retry make test-integration make -j${N_MAKE_JOBS} crossbinary-default-parallel diff --git a/.semaphoreci/vars b/.semaphoreci/vars index a17eabb76..5d2eb94ed 100644 --- a/.semaphoreci/vars +++ b/.semaphoreci/vars @@ -17,3 +17,25 @@ fi export CODENAME=raclette export N_MAKE_JOBS=2 + + +function ci_retry { + + local NRETRY=3 + local NSLEEP=5 + local n=0 + + until [ $n -ge $NRETRY ] + do + "$@" && break + n=$[$n+1] + echo "$@ failed, attempt ${n}/${NRETRY}" + sleep $NSLEEP + done + + [ $n -lt $NRETRY ] + +} + +export -f ci_retry + From eeed035ef0d0142ec6a0d3339f1d28cfa64818bf Mon Sep 17 00:00:00 2001 From: Attilio Borello Date: Fri, 12 May 2017 16:27:16 +0200 Subject: [PATCH 2/2] added retry function to validate script --- .semaphoreci/setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.semaphoreci/setup.sh b/.semaphoreci/setup.sh index 56bb0169d..e8c6e1e2e 100755 --- a/.semaphoreci/setup.sh +++ b/.semaphoreci/setup.sh @@ -8,4 +8,4 @@ docker version pip install --user -r requirements.txt make pull-images -make validate +ci_retry make validate