diff --git a/ci/release-linux.sh b/ci/release-linux.sh index 74c6fe1..9736ac1 100644 --- a/ci/release-linux.sh +++ b/ci/release-linux.sh @@ -42,11 +42,33 @@ cp -a "$output/." "$container_context/app/" export REGISTRY_AUTH_FILE="$root/.release/auth/zot-linux-$arch.json" mkdir -p "$(dirname "$REGISTRY_AUTH_FILE")" -buildah login --tls-verify=false --username "$ZOT_USERNAME" --password-stdin "$registry" <<< "$ZOT_PASSWORD" >/dev/null +logged_in=false +for attempt in 1 2 3 4; do + if buildah login --tls-verify=false --username "$ZOT_USERNAME" --password-stdin "$registry" <<< "$ZOT_PASSWORD" >/dev/null; then + logged_in=true + break + fi + if [[ "$attempt" -lt 4 ]]; then + echo "Zot login attempt $attempt failed; retrying in 3 seconds" >&2 + sleep 3 + fi +done +[[ "$logged_in" == true ]] || { echo "could not authenticate to Zot after 4 attempts" >&2; exit 1; } local_image="localhost/monitor-backend:$version-$arch" buildah bud --tls-verify=false --arch "$arch" \ --build-arg "APP_VERSION=$version" \ -f "$root/packaging/container/Backend.Containerfile" \ -t "$local_image" "$container_context" >/dev/null -buildah push --tls-verify=false "$local_image" "docker://$image:$version-$arch" >/dev/null +pushed=false +for attempt in 1 2 3; do + if buildah push --tls-verify=false "$local_image" "docker://$image:$version-$arch" >/dev/null; then + pushed=true + break + fi + if [[ "$attempt" -lt 3 ]]; then + echo "Zot push attempt $attempt failed; retrying in 5 seconds" >&2 + sleep 5 + fi +done +[[ "$pushed" == true ]] || { echo "could not push image to Zot after 3 attempts" >&2; exit 1; } echo "pushed Zot image $image:$version-$arch"