Skip to content

Commit 0bcc963

Browse files
authored
ci: configure actions/setup-java maven caching across workflows to fix 429 flakiness (#14044)
Enable 'cache: maven' in 'actions/setup-java' across the remaining GitHub Actions workflows to eliminate redundant dependency downloads and mitigate HTTP 429 (Too Many Requests) rate limiting errors from Maven Central. There may be a better/ bigger long-term fix for this. But adding some caching for CIs should help resolve a lot of these flaky 429 issues causing the CIs to fail randomly. Additionally, remove fragile and deprecated week-of-year date steps and custom actions/cache configs that conflicted with native setup-java caching. Error logs: ``` 18:31:58:640 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:3.6.0:check (checkstyle) on project gax-bom: Execution checkstyle of goal org.apache.maven.plugins:maven-checkstyle-plugin:3.6.0:check failed: Plugin org.apache.maven.plugins:maven-checkstyle-plugin:3.6.0 or one of its dependencies could not be resolved: 18:31:58:640 [ERROR] Failed to read artifact descriptor for org.iq80.snappy:snappy:jar:0.4 ... 18:33:16:682 [ERROR] The project com.google.api:gax-bom:2.84.0-SNAPSHOT (/home/runner/work/google-cloud-java/google-cloud-java/sdk-platform-java/gax-java/gax-bom/pom.xml) has 1 error 18:33:16:682 [ERROR] Non-resolvable parent POM for com.google.api:gax-bom:2.84.0-SNAPSHOT: The following artifacts could not be resolved: com.google.cloud:google-cloud-shared-config:pom:1.17.0 (absent): com.google.cloud:google-cloud-shared-config:pom:1.17.0 failed to transfer from https://repo.maven.apache.org/maven2 during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact com.google.cloud:google-cloud-shared-config:pom:1.17.0 from/to central (https://repo.maven.apache.org/maven2): status code: 429, reason phrase: Too Many Requests (429) and 'parent.relativePath' points at no local POM @ line 11, column 11 -> [Help 2] ``` From: https://github.com/googleapis/google-cloud-java/actions/runs/31522962200/job/93884821458?pr=14029
1 parent 1dc342c commit 0bcc963

27 files changed

Lines changed: 92 additions & 40 deletions

.github/workflows/ci.yaml

Lines changed: 5 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,6 @@ jobs:
6666
matrix:
6767
java: [11, 17, 21, 25, 26]
6868
steps:
69-
- name: Get current week within the year
70-
id: date
71-
if: ${{ needs.bulk-filter.outputs.runnable == 'true' }}
72-
run: echo "::set-output name=week_of_year::$(date +'%W' --utc)"
7369
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
7470
if: ${{ needs.bulk-filter.outputs.runnable == 'true' }}
7571
with:
@@ -79,14 +75,9 @@ jobs:
7975
with:
8076
distribution: temurin
8177
java-version: ${{matrix.java}}
78+
cache: maven
8279
- run: java -version
8380
if: ${{ needs.bulk-filter.outputs.runnable == 'true' }}
84-
- uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
85-
id: mvn-cache
86-
if: ${{ needs.bulk-filter.outputs.runnable == 'true' }}
87-
with:
88-
path: ~/.m2/repository
89-
key: ${{ runner.os }}-maven-unified-${{ steps.date.outputs.week_of_year }}
9081
- run: .kokoro/build.sh
9182
if: ${{ needs.bulk-filter.outputs.runnable == 'true' && (needs.bulk-filter.outputs.src == 'true' || needs.bulk-filter.outputs.ci == 'true') }}
9283
env:
@@ -97,10 +88,6 @@ jobs:
9788
needs: bulk-filter
9889
name: "units (8)"
9990
steps:
100-
- name: Get current week within the year
101-
id: date
102-
if: ${{ needs.bulk-filter.outputs.runnable == 'true' }}
103-
run: echo "::set-output name=week_of_year::$(date +'%W' --utc)"
10491
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
10592
if: ${{ needs.bulk-filter.outputs.runnable == 'true' }}
10693
with:
@@ -122,12 +109,6 @@ jobs:
122109
java-version: 11
123110
distribution: temurin
124111
cache: maven
125-
- uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
126-
id: mvn-cache
127-
if: ${{ needs.bulk-filter.outputs.runnable == 'true' }}
128-
with:
129-
path: ~/.m2/repository
130-
key: ${{ runner.os }}-maven-unified-${{ steps.date.outputs.week_of_year }}
131112
- run: .kokoro/build.sh
132113
if: ${{ needs.bulk-filter.outputs.runnable == 'true' && (needs.bulk-filter.outputs.src == 'true' || needs.bulk-filter.outputs.ci == 'true') }}
133114
shell: bash
@@ -271,16 +252,14 @@ jobs:
271252
package: ${{ fromJSON(needs.changes.outputs.packages) }}
272253
java: [11, 17, 21, 25, 26]
273254
steps:
274-
- name: Get current week within the year
275-
id: date
276-
run: echo "::set-output name=week_of_year::$(date +'%W' --utc)"
277255
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
278256
with:
279257
persist-credentials: false
280258
- uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4.8.0
281259
with:
282260
distribution: temurin
283261
java-version: ${{matrix.java}}
262+
cache: maven
284263
- run: .kokoro/build.sh
285264
env:
286265
BUILD_SUBDIR: ${{matrix.package}}
@@ -296,9 +275,6 @@ jobs:
296275
package: ${{ fromJSON(needs.changes.outputs.packages) }}
297276
java: [8]
298277
steps:
299-
- name: Get current week within the year
300-
id: date
301-
run: echo "::set-output name=week_of_year::$(date +'%W' --utc)"
302278
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
303279
with:
304280
persist-credentials: false
@@ -308,11 +284,6 @@ jobs:
308284
distribution: temurin
309285
cache: maven
310286
- run: java -version
311-
- uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
312-
id: mvn-cache
313-
with:
314-
path: ~/.m2/repository
315-
key: ${{ runner.os }}-maven-unified-${{ steps.date.outputs.week_of_year }}
316287
- name: Install all modules using Java 11
317288
shell: bash
318289
run: .kokoro/build.sh
@@ -353,6 +324,7 @@ jobs:
353324
with:
354325
distribution: temurin
355326
java-version: 11
327+
cache: maven
356328
- run: .kokoro/build.sh
357329
env:
358330
BUILD_SUBDIR: ${{matrix.package}}
@@ -372,6 +344,7 @@ jobs:
372344
with:
373345
distribution: temurin
374346
java-version: 17
347+
cache: maven
375348
- run: .kokoro/dependencies.sh
376349
env:
377350
BUILD_SUBDIR: ${{matrix.package}}
@@ -419,6 +392,7 @@ jobs:
419392
with:
420393
distribution: temurin
421394
java-version: 17
395+
cache: maven
422396
- run: java -version
423397
- run: .kokoro/build.sh
424398
env:
@@ -430,9 +404,6 @@ jobs:
430404
if: ${{ needs.bulk-filter.outputs.runnable == 'true' }}
431405
runs-on: ubuntu-latest
432406
steps:
433-
- name: Get current week within the year
434-
id: date
435-
run: echo "::set-output name=week_of_year::$(date +'%W' --utc)"
436407
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
437408
with:
438409
persist-credentials: false

.github/workflows/google-auth-library-java-ci.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ jobs:
5656
with:
5757
distribution: temurin
5858
java-version: ${{matrix.java}}
59+
cache: maven
5960
- run: java -version
6061
- run: .kokoro/build.sh
6162
env:
@@ -74,6 +75,7 @@ jobs:
7475
with:
7576
distribution: temurin
7677
java-version: 11
78+
cache: maven
7779
- run: java -version
7880
- run: .kokoro/build.sh
7981
env:
@@ -91,6 +93,7 @@ jobs:
9193
with:
9294
distribution: temurin
9395
java-version: 17
96+
cache: maven
9497
- run: .kokoro/dependencies.sh
9598

9699
required:

.github/workflows/java-bigquery-jdbc-ci.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ jobs:
6363
with:
6464
distribution: temurin
6565
java-version: ${{matrix.java}}
66+
cache: maven
6667
- run: java -version
6768
- run: .kokoro/build.sh
6869
env:
@@ -81,6 +82,7 @@ jobs:
8182
with:
8283
java-version: 8
8384
distribution: temurin
85+
cache: maven
8486
- name: "Set jvm system property environment variable for surefire plugin (unit tests)"
8587
# Maven surefire plugin (unit tests) allows us to specify JVM to run the tests.
8688
# https://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#jvm
@@ -90,6 +92,7 @@ jobs:
9092
with:
9193
java-version: 17
9294
distribution: temurin
95+
cache: maven
9396
- run: .kokoro/build.sh
9497
env:
9598
JOB_TYPE: test
@@ -109,6 +112,7 @@ jobs:
109112
with:
110113
distribution: temurin
111114
java-version: 8
115+
cache: maven
112116
- run: java -version
113117
- run: .kokoro/build.sh
114118
env:
@@ -125,6 +129,7 @@ jobs:
125129
with:
126130
distribution: temurin
127131
java-version: 17
132+
cache: maven
128133
- run: .kokoro/dependencies.sh
129134
javadoc:
130135
needs: filter
@@ -138,6 +143,7 @@ jobs:
138143
with:
139144
distribution: temurin
140145
java-version: 17
146+
cache: maven
141147
- run: java -version
142148
- run: .kokoro/build.sh
143149
env:
@@ -155,6 +161,7 @@ jobs:
155161
with:
156162
distribution: temurin
157163
java-version: 17
164+
cache: maven
158165
- run: java -version
159166
- run: .kokoro/build.sh
160167
env:

.github/workflows/java-bigtable-ci.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ jobs:
5555
with:
5656
distribution: temurin
5757
java-version: ${{matrix.java}}
58+
cache: maven
5859
- run: java -version
5960
- run: .kokoro/build.sh
6061
env:
@@ -73,6 +74,7 @@ jobs:
7374
with:
7475
java-version: 8
7576
distribution: temurin
77+
cache: maven
7678
- name: "Set jvm system property environment variable for surefire plugin (unit tests)"
7779
# Maven surefire plugin (unit tests) allows us to specify JVM to run the tests.
7880
# https://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#jvm
@@ -82,6 +84,7 @@ jobs:
8284
with:
8385
java-version: 17
8486
distribution: temurin
87+
cache: maven
8588
- run: .kokoro/build.sh
8689
env:
8790
JOB_TYPE: test
@@ -99,6 +102,7 @@ jobs:
99102
with:
100103
distribution: temurin
101104
java-version: 8
105+
cache: maven
102106
- run: java -version
103107
- run: .kokoro/build.sh
104108
env:
@@ -118,6 +122,7 @@ jobs:
118122
with:
119123
distribution: temurin
120124
java-version: ${{matrix.java}}
125+
cache: maven
121126
- run: java -version
122127
- run: .kokoro/dependencies.sh
123128
javadoc:
@@ -132,6 +137,7 @@ jobs:
132137
with:
133138
distribution: temurin
134139
java-version: 17
140+
cache: maven
135141
- run: java -version
136142
- run: .kokoro/build.sh
137143
env:
@@ -149,6 +155,7 @@ jobs:
149155
with:
150156
distribution: temurin
151157
java-version: 17
158+
cache: maven
152159
- run: java -version
153160
- run: .kokoro/build.sh
154161
env:
@@ -167,6 +174,7 @@ jobs:
167174
with:
168175
distribution: temurin
169176
java-version: 11
177+
cache: maven
170178
- run: java -version
171179
- run: .kokoro/build.sh
172180
env:

.github/workflows/java-bigtable-conformance.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ jobs:
5757
with:
5858
distribution: zulu
5959
java-version: 11
60+
cache: maven
6061
- uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
6162
with:
6263
go-version: '>=1.20.2'

.github/workflows/java-cloud-bom-ci.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ jobs:
105105
with:
106106
distribution: zulu
107107
java-version: 11
108+
cache: maven
108109
- run: java -version
109110
- name: Install modules locally
110111
run: mvn install -B -ntp -Pquick-build -DskipTests=true -T 1C

.github/workflows/java-firestore-ci.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ jobs:
5555
with:
5656
distribution: temurin
5757
java-version: ${{matrix.java}}
58+
cache: maven
5859
- run: java -version
5960
- run: .kokoro/build.sh
6061
env:
@@ -73,6 +74,7 @@ jobs:
7374
with:
7475
java-version: 8
7576
distribution: temurin
77+
cache: maven
7678
- name: "Set jvm system property environment variable for surefire plugin (unit tests)"
7779
# Maven surefire plugin (unit tests) allows us to specify JVM to run the tests.
7880
# https://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#jvm
@@ -82,6 +84,7 @@ jobs:
8284
with:
8385
java-version: 17
8486
distribution: temurin
87+
cache: maven
8588
- run: .kokoro/build.sh
8689
env:
8790
JOB_TYPE: test
@@ -99,6 +102,7 @@ jobs:
99102
with:
100103
distribution: temurin
101104
java-version: 8
105+
cache: maven
102106
- run: java -version
103107
- run: .kokoro/build.sh
104108
env:
@@ -118,6 +122,7 @@ jobs:
118122
with:
119123
distribution: temurin
120124
java-version: ${{matrix.java}}
125+
cache: maven
121126
- run: java -version
122127
- run: .kokoro/dependencies.sh
123128
javadoc:
@@ -132,6 +137,7 @@ jobs:
132137
with:
133138
distribution: temurin
134139
java-version: 17
140+
cache: maven
135141
- run: java -version
136142
- run: .kokoro/build.sh
137143
env:
@@ -149,6 +155,7 @@ jobs:
149155
with:
150156
distribution: temurin
151157
java-version: 17
158+
cache: maven
152159
- run: java -version
153160
- run: .kokoro/build.sh
154161
env:
@@ -167,6 +174,7 @@ jobs:
167174
with:
168175
distribution: temurin
169176
java-version: 11
177+
cache: maven
170178
- run: java -version
171179
- run: .kokoro/build.sh
172180
env:

0 commit comments

Comments
 (0)