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

Remove Ruby dependency on bin/release #1308

Merged
merged 3 commits into from
Jun 6, 2022
Merged

Remove Ruby dependency on bin/release #1308

merged 3 commits into from
Jun 6, 2022

Conversation

schneems
Copy link
Contributor

@schneems schneems commented Jun 6, 2022

On heroku-22 there is no longer a system Ruby so we cannot depend on it. We can either bootstrap as we do in bin/compile or use bash. Considering this logic is trivial to represent in bash that's what we will do.

GUS-W-10343881.

@schneems schneems force-pushed the schneems/bash-release branch from 0e4908b to ef19f03 Compare June 6, 2022 19:29
On heroku-22 there is no longer a system Ruby so we cannot depend on it. We can either bootstrap as we do in `bin/compile` or use bash. Considering this logic is trivial to represent in bash that's what we will do.
@schneems schneems force-pushed the schneems/bash-release branch from ef19f03 to 30a663f Compare June 6, 2022 19:31
@schneems
Copy link
Contributor Author

schneems commented Jun 6, 2022

Verifying this does work manually:

$ mkdir -p /tmp/c829b079935c76c638d42b97598666a5; cd /tmp/c829b079935c76c638d42b97598666a5
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Using rake 13.0.6
Using bundler 2.3.15
Bundle complete! 1 Gemfile dependency, 2 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Writing lockfile to /private/tmp/c829b079935c76c638d42b97598666a5/Gemfile.lock
Initialized empty Git repository in /private/tmp/c829b079935c76c638d42b97598666a5/.git/
[main (root-commit) 32a8f03] first
 2 files changed, 16 insertions(+)
 create mode 100644 Gemfile
 create mode 100644 Gemfile.lock
Creating app... done, ⬢ quiet-brook-22605
https://quiet-brook-22605.herokuapp.com/ | https://git.heroku.com/quiet-brook-22605.git
⛄️ 3.1.2 🚀 /tmp/c829b079935c76c638d42b97598666a5 (main)
$ heroku buildpacks:set https://github.com/heroku/heroku-buildpack-ruby#schneems/bash-release
git push heroku
Buildpack set. Next release on quiet-brook-22605 will use https://github.com/heroku/heroku-buildpack-ruby#schneems/bash-release.
Run git push heroku main to create a new release using this buildpack.
⛄️ 3.1.2 🚀 /tmp/c829b079935c76c638d42b97598666a5 (main)
$ git push heroku
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 16 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (4/4), 422 bytes | 422.00 KiB/s, done.
Total 4 (delta 0), reused 0 (delta 0), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Using buildpack: https://github.com/heroku/heroku-buildpack-ruby#schneems/bash-release
remote: -----> Ruby app detected
remote: -----> Installing bundler 2.3.10
remote: -----> Removing BUNDLED WITH version in the Gemfile.lock
remote: -----> Compiling Ruby
remote: -----> Using Ruby version: ruby-3.0.3
remote: -----> Installing dependencies using bundler 2.3.10
remote:        Running: BUNDLE_WITHOUT='development:test' BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 bundle install -j4
remote:        Fetching gem metadata from https://rubygems.org/.
remote:        Fetching rake 13.0.6
remote:        Installing rake 13.0.6
remote:        Using bundler 2.3.10
remote:        Bundle complete! 1 Gemfile dependency, 2 gems now installed.
remote:        Gems in the groups 'development' and 'test' were not installed.
remote:        Bundled gems are installed into `./vendor/bundle`
remote:        Bundle completed (0.95s)
remote:        Cleaning up the bundler cache.
remote: -----> Detecting rake tasks
remote:
remote: ###### WARNING:
remote:
remote:        You have not declared a Ruby version in your Gemfile.
remote:
remote:        To declare a Ruby version add this line to your Gemfile:
remote:
remote:        ```
remote:        ruby "3.0.3"
remote:        ```
remote:
remote:        For more information see:
remote:          https://devcenter.heroku.com/articles/ruby-versions
remote:
remote: ###### WARNING:
remote:
remote:        There is a more recent Ruby version available for you to use:
remote:
remote:        3.0.4
remote:
remote:        The latest version will include security and bug fixes. We always recommend
remote:        running the latest version of your minor release.
remote:
remote:        Please upgrade your Ruby version.
remote:
remote:        For all available Ruby versions see:
remote:          https://devcenter.heroku.com/articles/ruby-support#supported-runtimes
remote:
remote: ###### WARNING:
remote:
remote:        No Procfile detected, using the default web server.
remote:        We recommend explicitly declaring how to boot your server process via a Procfile.
remote:        https://devcenter.heroku.com/articles/ruby-default-web-server
remote:
remote:
remote: -----> Discovering process types
remote:        Procfile declares types     -> (none)
remote:        Default types for buildpack -> console, rake  # < =================== HERE ====================
remote:
remote: -----> Compressing...
remote:        Done: 20.3M
remote: -----> Launching...
remote:        Released v4
remote:        https://quiet-brook-22605.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
To https://git.heroku.com/quiet-brook-22605.git
 * [new branch]      main -> main

