Skip to content

Suggest the latest patch release when a version is unavailable - #949

Merged
eregon merged 1 commit into
ruby:masterfrom
CyberNative-AI:unavailable-version-hint
Oct 19, 2026
Merged

eregon merged 1 commit into
ruby:masterfrom
CyberNative-AI:unavailable-version-hint

Conversation

@CyberNativeAI

Copy link
Copy Markdown
Contributor

Follow-up to the comment in #943 that the latest-patch-only policy "should be better documented though, including in this error message".

When ubuntu-latest moves to ubuntu-26.04 (rolling out from October 19, see actions/runner-images#14748), workflows on ubuntu-latest that pin an older patch version such as 3.4.2 in ruby-version or .ruby-version, or use a series older than 3.2, get this error:

Unavailable version 3.4.2 for ruby on ubuntu-26.04
          You can request it at https://github.com/ruby/setup-ruby/issues

This PR keeps the error, but on a 404 it checks with one HEAD request whether the latest release of the same series exists for the platform, and says what to do:

Unavailable version 3.4.2 for ruby on ubuntu-26.04
          Only the latest patch release of each series is built for newer runner images.
          ruby-3.4.11 is available on ubuntu-26.04: use ruby-version: '3.4.11', or '3.4' to always use the latest 3.4.x release.
Unavailable version 3.1.4 for ruby on ubuntu-26.04
          ruby-3.1.7, the latest 3.1.x release, is not available on ubuntu-26.04 either.
          Use a newer ruby version on ubuntu-26.04, or an older runner image for ruby 3.1.
          Note that ubuntu-latest and macos-latest move to newer runner images over time.

If the HEAD request fails or returns anything other than 200 or 404, the previous message is shown unchanged. head versions and series without a stable release also keep the previous message. The README gets a short note under Supported Platforms.

Testing: we ran dist/index.js under Node 24.21.0 in plain ubuntu:26.04 and ubuntu:24.04 containers with an empty tool cache, not on a hosted runner.

  • 3.4.2, 3.1.4 and jruby-9.4.3.0 on 26.04 give the messages above (for JRuby it suggests 'jruby-9.4.15.0' or 'jruby-9.4'). 3.1 resolves to 3.1.7, so its first line is ruby-3.1.7 is the latest 3.1.x release. instead.
  • The suggested '3.4' installs 3.4.11 on 26.04, and 'jruby-9.4' downloads 9.4.15.0.
  • 3.4.2 still installs on 24.04, and 3.4.11 on 26.04.
  • With fetch stubbed to throw, or to return 500, the message is the previous one.
  • yarn run package on the patched source reproduces the committed dist/index.js.

This PR was prepared with AI assistance; we reviewed and tested it before opening it.

Newer runner images such as ubuntu-26.04 only have builds of the latest
patch release of each series, so an exact version like 3.4.2 from
.ruby-version fails with a 404 and only a link to request the build.

On a 404, check whether the latest release of the same series exists for
the platform. If it does, name it and the short version that always picks
it. If it does not, say so and suggest a newer version or an older runner
image. If that check fails for another reason, keep the previous message.

Also document this in the README.

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

This is great, thank you.
I'm tweaking the wording in the README and this should be good to go.

Comment thread README.md
The list of available Ruby versions can be seen in [ruby-builder-versions.json](ruby-builder-versions.json) for Ubuntu and macOS
(although some combinations are not available, see [the full list](https://github.com/ruby/ruby-builder/releases/tag/toolcache))
and in [windows-versions.json](windows-versions.json) for Windows.
Newer runner images usually only have builds of the latest patch release of each series,

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
Newer runner images usually only have builds of the latest patch release of each series,
Newer runner images only have builds of the latest patch release of each series,

Comment thread README.md
(although some combinations are not available, see [the full list](https://github.com/ruby/ruby-builder/releases/tag/toolcache))
and in [windows-versions.json](windows-versions.json) for Windows.
Newer runner images usually only have builds of the latest patch release of each series,
so prefer a short version like `'3.4'` over an exact one like `'3.4.2'` in `ruby-version` or `.ruby-version`.

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
so prefer a short version like `'3.4'` over an exact one like `'3.4.2'` in `ruby-version` or `.ruby-version`.
so prefer a short version like `'3.4'` over an exact one like `'3.4.2'`, or pin to a specific runner version (e.g. `ubuntu-24.04`).

Comment thread README.md
@@ -57,6 +57,10 @@ Not all combinations of runner images and versions are supported.
The list of available Ruby versions can be seen in [ruby-builder-versions.json](ruby-builder-versions.json) for Ubuntu and macOS
(although some combinations are not available, see [the full list](https://github.com/ruby/ruby-builder/releases/tag/toolcache))

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
(although some combinations are not available, see [the full list](https://github.com/ruby/ruby-builder/releases/tag/toolcache))
(although some combinations are not available, see [the full list](https://github.com/ruby/ruby-builder/releases))

Unfortunately that full list is no longer accurate, so let's just point to the release list.
(not related to this PR but changing wording around it so fixing it together anyway)

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

Unfortunately your fork doesn't allow pushing commits/applying suggestions, so I'll do them in a separate commit then: a89e929

@eregon
eregon merged commit fbbff8d into ruby:master Oct 19, 2026
469 of 470 checks passed
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