diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 94348700e0b246858ce9babe8707f164f49f5519..4008237fb529b0e473728b10fdfa4d8617fe97e8 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -53,7 +53,9 @@ variables:
   cache:
     key: ${environment}-spack-cache
     policy: pull-push
-    untracked: true
+    paths:
+      - stack
+
 # ------------------------------------------------------------------------------
 # ------------------------------------------------------------------------------
 spack:checkout:
@@ -102,6 +104,7 @@ spack:concretize:
     - .parallel_job
   script:
     - source stack_env.sh
+    - cd ${STACK_LOCATION}/${stack}
     - spack/bin/spack -e ${SPACK_SYSTEM_CONFIG_PATH} config blame
     - spack/bin/spack -e ${SPACK_SYSTEM_CONFIG_PATH} concretize
   needs:
@@ -118,6 +121,7 @@ spack:install:
     - .parallel_job
   script:
     - source stack_env.sh
+    - cd ${STACK_LOCATION}/${stack}
     - spack/bin/spack -e ${SPACK_SYSTEM_CONFIG_PATH} install
       --log-file spack-install.xml
       --log-format junit
@@ -130,7 +134,7 @@ spack:install:
       /buildcache
   after_script:
     - if [ ! -e spack-install.xml ]; then
-      echo "{}" > spack-install.xml
+        echo "{}" > spack-install.xml
       fi
   needs:
     - job: spack:concretize
diff --git a/ci/install_compilers.sh b/ci/install_compilers.sh
index 155ab614ab22532c3235242380121f2bcdd93b28..2fa0742dbbeca8f08a6401b2c57c6875d8d17d89 100755
--- a/ci/install_compilers.sh
+++ b/ci/install_compilers.sh
@@ -6,8 +6,10 @@ set -o nounset
 
 source ${CI_PROJECT_DIR}/ci/stack_env.sh
 
+export spack_location=${STACK_LOCATION}/${stack}
+
 echo "Getting system compiler"
-${STACK_LOCATION}/spack/bin/spack compiler find --scope system /usr
+${spack_location}/spack/bin/spack compiler find --scope system /usr
 
 for c in  "core_compilers" "compilers"; do
     echo "Installing $c"
@@ -17,14 +19,14 @@ for c in  "core_compilers" "compilers"; do
     echo "${_specs}"
 
     if [ "x${_specs}" != "x" ]; then
-        ${STACK_LOCATION}/spack/bin/spack spec \
+        ${spack_location}/spack/bin/spack spec \
             --install-status \
             --namespaces \
             --long \
             --types \
             ${_specs}
 
-        ${STACK_LOCATION}/spack/bin/spack spec \
+        ${spack_location}/spack/bin/spack spec \
             --install-status \
             --namespaces \
             --long \
@@ -32,7 +34,7 @@ for c in  "core_compilers" "compilers"; do
             --json \
             ${_specs} > compilers_spec.json
 
-        ${STACK_LOCATION}/spack/bin/spack install \
+        ${spack_location}/spack/bin/spack install \
             --log-file spack-install.xml \
             --log-format junit \
             --fail-fast \
@@ -42,20 +44,20 @@ for c in  "core_compilers" "compilers"; do
         hashes=$(jq -Mr '.spec.nodes | map("/\(.hash)") | join(" ")' compilers_spec.json)
 
         echo "Adding packages to buildcache"
-        ${STACK_LOCATION}/spack/bin/spack buildcache create \
+        ${spack_location}/spack/bin/spack buildcache create \
             --update-index \
             --key EDC904DCE3D2E84E \
             /buildcache ${hashes}
 
         for compiler_hash in $(echo ${hashes}); do
-            location=$(${STACK_LOCATION}/spack/bin/spack location -i ${compiler_hash})
+            location=$(${spack_location}/spack/bin/spack location -i ${compiler_hash})
             # echo "Checking for compiler"
             # echo "  - ${location}"
             # echo "  - ${location}/compiler/latest"
             # echo "  - ${location}/compiler/latest/linux"
             # echo "  - ${location}/Linux_x86_64/2024/compilers"
 
-            ${STACK_LOCATION}/spack/bin/spack compiler find \
+            ${spack_location}/spack/bin/spack compiler find \
                 --scope system \
                 ${location} \
                 ${location}/compiler/latest \
diff --git a/ci/setup_spack.sh b/ci/setup_spack.sh
index 166990264fa8577cbb922b52f92f537b44e269b3..cbf00d0d187e353709a98814ee60127d58e7fc74 100755
--- a/ci/setup_spack.sh
+++ b/ci/setup_spack.sh
@@ -7,7 +7,7 @@ set -o nounset
 source ${CI_PROJECT_DIR}/ci/stack_env.sh
 
 mkdir -p ${STACK_LOCATION}
-cd ${STACK_LOCATION}
+cd ${STACK_LOCATION}/${stack}
 
 echo "Setting up spack"
 if [ ! -d spack/.git ]; then