summaryrefslogtreecommitdiff
path: root/tools/ci/scripts/dockerretry.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tools/ci/scripts/dockerretry.sh')
-rwxr-xr-xtools/ci/scripts/dockerretry.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/tools/ci/scripts/dockerretry.sh b/tools/ci/scripts/dockerretry.sh
new file mode 100755
index 000000000..22e38e574
--- /dev/null
+++ b/tools/ci/scripts/dockerretry.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+# skip if we not in docker
+if [[ ${CI_RUNNER_TAGS} != *"docker"* ]]; then
+ echo "Running from shell. Skipping $*"
+ exit 0
+fi
+
+n=0
+
+while true; do
+ $*
+ if [ "$?" == 0 ]; then
+ exit 0
+ fi
+ if [[ $n -ge 10 ]]; then
+ exit -1
+ fi
+ sleep 5s
+ n=$((n+1))
+done