Files
aleksey e6c7e65982
CI / test (push) Failing after 1m7s
Deploy IFT (admin) / deploy-ift-admin (push) Failing after 1m30s
CI: robust admin docker build/push on WSL runner.
Use build --load with network=host and retry script like EventHubBack; add deploy concurrency group and 90m timeout.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-10 22:07:34 +03:00

35 lines
813 B
Bash

#!/usr/bin/env bash
# Retry docker/buildx commands on transient network/registry failures.
# Usage: retry-docker-build.sh [max_attempts] [wait_seconds] -- <command...>
set -euo pipefail
MAX="${1:-3}"
WAIT="${2:-30}"
shift 2
[[ "${1:-}" == "--" ]] && shift
if [[ $# -eq 0 ]]; then
echo "Usage: $0 [max_attempts] [wait_seconds] -- <command...>" >&2
exit 2
fi
attempt=1
while true; do
echo "== docker build attempt ${attempt}/${MAX}: $*"
set +e
"$@"
code=$?
set -e
if (( code == 0 )); then
exit 0
fi
if (( attempt >= MAX )); then
echo "== all ${MAX} attempts failed (last exit ${code})"
exit "${code}"
fi
echo "== attempt ${attempt} failed (exit ${code}), retry in ${WAIT}s..."
docker buildx prune -f >/dev/null 2>&1 || true
sleep "${WAIT}"
attempt=$((attempt + 1))
done