From 2a104c52aee099546949551b48704631a456dfb4 Mon Sep 17 00:00:00 2001
From: Wouter Deconinck <wdconinc@gmail.com>
Date: Tue, 27 Aug 2024 20:38:41 +0000
Subject: [PATCH] fix: limit --no-cache retries to 1

---
 .gitlab-ci.yml | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 53767473a..acee1860c 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -269,7 +269,8 @@ base:
   needs:
     - version
   script:
-    - while !
+    - attempts=0
+    - while test ${attempts} -lt 2 && !
       docker buildx build --push ${BUILD_OPTIONS}
                    --tag ${CI_REGISTRY}/${CI_PROJECT_PATH}/${BUILD_IMAGE}:${INTERNAL_TAG}
                    ${EXPORT_TAG:+
@@ -289,7 +290,8 @@ base:
           BUILD_OPTIONS="--no-cache ${BUILD_OPTIONS}" ;
         else
           exit 1 ;
-        fi
+        fi ;
+        let attempts=$attempts+1 ;
       done
 
 
@@ -353,7 +355,8 @@ eic:
       source eic-spack.sh ;
       export SPACK_VERSION ;
       cat mirrors.yaml.in | envsubst > mirrors.yaml
-    - while !
+    - attempts=0
+    - while test ${attempts} -lt 2 && !
       docker buildx build --push ${BUILD_OPTIONS}
                    --tag ${CI_REGISTRY}/${CI_PROJECT_PATH}/${BUILD_IMAGE}${ENV}:${INTERNAL_TAG}-${BUILD_TYPE}
                    --tag ${CI_REGISTRY}/${CI_PROJECT_PATH}/${BUILD_IMAGE/eic/jug}${ENV}:${INTERNAL_TAG}-${BUILD_TYPE}
@@ -444,7 +447,8 @@ eic:
           BUILD_OPTIONS="--no-cache ${BUILD_OPTIONS}" ;
         else
           exit 1 ;
-        fi
+        fi ;
+        let attempts=$attempts+1 ;
       done
 
 .singularity:
-- 
GitLab