Skip to content

[Improvement-18656][CI] Cache Maven Wrapper to avoid Central HTTP 429 - #18657

Merged
SbloodyS merged 8 commits into
apache:devfrom
det101:feature-18656-cache-maven-wrapper
Sep 24, 2026
Merged

SbloodyS merged 8 commits into
apache:devfrom
det101:feature-18656-cache-maven-wrapper

Conversation

@det101

@det101 det101 commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

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 ./mvnw jobs download apache-maven-3.8.4-bin.zip from Maven Central. The existing cache only covers ~/.m2/repository. Wrapper's DefaultDownloader has no retry, so HTTP 429 fails jobs before tests run — worst in the unit-test matrix (~44 jobs).

Cache ~/.m2/wrapper with a key from maven-wrapper.properties (not pom.xml) on every PR workflow that actually runs ./mvnw. Same key so a save on one workflow can be restored on another. Job needs and fail-fast are unchanged.

Closes #18656

Example failure: https://github.com/apache/dolphinscheduler/actions/runs/35494682258/job/106035745127?pr=18585

Brief change log

  • Cache ~/.m2/wrapper in: 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
  • Do not retry ./mvnw in the sanity-check action

Verify this pull request

This pull request is CI workflow YAML without unit-test coverage.

  • YAML parses locally
  • On this PR: a Cache Maven Wrapper step restore/save with key Linux-mvnw-...; unit-test / e2e / api-test matrices restore the same key and do not download apache-maven-*-bin.zip from Central

Non-goals

  • Do not set fail-fast: false
  • Do not change distributionUrl
  • Do not add retry around ./mvnw
  • Do not add wrapper cache to owasp / publish-docker, or to jobs that never run ./mvnw

- Save/restore ~/.m2/wrapper in unit-test sanity-check and matrix jobs
- Retry sanity-check ./mvnw spotless:check on wrapper download failures
Comment thread .github/actions/sanity-check/action.yml Outdated
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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need this since we've already cache maven wrapper.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dropped the retry. Wrapper cache is enough here.

Comment thread .github/workflows/unit-test.yml Outdated
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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the comments.

Comment thread .github/workflows/unit-test.yml
@github-actions github-actions Bot added UI ui and front end related backend e2e e2e test labels Sep 22, 2026
@SbloodyS SbloodyS added improvement make more easy to user or prompt friendly chore labels Sep 22, 2026
@SbloodyS SbloodyS added this to the 3.5.0 milestone Sep 22, 2026

@SbloodyS SbloodyS left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@SbloodyS
SbloodyS merged commit 7cf1677 into apache:dev Sep 24, 2026
127 of 142 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend chore CI&CD e2e e2e test improvement make more easy to user or prompt friendly UI ui and front end related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Improvement][CI] Cache Maven Wrapper dist to avoid Central HTTP 429

2 participants