krrish преди 6 години
родител
ревизия
38f3cf3062
променени са 2 файла, в които са добавени 19 реда и са изтрити 6 реда
  1. 19 2
      build/pullToLocal.sh
  2. 0 4
      build/pushToRemote.sh

+ 19 - 2
build/pullToLocal.sh

@@ -50,9 +50,26 @@ if ! systemctl show --property=Environment docker | grep -q HTTP_PROXY; then
 fi
 
 # login remote repo
-docker login -u admin -p "Gocm5]WeqaSufg" registry.svicloud.com &>/dev/null || \
-  { echo "docker login to remote repo failed" && echo && exit 1; } 
+retry=5
+retry_count=0
+while true; do
+    retry_count=`expr $retry_count + 1`
+
+    # 5 times
+    if [ "$retry_count" -ge $retry ]; then
+        echo "login failed for 5 times, exit."
+        echo 
+        exit 1
+    fi
 
+    # login
+    if docker login -u admin -p "Gocm5]WeqaSufg" registry.svicloud.com &>/dev/null; then
+        break
+     else
+        echo "login to remote registry.svicloud.com $retry_count"
+    fi
+done
+  
 
 # pull the remote image
 if docker pull $1; then

+ 0 - 4
build/pushToRemote.sh

@@ -38,10 +38,6 @@ done
 sed -i '/registry.svicloud.com/d' /etc/hosts
 echo "192.168.100.23 registry.svicloud.com" >>/etc/hosts
 
-# comment to use local repo
-sed -i "/^[^#].*registry.svicloud.com/s/^/#/" /etc/hosts
-
-
 # local repository, so no proxy allowed
 if systemctl show --property=Environment docker | grep -q HTTP_PROXY; then
   mkdir -p /etc/systemd/system/docker.service.d/