[Improvement-18656][CI] Cache Maven Wrapper to avoid Central HTTP 429 - #18657
Merged
Merged
Conversation
- Save/restore ~/.m2/wrapper in unit-test sanity-check and matrix jobs - Retry sanity-check ./mvnw spotless:check on wrapper download failures
SbloodyS
requested changes
Sep 22, 2026
Comment on lines
+37
to
+51
| # Retry Wrapper download on Maven Central HTTP 429. `if cmd` is used so | ||
| # `set -e` does not abort the loop on a failed attempt. | ||
| - name: Spotless Check | ||
| shell: bash | ||
| run: | | ||
| for i in 1 2 3 4 5; do | ||
| if ./mvnw spotless:check; then | ||
| break | ||
| fi | ||
| if [ "$i" -eq 5 ]; then | ||
| echo "::error::mvnw spotless:check failed after ${i} attempts" | ||
| exit 1 | ||
| fi | ||
| sleep $(( i * 15 + RANDOM % 20 )) | ||
| done |
Member
There was a problem hiding this comment.
We don't need this since we've already cache maven wrapper.
Contributor
Author
There was a problem hiding this comment.
Dropped the retry. Wrapper cache is enough here.
Comment on lines
+54
to
+57
| # Cache the Maven Wrapper distribution (~/.m2/wrapper) so the unit-test | ||
| # matrix can restore it instead of downloading apache-maven-*-bin.zip | ||
| # from Maven Central in parallel (HTTP 429). Key is independent of | ||
| # pom.xml so dependency changes do not invalidate the dist cache. |
Member
There was a problem hiding this comment.
Suggested change
| # Cache the Maven Wrapper distribution (~/.m2/wrapper) so the unit-test | |
| # matrix can restore it instead of downloading apache-maven-*-bin.zip | |
| # from Maven Central in parallel (HTTP 429). Key is independent of | |
| # pom.xml so dependency changes do not invalidate the dist cache. |
Contributor
Author
There was a problem hiding this comment.
Removed the comments.
10 of 23 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Was this PR generated or assisted by AI?
YES. Implementation was assisted by AI (CI log analysis, change drafting, and PR text). The approach and scope were reviewed before landing.
Purpose of the pull request
Fix CI flake where parallel
./mvnwjobs downloadapache-maven-3.8.4-bin.zipfrom Maven Central. The existing cache only covers~/.m2/repository. Wrapper'sDefaultDownloaderhas no retry, so HTTP 429 fails jobs before tests run — worst in the unit-test matrix (~44 jobs).Cache
~/.m2/wrapperwith a key frommaven-wrapper.properties(notpom.xml) on every PR workflow that actually runs./mvnw. Same key so a save on one workflow can be restored on another. Jobneedsandfail-fastare unchanged.Closes #18656
Example failure: https://github.com/apache/dolphinscheduler/actions/runs/35494682258/job/106035745127?pr=18585
Brief change log
~/.m2/wrapperin:unit-test.yml(sanity-check + matrix),backend.yml(Build),e2e.yml(Build + matrix),api-test.yml(Build + matrix),frontend.yml(ubuntu sanity-check only),docs.yml(style + helm-doc),e2e-k8s.yml,codeql.yaml./mvnwin the sanity-check actionVerify this pull request
This pull request is CI workflow YAML without unit-test coverage.
Cache Maven Wrapperstep restore/save with keyLinux-mvnw-...; unit-test / e2e / api-test matrices restore the same key and do not downloadapache-maven-*-bin.zipfrom CentralNon-goals
fail-fast: falsedistributionUrl./mvnw./mvnw