Skip to content

Commit

Permalink
first draft of supporting unpacked images on cvmfs
Browse files Browse the repository at this point in the history
basic idea is just to symlink the unpacked image into our .denv/images
cache so that the running infrastructure does not need to change. The
existence-checking needs to be lighted to existence of any type of file
since the unpacked images are symlinks or directories and not single
files.
  • Loading branch information
tomeichlersmith committed Jul 10, 2023
1 parent 863199f commit e53581f
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions denv
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ _denv_image_exists() {
;;
apptainer|singularity)
[ -d "${denv_image_cache}" ] || return 1;
test -f "${denv_image_cache}/$(_denv_image_to_filename).sif"
test -e "${denv_image_cache}/$(_denv_image_to_filename).sif"
return $?
;;
norunner)
Expand Down Expand Up @@ -154,12 +154,24 @@ _denv_pull() {
apptainer|singularity)
[ -d "${denv_image_cache}" ] || mkdir -p "${denv_image_cache}"
sif_file="${denv_image_cache}/$(_denv_image_to_filename).sif"
image_full="${denv_image}"
echo "${denv_image}" | grep -v '://' && image_full="docker://${denv_image}"
${denv_runner} build \
--force \
"${sif_file}" \
"${image_full}"
if [ -e "${denv_image}" ]; then
_denv_info "This path exists on the filesystem, assuming unpacked image."
# if the passed image is a file system path,
# we assume it is an already unpacked image
# and so we just symlink to it in our cache
ln -s "${denv_image}" "${sif_file}"
else
_denv_info "Image does not exist on filesystem, assuming registry tag."
# passed image is not a file so we assume it
# is the name of an image in some remote registry
# using the docker:// registry as default
image_full="${denv_image}"
echo "${denv_image}" | grep -v '://' && image_full="docker://${denv_image}"
${denv_runner} build \
--force \
"${sif_file}" \
"${image_full}"
fi
;;
norunner)
mkdir -p "${denv_image_cache}"
Expand Down

0 comments on commit e53581f

Please sign in to comment.