Skip to content

Commit

Permalink
Merge branch 'if_set_use_tmpdir' into merge_pr908_pr910_pr911
Browse files Browse the repository at this point in the history
  • Loading branch information
Caspar van Leeuwen committed Feb 12, 2025
2 parents 3ca81d9 + 174354a commit c8c0ce1
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions bot/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,23 @@ if [[ ! -z ${SINGULARITY_CACHEDIR} ]]; then
export SINGULARITY_CACHEDIR
fi

echo -n "setting \$STORAGE by replacing any var in '${LOCAL_TMP}' -> "
# replace any env variable in ${LOCAL_TMP} with its
# current value (e.g., a value that is local to the job)
STORAGE=$(envsubst <<< ${LOCAL_TMP})
echo "'${STORAGE}'"
if [[ -z "${TMPDIR}" ]]; then
echo -n "setting \$STORAGE by replacing any var in '${LOCAL_TMP}' -> "
# replace any env variable in ${LOCAL_TMP} with its
# current value (e.g., a value that is local to the job)
STORAGE=$(envsubst <<< ${LOCAL_TMP})
else
STORAGE=${TMPDIR}
fi
echo "bot/build.sh: STORAGE='${STORAGE}'"

# make sure ${STORAGE} exists
mkdir -p ${STORAGE}

# Make sure ${STORAGE} gets bind-mounted
# This will make sure that any subsequent jobs that create dirs or files under STORAGE have access to it in the container
export SINGULARITY_BIND="${SINGULARITY_BIND},${STORAGE}"

# make sure the base tmp storage is unique
JOB_STORAGE=$(mktemp --directory --tmpdir=${STORAGE} bot_job_tmp_XXX)
echo "bot/build.sh: created unique base tmp storage directory at ${JOB_STORAGE}"
Expand Down Expand Up @@ -288,6 +296,9 @@ else
TARBALL_STEP_ARGS+=("--resume" "${REMOVAL_TMPDIR}")
fi

# Make sure we define storage, so that the TMPDIR is set to this in eessi_container.sh
TARBALL_STEP_ARGS+=("--storage" "${STORAGE}")

timestamp=$(date +%s)
# to set EESSI_VERSION we need to source init/eessi_defaults now
source $software_layer_dir/init/eessi_defaults
Expand Down

0 comments on commit c8c0ce1

Please sign in to comment.