From a3af7f823fafb3bd160ea875a779ce91920d8dfd Mon Sep 17 00:00:00 2001 From: Patrick Linnane Date: Tue, 22 Apr 2025 09:07:53 -0700 Subject: [PATCH 1/3] workflows/docker: add retry to image push Signed-off-by: Patrick Linnane --- .github/workflows/docker.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index fd7dc1ded1..07e8164387 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -306,4 +306,13 @@ jobs: image_args+=("ghcr.io/homebrew/ubuntu${VERSION}@sha256:$(<"${RUNNER_TEMP}/digests/${VERSION}-arm64")") fi - docker buildx imagetools create "${tag_args[@]}" "${image_args[@]}" + attempts=0 + until docker buildx imagetools create "${tag_args[@]}" "${image_args[@]}"; do + attempts=$((attempts + 1)) + if [[ $attempts -ge 3 ]]; then + echo "[$(date -u)] ERROR: Failed after 3 attempts." + exit 1 + fi + echo "Push failed (attempt $attempts). Retrying in $((attempts * 5)) seconds..." + sleep $((attempts * 5)) + done From 7ad5460336f26d68c515a4c6b3f01c0b35031bdd Mon Sep 17 00:00:00 2001 From: Patrick Linnane Date: Tue, 22 Apr 2025 09:13:55 -0700 Subject: [PATCH 2/3] Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/docker.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 07e8164387..352424f025 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -310,9 +310,11 @@ jobs: until docker buildx imagetools create "${tag_args[@]}" "${image_args[@]}"; do attempts=$((attempts + 1)) if [[ $attempts -ge 3 ]]; then - echo "[$(date -u)] ERROR: Failed after 3 attempts." + echo "[$(date -u)] ERROR: Failed after 3 attempts." >&2 exit 1 fi - echo "Push failed (attempt $attempts). Retrying in $((attempts * 5)) seconds..." - sleep $((attempts * 5)) + delay=$((2 ** attempts)) + if [[ $delay -gt 60 ]]; then delay=60; fi + echo "Push failed (attempt $attempts). Retrying in ${delay} seconds..." + sleep ${delay} done From ead6c13cf2bcaa840fdc50daf5669cca755142c8 Mon Sep 17 00:00:00 2001 From: Patrick Linnane Date: Tue, 22 Apr 2025 09:15:10 -0700 Subject: [PATCH 3/3] workflows/docker: reduce delay to 15 seconds Signed-off-by: Patrick Linnane --- .github/workflows/docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 352424f025..b6f4e03751 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -314,7 +314,7 @@ jobs: exit 1 fi delay=$((2 ** attempts)) - if [[ $delay -gt 60 ]]; then delay=60; fi + if [[ $delay -gt 15 ]]; then delay=15; fi echo "Push failed (attempt $attempts). Retrying in ${delay} seconds..." sleep ${delay} done