From eea787d3a404c56debf9cf982f2899b729acff3d Mon Sep 17 00:00:00 2001 From: Philipp Spilger <philipp.spilger@kip.uni-heidelberg.de> Date: Fri, 10 Sep 2021 18:19:49 +0200 Subject: [PATCH] Allow update build cache to run with container image paths of host user * spack user typically won't be allowed to read the file or its dirname Change-Id: If54bb738a78e5c70e4b074379b091202c42544c3 --- .ci/update_build_cache.sh | 4 ++-- .ci/update_build_cache_in_container.sh | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.ci/update_build_cache.sh b/.ci/update_build_cache.sh index 04cb514f..bac58999 100755 --- a/.ci/update_build_cache.sh +++ b/.ci/update_build_cache.sh @@ -35,7 +35,7 @@ source "${SOURCE_DIR}/commons.sh" # update script inside the container set +e # Arugments needed once we switch to singularity3: --writable-tmpfs -sudo -Eu spack singularity exec\ +sudo -E singularity exec\ -B "${BUILD_CACHE_OUTSIDE}:${BUILD_CACHE_INSIDE}:rw"\ "${IMAGE_NAME}" \ - /opt/spack_install_scripts/update_build_cache_in_container.sh -q || exit 0 + sudo -Eu spack /opt/spack_install_scripts/update_build_cache_in_container.sh -q || exit 0 diff --git a/.ci/update_build_cache_in_container.sh b/.ci/update_build_cache_in_container.sh index 38a4e421..2371d59f 100755 --- a/.ci/update_build_cache_in_container.sh +++ b/.ci/update_build_cache_in_container.sh @@ -82,6 +82,9 @@ if (( quiet == 1 )); then args_progress="" fi +# find requires current working directory to be readable by spack user +cd ${MY_SPACK_FOLDER} + get_hashes_to_store \ | parallel -r ${args_progress} -j$(nproc) \ tar Pcfz "${destination_folder}/{}.tar.gz" \"\$\(spack location -i /{}\)\" -- GitLab