Skip to content

Commit

Permalink
Pull oci-images through proxy on the lxd
Browse files Browse the repository at this point in the history
  • Loading branch information
addyess committed Feb 8, 2024
1 parent bc81aab commit 90fabb6
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions jobs/sync-oci-images/sync-oci-images.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -197,16 +197,30 @@ pipeline {
PULL_CREDS=
fi
# Pull Through proxy
if echo ${i} | grep -qi -e 'nvcr.io'
then
PROXY="HTTPS_PROXY=http://squid.internal:3128"
else
PROXY=
fi
# Pull upstream image
if [ "$IS_DRY_RUN" = true ] ; then
echo "Dry run; would have pulled: ${i}"
else
# simple retry if initial pull fails
if ! sudo lxc exec $LXC_NAME -- ctr content fetch ${PULL_CREDS} ${i} --all-platforms >/dev/null
then
echo "Retrying pull"
function pull {
lxc exec $LXC_NAME \
--env PROXY="${PROXY}" \
--env CREDS="${PULL_CREDS}" \
-- sh -c 'ctr content fetch ${CREDS} '${1}' --all-platforms > /dev/null';
}
if ! sudo pull ${i}; then
echo "Retrying pull ${i}"
sleep 5
sudo lxc exec $LXC_NAME -- ctr content fetch ${PULL_CREDS} ${i} --all-platforms >/dev/null
sudo pull ${i}
fi
fi
Expand Down

0 comments on commit 90fabb6

Please sign in to comment.