Skip to content

Commit 69853c2

Browse files
authored
Merge pull request #911 from casparvl/if_set_use_tmpdir
Make sure that the TMPDIR is used as STORAGE if it is set
2 parents f3fe933 + bc119ee commit 69853c2

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

bot/build.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,15 @@ if [[ ! -z ${SINGULARITY_CACHEDIR} ]]; then
9090
export SINGULARITY_CACHEDIR
9191
fi
9292

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

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

eessi_container.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,15 @@ BIND_PATHS="${EESSI_CVMFS_VAR_LIB}:/var/lib/cvmfs,${EESSI_CVMFS_VAR_RUN}:/var/ru
529529

530530
# provide a '/tmp' inside the container
531531
BIND_PATHS="${BIND_PATHS},${EESSI_TMPDIR}:${TMP_IN_CONTAINER}"
532+
533+
# if TMPDIR is not empty and if TMP_IN_CONTAINER is not a prefix of TMPDIR, we need to add a bind mount for TMPDIR
534+
if [[ ! -z ${TMPDIR} && ${TMP_IN_CONTAINER} != ${TMPDIR}* ]]; then
535+
msg="TMPDIR is not empty (${TMPDIR}) and TMP_IN_CONTAINER (${TMP_IN_CONTAINER}) is not a prefix of TMPDIR:"
536+
msg="${msg} adding bind mount for TMPDIR"
537+
echo "${msg}"
538+
BIND_PATHS="${BIND_PATHS},${TMPDIR}"
539+
fi
540+
532541
if [[ ! -z ${EXTRA_BIND_PATHS} ]]; then
533542
BIND_PATHS="${BIND_PATHS},${EXTRA_BIND_PATHS}"
534543
fi

0 commit comments

Comments
 (0)