Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions .github/actions/bootstrap-maven/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# 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.

name: Bootstrap Maven
description: >-
Install the Maven distribution the wrapper points at, retrying the download
and caching the result, so a Maven Central hiccup does not fail a job before
it has built or tested anything.

# The dependency caches cover ~/.m2/repository, but the wrapper installs Maven
# itself under ~/.m2/wrapper/dists. On a fresh runner the first ./mvnw call
# therefore still downloads apache-maven-*-bin.zip from Maven Central, and that
# single request has failed with HTTP 403 and 429 often enough to matter.
# Every job that runs ./mvnw (directly, via make, or via setup-spark-builder)
# goes through setup-builder or setup-macos-builder, which end by calling this
# action; ci.yml's preflight job calls it directly before the RAT check.
#
# Requires a checkout and a JDK on PATH. Runs from the repository root.

runs:
using: "composite"
steps:
# Maven itself is stored outside the dependency repository. Keep its cache
# independent of pom.xml changes.
- name: Restore Maven distribution
id: maven-distribution
# Temporarily disabled on macOS to work around
# https://github.com/actions/runner-images/issues/13341; macOS still
# gets the retry below, just not the cache.
if: ${{ runner.os != 'macOS' }}
uses: actions/cache/restore@v5
with:
path: |
~/.m2/wrapper/dists
/root/.m2/wrapper/dists
key: ${{ runner.os }}-${{ runner.arch }}-maven-wrapper-${{ hashFiles('.mvn/wrapper/maven-wrapper.properties') }}

# Retry only the wrapper download, never compilation or test execution.
# Delays use exponential backoff (10s, 20s, 40s) plus 0-4s of random jitter.
- name: Bootstrap Maven
shell: bash
run: |
for attempt in 1 2 3 4; do
if ./mvnw -B --version; then
break
fi
if [ "$attempt" -eq 4 ]; then
echo "::error::Maven bootstrap failed after $attempt attempts; nothing was built."
exit 1
fi
delay=$((10 * (1 << (attempt - 1)) + RANDOM % 5))
echo "::warning::Maven bootstrap attempt $attempt failed; retrying in ${delay}s."
sleep "$delay"
done

# Save a successful bootstrap even when the rest of the job fails.
- name: Save Maven distribution
if: ${{ runner.os != 'macOS' && steps.maven-distribution.outputs.cache-hit != 'true' }}
uses: actions/cache/save@v5
with:
path: |
~/.m2/wrapper/dists
/root/.m2/wrapper/dists
Comment on lines +76 to +77

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.

Correctness

[P2] Use an accessible distribution cache path in preflight

Could we exclude the inaccessible /root/.m2/wrapper/dists path for the new non-container preflight caller? In this PR's Preflight log, Maven is installed under /home/runner/.m2/wrapper/dists, but Save Maven distribution emits EACCES: permission denied, lstat '/root/.m2/wrapper/dists' and saves no cache. The cache action aborts path enumeration on this error, so the valid user-home directory is not saved either, even though the step stays green. This leaves the pipeline's preflight gate downloading Maven again on a cache miss and misses the caching part of the reliability fix. Please select accessible distribution paths for each runner environment in both restore and save, then verify a cold save and warm restore on ubuntu-slim as well as the container path.

key: ${{ steps.maven-distribution.outputs.cache-primary-key }}
45 changes: 4 additions & 41 deletions .github/actions/java-test/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,45 +76,9 @@ runs:
restore-keys: |
${{ runner.os }}-java-maven-

# Maven itself is stored outside the dependency repository. Keep its cache
# independent of pom.xml changes and preserve the macOS cache workaround.
- name: Restore Maven distribution
id: maven-distribution
if: ${{ runner.os != 'macOS' }}
uses: actions/cache/restore@v5
with:
path: |
~/.m2/wrapper/dists
/root/.m2/wrapper/dists
key: ${{ runner.os }}-${{ runner.arch }}-maven-wrapper-${{ hashFiles('.mvn/wrapper/maven-wrapper.properties') }}

# Retry only the wrapper download, never compilation or test execution.
# Delays use exponential backoff (10s, 20s, 40s) plus 0-4s of random jitter.
- name: Bootstrap Maven
shell: bash
run: |
for attempt in 1 2 3 4; do
if ./mvnw -B --version; then
break
fi
if [ "$attempt" -eq 4 ]; then
echo "::error::Maven bootstrap failed after $attempt attempts; tests were not started."
exit 1
fi
delay=$((10 * (1 << (attempt - 1)) + RANDOM % 5))
echo "::warning::Maven bootstrap attempt $attempt failed; retrying in ${delay}s."
sleep "$delay"
done

# Save a successful bootstrap even when the subsequent tests fail.
- name: Save Maven distribution
if: ${{ runner.os != 'macOS' && steps.maven-distribution.outputs.cache-hit != 'true' }}
uses: actions/cache/save@v5
with:
path: |
~/.m2/wrapper/dists
/root/.m2/wrapper/dists
key: ${{ steps.maven-distribution.outputs.cache-primary-key }}
# Maven itself is already installed (with download retries and its own
# cache) by setup-builder / setup-macos-builder via bootstrap-maven, which
# every caller of this action runs first.

