Skip to content

Commit

Permalink
Function as a groovy sh script
Browse files Browse the repository at this point in the history
  • Loading branch information
addyess committed Feb 8, 2024
1 parent 5e9d8f8 commit 48dc2d4
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions jobs/sync-oci-images/sync-oci-images.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -209,19 +209,20 @@ pipeline {
if [ "$IS_DRY_RUN" = true ] ; then
echo "Dry run; would have pulled: ${i}"
else
# simple retry if initial pull fails
function pull {
lxc exec $LXC_NAME \
--env HTTP_PROXY="${PROXY}" \
--env HTTPS_PROXY="${PROXY}" \
--env CREDS="${PULL_CREDS}" \
-- sh -c 'ctr content fetch ${CREDS} '${1}' --all-platforms > /dev/null';
function pull() {
sudo lxc exec $LXC_NAME \
--env HTTP_PROXY="${PROXY}" \
--env HTTPS_PROXY="${PROXY}" \
--env CREDS="${PULL_CREDS}" \
--env IMAGE=${1} \
-- sh -c 'ctr content fetch ${CREDS} ${IMAGE} --all-platforms > /dev/null';
}
if ! sudo pull ${i}; then
# simple retry if initial pull fails
if ! pull ${i} ; then
echo "Retrying pull ${i}"
sleep 5
sudo pull ${i}
pull ${i}
fi
fi
Expand Down

0 comments on commit 48dc2d4

Please sign in to comment.