Skip to content

Commit c8c0ce1

Browse files
author
Caspar van Leeuwen
committed
Merge branch 'if_set_use_tmpdir' into merge_pr908_pr910_pr911
2 parents 3ca81d9 + 174354a commit c8c0ce1

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

bot/build.sh

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,23 @@ 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}
101105

106+
# Make sure ${STORAGE} gets bind-mounted
107+
# This will make sure that any subsequent jobs that create dirs or files under STORAGE have access to it in the container
108+
export SINGULARITY_BIND="${SINGULARITY_BIND},${STORAGE}"
109+
102110
# make sure the base tmp storage is unique
103111
JOB_STORAGE=$(mktemp --directory --tmpdir=${STORAGE} bot_job_tmp_XXX)
104112
echo "bot/build.sh: created unique base tmp storage directory at ${JOB_STORAGE}"
@@ -288,6 +296,9 @@ else
288296
TARBALL_STEP_ARGS+=("--resume" "${REMOVAL_TMPDIR}")
289297
fi
290298

299+
# Make sure we define storage, so that the TMPDIR is set to this in eessi_container.sh
300+
TARBALL_STEP_ARGS+=("--storage" "${STORAGE}")
301+
291302
timestamp=$(date +%s)
292303
# to set EESSI_VERSION we need to source init/eessi_defaults now
293304
source $software_layer_dir/init/eessi_defaults

0 commit comments

Comments
 (0)