schneems added 2 commits June 6, 2022 14:47
Failed due to a change in the Ruby getting started guide. This is perhaps not a great test that needs to be re-visited. I believe I was just looking to ensure that `ruby -v` was working and wasn't system ruby.
@schneems schneems marked this pull request as ready for review June 6, 2022 19:48
@schneems schneems requested a review from a team as a code owner June 6, 2022 19:48
@schneems schneems merged commit c056d91 into main Jun 6, 2022
@schneems schneems deleted the schneems/bash-release branch June 6, 2022 19:55
edmorley added a commit that referenced this pull request Jun 7, 2022
Whilst the `tmp/heroku-buildpack-release-step.yml` file is always written by
the buildpack during `bin/compile`, some apps use third-party slug cleaner
buildpacks to remove this and other files, during their later `bin/compile` steps.

This restores the `bin/release` behaviour prior to #1308, whereby the file being
missing (at the time of the release step) is not treated as an error.

This unblocks us adjusting the build system to make non-zero `bin/release` exit
codes fatal, since otherwise too many existing apps would start failing.

Longer term if the Ruby buildpack wanted to ensure slug cleaner buildpacks
did not accidentally break the features supported by `bin/release`, the release
output file could be renamed from `tmp/heroku-buildpack-release-step.yml` to
something else (so it evades cleanup), then for bonus points, `bin/release` would
clean that file up itself, so that it didn't end up in the slug. However such a change
would be need to be rolled out carefully, in case people were depending on the
presence of `tmp/heroku-buildpack-release-step.yml`, so is out of scope for this
PR.

GUS-W-10343881.
schneems pushed a commit that referenced this pull request Jun 7, 2022
Whilst the `tmp/heroku-buildpack-release-step.yml` file is always written by
the buildpack during `bin/compile`, some apps use third-party slug cleaner
buildpacks to remove this and other files, during their later `bin/compile` steps.

This restores the `bin/release` behaviour prior to #1308, whereby the file being
missing (at the time of the release step) is not treated as an error.

This unblocks us adjusting the build system to make non-zero `bin/release` exit
codes fatal, since otherwise too many existing apps would start failing.

Longer term if the Ruby buildpack wanted to ensure slug cleaner buildpacks
did not accidentally break the features supported by `bin/release`, the release
output file could be renamed from `tmp/heroku-buildpack-release-step.yml` to
something else (so it evades cleanup), then for bonus points, `bin/release` would
clean that file up itself, so that it didn't end up in the slug. However such a change
would be need to be rolled out carefully, in case people were depending on the
presence of `tmp/heroku-buildpack-release-step.yml`, so is out of scope for this
PR.

GUS-W-10343881.
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