mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 10:59:59 +00:00
The 'Set up Docker Buildx' step boots BuildKit, which pulls
moby/buildkit from registry-1.docker.io. A transient Docker Hub
timeout there had no retry (only the build step did), so the whole
build job failed at setup.
Pre-pull the BuildKit image with a 7x/20s retry before the buildx
setup, and pin the action to that exact tag via driver-opts. Once the
image is local, buildx falls back to it if the bootstrap pull fails
('pulling failed, using local image'), so a flaky Docker Hub no longer
breaks setup. Applied to both images-build-ci.yml and
release-version.yml.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
25 lines
649 B
Bash
Executable File
25 lines
649 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
image="${1:?Usage: pull_with_retry.sh <image>}"
|
|
max_attempts="${MAX_ATTEMPTS:-7}"
|
|
retry_delay_seconds="${RETRY_DELAY_SECONDS:-20}"
|
|
attempt=1
|
|
|
|
while true; do
|
|
echo "=== docker pull ${image} attempt ${attempt}/${max_attempts} ==="
|
|
if docker pull "${image}"; then
|
|
echo "Pulled ${image} on attempt ${attempt}/${max_attempts}."
|
|
break
|
|
fi
|
|
|
|
if [[ "${attempt}" -ge "${max_attempts}" ]]; then
|
|
echo "Failed to pull ${image} after ${max_attempts} attempts." >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "Attempt ${attempt} failed. Retrying in ${retry_delay_seconds}s..."
|
|
sleep "${retry_delay_seconds}"
|
|
attempt=$((attempt + 1))
|
|
done
|