From b9e33a7f51b19811e4cb68cbf29c206fdeeea063 Mon Sep 17 00:00:00 2001
From: Sylvester Joosten <sjoosten@anl.gov>
Date: Mon, 23 Aug 2021 00:37:29 +0000
Subject: [PATCH] Add functionality to force no-cache build in CI

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

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 4e7c54d39..2b0015616 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -30,6 +30,9 @@ variables:
   ## is this nightly or not?
   NIGHTLY: 0
 
+  ## Force a rebuild without using cache
+  FORCE_NOCACHE: 0
+
 stages:
   - config
   - build:base      ## base OS image
@@ -191,6 +194,11 @@ 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
+    - |
+      if [ $FORCE_NOCACHE = 1 ]; then
+        echo "FORCE_NOCACHE set"
+        export PACKAGE_HASH=`date +%s`
+      fi   
     ## Optionally build the raw builder image
     - test ${EXPORT_BUILDER} = 1 && docker build 
                    -t ${CI_REGISTRY_IMAGE}/${BUILD_IMAGE}:builder-${INTERNAL_TAG} 
-- 
GitLab