Skip to content

Only remove the preinstalled JDKs that are installed - #9952

Merged
headius merged 1 commit into
jruby:jruby-10.0from
matrei:fix/ci-remove-installed-jdks
Oct 29, 2026
Merged

headius merged 1 commit into
jruby:jruby-10.0from
matrei:fix/ci-remove-installed-jdks

Conversation

@matrei

@matrei matrei commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

ubuntu-latest already resolves to the ubuntu-26.04 runner image for some repositories, including my fork of this one. There, every Linux job in ci.yml fails at its first step:

sudo apt remove temurin-8-jdk temurin-11-jdk temurin-17-jdk
Error: Unable to locate package temurin-8-jdk

For #9945's branch, the run on my fork got ubuntu-26.04 and failed at that step. The same jobs here got ubuntu-24.04 and passed.

ubuntu-26.04 has Temurin 11, 17, 21 and 25, but not 8, and apt removes nothing when it doesn't know one of the packages. The step removes the JDKs older than 21 because some subprocesses of the build fall back on the system Java instead of the one from setup-java, see actions/setup-java#701. So ignoring the error wouldn't help: 11 and 17 would stay installed.

This PR removes only the listed JDKs that dpkg knows about: 8, 11 and 17 on ubuntu-24.04, as before, and 11 and 17 on ubuntu-26.04. Otherwise, these jobs will fail here too once ubuntu-latest moves to ubuntu-26.04 for this repository.

In an ubuntu:26.04 container, with two installed packages standing in for the JDKs, the current command exits with 100 and removes nothing. The new one removes both and exits 0, and also exits 0 when none of the packages are installed. actionlint reports the same findings for ci.yml before and after.

master has the same step in two jobs.

The ubuntu-26.04 runner image has Temurin 11, 17, 21 and 25, but not
8. On it, "apt remove temurin-8-jdk temurin-11-jdk temurin-17-jdk"
fails with "Unable to locate package temurin-8-jdk" and removes none
of them, so every job with that step fails at the start. ubuntu-latest
already resolves to ubuntu-26.04 for some repositories.

The step now removes only the listed JDKs that dpkg knows about: 8, 11
and 17 on ubuntu-24.04, as before, and 11 and 17 on ubuntu-26.04.
@matrei

matrei commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

With this change, the whole CI passed on my fork, where ubuntu-latest is ubuntu-26.04: this run has 99 green jobs, and only publish-snapshot was skipped.

The Linux jobs I checked all got ubuntu-26.04. In rake spec:ji (Java 21 -indy), for example, the step removed temurin-11-jdk and temurin-17-jdk.

@headius headius 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.

Sigh, the things we must do.

This is approved and makes sense to merge into 10.0, but master moved much of this duplicate workflow to a separate local action (@sampokuokkanen). Perhaps we should backport that as well to avoid future changes to the 10.0 workflows being impossible to merge to master.

@headius headius added this to the Non-Release milestone Oct 29, 2026
@headius
headius merged commit 1f3d908 into jruby:jruby-10.0 Oct 29, 2026
127 checks passed
@matrei
matrei deleted the fix/ci-remove-installed-jdks branch October 29, 2026 20:04
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.

2 participants