Skip to content

fix: maven download failure (silently not failing the build)#163

Open
silvestre wants to merge 2 commits into
catthehacker:masterfrom
silvestre:port-maven-fix
Open

fix: maven download failure (silently not failing the build)#163
silvestre wants to merge 2 commits into
catthehacker:masterfrom
silvestre:port-maven-fix

Conversation

@silvestre

@silvestre silvestre commented May 11, 2026

Copy link
Copy Markdown

Issues

Maven installation broken by upstream toolset change

This repo fetches toolset.json live from actions/virtual-environments@main at build time. Upstream actions/runner-images#13993 changed "maven": "3.9.15" to "maven": "3" in that toolset, but this repo had not yet ported the accompanying dynamic version resolution logic from java-tools.sh. As a result, the download URL was constructed as .../maven-3/3/binaries/apache-maven-3-bin.zip, a path that does not exist, returning HTTP 404 on all 20 retry attempts. Closes #164.

Failing downloads not failing the build

download_with_retries uses return 1 on exhausted retries, which does not trigger bash's errexit when a function is called as a plain statement. The build continued past the Maven download failure, unzip failed silently on an empty file, and subsequent steps ran as if nothing had gone wrong.

Fix

Dynamic Maven version resolution

Ported from actions/runner-images#13993 by @v-sergei-pyshnoi. java-tools.sh now accepts a bare major version (e.g. "3") in the toolset config. When detected, it resolves the latest matching release by parsing Maven's metadata XML, selecting the newest patch version via sort -V. This means builds always pick up the current latest release without requiring manual version bumps.

Robust download failure handling

Ported from actions/runner-images#8912 by @vpolikarpov-akvelon. download_with_retries is replaced with download_with_retry. The new implementation drops the set +e/set -e errexit juggling entirely and uses exit 1 instead of return 1 on failure, terminating the script unconditionally regardless of how the function was called. All three call sites (install.sh, java-tools.sh, yq.sh) are updated accordingly.

silvestre and others added 2 commits May 11, 2026 12:02
Port install-java-tools.sh changes from actions/runner-images#13993:
- When `.java.maven` is a bare major version (e.g. "3"), curl Maven's
  metadata XML and select the latest matching patch release via sort -V
- Fall back to the literal value if a full version string is given
- Exit with an error if version resolution fails
- Update download URL and symlink to use the resolved version

Co-authored-by: Sergei Pyshnoi <121864472+v-sergei-pyshnoi@users.noreply.github.com>
# Issue
A failing download of `maven` (e.g. https://github.com/catthehacker/docker_images/actions/runs/25560074274/job/75035927400#step:13:556) did not fail the build, as `download_with_retries` used `return 1` on exhausted retries, which does not trigger bash's `errexit` when a function is called as a plain statement.

# Fix
Port `download_with_retry` from actions/runner-images#8912 (by @vpolikarpov-akvelon), replacing `download_with_retries` across `install.sh`, `java-tools.sh`, and `yq.sh`. The new implementation drops the `set +e`/`set -e` errexit juggling entirely and uses `exit 1` instead of `return 1` on failure, which terminates the script unconditionally regardless of how the function was called.

Co-authored-by: Vasilii Polikarpov <126792224+vpolikarpov-akvelon@users.noreply.github.com>
@silvestre silvestre changed the title port maven fix fix: maven download failure silently not failing the build May 11, 2026
@silvestre
silvestre marked this pull request as ready for review May 11, 2026 12:43
@silvestre silvestre changed the title fix: maven download failure silently not failing the build fix: maven download failure (silently not failing the build) May 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: mvn not found in java-tools images since 2026-05-08

1 participant