From d2d8290752e8d5c449725f7848c0ee29afdc3ba6 Mon Sep 17 00:00:00 2001
From: Rohit Gupta <rohit.gupta@eurecom.fr>
Date: Sun, 14 Aug 2016 12:03:00 +0200
Subject: [PATCH] Gitlab CI: command to retry git clone in case of network
 failure

---
 cmake_targets/autotests/tools/git-retry.sh | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
 create mode 100755 cmake_targets/autotests/tools/git-retry.sh

diff --git a/cmake_targets/autotests/tools/git-retry.sh b/cmake_targets/autotests/tools/git-retry.sh
new file mode 100755
index 0000000000..0645646b74
--- /dev/null
+++ b/cmake_targets/autotests/tools/git-retry.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+#Simple script to retry git clone in case of failure
+
+REALGIT=/usr/bin/git
+
+RETRIES=10
+DELAY=10
+COUNT=1
+while [ $COUNT -lt $RETRIES ]; do
+  $REALGIT $*
+  if [ $? -eq 0 ]; then
+    RETRIES=0
+    break
+  fi
+  let COUNT=$COUNT+1
+  sleep $DELAY
+done
-- 
GitLab