From ca3b4f9c3a231f27541a35e4a72837a6b86ccd9d Mon Sep 17 00:00:00 2001
From: Sylvester Joosten <sjoosten@anl.gov>
Date: Mon, 22 Nov 2021 17:01:42 +0000
Subject: [PATCH] Just use --no-cache option when building FORCE_NOCACHE mode

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

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 863bb7c51..c2f76ba3e 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -193,13 +193,14 @@ jug_dev:default:
     ## move spacke directory and spack.yaml into the container build directory
     - cp -r spack containers/jug
     - cp -r spack.yaml containers/jug/spack/spack.yaml
+    - CACHE_FLAG=""
     - |
       if [ $FORCE_NOCACHE = 1 ]; then
         echo "FORCE_NOCACHE set"
-        export PACKAGE_HASH=`date +%s`
+        export CACHE_FLAG="--no-cache"
       fi   
     ## Optionally build the raw builder image
-    - test ${EXPORT_BUILDER} = 1 && docker build 
+    - test ${EXPORT_BUILDER} = 1 && docker build ${CACHE_FLAG}
                    -t ${CI_REGISTRY_IMAGE}/${BUILD_IMAGE}:builder-${INTERNAL_TAG} 
                    --target=builder
                    -f containers/jug/dev.Dockerfile
@@ -209,7 +210,7 @@ jug_dev:default:
                    --build-arg JUG_VERSION=${INTERNAL_TAG}-$(git rev-parse HEAD)
                    containers/jug
     ## now build our image
-    - docker build -t ${CI_REGISTRY_IMAGE}/${BUILD_IMAGE}:${INTERNAL_TAG} 
+    - docker build -t ${CI_REGISTRY_IMAGE}/${BUILD_IMAGE}:${INTERNAL_TAG} ${CACHE_FLAG}
                    -f containers/jug/dev.Dockerfile
                    --build-arg SPACK_VERSION=${SPACK_VERSION}
                    --build-arg CACHE_BUST=${PACKAGE_HASH}
-- 
GitLab