From 103cb510b0f7dad96ce211d0e0667df9a36d8e35 Mon Sep 17 00:00:00 2001
From: Nicolas Richart <nicolas.richart@epfl.ch>
Date: Tue, 23 Jul 2024 11:29:16 +0200
Subject: [PATCH] Moving data to /work since they should not be deleted

---
 .gitlab-ci.yml         | 10 +---------
 ci/prepare_squashfs.sh |  7 ++++++-
 2 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 2d63fef..076e2fd 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -17,7 +17,7 @@ workflow:
 
 variables:
   TERM: ansi
-  CI_DATA: "/scratch/richart/ci"
+  CI_DATA: "/work/scitas-ge/richart/ci"
 
 .parallel_definition:
   parallel:
@@ -102,14 +102,6 @@ spack:checkout:
   before_script:
     - git config --global --add --bool advice.detachedHead false
   script:
-    # - |
-    #   for i in overlayfs squashfs-cache buildcache spack-mirror
-    #   do
-    #     if [ ! -e ${CI_DATA}/$i ]
-    #     then
-    #       mkdir -p ${CI_DATA}/$i
-    #     fi
-    #   done
     - ./ci/prepare_squashfs.sh
   timeout: 1h
 
diff --git a/ci/prepare_squashfs.sh b/ci/prepare_squashfs.sh
index e25e459..be78be6 100755
--- a/ci/prepare_squashfs.sh
+++ b/ci/prepare_squashfs.sh
@@ -2,7 +2,7 @@
 
 set -o pipefail
 set -o nounset
-
+set -o errexit
 source ${CI_PROJECT_DIR}/ci/stack_env.sh
 
 for i in overlayfs squashfs-cache buildcache spack-mirror
@@ -13,6 +13,8 @@ do
     fi
 done
 
+
+set +o errexit
 # Check if MR as squashfs
 sqfs_image=$(ls -t1 ${CI_DATA}/squashfs-cache/${stack}-${environment}-${squash_id}*.sqfs 2> /dev/null | head -1)
 if [ $? -ne 0 ]
@@ -31,6 +33,8 @@ then
         echo "Found ${sqfs_base_image}"
     fi
 
+    set -o errexit
+
     # Link MR sqaushfs to the one of default branch
     sqfs_image=${CI_DATA}/squashfs-cache/${stack}-${environment}-${squash_id}.sqfs
 
@@ -40,6 +44,7 @@ then
 
     echo "Linking ${sqfs_image} -> ${sqfs_base_image}"
 else
+    set -o errexit
     if [ ${sqfs_image} != ${CI_DATA}/squashfs-cache/${stack}-${environment}-${squash_id}.sqfs ];
     then
         cd ${CI_DATA}/squashfs-cache
-- 
GitLab