ruby / setup-ruby

An action to download a prebuilt Ruby and add it to the PATH in 5 seconds

Home Page:https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FeatReq: Add support for custom list of gem sources

erikpaasonen opened this issue Β· comments

hi! πŸ‘‹

my company wants to block access to rubygems.org and workloads should instead point to a custom source (virtual repo proxy) because $reasons.

I can't run gem sources --add ahead of time without the gem command.

I tried creating a ~/.gemrc file with my custom list, but the action didn't seem to use it at runtime (i.e. the action still failed due to the unavailability of rubygems.org).

can you please consider adding support for a custom list of gem sources to override the default rubygems.org source?

Just specify the sources you want to use in your Gemfile?

I guess I'm missing some important piece of info to understand what the issue is :)

Also, if you want functionality in this action, please consider contributing the code yourself, especially if it is for commercial use (which "my company" and "$reasons" sounds like)

We have a mix of self hosted runners and Github hosted runners, and some workloads are deployed on both. Could look into editing the Gemfile on the fly. This request is for the ability to override on a per-call basis, perhaps conditionally omitted by using a GH expression.

I'd love to contribute this but I'm personally lacking in the NodeJS expertise to add a pre-if command, since this action is written as Javascript type. I'll see what help I can drum up.

Not sure this action is the correct place to address this, reading https://guides.rubygems.org/command-reference/#gem-sources it sounds like modifying ~/.gemrc should work.

Is the problem you are having that this action installs bundler before installing your gems? You can try specifying default for the bundler input if so:

setup-ruby/action.yml

Lines 17 to 23 in 4f1c6a7

bundler:
description: |
The version of Bundler to install. Either 'Gemfile.lock' (the default), 'default', 'latest', 'none', or a version number (e.g., 1, 2, 2.1, 2.1.4).
For 'Gemfile.lock', the version of the BUNDLED WITH section from the Gemfile.lock if it exists. If the file or section does not exist then the same as 'default'.
For 'default', if the Ruby ships with Bundler 2.2+ as a default gem, that version is used, otherwise the same as 'latest'.
For 'latest', the latest compatible Bundler version is installed (Bundler 2 on Ruby >= 2.3, Bundler 1 on Ruby < 2.3).
For 'none', nothing is done.

Thank you for the guidance. Got this working using ~/.gemrc.