Skip to content

Commit

Permalink
Do bind-mount of TMPDIR in eessi_container instead, and check that th…
Browse files Browse the repository at this point in the history
…e TMP_IN_CONTAINER doesn't already contain that prefix
  • Loading branch information
Caspar van Leeuwen committed Feb 12, 2025
1 parent 174354a commit bc119ee
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
7 changes: 0 additions & 7 deletions bot/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,6 @@ 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 @@ -295,9 +291,6 @@ 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
9 changes: 9 additions & 0 deletions eessi_container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,15 @@ BIND_PATHS="${EESSI_CVMFS_VAR_LIB}:/var/lib/cvmfs,${EESSI_CVMFS_VAR_RUN}:/var/ru

# provide a '/tmp' inside the container
BIND_PATHS="${BIND_PATHS},${EESSI_TMPDIR}:${TMP_IN_CONTAINER}"

# 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
if [[ ! -z ${TMPDIR} && ${TMP_IN_CONTAINER} != ${TMPDIR}* ]]; then
msg="TMPDIR is not empty (${TMPDIR}) and TMP_IN_CONTAINER (${TMP_IN_CONTAINER}) is not a prefix of TMPDIR:"
msg="${msg} adding bind mount for TMPDIR"
echo "${msg}"
BIND_PATHS="${BIND_PATHS},${TMPDIR}"
fi

if [[ ! -z ${EXTRA_BIND_PATHS} ]]; then
BIND_PATHS="${BIND_PATHS},${EXTRA_BIND_PATHS}"
fi
Expand Down

0 comments on commit bc119ee

Please sign in to comment.