Skip to content

Commit

Permalink
bundler: bundler 2.6.3 needs ruby 3.1
Browse files Browse the repository at this point in the history
jammy ubuntu package provides their own suffixed version of 3.0.2.

This causes bundler build to fail with:

bundler-2.6.3 requires Ruby version >= 3.1.0. The current ruby version
is 3.0.2.107.

https://buildpacks.ci.cf-app.com/teams/main/pipelines/dependency-builds/jobs/build-bundler-2.x.x/builds/132#L67a1062d:546

So install ruby 3.3 from the ruby-buildpack
  • Loading branch information
arjun024 committed Feb 25, 2025
1 parent 904087a commit e37c4d3
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tasks/build-binary-new-cflinuxfs4/builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,23 @@ def strip_top_level_directory_from_zip(filename, destination)

module DependencyBuildHelper
class << self
def setup_ruby
puts "Updating ruby because bundler 2.6.2+ requires newer ruby than what comes from the default jammy ubuntu repo."
Runner.run('mkdir', '/opt/ruby')
# From https://github.com/cloudfoundry/ruby-buildpack/blob/v1.10.21/manifest.yml#L165
Runner.run('curl', '-L', '-o', '/opt/ruby/ruby3.3.6.tgz', 'https://buildpacks.cloudfoundry.org/dependencies/ruby/ruby_3.3.6_linux_x64_cflinuxfs4_e4311262.tgz')
Runner.run('tar' ,'-xzf', '/opt/ruby/ruby3.3.6.tgz', '-C', '/opt/ruby')
ENV["PATH"] = "/opt/ruby/bin:" + ENV["PATH"]
Runner.run('ruby', '--version')
# update Gemfile{,.lock} to the same ruby version
Dir.chdir("binary-builder/cflinuxfs4") do
Runner.run("sed", "-i", "s/^ruby .*/ruby '3.3.6'/", "Gemfile")
puts("[DEBUG] running bundle install")
Runner.run("bundle", "install")
puts("[DEBUG] finished bundle install")
end
end

def build_nginx_helper(source_input, custom_options, static = false)
public_gpg_key_urls = [
"http://nginx.org/keys/maxim.key", # Maxim Konovalov’s PGP public key
Expand Down Expand Up @@ -339,6 +356,7 @@ def build_bower
end

def build_bundler
DependencyBuildHelper.setup_ruby
@binary_builder.build(@source_input)

old_filepath = "#{@binary_builder.base_dir}/#{@source_input.name}-#{@source_input.version}.tgz"
Expand Down

0 comments on commit e37c4d3

Please sign in to comment.