From 5f091946c9a085c17e24bae3b98e4d0ccf46c200 Mon Sep 17 00:00:00 2001
From: Wouter Deconinck <wdconinc@gmail.com>
Date: Wed, 28 Aug 2024 21:27:29 +0000
Subject: [PATCH] fix(ci): better attempts handling

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

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index acee1860c..8c24f301a 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -270,7 +270,7 @@ base:
     - version
   script:
     - attempts=0
-    - while test ${attempts} -lt 2 && !
+    - while !
       docker buildx build --push ${BUILD_OPTIONS}
                    --tag ${CI_REGISTRY}/${CI_PROJECT_PATH}/${BUILD_IMAGE}:${INTERNAL_TAG}
                    ${EXPORT_TAG:+
@@ -291,6 +291,9 @@ base:
         else
           exit 1 ;
         fi ;
+        if test ${attempts} -ge 1 ; then
+          exit 1 ;
+        fi ;
         let attempts=$attempts+1 ;
       done
 
@@ -356,7 +359,7 @@ eic:
       export SPACK_VERSION ;
       cat mirrors.yaml.in | envsubst > mirrors.yaml
     - attempts=0
-    - while test ${attempts} -lt 2 && !
+    - while !
       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}
@@ -448,6 +451,9 @@ eic:
         else
           exit 1 ;
         fi ;
+        if test ${attempts} -ge 1 ; then
+          exit 1 ;
+        fi ;
         let attempts=$attempts+1 ;
       done
 
-- 
GitLab