Skip to content
This repository has been archived by the owner on Nov 10, 2022. It is now read-only.

Vendor Ruby if an installation is not found #8

Merged
merged 1 commit into from
Jun 30, 2022
Merged

Vendor Ruby if an installation is not found #8

merged 1 commit into from
Jun 30, 2022

Conversation

edmorley
Copy link
Contributor

This buildpack requires that a Ruby installation be available during buildpack compile, in order to install the parseconfig gem, and then run the install_git_submodules.rb script.

On Heroku-22 the stack image no longer includes a system Ruby installation, so in order for this buildpack to continue to work, a Ruby install must be vendored by this buildpack.

If an app already uses the Ruby buildpack, and that buildpack is ordered prior to the submodules buildpack, then this buildpack will skip the Ruby vendoring step to save downloading a redundant copy of Ruby.

The Ruby installation vendored by this buildpack is not made available to later buildpacks or at runtime, so will otherwise not affect the build.

The implementation is based on that in heroku/heroku-buildpack-nginx#103 (except for that buildpack, Ruby needed to be available at runtime, whereas here it is only needed during the build).

Fixes #7.

This buildpack requires that a Ruby installation be available during
buildpack compile, in order to install the `parseconfig` gem, and then
run the `install_git_submodules.rb` script.

On Heroku-22 the stack image no longer includes a system Ruby
installation, so in order for this buildpack to continue to work, a
Ruby install must be vendored by this buildpack.

If an app already uses the Ruby buildpack, and that buildpack is ordered
prior to the submodules buildpack, then this buildpack will skip the
Ruby vendoring step to save downloading a redundant copy of Ruby.

The Ruby installation vendored by this buildpack is not made available
to later buildpacks or at runtime, so will otherwise not affect the
build.

Fixes #7.
@edmorley
Copy link
Contributor Author

Test run on Heroku-22 (where Ruby installation needed):

-----> Building on the Heroku-22 stack
-----> Using buildpack: https://github.com/edmorley/heroku-buildpack-submodules#vendor-ruby
-----> GIT Submodules app detected
-----> Ruby installation not found, temporarily installing Ruby for use by this buildpack
-----> Installed Ruby 3.1.2
-----> Installing parseconfig gem
Successfully installed parseconfig-1.1.2
Parsing documentation for parseconfig-1.1.2
Installing ri documentation for parseconfig-1.1.2
Done installing documentation for parseconfig after 0 seconds
1 gem installed
-----> Installing submodule libcnb.rs 
       Removing submodule git folder
-----> Discovering process types
       Procfile declares types -> (none)
-----> Compressing...
       Done: 84.9K

And on Heroku-20 (where system Ruby exists, so vendoring isn't needed):

-----> Building on the Heroku-20 stack
-----> Using buildpack: https://github.com/edmorley/heroku-buildpack-submodules#vendor-ruby
-----> GIT Submodules app detected
-----> Installing parseconfig gem
Successfully installed parseconfig-1.1.2
Parsing documentation for parseconfig-1.1.2
Installing ri documentation for parseconfig-1.1.2
Done installing documentation for parseconfig after 0 seconds
1 gem installed
-----> Installing submodule libcnb.rs 
       Removing submodule git folder
-----> Discovering process types
       Procfile declares types -> (none)
-----> Compressing...
       Done: 85.4K

(Both of these were using GitHub sync, since if git push is used, then the Heroku git server's built in submodules support takes over instead.)

@edmorley edmorley marked this pull request as ready for review June 30, 2022 09:27
Copy link
Owner

@dmathieu dmathieu left a comment

Choose a reason for hiding this comment

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

Thank you Ed! ❤️

@dmathieu dmathieu merged commit aefe174 into dmathieu:main Jun 30, 2022
@edmorley edmorley deleted the vendor-ruby branch June 30, 2022 09:30
@edmorley
Copy link
Contributor Author

Thank you for the quick review/merge! :-)

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

Successfully merging this pull request may close these issues.

Heroku-22 and no system Ruby
2 participants