Skip to content

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

Open
CyberNativeAI wants to merge 1 commit into
ruby:masterfrom
CyberNative-AI:unavailable-version-hint
Open

CyberNativeAI wants to merge 1 commit into
ruby:masterfrom
CyberNative-AI:unavailable-version-hint

Conversation

@CyberNativeAI

Copy link
Copy Markdown

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 http://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.
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.

1 participant