Skip to content

Commit

Permalink
allow retry while downloading images (#8232)
Browse files Browse the repository at this point in the history
* allow retry while downloading images

* sleep before retry
  • Loading branch information
stgmsa authored Jul 29, 2024
1 parent fc4c1fd commit 87cbc61
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions containers/manage-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,21 @@ configure_and_check() {
}

pull_images() {
for img in ${CONTAINERS_IMAGES}; do
docker pull -q ${KNK_REGISTRY_URL}/${img}:${TAG_OR_BRANCH_NAME}
RETRY_LIMIT=2
for attempt in $(seq 1 $RETRY_LIMIT); do
for img in ${CONTAINERS_IMAGES}; do
docker pull -q ${KNK_REGISTRY_URL}/${img}:${TAG_OR_BRANCH_NAME}
if [ $? -eq 0 ]; then
break
else
if [ $attempt -le $RETRY_LIMIT ]; then
sleep 3
echo "Retry downloading image: ${KNK_REGISTRY_URL}/${img}:${TAG_OR_BRANCH_NAME}"
else
echo "Failed downloading image: ${KNK_REGISTRY_URL}/${img}:${TAG_OR_BRANCH_NAME}"
fi
fi
done
done
echo "$(date) - Pull of images finished"
}
Expand Down

0 comments on commit 87cbc61

Please sign in to comment.