Skip to content

Commit

Permalink
[build] Retry docker pull (#80432)
Browse files Browse the repository at this point in the history
Signed-off-by: Tyler Smalley <[email protected]>
  • Loading branch information
Tyler Smalley authored Oct 14, 2020
1 parent dbb8da8 commit c39581d
Showing 1 changed file with 27 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,33 @@ function generator({
#
set -euo pipefail
docker pull ${baseOSImage}
retry_docker_pull() {
image=$1
attempt=0
max_retries=5
while true
do
attempt=$((attempt+1))
if [ $attempt -gt $max_retries ]
then
echo "Docker pull retries exceeded, aborting."
exit 1
fi
if docker pull "$image"
then
echo "Docker pull successful."
break
else
echo "Docker pull unsuccessful, attempt '$attempt'."
fi
done
}
retry_docker_pull ${baseOSImage}
echo "Building: kibana${imageFlavor}${ubiImageFlavor}-docker"; \\
docker build -t ${imageTag}${imageFlavor}${ubiImageFlavor}:${version} -f Dockerfile . || exit 1;
Expand Down

0 comments on commit c39581d

Please sign in to comment.