Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support bundler-only runs #548

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Support bundler-only runs #548

wants to merge 1 commit into from

Conversation

Bo98
Copy link

@Bo98 Bo98 commented Dec 5, 2023

#489

Seems to work across all macOS and Ubuntu runners.

Cache key has an extra RUBY_PLATFORM when using system Ruby as that can vary depending on how Ruby is compiled. For example, on macOS you could have a Ruby compiled for an older Darwin version than the one you are currently running on.

@eregon
Copy link
Member

eregon commented Dec 6, 2023

Could you clarify what's the use-case?

It does look like a lot of changes and complications, so it would need a really good use case (without good workarounds) to be worth it.

@@ -79,7 +81,21 @@ export async function installBundler(bundlerVersionInput, rubygemsInputSet, lock
const floatVersion = common.floatVersion(rubyVersion)

if (bundlerVersion === 'default') {
if (common.isBundler2dot2Default(engine, rubyVersion)) {
if (systemRubyUsed) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we shouldn't pass systemRubyUsed to bundler.js, it should just work if we pass the correct rubyVersion.
So we'd ask the RUBY_VERSION of the system ruby early on, and use that for rubyVersion.
We'd just skip downloading, extracting and adding to PATH if the input is system.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basing it on rubyVersion isn't quite correct as:

  • Ubuntu image doesn't ship with any Bundler
  • macOS 11 image ships with a default Ruby 2.7 but with Bundler 2.4.

The logic used here for system Ruby is generic enough however that we could replace the existing common.isBundler2dot2Default logic here and thus avoid the systemRubyUsed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ubuntu image doesn't ship with any Bundler

Which Ubuntu image? IIRC ubuntu-22.04 ships with some Ruby version in PATH by default from the toolcache, and that has Bundler.

macOS 11 image ships with a default Ruby 2.7 but with Bundler 2.4.

That's rather weird, updating to latest Bundler but not latest Ruby. It is what it is though.

Copy link
Author

@Bo98 Bo98 Dec 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which Ubuntu image? IIRC ubuntu-22.04 ships with some Ruby version in PATH by default from the toolcache, and that has Bundler.

This is what I get with ubuntu-22.04: https://github.com/Bo98/workflow-test/actions/runs/7118996527/job/19383150052

macOS and Ubuntu runners do not use a toolcache Ruby by default. They use ones from system package managers.

Windows does use a toolcache Ruby by default (though badly broken for native gem builds on windows-2022).

@Bo98
Copy link
Author

Bo98 commented Dec 6, 2023

Could you clarify what's the use-case?

It does look like a lot of changes and complications, so it would need a really good use case (without good workarounds) to be worth it.

#489 lists some, but for me specifically I need to conditionally use a custom-compiled Ruby while keeping the standard bundler install. Workaround would be to just copy the bundler caching logic here into a personal local action for my own use.

I suppose it in part comes from ruby/setup-ruby being more of a ruby/setup-ruby-and-bundler.

If this is too much then that's fine - I'll figure something else out.

@eregon
Copy link
Member

eregon commented Dec 6, 2023

#489 lists some,

I only see Docker there and I wonder if actions even work at all within Docker images.

but for me specifically I need to conditionally use a custom-compiled Ruby while keeping the standard bundler install.

I think one way would be to install your custom-compiled Ruby under the toolcache.
Then it would be found by this action and no changes should be needed.
See the end of https://github.com/ruby/setup-ruby/blob/master/README.md#using-self-hosted-runners, notably that self-hosted: true mode.

@Bo98
Copy link
Author

Bo98 commented Dec 6, 2023

I think one way would be to install your custom-compiled Ruby under the toolcache.

I can't move the install but maybe could maybe nuke the toolcache and symlink? Seems very hacky but I can give it a try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants