From 57cce3a72cc395210d08bcdcd3512d1161f1a5d8 Mon Sep 17 00:00:00 2001 From: ngenohkevin Date: Mon, 8 Jun 2026 09:47:05 +0300 Subject: [PATCH] ci: retry Gradle wrapper download to tolerate flaky distribution CDN services.gradle.org intermittently returns 504 / times out while the wrapper fetches the distribution, failing releases and emailing on every blip. Warm the wrapper with a backoff retry before the real build/test steps in both jobs. --- .github/workflows/release.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b03bdb4..f8cf7be 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,6 +24,20 @@ jobs: - name: Setup Gradle uses: gradle/actions/setup-gradle@v4 + # services.gradle.org intermittently returns 504s / times out while the + # wrapper fetches the distribution. Retry just the download (./gradlew + # --version does nothing else) with backoff so a flaky CDN doesn't fail + # the release. Once fetched it's cached for the real build step. + - name: Warm Gradle wrapper (tolerate flaky CDN) + run: | + for i in 1 2 3 4 5; do + ./gradlew --version && exit 0 + echo "Gradle download attempt $i failed; retrying in $((i*20))s..." + sleep $((i*20)) + done + echo "Gradle distribution still unreachable after retries." >&2 + exit 1 + - name: Decode keystore run: | mkdir -p keystore @@ -64,5 +78,15 @@ jobs: - name: Setup Gradle uses: gradle/actions/setup-gradle@v4 + - name: Warm Gradle wrapper (tolerate flaky CDN) + run: | + for i in 1 2 3 4 5; do + ./gradlew --version && exit 0 + echo "Gradle download attempt $i failed; retrying in $((i*20))s..." + sleep $((i*20)) + done + echo "Gradle distribution still unreachable after retries." >&2 + exit 1 + - name: Run tests run: ./gradlew testDebugUnitTest