diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index acee1860ced2b8637be96546725decd95c3062ff..8c24f301a628a2b03b7eeef80308304567cd9cca 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