- name: Run all tests
shell: bash
Expand All @@ -137,8 +101,7 @@ runs:
- name: Upload crash logs
if: failure()
# These three stay on the plain action rather than
# ../upload-artifact-retry: a local action calling another local action
# is untested in this repo. The two failure-only uploads run on jobs that
# ../upload-artifact-retry. The two failure-only uploads run on jobs that
# are already red. The test-report upload also runs on green jobs, so it
# is continue-on-error: a FinalizeArtifact 403 must not turn a passing test
# run into a red check, and nothing downstream consumes the reports.
Expand Down
5 changes: 5 additions & 0 deletions .github/actions/setup-builder/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,8 @@ runs:
rustup toolchain install ${{inputs.rust-version}}
rustup default ${{inputs.rust-version}}
rustup component add rustfmt clippy

# Runs last so the JDK is on PATH. Retries the Maven distribution download
# and caches it; see .github/actions/bootstrap-maven/action.yaml.
- name: Bootstrap Maven
uses: ./.github/actions/bootstrap-maven
5 changes: 5 additions & 0 deletions .github/actions/setup-macos-builder/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,8 @@ runs:
rustup toolchain install ${{inputs.rust-version}}
rustup default ${{inputs.rust-version}}
rustup component add rustfmt clippy

# Runs last so the JDK is on PATH. Retries the Maven distribution download
# and caches it; see .github/actions/bootstrap-maven/action.yaml.
- name: Bootstrap Maven
uses: ./.github/actions/bootstrap-maven
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ jobs:
distribution: temurin
java-version: 11

# Preflight gates every other job, so a single failed download of the
# Maven distribution here would fail the whole run.
- name: Bootstrap Maven
uses: ./.github/actions/bootstrap-maven

- name: Apache RAT license check
run: ./mvnw -B -N apache-rat:check

Expand Down
3 changes: 3 additions & 0 deletions dev/ci/check-ci-config.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@
# to nothing at all and merges having been exercised by no consumer.
([".github/actions/upload-artifact-retry/action.yaml"], BUILD_JOBS),
([".github/actions/download-artifact-retry/action.yaml"], BUILD_JOBS),
# Maven bootstrap runs inside setup-builder and setup-macos-builder, so it
# reaches every job that runs ./mvnw.
([".github/actions/bootstrap-maven/action.yaml"], BUILD_JOBS),
# Spot checks that the additions above did not widen unrelated routes.
(["docs/source/user-guide/overview.md"], {"docs"}),
(["native/core/benches/parquet_read.rs"], {"benchmark"}),
Expand Down
10 changes: 10 additions & 0 deletions dev/ci/compute-changes.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
".github/actions/rust-test/**",
".github/actions/upload-artifact-retry/**",
".github/actions/download-artifact-retry/**",
".github/actions/bootstrap-maven/**",
"!**.md",
"!native/core/benches/**",
"!native/spark-expr/benches/**",
Expand All @@ -82,6 +83,7 @@
".github/actions/java-test/**",
".github/actions/upload-artifact-retry/**",
".github/actions/download-artifact-retry/**",
".github/actions/bootstrap-maven/**",
"!**.md",
"!native/core/benches/**",
"!native/spark-expr/benches/**",
Expand Down Expand Up @@ -129,6 +131,7 @@
".github/actions/setup-spark-builder/**",
".github/actions/upload-artifact-retry/**",
".github/actions/download-artifact-retry/**",
".github/actions/bootstrap-maven/**",
".mvn/**",
"mvnw",
],
Expand All @@ -155,6 +158,7 @@
".github/actions/setup-spark-builder/**",
".github/actions/upload-artifact-retry/**",
".github/actions/download-artifact-retry/**",
".github/actions/bootstrap-maven/**",
".mvn/**",
"mvnw",
],
Expand All @@ -181,6 +185,7 @@
".github/actions/setup-spark-builder/**",
".github/actions/upload-artifact-retry/**",
".github/actions/download-artifact-retry/**",
".github/actions/bootstrap-maven/**",
".mvn/**",
"mvnw",
],
Expand All @@ -207,6 +212,7 @@
".github/actions/setup-spark-builder/**",
".github/actions/upload-artifact-retry/**",
".github/actions/download-artifact-retry/**",
".github/actions/bootstrap-maven/**",
".mvn/**",
"mvnw",
],
Expand All @@ -231,6 +237,7 @@
"dev/ci/test-iceberg-shards.py",
".github/actions/upload-artifact-retry/**",
".github/actions/download-artifact-retry/**",
".github/actions/bootstrap-maven/**",
".mvn/**",
"mvnw",
],
Expand All @@ -255,6 +262,7 @@
"dev/ci/test-iceberg-shards.py",
".github/actions/upload-artifact-retry/**",
".github/actions/download-artifact-retry/**",
".github/actions/bootstrap-maven/**",
".mvn/**",
"mvnw",
],
Expand All @@ -279,6 +287,7 @@
"dev/ci/test-iceberg-shards.py",
".github/actions/upload-artifact-retry/**",
".github/actions/download-artifact-retry/**",
".github/actions/bootstrap-maven/**",
".mvn/**",
"mvnw",
],
Expand All @@ -303,6 +312,7 @@
"dev/ci/test-iceberg-shards.py",
".github/actions/upload-artifact-retry/**",
".github/actions/download-artifact-retry/**",
".github/actions/bootstrap-maven/**",
".mvn/**",
"mvnw",
],
Expand Down
Loading