From ba83958337fc1e7f3a9b8ad9accece7aa44a49d1 Mon Sep 17 00:00:00 2001 From: David Culbreth Date: Wed, 25 Mar 2026 17:29:27 -0500 Subject: [PATCH] trying to fix manifest push --- .gitea/workflows/publish.yml | 76 ++++++++++++++++++++++++++++++++++-- 1 file changed, 73 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/publish.yml b/.gitea/workflows/publish.yml index 8352ace..e491085 100644 --- a/.gitea/workflows/publish.yml +++ b/.gitea/workflows/publish.yml @@ -546,6 +546,29 @@ jobs: run: | set -euo pipefail + run_with_retries() { + local max_attempts="$1" + local delay_seconds="$2" + shift 2 + + local attempt=1 + while true; do + if "$@"; then + return 0 + fi + + if [ "$attempt" -ge "$max_attempts" ]; then + echo "Command failed after ${attempt} attempts: $*" + return 1 + fi + + echo "Command failed on attempt ${attempt}/${max_attempts}: $*" + echo "Retrying in ${delay_seconds}s..." + sleep "$delay_seconds" + attempt=$((attempt + 1)) + done + } + image_ref="${{ needs.metadata.outputs.registry }}/${{ needs.metadata.outputs.namespace }}/${{ matrix.image.repository }}:${{ needs.metadata.outputs.image_tag }}-${{ matrix.arch }}" build_cmd=( @@ -561,7 +584,7 @@ jobs: build_cmd+=(--tag "$image_ref" --push) fi - "${build_cmd[@]}" + run_with_retries 3 5 "${build_cmd[@]}" - name: Link container package to repository shell: bash @@ -663,6 +686,29 @@ jobs: run: | set -euo pipefail + run_with_retries() { + local max_attempts="$1" + local delay_seconds="$2" + shift 2 + + local attempt=1 + while true; do + if "$@"; then + return 0 + fi + + if [ "$attempt" -ge "$max_attempts" ]; then + echo "Command failed after ${attempt} attempts: $*" + return 1 + fi + + echo "Command failed on attempt ${attempt}/${max_attempts}: $*" + echo "Retrying in ${delay_seconds}s..." + sleep "$delay_seconds" + attempt=$((attempt + 1)) + done + } + image_ref="${{ needs.metadata.outputs.registry }}/${{ needs.metadata.outputs.namespace }}/attune/web:${{ needs.metadata.outputs.image_tag }}-${{ matrix.arch }}" build_cmd=( @@ -678,7 +724,7 @@ jobs: build_cmd+=(--tag "$image_ref" --push) fi - "${build_cmd[@]}" + run_with_retries 3 5 "${build_cmd[@]}" - name: Link web container package to repository shell: bash @@ -775,6 +821,29 @@ jobs: run: | set -euo pipefail + run_with_retries() { + local max_attempts="$1" + local delay_seconds="$2" + shift 2 + + local attempt=1 + while true; do + if "$@"; then + return 0 + fi + + if [ "$attempt" -ge "$max_attempts" ]; then + echo "Command failed after ${attempt} attempts: $*" + return 1 + fi + + echo "Command failed on attempt ${attempt}/${max_attempts}: $*" + echo "Retrying in ${delay_seconds}s..." + sleep "$delay_seconds" + attempt=$((attempt + 1)) + done + } + image_base="${{ needs.metadata.outputs.registry }}/${{ needs.metadata.outputs.namespace }}/${{ matrix.repository }}" IFS=',' read -ra tags <<< "${{ needs.metadata.outputs.image_tags }}" @@ -783,7 +852,8 @@ jobs: amd64_ref="${image_base}:${{ needs.metadata.outputs.image_tag }}-amd64" arm64_ref="${image_base}:${{ needs.metadata.outputs.image_tag }}-arm64" - docker buildx imagetools create \ + run_with_retries 3 5 \ + docker buildx imagetools create \ --tag "$manifest_ref" \ "$amd64_ref" \ "$arm64_ref"