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

Warn users about using default Ruby version when Gemfile.lock does not specify the version #304

Open
lilacstella opened this issue Jul 17, 2024 · 0 comments

Comments

@lilacstella
Copy link
Contributor

lilacstella commented Jul 17, 2024

The current buildpack does not warn users when the Gemfile.lock lacks a specified Ruby version. This can cause applications to run on a default Ruby version, potentially leading to unexpected behavior or errors. This feature was part of the classic Ruby buildpack but has not been implemented here yet. This warning should inform users that the buildpack will use a default Ruby version and recommend specifying a Ruby version in their Gemfile.lock to ensure consistent and predictable application behavior.

Actual result

[Checking Node.js version]
Node.js version not specified, using 20.x
Resolved Node.js version: 20.15.1

[Installing Node.js distribution]
Downloading Node.js 20.15.1 (linux-amd64) from https://nodejs.org/download/release/v20.15.1/node-v20.15.1-linux-x64.tar.gz
Verifying checksum
Extracting Node.js 20.15.1 (linux-amd64)
Installing Node.js 20.15.1 (linux-amd64)

# Heroku Ruby Buildpack

- Metrics agent
  - Skipping install (`barnes` gem not found)
- Ruby version `3.3.1` from `Gemfile.lock`
  - Installing ........................................... (40.548s)
- Bundler version `2.3.16` from `Gemfile.lock`
  - Running `gem install bundler --version 2.3.16` .... (1.808s)
- Bundle install
  - Running `BUNDLE_BIN="/layers/heroku_ruby/gems/bin" BUNDLE_CLEAN="1" BUNDLE_DEPLOYMENT="1" BUNDLE_GEMFILE="/workspace/Gemfile" BUNDLE_PATH="/layers/heroku_ruby/gems" BUNDLE_WITHOUT="development:test" bundle install`

      Fetching gem metadata from https://rubygems.org/.........

Expected outcome

When the Gemfile.lock does not specify a Ruby version, the buildpack should:

  • Output a warning message informing the user that a specific Ruby version is not specified and that the buildpack will use a default Ruby version.
  • Suggest to the user to specify a Ruby version in their Gemfile.lock to avoid unexpected results.

The warning could look something like this:

To avoid unexpected results due to difference in Ruby versions, please specify a version in your `Gemfile.lock` by choosing the version in the `Gemfile` and using `bundle install` to update the `Gemfile.lock`.
https://devcenter.heroku.com/articles/ruby-versions
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

No branches or pull requests

1 participant