Repository navigation
ci: retry Maven downloads in the TPC-H and TPC-DS builds #7828
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
adityavaish
wants to merge
5
commits into
apache:main
from
adityavaish:adityavaish-retry-tpc-maven-downloads
+74
−41
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
85f62dc
ci: retry Maven downloads in the TPC-H and TPC-DS builds
adivaish 1e6ae6e
Merge branch 'main' into adityavaish-retry-tpc-maven-downloads
adityavaish b6e54f8
ci: deduplicate Maven retry loop into dev/ci/mvn-retry.sh and wrap TP…
adivaish 8caeb36
Merge remote-tracking branch 'origin/adityavaish-retry-tpc-maven-down…
adivaish 59e8c8e
Merge branch 'main' into adityavaish-retry-tpc-maven-downloads
adityavaish File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| #!/usr/bin/env bash | ||
| # | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| # Runs a Maven invocation with bounded retries on Maven Central download | ||
| # failures (HTTP 403, 404, 429, transfer errors, missing plugin prefix, or a | ||
| # missing scala-compiler jar). Non-download failures such as compile errors or | ||
| # lint violations still fail on the first attempt. | ||
| # | ||
| # Maven caches a 404 in the local repository and will not re-query Central on | ||
| # its own, so retries pass -U right after the Maven command. Backoff matches | ||
| # .github/actions/maven-bootstrap: 10s, 20s, 40s plus 0-4s of jitter. | ||
| # | ||
| # The captured log lives in a mktemp file outside the checkout and is removed | ||
| # on exit so downstream clean-tree checks stay clean. | ||
| # | ||
| # Usage: dev/ci/mvn-retry.sh <mvnw> [args...] | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| mvn_cmd="${1:?usage: mvn-retry.sh <mvnw> [args...]}" | ||
| shift | ||
|
|
||
| log=$(mktemp) | ||
| trap 'rm -f "$log"' EXIT | ||
|
|
||
| retry_pattern='^\[(ERROR|FATAL)\] .*(No plugin found for prefix|could not be resolved|Could not transfer|Could not find artifact|ClassNotFoundException: scala\.tools\.nsc\.Main)' | ||
| update=() | ||
|
|
||
| for attempt in 1 2 3 4; do | ||
| if "$mvn_cmd" ${update[@]+"${update[@]}"} "$@" 2>&1 | tee "$log"; then | ||
| exit 0 | ||
| fi | ||
| if ! grep -qE "$retry_pattern" "$log"; then | ||
| echo "::error::Maven failed for a reason other than a download, such as a compile error or lint violation; not retrying." | ||
| exit 1 | ||
| fi | ||
| if [ "$attempt" -eq 4 ]; then | ||
| echo "::error::Maven could not download a plugin or dependency after $attempt attempts." | ||
| exit 1 | ||
| fi | ||
| delay=$((10 * (1 << (attempt - 1)) + RANDOM % 5)) | ||
| echo "::warning::Maven failed to download a plugin or dependency (attempt $attempt of 4); retrying in ${delay}s with -U." | ||
| sleep "$delay" | ||
| update=(-U) | ||
| done |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The step after the build,
Generate TPC-H data, runs../mvnw -B -Prelease exec:java ...(andGenerate TPC-DS datadoes the same) with no retry.exec-maven-pluginis declared inspark/pom.xmlonly inside thegenerate-docsprofile (line 638) and has nopluginManagemententry in the rootpom.xml, so-Prelease installdoes not resolve it. I expectexec:javato do its own prefix lookup and plugin download, which is theNo plugin found for prefixfailure this PR retries one step earlier. A failure there also skipsSave Maven dependencies, which is the problem the PR describes. Please either route these steps through the same retry or show that the build step already caches the plugin, for example from a cold-cache run.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch—wrapped both
Generate TPC-H data (SF=1)andGenerate TPC-DS data (SF=1)(../mvnw -B -Prelease exec:java ...) with../dev/ci/mvn-retry.shinb6e54f869(preservingcd spark,MAVEN_OPTS='-Xmx20g', and quoted-Dexec.args), so a transientexec-maven-pluginlookup/download failure is also retried beforeSave Maven dependencies.Auto-replied by the GitHub Copilot app