From 419f75dd5016449a97d54165cbe8368b82390f9a Mon Sep 17 00:00:00 2001 From: Anton Malygin Date: Mon, 23 Nov 2026 18:36:40 -0600 Subject: [PATCH] ci: give Gradle two minutes to outlast a 429 in the android job Maven Central rate-limits the addresses that GitHub's runners share. On 2026-11-23 the android job failed on it (run 45272167046): the first request the build sent, for kotlin-gradle-plugin-2.4.21.pom, was answered 429, and the build had failed 18 seconds after it started. Gradle 9.8.1 does retry a 429, as it does 408, 5xx and a dropped connection, but three times in three seconds. Then it disables the repository for the rest of the build, which is where "52 more failures with identical causes" comes from. The number of tries is the internal property org.gradle.internal.repository.max.tentatives, 3 by default, and the wait doubles from one second. The job now sets it to 8 through GRADLE_OPTS, which reaches all three Gradle runs of the job: 1+2+...+64 = 127 seconds for one request. The job keeps resolving from an empty Gradle home. That is a control, not an omission (docs/verification.md; IR-03 and IR-05 of the v0.6 security review), so a dependency cache was not an option here. The property is undocumented and Gradle ignores a -D it does not know. A step after the first build fails when the name is no longer in the Gradle distribution the wrapper fetched, so a Gradle update cannot bring the three-second limit back unnoticed. --- .github/workflows/ci.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c0dbea1b..d15a4b07 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -829,6 +829,16 @@ jobs: if: github.event_name != 'push' || github.ref_type != 'tag' || contains(github.ref_name, '-rc.') runs-on: ubuntu-24.04 timeout-minutes: 75 + env: + # Maven Central rate-limits the addresses that GitHub's runners share, + # and this job resolves every artifact from an empty Gradle home on + # purpose (docs/verification.md). Gradle 9.8.1 does retry a request + # answered 429, 408 or 5xx, but only three times, 1 and 2 seconds apart, + # and then disables the repository for the rest of the build. Eight + # tries wait 1, 2, 4 ... 64 seconds, about two minutes for one request. + # The property is internal to Gradle: the check after the first build + # fails if a new Gradle no longer has it. + GRADLE_OPTS: -Dorg.gradle.internal.repository.max.tentatives=8 steps: - name: Check out repository uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -865,6 +875,24 @@ jobs: - name: Build and verify Android AAR run: bash scripts/build-android-adapter.sh + - name: Check that this Gradle has the retry property + env: + GRADLE_USER_HOME: ${{ github.workspace }}/target/mobile/android-gradle-home + run: | + # Gradle ignores a -D it does not know, so a release that renamed + # the property would quietly bring back the three-second limit. + property="${GRADLE_OPTS#-D}" + property="${property%%=*}" + jars=("$GRADLE_USER_HOME"/wrapper/dists/gradle-*-bin/*/gradle-*/lib/plugins/gradle-dependency-management-[0-9]*.jar) + if [[ ${#jars[@]} -ne 1 || ! -f "${jars[0]}" ]]; then + echo "expected one Gradle dependency-management JAR, found: ${jars[*]}" >&2 + exit 1 + fi + if [[ "$(unzip -p "${jars[0]}" | grep -acF "$property")" -eq 0 ]]; then + echo "$property is not in ${jars[0]}; GRADLE_OPTS has no effect" >&2 + exit 1 + fi + - name: Test Android adapter env: GRADLE_USER_HOME: ${{ github.workspace }}/target/mobile/android-gradle-home