diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index e689ac0..713c0f0 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -83,9 +83,26 @@ jobs: echo "=== Tag ===" docker tag shot-crafter-calculator:ci gitea.danielarroyo.cl/proyectos/shot-crafter-calculator:latest docker tag shot-crafter-calculator:ci gitea.danielarroyo.cl/proyectos/shot-crafter-calculator:${SHORT_SHA} - echo "=== Push ===" - docker push gitea.danielarroyo.cl/proyectos/shot-crafter-calculator:latest - docker push gitea.danielarroyo.cl/proyectos/shot-crafter-calculator:${SHORT_SHA} + + push_with_retry() { + local ref="$1" + local attempt=1 + local max_attempts=3 + while [ $attempt -le $max_attempts ]; do + echo "=== Push (attempt $attempt/$max_attempts): $ref ===" + if docker push "$ref"; then + return 0 + fi + echo "::warning::Push of $ref failed, retrying in 15s..." + sleep 15 + attempt=$((attempt + 1)) + done + echo "::error::Push of $ref failed after $max_attempts attempts" + return 1 + } + + push_with_retry "gitea.danielarroyo.cl/proyectos/shot-crafter-calculator:latest" + push_with_retry "gitea.danielarroyo.cl/proyectos/shot-crafter-calculator:${SHORT_SHA}" echo "=== Logout ===" docker logout gitea.danielarroyo.cl echo "=== Done ==="