From 11ae4531e85fe88ef1a1ce41ed802ce541029a1c Mon Sep 17 00:00:00 2001
From: Eleni Mathioulaki <emathioulaki@athenarc.gr>
Date: Fri, 21 Feb 2025 12:04:43 +0100
Subject: [PATCH] fix(CI): find correct upstream prefix when it's padded

---
 install_spack_env.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/install_spack_env.sh b/install_spack_env.sh
index e0cd249f..4917a134 100644
--- a/install_spack_env.sh
+++ b/install_spack_env.sh
@@ -48,10 +48,12 @@ fi
 
 if [[ $UPSTREAM_INSTANCE ]]
 then
+  UPSTREAM_PREFIX=$(find $UPSTREAM_INSTANCE/spack/opt/spack/ -type d -name ".spack-db" 2>/dev/null | xargs -I {} dirname {})
+  echo $UPSTREAM_PREFIX
   cat <<EOF > ${CI_SPACK_ROOT}/etc/spack/defaults/upstreams.yaml
 upstreams:
   upstream-spack-instance:
-    install_tree: $UPSTREAM_INSTANCE/spack/opt/spack
+    install_tree: $UPSTREAM_PREFIX
 EOF
 fi
 
-- 
GitLab