Skip to content

Commit

Permalink
[build] Retry docker pull (#80432) (#80774)
Browse files Browse the repository at this point in the history
Signed-off-by: Tyler Smalley <[email protected]>
# Conflicts:
#	src/dev/build/tasks/os_packages/docker_generator/templates/build_docker_sh.template.ts
  • Loading branch information
Tyler Smalley authored Oct 15, 2020
1 parent b4eb14e commit 2e5162f
Showing 1 changed file with 27 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,33 @@ function generator({ imageTag, imageFlavor, versionTag, dockerOutputDir }) {
#
set -euo pipefail
docker pull centos:7
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 "centos:7"
echo "Building: kibana${ imageFlavor }-docker"; \\
docker build -t ${ imageTag }${ imageFlavor }:${ versionTag } -f Dockerfile . || exit 1;
Expand Down

0 comments on commit 2e5162f

Please sign in to comment.