From d7f4afa2178e4d06a9e7fa8759ba82202833adf9 Mon Sep 17 00:00:00 2001
From: Wouter Deconinck <wdconinc@gmail.com>
Date: Wed, 4 Sep 2024 23:58:32 +0000
Subject: [PATCH] fix(ci): don't modify $BUILD_OPTIONS; use $nocache

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

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index eadebb1cf..48f13eebd 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -270,8 +270,9 @@ base:
     - version
   script:
     - attempts=0
+    - nocache=""
     - while !
-      docker buildx build --push ${BUILD_OPTIONS}
+      docker buildx build --push ${BUILD_OPTIONS} ${nocache}
                    --tag ${CI_REGISTRY}/${CI_PROJECT_PATH}/${BUILD_IMAGE}:${INTERNAL_TAG}
                    ${EXPORT_TAG:+
                      ${CI_PUSH:+--tag ${CI_REGISTRY}/${CI_PROJECT_PATH}/${BUILD_IMAGE}:${EXPORT_TAG}}
@@ -287,7 +288,7 @@ base:
                    2>&1 | tee build.log
       ; do
         if grep "unknown blob" build.log ; then
-          BUILD_OPTIONS="--no-cache ${BUILD_OPTIONS}" ;
+          nocache="--no-cache" ;
         else
           exit 1 ;
         fi ;
@@ -360,8 +361,9 @@ eic:
       export SPACK_VERSION ;
       cat mirrors.yaml.in | envsubst > mirrors.yaml
     - attempts=0
+    - nocache=""
     - while !
-      docker buildx build --push ${BUILD_OPTIONS}
+      docker buildx build --push ${BUILD_OPTIONS} ${nocache}
                    --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}
                    ${EXPORT_TAG:+
@@ -448,7 +450,7 @@ eic:
                    2>&1 | tee build.log
       ; do
         if grep "unknown blob" build.log ; then
-          BUILD_OPTIONS="--no-cache-filter spack,builder,staging,runtime ${BUILD_OPTIONS}" ;
+          nocache="--no-cache" ;
         else
           exit 1 ;
         fi ;
-- 
GitLab