Skip to content

Commit

Permalink
Preloading oras://ghcr.io images via CURL
Browse files Browse the repository at this point in the history
  • Loading branch information
maouw committed Oct 28, 2023
1 parent 627e6f5 commit ba5532a
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions hyakvnc
Original file line number Diff line number Diff line change
Expand Up @@ -1072,19 +1072,14 @@ function cmd_create {

# Preload ORAS images if requested:
if [[ "${HYAKVNC_APPTAINER_GHCR_ORAS_PRELOAD:-1}" == 1 ]]; then
local oras_image_path oras_cache_dir
local oras_cache_dir
oras_cache_dir="${APPTAINER_CACHEDIR:-${HOME}/.apptainer/cache}/cache/oras"
if mkdir -p "${oras_cache_dir}"; then
log INFO "Preloading ORAS image for \"${HYAKVNC_APPTAINER_CONTAINER}\""
oras_image_path="$(ghcr_get_oras_sif "${HYAKVNC_APPTAINER_CONTAINER}" "${APPTAINER_CACHEDIR}/cache/oras" || true)"
ghcr_get_oras_sif "${HYAKVNC_APPTAINER_CONTAINER}" "${APPTAINER_CACHEDIR}/cache/oras" || log ERROR "hyakvnc failed to preload ORAS image for \"${HYAKVNC_APPTAINER_CONTAINER:-}\" on its own. Apptainer will try to download the image by itself. If you don't want to preload ORAS images, use the --no-ghcr-oras-preload option."
else
log ERROR "Failed to create directory ${oras_cache_dir}."
fi
if [[ -n "${oras_image_path:-}" ]]; then
log INFO "Preloaded ORAS image for \"${HYAKVNC_APPTAINER_CONTAINER}\""
else
log ERROR "hyakvnc failed to preload ORAS image for \"${HYAKVNC_APPTAINER_CONTAINER:-}\" on its own. Apptainer will try to download the image by itself. If you don't want to preload ORAS images, use the --no-ghcr-oras-preload option."
fi
fi

export HYAKVNC_SLURM_JOB_NAME="${HYAKVNC_SLURM_JOB_PREFIX}${container_name}"
Expand Down Expand Up @@ -1261,6 +1256,7 @@ function cmd_create {
}
# Stop trapping the signals:
[[ -z "${XNOTRAP:-}" ]] && trap - SIGINT SIGTERM SIGHUP SIGABRT SIGQUIT ERR EXIT
kill -TERM %tail 2>/dev/null # Stop following the SLURM log file
return 0
}

Expand Down

0 comments on commit ba5532a

Please sign in to comment.