Merge pull request #1573 from atbore-phx/ci-retry-tests
[CI] retry function
This commit is contained in:
commit
8a551d91fd
3 changed files with 25 additions and 2 deletions
|
@ -8,4 +8,4 @@ docker version
|
||||||
pip install --user -r requirements.txt
|
pip install --user -r requirements.txt
|
||||||
|
|
||||||
make pull-images
|
make pull-images
|
||||||
make validate
|
ci_retry make validate
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
make test-unit && make test-integration
|
make test-unit
|
||||||
|
ci_retry make test-integration
|
||||||
make -j${N_MAKE_JOBS} crossbinary-default-parallel
|
make -j${N_MAKE_JOBS} crossbinary-default-parallel
|
||||||
|
|
|
@ -17,3 +17,25 @@ fi
|
||||||
export CODENAME=raclette
|
export CODENAME=raclette
|
||||||
|
|
||||||
export N_MAKE_JOBS=2
|
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
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue