From d373b096cd78b063f0c44423cea719a732c24965 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 20 Mar 2014 12:48:35 -0500 Subject: [PATCH 0001/1195] Enhanced error message on app deploys missing db When deploying for the first time there is no database present. If a customer's application relies on a database connection for deploy it will fail. We can give instructions to mitigate this issue to users who encounter this error. --- hatchet.json | 1 + lib/language_pack/rails3.rb | 3 +-- lib/language_pack/rails4.rb | 3 +-- lib/language_pack/ruby.rb | 14 ++++++++++++-- spec/bugs_spec.rb | 8 ++++++++ 5 files changed, 23 insertions(+), 6 deletions(-) diff --git a/hatchet.json b/hatchet.json index 2c201e99b..4643e2249 100644 --- a/hatchet.json +++ b/hatchet.json @@ -4,6 +4,7 @@ "sharpstone/asset_precompile_pass", "sharpstone/asset_precompile_not_found", "sharpstone/database_url_expected_in_rakefile", + "sharpstone/connect_to_database_on_first_push", "sharpstone/no_rakefile", "sharpstone/bad_rakefile", "sharpstone/mri_187_no_rake", diff --git a/lib/language_pack/rails3.rb b/lib/language_pack/rails3.rb index 685a438f7..55bdc2ec5 100644 --- a/lib/language_pack/rails3.rb +++ b/lib/language_pack/rails3.rb @@ -75,8 +75,7 @@ def run_assets_precompile_rake_task log "assets_precompile", :status => "success" puts "Asset precompilation completed (#{"%.2f" % precompile.time}s)" else - log "assets_precompile", :status => "failure" - error "Precompiling assets failed." + precompile_fail(precompile.output) end end end diff --git a/lib/language_pack/rails4.rb b/lib/language_pack/rails4.rb index 04626b633..a1c0b45e4 100644 --- a/lib/language_pack/rails4.rb +++ b/lib/language_pack/rails4.rb @@ -95,8 +95,7 @@ def run_assets_precompile_rake_task @cache.store public_assets_folder @cache.store default_assets_cache else - log "assets_precompile", :status => "failure" - error "Precompiling assets failed." + precompile_fail(precompile.output) end end end diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 3615252bc..cafcf1913 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -697,12 +697,22 @@ def run_assets_precompile_rake_task if precompile.success? puts "Asset precompilation completed (#{"%.2f" % precompile.time}s)" else - log "assets_precompile", :status => "failure" - error "Precompiling assets failed." + precompile_fail(precompile.output) end end end + def precompile_fail(output) + log "assets_precompile", :status => "failure" + if output.match(/(127\.0\.0\.1)|(org\.postgresql\.util)/) + puts "" + puts "Attempted to access a non existant database:" + puts "https://devcenter.heroku.com/articles/pre-provision-database" + puts "" + end + error "Precompiling assets failed." + end + def bundler_cache "vendor/bundle" end diff --git a/spec/bugs_spec.rb b/spec/bugs_spec.rb index 5bd177863..28e55e40b 100644 --- a/spec/bugs_spec.rb +++ b/spec/bugs_spec.rb @@ -16,4 +16,12 @@ expect(app.run("bundle exec nokogiri -v")).not_to include("WARNING: Nokogiri was built against LibXML version") end end + + context "database connections" do + it "fails with better error message" do + Hatchet::Runner.new("connect_to_database_on_first_push", allow_failure: true).deploy do |app| + expect(app.output).to match("https://devcenter.heroku.com/articles/pre-provision-database") + end + end + end end From 1202c445db1b8b412b5a449f458a004adeab8c12 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 20 Mar 2014 12:48:35 -0500 Subject: [PATCH 0002/1195] Enhanced error message on app deploys missing db When deploying for the first time there is no database present. If a customer's application relies on a database connection for deploy it will fail. We can give instructions to mitigate this issue to users who encounter this error. --- lib/language_pack/ruby.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index cafcf1913..7fb53a130 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -704,13 +704,12 @@ def run_assets_precompile_rake_task def precompile_fail(output) log "assets_precompile", :status => "failure" + msg = "Precompiling assets failed.\n" if output.match(/(127\.0\.0\.1)|(org\.postgresql\.util)/) - puts "" - puts "Attempted to access a non existant database:" - puts "https://devcenter.heroku.com/articles/pre-provision-database" - puts "" + msg << "Attempted to access a non existant database:\n" + msg << "https://devcenter.heroku.com/articles/pre-provision-database\n" end - error "Precompiling assets failed." + error msg end def bundler_cache From 6a7bc6d54f7d78215a65f638446d7d7d55a2b7b1 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 20 Mar 2014 18:42:58 -0500 Subject: [PATCH 0003/1195] bump to v110 --- lib/language_pack/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index a94f79c8a..e263304ef 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v108" + BUILDPACK_VERSION = "v110" end end From 05ae0ba44c85def4d8f4eaf85b7b964836b015e2 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 20 Mar 2014 18:44:15 -0500 Subject: [PATCH 0004/1195] v110 --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e9a0caf34..a4abae303 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ ## Master +## v110 (3/20/2014) + +Features: + +* Better message when running `assets:precompile` without a database + +Bugfixes: + ## v108 (2/27/2014) Features: From 3c2d0647bf4f92d3e9002f64f1288ee98f99f7ef Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 20 Mar 2014 18:53:12 -0500 Subject: [PATCH 0005/1195] spelling --- lib/language_pack/ruby.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 7fb53a130..979249065 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -706,7 +706,7 @@ def precompile_fail(output) log "assets_precompile", :status => "failure" msg = "Precompiling assets failed.\n" if output.match(/(127\.0\.0\.1)|(org\.postgresql\.util)/) - msg << "Attempted to access a non existant database:\n" + msg << "Attempted to access a nonexistent database:\n" msg << "https://devcenter.heroku.com/articles/pre-provision-database\n" end error msg From 518757b7b19a633d496f70e12f1de9f56e9ed1d0 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 20 Mar 2014 18:55:42 -0500 Subject: [PATCH 0006/1195] don't make :publish public --- Rakefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Rakefile b/Rakefile index cad0c21f8..00f228a3a 100644 --- a/Rakefile +++ b/Rakefile @@ -246,7 +246,6 @@ FILE } end - desc "publish buildpack" task :publish do buildpack_name = "heroku/ruby" puts "Publishing #{buildpack_name} buildpack" From 9343a3dda6b615fab34726282e29360caf979b2e Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 20 Mar 2014 18:56:12 -0500 Subject: [PATCH 0007/1195] v111 --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a4abae303..8cca9b9ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ ## Master +## v111 (3/20/2014) + +Features: + + +Bugfixes: + +* spelling + + ## v110 (3/20/2014) Features: From de25d3cf522b55c0e993f1136826f90dbbc3ffb2 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 20 Mar 2014 18:56:31 -0500 Subject: [PATCH 0008/1195] bump to v111 --- lib/language_pack/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index e263304ef..ec95afbbe 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v110" + BUILDPACK_VERSION = "v111" end end From a82969f8acbe02c30a638b548c8d5a956c02edc3 Mon Sep 17 00:00:00 2001 From: Steven Yang Date: Thu, 27 Mar 2014 17:34:10 +0800 Subject: [PATCH 0009/1195] use ENV variables to configure vendor_url as sometimes we have an internal vendor mirror --- lib/language_pack/base.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/base.rb b/lib/language_pack/base.rb index 4e5d63459..6cfd9bf80 100644 --- a/lib/language_pack/base.rb +++ b/lib/language_pack/base.rb @@ -14,7 +14,7 @@ class LanguagePack::Base include LanguagePack::ShellHelpers - VENDOR_URL = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby" + VENDOR_URL = ENV['BUILDPACK_VENDOR_URL'] || "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby" attr_reader :build_path, :cache From cf8151f9e482e6105b7630fb0a277e728c3f4533 Mon Sep 17 00:00:00 2001 From: Daniel Farina Date: Thu, 27 Mar 2014 14:44:52 -0700 Subject: [PATCH 0010/1195] Avoid "Running: rake assets:precompile" stutter in build pack output To fix this, use a distinct title intended to convey the purpose of the step to humans, using the same jargon as the completion message ("asset precompile"). As seen in Rack applications, this banner would appear as follows: -----> Running: rake assets:precompile Running: rake assets:precompile Normally, the banner and the performed command are different, e.g.: -----> Installing dependencies using 1.5.2 Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment --- lib/language_pack/ruby.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 979249065..6487956db 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -692,7 +692,7 @@ def run_assets_precompile_rake_task precompile = rake.task("assets:precompile") return true unless precompile.is_defined? - topic "Running: rake assets:precompile" + topic "Precompiling assets" precompile.invoke(env: rake_env) if precompile.success? puts "Asset precompilation completed (#{"%.2f" % precompile.time}s)" From cb9b6c85bc482fac5ff23f81a57cf80dc257e0fb Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Thu, 27 Mar 2014 15:41:10 -0700 Subject: [PATCH 0011/1195] bump libyaml to 0.1.6 for CVE-2014-2525 --- lib/language_pack/ruby.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 979249065..d8f11c935 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -10,7 +10,7 @@ # base Ruby Language Pack. This is for any base ruby app. class LanguagePack::Ruby < LanguagePack::Base NAME = "ruby" - LIBYAML_VERSION = "0.1.5" + LIBYAML_VERSION = "0.1.6" LIBYAML_PATH = "libyaml-#{LIBYAML_VERSION}" BUNDLER_VERSION = "1.5.2" BUNDLER_GEM_PATH = "bundler-#{BUNDLER_VERSION}" From 2ada3174b47c43f504b9a3e6d5e2c51ede8f4c33 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Thu, 27 Mar 2014 16:57:40 -0700 Subject: [PATCH 0012/1195] update changelog --- CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8cca9b9ee..1b8e83224 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ ## Master +## v112 (3/27/2014) + +Features: + + +Bugfixes: + +* compile psych with libyaml 0.1.6 for CVE-2014-2525 + ## v111 (3/20/2014) Features: From c5f7b66dc1fd4fb8459b2eb581afa7d45c2fd80d Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Thu, 27 Mar 2014 16:59:20 -0700 Subject: [PATCH 0013/1195] bump to v112 --- lib/language_pack/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index ec95afbbe..447ca691d 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v111" + BUILDPACK_VERSION = "v112" end end From c16ce3deb466e50d98d7c3b236034a6033201098 Mon Sep 17 00:00:00 2001 From: schneems Date: Sat, 5 Apr 2014 15:44:44 -0400 Subject: [PATCH 0014/1195] fix tests --- spec/user_env_compile_edge_case_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/user_env_compile_edge_case_spec.rb b/spec/user_env_compile_edge_case_spec.rb index 1af8667c9..164520642 100644 --- a/spec/user_env_compile_edge_case_spec.rb +++ b/spec/user_env_compile_edge_case_spec.rb @@ -2,7 +2,7 @@ describe "User env compile" do it "should not cause problems with warnings" do - app = Hatchet::Runner.new("mri_210", labs: "user-env-compile") + app = Hatchet::Runner.new("mri_210") app.setup! app.set_config("RUBY_HEAP_MIN_SLOTS" => "1000000") app.deploy do |app| From e3fa57ef528d66865b663895824bfa1fd1ec43b1 Mon Sep 17 00:00:00 2001 From: Cyril Rohr Date: Fri, 4 Apr 2014 16:00:49 +0100 Subject: [PATCH 0015/1195] Parametrize curl connect timeout. --- lib/language_pack/fetcher.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/language_pack/fetcher.rb b/lib/language_pack/fetcher.rb index 003096bf3..34c569d61 100644 --- a/lib/language_pack/fetcher.rb +++ b/lib/language_pack/fetcher.rb @@ -28,13 +28,17 @@ def fetch_bunzip2(path) private def curl_command(command) - "set -o pipefail; curl --fail --retry 3 --retry-delay 1 --connect-timeout 3 --max-time #{curl_timeout_in_seconds} #{command}" + "set -o pipefail; curl --fail --retry 3 --retry-delay 1 --connect-timeout #{curl_connect_timeout_in_seconds} --max-time #{curl_timeout_in_seconds} #{command}" end def curl_timeout_in_seconds ENV['CURL_TIMEOUT'] || 30 end + def curl_connect_timeout_in_seconds + ENV['CURL_CONNECT_TIMEOUT'] || 3 + end + def load_config YAML.load_file(CDN_YAML_FILE) || {} end From 43db57bae4efa51e6ef0bbb6e8c2725d7bb50602 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Tue, 18 Mar 2014 04:25:57 -0700 Subject: [PATCH 0016/1195] compatibilty with the node.js buildpack for installing node --- lib/language_pack/ruby.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index d63ebe144..af135f009 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -21,6 +21,7 @@ class LanguagePack::Ruby < LanguagePack::Base LEGACY_JVM_VERSION = "openjdk1.7.0_25" DEFAULT_RUBY_VERSION = "ruby-2.0.0" RBX_BASE_URL = "http://binaries.rubini.us/heroku" + NODE_BP_PATH = "vendor/node/bin" # detects if this is a valid Ruby app # @return [Boolean] true if it's a Ruby app @@ -219,6 +220,7 @@ def ruby_versions def setup_language_pack_environment instrument 'ruby.setup_language_pack_environment' do setup_ruby_install_env + ENV["PATH"] += ":#{node_bp_bin_path}" if node_js_installed? # TODO when buildpack-env-args rolls out, we can get rid of # ||= and the manual setting below @@ -683,7 +685,15 @@ def add_dev_database_addon # @note execjs will blow up if no JS RUNTIME is detected and is loaded. # @return [Array] the node.js binary path if we need it or an empty Array def add_node_js_binary - bundler.has_gem?('execjs') ? [NODE_JS_BINARY_PATH] : [] + bundler.has_gem?('execjs') && !node_js_installed? ? [NODE_JS_BINARY_PATH] : [] + end + + def node_bp_bin_path + "#{Dir.pwd}/#{NODE_BP_PATH}" + end + + def node_js_installed? + @node_js_installed ||= run("node -v", env: {"PATH" => "#{node_bp_bin_path}:#{ENV["PATH"]}" }) && $?.success? end def run_assets_precompile_rake_task From f26a252ab193b588504b9c969c1bd379b629c43a Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Tue, 8 Apr 2014 10:45:26 -0500 Subject: [PATCH 0017/1195] update changelog --- CHANGELOG.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b8e83224..2555ad878 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ ## Master +## v113 (4/8/2014) + +Features: + +* use heroku-buildpack-nodejs's node binary +* `CURL_CONNECT_TIMEOUT` and `CURL_TIMEOUT` are configurable as ENV vars + +Bugfixes: + +* Don't double print "Running: rake assets:precompile" on Ruby apps + + ## v112 (3/27/2014) Features: From 8f6e458f6b37d27caa4ad0e33e7be8a79261a9bb Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Tue, 8 Apr 2014 10:46:19 -0500 Subject: [PATCH 0018/1195] bump to v113 --- lib/language_pack/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 447ca691d..7e4cea9c7 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v112" + BUILDPACK_VERSION = "v113" end end From 14b0f7eb2df349d283d94dbfb70d46ead7f10839 Mon Sep 17 00:00:00 2001 From: Arthur Nogueira Neves Date: Fri, 4 Apr 2014 20:30:54 -0400 Subject: [PATCH 0019/1195] Bump bundler version Bump bundler version. --- lib/language_pack/ruby.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index af135f009..620382115 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -12,7 +12,7 @@ class LanguagePack::Ruby < LanguagePack::Base NAME = "ruby" LIBYAML_VERSION = "0.1.6" LIBYAML_PATH = "libyaml-#{LIBYAML_VERSION}" - BUNDLER_VERSION = "1.5.2" + BUNDLER_VERSION = "1.6.1" BUNDLER_GEM_PATH = "bundler-#{BUNDLER_VERSION}" NODE_VERSION = "0.4.7" NODE_JS_BINARY_PATH = "node-#{NODE_VERSION}" From 36c97fda9c1fc7e611e3186c85f9a528a469c1cd Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 9 Apr 2014 15:12:37 -0500 Subject: [PATCH 0020/1195] [close #244] Warn when default webserver is used --- lib/language_pack/base.rb | 10 +++++++++- spec/rubies_spec.rb | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/language_pack/base.rb b/lib/language_pack/base.rb index 6cfd9bf80..989feba22 100644 --- a/lib/language_pack/base.rb +++ b/lib/language_pack/base.rb @@ -90,12 +90,20 @@ def compile def write_release_yaml release = {} release["addons"] = default_addons - release["default_process_types"] = default_process_types release["config_vars"] = default_config_vars FileUtils.mkdir("tmp") unless File.exists?("tmp") File.open("tmp/heroku-buildpack-release-step.yml", 'w') do |f| f.write(release.to_yaml) end + + procfile = Pathname.new("Procfile") + + unless procfile.exist? + msg = "No Procfile detected, using the default web server (webrick)\n" + msg << "https://devcenter.heroku.com/articles/ruby-default-web-server" + warn msg + procfile.open('w') {|f| f.write(default_process_types.to_yaml) } + end end # log output diff --git a/spec/rubies_spec.rb b/spec/rubies_spec.rb index 9d61c33f5..bb4a4691d 100644 --- a/spec/rubies_spec.rb +++ b/spec/rubies_spec.rb @@ -38,6 +38,8 @@ version = '2.0.0' expect(app.output).to match(version) expect(app.run('ruby -v')).to match(version) + + expect(app.output).to match("devcenter.heroku.com/articles/ruby-default-web-server") end end From 79b44bca9b1cb0dfa32177fbe3d1bbd264848588 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Wed, 9 Apr 2014 19:02:16 -0500 Subject: [PATCH 0021/1195] update changelog --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2555ad878..2dbb7793c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ ## Master +## v114 (4/9/2014) + +Features: + +* Bundler 1.6.1 +* When when not using a Procfile (looking at you webrick) + +Bugfixes: + + ## v113 (4/8/2014) Features: From b149c9c2ca8a4c496e13f9701bcc1168db57975d Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Wed, 9 Apr 2014 19:02:43 -0500 Subject: [PATCH 0022/1195] bump to v114 --- lib/language_pack/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 7e4cea9c7..d064a5427 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v113" + BUILDPACK_VERSION = "v114" end end From 89d4e2cb16e242885debf4de9282c58e56a3aabc Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 9 Apr 2014 23:01:18 -0500 Subject: [PATCH 0023/1195] set default process types Fixes case where people have a Procfile, so now they have a `web:` process --- lib/language_pack/base.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/language_pack/base.rb b/lib/language_pack/base.rb index 989feba22..802a89e41 100644 --- a/lib/language_pack/base.rb +++ b/lib/language_pack/base.rb @@ -91,18 +91,16 @@ def write_release_yaml release = {} release["addons"] = default_addons release["config_vars"] = default_config_vars + release["default_process_types"] = default_process_types FileUtils.mkdir("tmp") unless File.exists?("tmp") File.open("tmp/heroku-buildpack-release-step.yml", 'w') do |f| f.write(release.to_yaml) end - procfile = Pathname.new("Procfile") - - unless procfile.exist? + unless File.exist?("Procfile") msg = "No Procfile detected, using the default web server (webrick)\n" msg << "https://devcenter.heroku.com/articles/ruby-default-web-server" warn msg - procfile.open('w') {|f| f.write(default_process_types.to_yaml) } end end From 79c0b41c28b6fb0cda6bff7e106b191ab2a187d8 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 9 Apr 2014 23:17:20 -0500 Subject: [PATCH 0024/1195] bump to v115 --- lib/language_pack/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index d064a5427..b83e32d86 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v114" + BUILDPACK_VERSION = "v115" end end From 8bf6539256a518e58c0dffec32cd6b570d27025f Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 9 Apr 2014 23:18:42 -0500 Subject: [PATCH 0025/1195] changelog --- CHANGELOG.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2dbb7793c..47c554e6c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,20 @@ ## Master +## v115 (4/9/2014) + +Features: + + +Bugfixes: + +* Add default process types to all apps deployed regardless of `Procfile` + ## v114 (4/9/2014) Features: * Bundler 1.6.1 -* When when not using a Procfile (looking at you webrick) +* Warn when not using a Procfile (looking at you webrick) Bugfixes: From c0dda5ec78e0bdbf97342d8bdb6a01f2efddb3ff Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 10 Apr 2014 09:41:14 -0500 Subject: [PATCH 0026/1195] Use 1.5.2 as 1.6.1 has a critical bug: https://github.com/bundler/bundler/issues/2970 . --- lib/language_pack/ruby.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 620382115..af135f009 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -12,7 +12,7 @@ class LanguagePack::Ruby < LanguagePack::Base NAME = "ruby" LIBYAML_VERSION = "0.1.6" LIBYAML_PATH = "libyaml-#{LIBYAML_VERSION}" - BUNDLER_VERSION = "1.6.1" + BUNDLER_VERSION = "1.5.2" BUNDLER_GEM_PATH = "bundler-#{BUNDLER_VERSION}" NODE_VERSION = "0.4.7" NODE_JS_BINARY_PATH = "node-#{NODE_VERSION}" From e3b419f8e78085c93072cb528613aae436420f4a Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 10 Apr 2014 09:44:05 -0500 Subject: [PATCH 0027/1195] v116 --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 47c554e6c..fdd699226 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ ## Master +## v116 (4/10/2014) + +Features: + + +Bugfixes: + +* Revert back to Bundler 1.5.2 + + ## v115 (4/9/2014) Features: From 64872fae52d6430b6db29301a026e606fe563915 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 10 Apr 2014 09:44:17 -0500 Subject: [PATCH 0028/1195] bump to v116 --- lib/language_pack/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index b83e32d86..824c0b655 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v115" + BUILDPACK_VERSION = "v116" end end From 284b44552d91648042f04915427b585b95b48f9b Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Fri, 11 Apr 2014 12:06:11 -0500 Subject: [PATCH 0029/1195] scope the node path check Since the anvil service which Travis uses is built using node and anvil leaks its path into the build enviroment, node is always on the path, so `node_js_installed?` will always return true. This executes the direct binary skipping the PATH completely. --- lib/language_pack/ruby.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index af135f009..df9c841c1 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -693,7 +693,7 @@ def node_bp_bin_path end def node_js_installed? - @node_js_installed ||= run("node -v", env: {"PATH" => "#{node_bp_bin_path}:#{ENV["PATH"]}" }) && $?.success? + @node_js_installed ||= run("#{node_bp_bin_path}/node -v") && $?.success? end def run_assets_precompile_rake_task From 3c52a5e15bbfbbb08ac3c7e932b0c73b35fba04d Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Fri, 11 Apr 2014 12:40:08 -0500 Subject: [PATCH 0030/1195] add documentation for node_js_installed? --- lib/language_pack/ruby.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index df9c841c1..f3c8b94fe 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -692,6 +692,8 @@ def node_bp_bin_path "#{Dir.pwd}/#{NODE_BP_PATH}" end + # checks if node.js is installed via the official heroku-buildpack-nodejs using multibuildpack + # @return [Boolean] true if it's detected and false if it isn't def node_js_installed? @node_js_installed ||= run("#{node_bp_bin_path}/node -v") && $?.success? end From 8c29648ae6548b5fa362d0ac9e9e7a5b02e3ec99 Mon Sep 17 00:00:00 2001 From: schneems Date: Fri, 11 Apr 2014 13:54:30 -0500 Subject: [PATCH 0031/1195] node multibuildpack spec tests #261 --- hatchet.json | 3 +++ spec/multibuildpack_spec.rb | 11 +++++++++++ 2 files changed, 14 insertions(+) create mode 100644 spec/multibuildpack_spec.rb diff --git a/hatchet.json b/hatchet.json index 4643e2249..705457cf2 100644 --- a/hatchet.json +++ b/hatchet.json @@ -51,5 +51,8 @@ ], "rails41": [ "sharpstone/rails41_scaffold" + ], + "multibuildpack": [ + "sharpstone/node_multi" ] } diff --git a/spec/multibuildpack_spec.rb b/spec/multibuildpack_spec.rb new file mode 100644 index 000000000..6a7cf7efe --- /dev/null +++ b/spec/multibuildpack_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "Multibuildpack" do + it "works with node" do + Hatchet::Runner.new("node_multi", buildpack_url: "https://github.com/ddollar/heroku-buildpack-multi.git").deploy do |app| + puts app.output + expect(app.output).to match("Node Version in Ruby buildpack is: v0.10.3") + end + end +end + From 70530caa16093657f79050fc204f71f7c0d4ec54 Mon Sep 17 00:00:00 2001 From: schneems Date: Fri, 11 Apr 2014 14:34:09 -0500 Subject: [PATCH 0032/1195] Test default process types added with Procfile When a Procfile is present, default process types should still be added. --- hatchet.json | 3 ++- spec/ruby_spec.rb | 10 ++++++++++ spec/spec_helper.rb | 8 ++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/hatchet.json b/hatchet.json index 4643e2249..3a219bea4 100644 --- a/hatchet.json +++ b/hatchet.json @@ -22,7 +22,8 @@ "ruby": [ "sharpstone/mri_187", "sharpstone/ruby_193_jruby_173", - "sharpstone/ruby_193_jruby_176" + "sharpstone/ruby_193_jruby_176", + "sharpstone/empty-procfile" ], "rack": [ "sharpstone/default_ruby", diff --git a/spec/ruby_spec.rb b/spec/ruby_spec.rb index d6216fe2c..d9c73e7e5 100644 --- a/spec/ruby_spec.rb +++ b/spec/ruby_spec.rb @@ -2,6 +2,16 @@ describe "Ruby apps" do describe "Rake detection" do + context "default" do + fit "adds default process types" do + Hatchet::Runner.new('empty-procfile').deploy do |app| + app.run("console") do |console| + console.run("'hello' + 'world'") {|result| expect(result).to match('helloworld')} + end + end + end + end + context "Ruby 1.8.7" do it "doesn't run rake tasks if no rake gem" do Hatchet::Runner.new('mri_187_no_rake').deploy do |app, heroku| diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 2a64d3ff4..73c465db8 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -45,3 +45,11 @@ def create_file_with_size_in(size, dir) File.open(name, 'w') {|f| f.print([ 1 ].pack("C") * size) } Pathname.new name end + + +ReplRunner.register_commands(:console) do |config| + config.terminate_command "exit" # the command you use to end the 'rails console' + config.startup_timeout 60 # seconds to boot + config.return_char "\n" # the character that submits the command + config.sync_stdout "STDOUT.sync = true" # force REPL to not buffer standard out +end \ No newline at end of file From d25cd3ff9ceafe55d3bef5d9d2656c13d0e8e10d Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Mon, 14 Apr 2014 18:52:55 +0900 Subject: [PATCH 0033/1195] update changelog --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fdd699226..5020e0bc9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ ## Master +## v117 (4/14/2014) + +Features: + + +Bugfixes: + +* fix anvil use case of multibuildpack with node + + ## v116 (4/10/2014) Features: From c18be761ee9e93949496d975715868428f48274a Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Mon, 14 Apr 2014 18:53:24 +0900 Subject: [PATCH 0034/1195] bump to v117 --- lib/language_pack/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 824c0b655..626a61e1e 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v116" + BUILDPACK_VERSION = "v117" end end From 090e17baefadaf0562629bc37cf454ba881b67cc Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 8 Apr 2014 17:19:26 -0500 Subject: [PATCH 0035/1195] [close #247] bundle platform with user env args --- lib/language_pack/helpers/bundler_wrapper.rb | 53 +++++++------------- lib/language_pack/ruby.rb | 2 +- lib/language_pack/ruby_version.rb | 29 +++-------- spec/helpers/ruby_version_spec.rb | 14 +++--- 4 files changed, 33 insertions(+), 65 deletions(-) diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index c0524d256..462b5e7d2 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -1,9 +1,10 @@ class LanguagePack::Helpers::BundlerWrapper + include LanguagePack::ShellHelpers + class GemfileParseError < StandardError def initialize(error) msg = "There was an error parsing your Gemfile, we cannot continue\n" - msg << error.message - self.set_backtrace(error.backtrace) + msg << error super msg end end @@ -18,22 +19,19 @@ def initialize(error) def initialize(options = {}) @fetcher = options[:fetcher] || DEFAULT_FETCHER - @bundler_path = options[:bundler_path] || File.join(Dir.mktmpdir, BUNDLER_DIR_NAME) + @bundler_path = options[:bundler_path] || File.join(Dir.mktmpdir, "#{BUNDLER_DIR_NAME}") @gemfile_path = options[:gemfile_path] || GEMFILE_PATH @bundler_tar = options[:bundler_tar] || "#{BUNDLER_DIR_NAME}.tgz" @gemfile_lock_path = "#{@gemfile_path}.lock" @orig_bundle_gemfile = ENV['BUNDLE_GEMFILE'] ENV['BUNDLE_GEMFILE'] = @gemfile_path.to_s - @unlock = false @path = Pathname.new "#{@bundler_path}/gems/#{BUNDLER_DIR_NAME}/lib" end def install fetch_bundler $LOAD_PATH << @path - without_warnings do - load @path.join("bundler.rb") - end + require "bundler" self end @@ -42,14 +40,6 @@ def clean FileUtils.remove_entry_secure(bundler_path) if Dir.exist?(bundler_path) end - def without_warnings(&block) - orig_verb = $VERBOSE - $VERBOSE = nil - yield - ensure - $VERBOSE = orig_verb - end - def has_gem?(name) specs.key?(name) end @@ -86,26 +76,21 @@ def instrument(*args, &block) LanguagePack::Instrument.instrument(*args, &block) end - def ui - Bundler.ui = Bundler::UI::Shell.new({}) - end - - def definition - Bundler.definition(@unlock) - rescue => e - raise GemfileParseError.new(e) - end - - def unlock - @unlock = true - yield - ensure - @unlock = false - end - def ruby_version - unlock do - definition.ruby_version + instrument 'detect_ruby_version' do + old_system_path = "/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin" + env = { "PATH" => "#{bundler_path}/bin:#{old_system_path}", + "RUBYLIB" => File.join(bundler_path, "gems", BUNDLER_DIR_NAME, "lib") + } + command = "bundle platform --ruby" + + output = run_stdout(command, user_env: true, env: env) + raise GemfileParseError.new(run(command, user_env: true, env: env)) unless $?.success? + if output.match(/No ruby version specified/) + "" + else + output.chomp.sub('(', '').sub(')', '').split.join('-') + end end end diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index f3c8b94fe..53c55aa03 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -175,7 +175,7 @@ def ruby_version last_version = nil last_version = @metadata.read(last_version_file).chomp if @metadata.exists?(last_version_file) - @ruby_version = LanguagePack::RubyVersion.new(bundler, + @ruby_version = LanguagePack::RubyVersion.new(bundler.ruby_version, is_new: new_app, last_version: last_version) return @ruby_version diff --git a/lib/language_pack/ruby_version.rb b/lib/language_pack/ruby_version.rb index deee8371a..b77dcf5ef 100644 --- a/lib/language_pack/ruby_version.rb +++ b/lib/language_pack/ruby_version.rb @@ -27,10 +27,10 @@ def initialize(output = "") attr_reader :set, :version, :version_without_patchlevel, :patchlevel, :engine, :ruby_version, :engine_version include LanguagePack::ShellHelpers - def initialize(bundler, app = {}) - @set = nil - @bundler = bundler - @app = app + def initialize(bundler_output, app = {}) + @set = nil + @bundler_output = bundler_output + @app = app set_version parse_version @@ -74,22 +74,6 @@ def to_gemfile end private - def gemfile - ruby_version = @bundler.ruby_version - return "" unless ruby_version - - parts = [ - "ruby", - ruby_version.version - ] - parts << "p#{ruby_version.patchlevel}" if ruby_version.patchlevel - unless ruby_version.engine == "ruby" - parts << ruby_version.engine - parts << ruby_version.engine_version - end - - parts.compact.join("-") - end def none if @app[:is_new] @@ -102,13 +86,12 @@ def none end def set_version - bundler_output = gemfile - if bundler_output.empty? + if @bundler_output.empty? @set = false @version = none else @set = :gemfile - @version = gemfile + @version = @bundler_output end end diff --git a/spec/helpers/ruby_version_spec.rb b/spec/helpers/ruby_version_spec.rb index 46b429f41..97fa15232 100644 --- a/spec/helpers/ruby_version_spec.rb +++ b/spec/helpers/ruby_version_spec.rb @@ -11,7 +11,7 @@ it "correctly sets ruby version for bundler specified versions" do Hatchet::App.new("mri_193").in_directory do |dir| - ruby_version = LanguagePack::RubyVersion.new(@bundler.install, is_new: true) + ruby_version = LanguagePack::RubyVersion.new(@bundler.install.ruby_version, is_new: true) version_number = "1.9.3" version = "ruby-#{version_number}" expect(ruby_version.version_without_patchlevel).to eq(version) @@ -23,7 +23,7 @@ it "correctly sets default ruby versions" do Hatchet::App.new("default_ruby").in_directory do |dir| - ruby_version = LanguagePack::RubyVersion.new(@bundler.install, is_new: true) + ruby_version = LanguagePack::RubyVersion.new(@bundler.install.ruby_version, is_new: true) version_number = LanguagePack::RubyVersion::DEFAULT_VERSION_NUMBER version = LanguagePack::RubyVersion::DEFAULT_VERSION expect(ruby_version.version_without_patchlevel).to eq(version) @@ -36,7 +36,7 @@ it "correctly sets default legacy version" do Hatchet::App.new("default_ruby").in_directory do |dir| - ruby_version = LanguagePack::RubyVersion.new(@bundler.install, is_new: false) + ruby_version = LanguagePack::RubyVersion.new(@bundler.install.ruby_version, is_new: false) version_number = LanguagePack::RubyVersion::LEGACY_VERSION_NUMBER version = LanguagePack::RubyVersion::LEGACY_VERSION expect(ruby_version.version_without_patchlevel).to eq(version) @@ -48,7 +48,7 @@ it "detects Ruby 2.0.0" do Hatchet::App.new("mri_200").in_directory do |dir| - ruby_version = LanguagePack::RubyVersion.new(@bundler.install, is_new: true) + ruby_version = LanguagePack::RubyVersion.new(@bundler.install.ruby_version, is_new: true) version_number = "2.0.0" version = "ruby-#{version_number}" expect(ruby_version.version_without_patchlevel).to eq(version) @@ -61,7 +61,7 @@ it "detects non mri engines" do Hatchet::App.new("ruby_193_jruby_173").in_directory do |dir| - ruby_version = LanguagePack::RubyVersion.new(@bundler.install, is_new: true) + ruby_version = LanguagePack::RubyVersion.new(@bundler.install.ruby_version, is_new: true) version_number = "1.9.3" engine_version = "1.7.3" engine = :jruby @@ -78,8 +78,8 @@ bundle_error_msg = "Zomg der was a problem in da gemfile" error_klass = LanguagePack::Helpers::BundlerWrapper::GemfileParseError Hatchet::App.new("bad_gemfile_on_platform").in_directory do |dir| - @bundler = LanguagePack::Helpers::BundlerWrapper.new() - expect {LanguagePack::RubyVersion.new(@bundler)}.to raise_error(error_klass, /#{Regexp.escape(bundle_error_msg)}/) + @bundler = LanguagePack::Helpers::BundlerWrapper.new().install + expect {LanguagePack::RubyVersion.new(@bundler.ruby_version)}.to raise_error(error_klass, /#{Regexp.escape(bundle_error_msg)}/) end end end From 5fb3f88e6c4554671f3ab9b37d513c42cc696051 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Sat, 3 May 2014 02:45:06 -0500 Subject: [PATCH 0036/1195] setup GEM_PATH so rubygems can find bundler --- lib/language_pack/helpers/bundler_wrapper.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index 462b5e7d2..6227ba44a 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -80,7 +80,8 @@ def ruby_version instrument 'detect_ruby_version' do old_system_path = "/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin" env = { "PATH" => "#{bundler_path}/bin:#{old_system_path}", - "RUBYLIB" => File.join(bundler_path, "gems", BUNDLER_DIR_NAME, "lib") + "RUBYLIB" => File.join(bundler_path, "gems", BUNDLER_DIR_NAME, "lib"), + "GEM_PATH" => "#{bundler_path}:#{ENV["GEM_PATH"]}" } command = "bundle platform --ruby" From 4fb925c54e0c1872fff4af0f99cedf195c0e69b0 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Sat, 3 May 2014 05:03:05 -0500 Subject: [PATCH 0037/1195] remove bundler setup since it affects BundlerWrapper tests --- spec/spec_helper.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 73c465db8..7eb96ee3d 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -8,6 +8,7 @@ require 'language_pack' ENV['RACK_ENV'] = 'test' +ENV['RUBYOPT'] = ENV['RUBYOPT'].sub('-rbundler/setup', '') if ENV['RUBYOPT'] RSpec.configure do |config| config.filter_run focused: true unless ENV['IS_RUNNING_ON_TRAVIS'] From ae7dccf3b3a11365fa0c9f1b8f280617ed24edce Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Sat, 3 May 2014 05:59:30 -0500 Subject: [PATCH 0038/1195] don't overwrite travis's PATH the PATH matters b/c the binstubs pick up the ruby based on the ruby in the path: `#!/usr/bin/env ruby`. --- lib/language_pack/helpers/bundler_wrapper.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index 6227ba44a..53ef6a6e3 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -78,8 +78,7 @@ def instrument(*args, &block) def ruby_version instrument 'detect_ruby_version' do - old_system_path = "/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin" - env = { "PATH" => "#{bundler_path}/bin:#{old_system_path}", + env = { "PATH" => "#{bundler_path}/bin:#{ENV['PATH']}", "RUBYLIB" => File.join(bundler_path, "gems", BUNDLER_DIR_NAME, "lib"), "GEM_PATH" => "#{bundler_path}:#{ENV["GEM_PATH"]}" } From 6c81262c370da2b1e67a51cdb52d998b9d2f6b99 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 5 May 2014 09:41:52 -0500 Subject: [PATCH 0039/1195] git add . is weird on travis --- spec/ruby_spec.rb | 2 +- spec/upgrade_ruby_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/ruby_spec.rb b/spec/ruby_spec.rb index d9c73e7e5..160c74137 100644 --- a/spec/ruby_spec.rb +++ b/spec/ruby_spec.rb @@ -3,7 +3,7 @@ describe "Ruby apps" do describe "Rake detection" do context "default" do - fit "adds default process types" do + it "adds default process types" do Hatchet::Runner.new('empty-procfile').deploy do |app| app.run("console") do |console| console.run("'hello' + 'world'") {|result| expect(result).to match('helloworld')} diff --git a/spec/upgrade_ruby_spec.rb b/spec/upgrade_ruby_spec.rb index 975be7a2e..2d4159ea9 100644 --- a/spec/upgrade_ruby_spec.rb +++ b/spec/upgrade_ruby_spec.rb @@ -8,7 +8,7 @@ `echo "" > Gemfile; rm Gemfile.lock` `env BUNDLE_GEMFILE=./Gemfile bundle install` `echo "ruby '2.1.0'" > Gemfile` - `git add . ; git commit -m update-ruby` + `git add . -A; git commit -m update-ruby` app.push! expect(app.output).to match("2.1.0") expect(app.run("ruby -v")).to match("2.1.0") From b551e5c4ee74c1ffebf9eba8601df44881873c26 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 5 May 2014 11:18:40 -0500 Subject: [PATCH 0040/1195] preserve RUBYOPT except for BundlerWrapper tests --- spec/helpers/bundler_wrapper_spec.rb | 9 +++++++++ spec/helpers/ruby_version_spec.rb | 7 +++++++ spec/spec_helper.rb | 1 - spec/upgrade_ruby_spec.rb | 8 +++++--- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/spec/helpers/bundler_wrapper_spec.rb b/spec/helpers/bundler_wrapper_spec.rb index 8affc1f74..e82abd4c2 100644 --- a/spec/helpers/bundler_wrapper_spec.rb +++ b/spec/helpers/bundler_wrapper_spec.rb @@ -3,10 +3,19 @@ describe "BundlerWrapper" do before(:each) do + if ENV['RUBYOPT'] + @original_rubyopt = ENV['RUBYOPT'] + ENV['RUBYOPT'] = ENV['RUBYOPT'].sub('-rbundler/setup', '') + end + @bundler = LanguagePack::Helpers::BundlerWrapper.new end after(:each) do + if ENV['RUBYOPT'] + ENV['RUBYOPT'] = @original_rubyopt + end + @bundler.clean end diff --git a/spec/helpers/ruby_version_spec.rb b/spec/helpers/ruby_version_spec.rb index 97fa15232..ae72197cd 100644 --- a/spec/helpers/ruby_version_spec.rb +++ b/spec/helpers/ruby_version_spec.rb @@ -2,10 +2,17 @@ describe "RubyVersion" do before(:each) do + if ENV['RUBYOPT'] + @original_rubyopt = ENV['RUBYOPT'] + ENV['RUBYOPT'] = ENV['RUBYOPT'].sub('-rbundler/setup', '') + end @bundler = LanguagePack::Helpers::BundlerWrapper.new end after(:each) do + if ENV['RUBYOPT'] + ENV['RUBYOPT'] = @original_rubyopt + end @bundler.clean end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 7eb96ee3d..73c465db8 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -8,7 +8,6 @@ require 'language_pack' ENV['RACK_ENV'] = 'test' -ENV['RUBYOPT'] = ENV['RUBYOPT'].sub('-rbundler/setup', '') if ENV['RUBYOPT'] RSpec.configure do |config| config.filter_run focused: true unless ENV['IS_RUNNING_ON_TRAVIS'] diff --git a/spec/upgrade_ruby_spec.rb b/spec/upgrade_ruby_spec.rb index 2d4159ea9..f7152592b 100644 --- a/spec/upgrade_ruby_spec.rb +++ b/spec/upgrade_ruby_spec.rb @@ -5,10 +5,12 @@ Hatchet::Runner.new("mri_200").deploy do |app| expect(app.run("ruby -v")).to match("2.0.0") - `echo "" > Gemfile; rm Gemfile.lock` - `env BUNDLE_GEMFILE=./Gemfile bundle install` + puts "================" + `echo "" > Gemfile; echo "" > Gemfile.lock` + puts `env BUNDLE_GEMFILE=./Gemfile bundle install`.inspect + puts `env BUNDLE_GEMFILE=#{`pwd`}/Gemfile bundle install`.inspect `echo "ruby '2.1.0'" > Gemfile` - `git add . -A; git commit -m update-ruby` + `git add -A; git commit -m update-ruby` app.push! expect(app.output).to match("2.1.0") expect(app.run("ruby -v")).to match("2.1.0") From dcae95c97cea1cb9130c0f323215eaf36369d2a4 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 6 May 2014 09:07:15 -0500 Subject: [PATCH 0041/1195] remove debug test output --- spec/upgrade_ruby_spec.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/spec/upgrade_ruby_spec.rb b/spec/upgrade_ruby_spec.rb index f7152592b..5336ff079 100644 --- a/spec/upgrade_ruby_spec.rb +++ b/spec/upgrade_ruby_spec.rb @@ -5,10 +5,8 @@ Hatchet::Runner.new("mri_200").deploy do |app| expect(app.run("ruby -v")).to match("2.0.0") - puts "================" `echo "" > Gemfile; echo "" > Gemfile.lock` puts `env BUNDLE_GEMFILE=./Gemfile bundle install`.inspect - puts `env BUNDLE_GEMFILE=#{`pwd`}/Gemfile bundle install`.inspect `echo "ruby '2.1.0'" > Gemfile` `git add -A; git commit -m update-ruby` app.push! From 8ce9066e4c47246e6298881542afaa22f61c3a7a Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 6 May 2014 09:07:35 -0500 Subject: [PATCH 0042/1195] fix ruby patchlevel support --- hatchet.json | 1 + lib/language_pack/helpers/bundler_wrapper.rb | 2 +- spec/helpers/ruby_version_spec.rb | 12 ++++++++++++ spec/rubies_spec.rb | 9 +++++++++ 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/hatchet.json b/hatchet.json index bd38b582a..46338d6e3 100644 --- a/hatchet.json +++ b/hatchet.json @@ -21,6 +21,7 @@ ], "ruby": [ "sharpstone/mri_187", + "sharpstone/mri_193_p484", "sharpstone/ruby_193_jruby_173", "sharpstone/ruby_193_jruby_176", "sharpstone/empty-procfile" diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index 53ef6a6e3..5f1893f4a 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -89,7 +89,7 @@ def ruby_version if output.match(/No ruby version specified/) "" else - output.chomp.sub('(', '').sub(')', '').split.join('-') + output.chomp.sub('(', '').sub(')', '').sub("p", " p").split.join('-') end end end diff --git a/spec/helpers/ruby_version_spec.rb b/spec/helpers/ruby_version_spec.rb index ae72197cd..f1288400c 100644 --- a/spec/helpers/ruby_version_spec.rb +++ b/spec/helpers/ruby_version_spec.rb @@ -16,6 +16,18 @@ @bundler.clean end + it "correctly handles patch levels" do + Hatchet::App.new("mri_193_p484").in_directory do |dir| + ruby_version = LanguagePack::RubyVersion.new(@bundler.install.ruby_version, is_new: true) + version_number = "1.9.3" + version = "ruby-#{version_number}" + expect(ruby_version.version_without_patchlevel).to eq(version) + expect(ruby_version.patchlevel).to eq("p484") + expect(ruby_version.engine_version).to eq(version_number) + expect(ruby_version.engine).to eq(:ruby) + end + end + it "correctly sets ruby version for bundler specified versions" do Hatchet::App.new("mri_193").in_directory do |dir| ruby_version = LanguagePack::RubyVersion.new(@bundler.install.ruby_version, is_new: true) diff --git a/spec/rubies_spec.rb b/spec/rubies_spec.rb index bb4a4691d..d4ab71c9f 100644 --- a/spec/rubies_spec.rb +++ b/spec/rubies_spec.rb @@ -1,6 +1,15 @@ require_relative 'spec_helper' describe "Ruby Versions" do + it "should allow patchlevels" do + Hatchet::Runner.new("mri_193_p484").deploy do |app| + version = '1.9.3p484' + expect(app.output).to match("ruby-1.9.3-p484") + expect(app.run('ruby -v')).to match(version) + end + end + + it "should deploy ruby 1.8.7 properly" do Hatchet::Runner.new("mri_187").deploy do |app| version = '1.8.7' From 2876488bb24e6a5fcbe71b174e23be7cf3da505c Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 6 May 2014 11:57:16 -0500 Subject: [PATCH 0043/1195] bump to v118 --- lib/language_pack/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 626a61e1e..6af9ae677 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v117" + BUILDPACK_VERSION = "v118" end end From 6d1d4a5a7be6ccf28f13001dd32f33e6f20980c3 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 6 May 2014 11:58:17 -0500 Subject: [PATCH 0044/1195] changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5020e0bc9..f5391d49b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Master +## v118 (4/6/2014) + +* Ruby version detection now loads user environment variables + ## v117 (4/14/2014) Features: From b959f7bb37d493f7507d90a29fbe714f7c91da3d Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 6 May 2014 22:16:17 -0500 Subject: [PATCH 0045/1195] [ci skip] fix date --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f5391d49b..06fa9f127 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ## Master -## v118 (4/6/2014) +## v118 (5/6/2014) * Ruby version detection now loads user environment variables From 4916a2919fb838ce445a697b945f2b74af875383 Mon Sep 17 00:00:00 2001 From: schneems Date: Fri, 9 May 2014 10:07:01 -0500 Subject: [PATCH 0046/1195] temporarily disable default-cache --- lib/language_pack/ruby.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 53c55aa03..43ae301c1 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -429,7 +429,7 @@ def load_default_cache? # loads a default bundler cache for new apps to speed up initial bundle installs def load_default_cache instrument "ruby.load_default_cache" do - if load_default_cache? + if false # load_default_cache? puts "New app detected loading default bundler cache" patchlevel = run("ruby -e 'puts RUBY_PATCHLEVEL'").chomp cache_name = "#{DEFAULT_RUBY_VERSION}-p#{patchlevel}-default-cache" From bb87243b2e9b4392ea2401b045af50e4b14e4960 Mon Sep 17 00:00:00 2001 From: schneems Date: Fri, 9 May 2014 10:08:12 -0500 Subject: [PATCH 0047/1195] bump to v119 --- lib/language_pack/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 6af9ae677..85519cb69 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v118" + BUILDPACK_VERSION = "v119" end end From ef439b58df44211f594e6684cd9f82c9880aa809 Mon Sep 17 00:00:00 2001 From: schneems Date: Fri, 9 May 2014 10:09:00 -0500 Subject: [PATCH 0048/1195] changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 06fa9f127..9fa0ac23b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Master +## v119 (5/9/2014) + +* Temporarily disable default ruby cache + ## v118 (5/6/2014) * Ruby version detection now loads user environment variables From 4770dd5723e71ee717383be2b1c03122f4ee1d1a Mon Sep 17 00:00:00 2001 From: schneems Date: Fri, 9 May 2014 10:11:36 -0500 Subject: [PATCH 0049/1195] fix sublime text highlighting --- Rakefile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Rakefile b/Rakefile index 00f228a3a..83616153f 100644 --- a/Rakefile +++ b/Rakefile @@ -39,16 +39,16 @@ def in_gem_env(gem_home, &block) ENV['GEM_PATH'] = old_gem_path end -def install_gem(gem, version) - name = "#{gem}-#{version}" - Dir.mktmpdir("#{gem}-#{version}") do |tmpdir| +def install_gem(gem_name, version) + name = "#{gem_name}-#{version}" + Dir.mktmpdir("#{gem_name}-#{version}") do |tmpdir| Dir.chdir(tmpdir) do |dir| FileUtils.rm_rf("#{tmpdir}/*") in_gem_env(tmpdir) do - sh("unset RUBYOPT; gem install #{gem} --version #{version} --no-ri --no-rdoc --env-shebang") - sh("rm #{gem}-#{version}.gem") - sh("rm -rf cache/#{gem}-#{version}.gem") + sh("unset RUBYOPT; gem install #{gem_name} --version #{version} --no-ri --no-rdoc --env-shebang") + sh("rm #{gem_name}-#{version}.gem") + sh("rm -rf cache/#{gem_name}-#{version}.gem") sh("tar czvf #{tmpdir}/#{name}.tgz *") s3_upload(tmpdir, name) end From 4ccc5cbfdbc6459fabe34b793586782566171c9f Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 5 Jun 2014 12:10:12 -0500 Subject: [PATCH 0050/1195] default cache test turned off until further notice --- spec/default_cache_spec.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/default_cache_spec.rb b/spec/default_cache_spec.rb index b83c0ff90..cf7ccb4a9 100644 --- a/spec/default_cache_spec.rb +++ b/spec/default_cache_spec.rb @@ -1,7 +1,8 @@ require 'spec_helper' describe "Default Cache" do - it "gets loaded successfully" do + fit "gets loaded successfully" do + pending("needs dep-tracker work") Hatchet::Runner.new("default_ruby").deploy do |app| expect(app.output).to match("loading default bundler cache") end From a43e7450bfe125477f5cf633b8893224559c2634 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 16 Jun 2014 12:58:44 -0500 Subject: [PATCH 0051/1195] bundler 1.6.3 --- CHANGELOG.md | 2 ++ lib/language_pack/ruby.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9fa0ac23b..26c43d332 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Master +* Bump bundler to 1.6.3 which includes improved dependency resolver + ## v119 (5/9/2014) * Temporarily disable default ruby cache diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 43ae301c1..cd6ddc73a 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -12,7 +12,7 @@ class LanguagePack::Ruby < LanguagePack::Base NAME = "ruby" LIBYAML_VERSION = "0.1.6" LIBYAML_PATH = "libyaml-#{LIBYAML_VERSION}" - BUNDLER_VERSION = "1.5.2" + BUNDLER_VERSION = "1.6.3" BUNDLER_GEM_PATH = "bundler-#{BUNDLER_VERSION}" NODE_VERSION = "0.4.7" NODE_JS_BINARY_PATH = "node-#{NODE_VERSION}" From a9536ffbfc6c3df1c0e98148a1af1eda15ae5009 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 16 Jun 2014 14:55:19 -0500 Subject: [PATCH 0052/1195] bump to v120 --- lib/language_pack/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 85519cb69..030399e5f 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v119" + BUILDPACK_VERSION = "v120" end end From c4d217820c807e9a57ec3f4c31629bc19a3c9641 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 16 Jun 2014 14:55:54 -0500 Subject: [PATCH 0053/1195] [ci skip] v120 changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 26c43d332..7c5533582 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Master +## v120 (6/16/2014) + * Bump bundler to 1.6.3 which includes improved dependency resolver ## v119 (5/9/2014) From 5797d92421f1fc724d687e666d395fb0d0a997ca Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 18 Jun 2014 15:56:13 -0500 Subject: [PATCH 0054/1195] [close #277] Source default env from user --- lib/language_pack/rack.rb | 2 +- lib/language_pack/rails2.rb | 4 ++-- lib/language_pack/rails41.rb | 2 +- lib/language_pack/ruby.rb | 2 +- spec/rack_spec.rb | 15 +++++++++++++++ 5 files changed, 20 insertions(+), 5 deletions(-) create mode 100644 spec/rack_spec.rb diff --git a/lib/language_pack/rack.rb b/lib/language_pack/rack.rb index 19ef59f09..00b5e8669 100644 --- a/lib/language_pack/rack.rb +++ b/lib/language_pack/rack.rb @@ -19,7 +19,7 @@ def name def default_config_vars instrument "rack.default_config_vars" do super.merge({ - "RACK_ENV" => "production" + "RACK_ENV" => env("RACK_ENV") || "production" }) end end diff --git a/lib/language_pack/rails2.rb b/lib/language_pack/rails2.rb index 64b0f62e8..3ced58c21 100644 --- a/lib/language_pack/rails2.rb +++ b/lib/language_pack/rails2.rb @@ -23,8 +23,8 @@ def name def default_config_vars instrument "rails2.default_config_vars" do super.merge({ - "RAILS_ENV" => "production", - "RACK_ENV" => "production" + "RAILS_ENV" => env("RAILS_ENV") || "production", + "RACK_ENV" => env("RACK_ENV") || "production", }) end end diff --git a/lib/language_pack/rails41.rb b/lib/language_pack/rails41.rb index 924924a4b..ed3f4dc36 100644 --- a/lib/language_pack/rails41.rb +++ b/lib/language_pack/rails41.rb @@ -29,7 +29,7 @@ def setup_profiled def default_config_vars super.merge({ - "SECRET_KEY_BASE" => app_secret + "SECRET_KEY_BASE" => env("SECRET_KEY_BASE") || app_secret }) end diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index cd6ddc73a..544529a31 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -58,7 +58,7 @@ def default_addons def default_config_vars instrument "ruby.default_config_vars" do vars = { - "LANG" => "en_US.UTF-8", + "LANG" => env("LANG") || "en_US.UTF-8" } ruby_version.jruby? ? vars.merge({ diff --git a/spec/rack_spec.rb b/spec/rack_spec.rb new file mode 100644 index 000000000..6464bfdc6 --- /dev/null +++ b/spec/rack_spec.rb @@ -0,0 +1,15 @@ +require_relative 'spec_helper' + +describe "Rack" do + it "should not overwrite already set environment variables" do + custom_env = "FFFUUUUUUU" + app = Hatchet::Runner.new("default_ruby") + app.setup! + app.set_config("RACK_ENV" => custom_env) + expect(app.run("env")).to match(custom_env) + + app.deploy do |app| + expect(app.run("env")).to match(custom_env) + end + end +end From aa2493187054cc4b8f49c09762f6eb6593f10687 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Fri, 27 Jun 2014 11:48:31 -0700 Subject: [PATCH 0055/1195] support STACK for different cedar stacks --- lib/language_pack/base.rb | 1 + lib/language_pack/fetcher.rb | 3 ++- lib/language_pack/ruby.rb | 5 +++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/language_pack/base.rb b/lib/language_pack/base.rb index 802a89e41..f1c028b59 100644 --- a/lib/language_pack/base.rb +++ b/lib/language_pack/base.rb @@ -29,6 +29,7 @@ def initialize(build_path, cache_path=nil) @id = Digest::SHA1.hexdigest("#{Time.now.to_f}-#{rand(1000000)}")[0..10] @warnings = [] @deprecations = [] + @stack = ENV["STACK"] @fetchers = {:buildpack => LanguagePack::Fetcher.new(VENDOR_URL) } Dir.chdir build_path diff --git a/lib/language_pack/fetcher.rb b/lib/language_pack/fetcher.rb index 34c569d61..5ba22e896 100644 --- a/lib/language_pack/fetcher.rb +++ b/lib/language_pack/fetcher.rb @@ -6,9 +6,10 @@ class Fetcher include ShellHelpers CDN_YAML_FILE = File.expand_path("../../../config/cdn.yml", __FILE__) - def initialize(host_url) + def initialize(host_url, stack = nil) @config = load_config @host_url = fetch_cdn(host_url) + @host_url += stack if stack end def fetch(path) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 544529a31..18e02e1c3 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -41,6 +41,7 @@ def bundler def initialize(build_path, cache_path=nil) super(build_path, cache_path) + @fetchers[:mri] = LanguagePack::Fetcher.new(VENDOR_URL, @stack) @fetchers[:jvm] = LanguagePack::Fetcher.new(JVM_BASE_URL) @fetchers[:rbx] = LanguagePack::Fetcher.new(RBX_BASE_URL) end @@ -265,7 +266,7 @@ def install_ruby Dir.chdir(build_ruby_path) do ruby_vm = "ruby" instrument "ruby.fetch_build_ruby" do - @fetchers[:buildpack].fetch_untar("#{ruby_version.version.sub(ruby_vm, "#{ruby_vm}-build")}.tgz") + @fetchers[:mri].fetch_untar("#{ruby_version.version.sub(ruby_vm, "#{ruby_vm}-build")}.tgz") end end error invalid_ruby_version_message unless $?.success? @@ -295,7 +296,7 @@ def install_ruby FileUtils.rm(file) FileUtils.rm(sha_file) else - @fetchers[:buildpack].fetch_untar("#{ruby_version.version}.tgz") + @fetchers[:mri].fetch_untar("#{ruby_version.version}.tgz") end end end From 4ca2f3c31d7902c63a45e1e448ded5977c4b8d72 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Mon, 30 Jun 2014 18:22:22 -0700 Subject: [PATCH 0056/1195] prevent directory traversal --- lib/language_pack/fetcher.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/fetcher.rb b/lib/language_pack/fetcher.rb index 5ba22e896..91e4041fe 100644 --- a/lib/language_pack/fetcher.rb +++ b/lib/language_pack/fetcher.rb @@ -9,7 +9,7 @@ class Fetcher def initialize(host_url, stack = nil) @config = load_config @host_url = fetch_cdn(host_url) - @host_url += stack if stack + @host_url += File.basename(stack) if stack end def fetch(path) From 00b3fdb07231b8f7a477c44e9deaa22d63094ae2 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Mon, 30 Jun 2014 19:02:34 -0700 Subject: [PATCH 0057/1195] update changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c5533582..1f95c650c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ ## Master +## v121 (6/30/2014) + +* on new apps, source default envs instead of replacing them +* support different stacks for new apps + ## v120 (6/16/2014) * Bump bundler to 1.6.3 which includes improved dependency resolver From f68853fb5bc8ec5da2361c76dd4f9ba1d8e62b1d Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Mon, 30 Jun 2014 19:02:54 -0700 Subject: [PATCH 0058/1195] bump to v121 --- lib/language_pack/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 030399e5f..80f097cac 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v120" + BUILDPACK_VERSION = "v121" end end From d63977044089e4bc6d43571b11a598ad08638e27 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Thu, 10 Jul 2014 16:31:20 -0700 Subject: [PATCH 0059/1195] add cache documentation --- lib/language_pack/cache.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/language_pack/cache.rb b/lib/language_pack/cache.rb index 912daa120..be363b300 100644 --- a/lib/language_pack/cache.rb +++ b/lib/language_pack/cache.rb @@ -1,12 +1,14 @@ require "pathname" require "language_pack" +# Manipulates/handles contents of the cache directory class LanguagePack::Cache + # @param [String] path to the cache store def initialize(cache_path) @cache_base = Pathname.new(cache_path) end - # removes the the specified + # removes the the specified path from the cache # @param [String] relative path from the cache_base def clear(path) target = (@cache_base + path) From 445a5991424bbeb5bc9c7e2e5b8d34452d3aa666 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 7 Jul 2014 15:29:44 -0500 Subject: [PATCH 0060/1195] make warnings more obvious --- lib/language_pack/base.rb | 8 +++++--- lib/language_pack/shell_helpers.rb | 3 ++- spec/rails3_spec.rb | 2 +- spec/rails4_spec.rb | 8 +++++--- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/lib/language_pack/base.rb b/lib/language_pack/base.rb index f1c028b59..3d54af245 100644 --- a/lib/language_pack/base.rb +++ b/lib/language_pack/base.rb @@ -77,9 +77,11 @@ def default_process_types def compile write_release_yaml instrument 'base.compile' do - if @warnings.any? - topic "WARNINGS:" - puts @warnings.join("\n") + Kernel.puts "" + @warnings.each do |warning| + Kernel.puts "###### WARNING:" + puts warning + Kernel.puts "" end if @deprecations.any? topic "DEPRECATIONS:" diff --git a/lib/language_pack/shell_helpers.rb b/lib/language_pack/shell_helpers.rb index 3a16d33f1..6d2d09422 100644 --- a/lib/language_pack/shell_helpers.rb +++ b/lib/language_pack/shell_helpers.rb @@ -122,8 +122,9 @@ def puts(message) def warn(message, options = {}) if options.key?(:inline) ? options[:inline] : false - topic "Warning:" + Kernel.puts "###### WARNING:" puts message + Kernel.puts "" end @warnings ||= [] @warnings << message diff --git a/spec/rails3_spec.rb b/spec/rails3_spec.rb index 6b5fe9c6b..5935b7d27 100644 --- a/spec/rails3_spec.rb +++ b/spec/rails3_spec.rb @@ -6,7 +6,7 @@ expect(app.output).to include("Asset precompilation completed") add_database(app, heroku) - expect(app.output).to match("WARNINGS") + expect(app.output).to match("WARNING") expect(app.output).to match("Add 'rails_12factor' gem to your Gemfile to skip plugin injection") ls = app.run("ls vendor/plugins") diff --git a/spec/rails4_spec.rb b/spec/rails4_spec.rb index d9372cacd..9d94ecf07 100644 --- a/spec/rails4_spec.rb +++ b/spec/rails4_spec.rb @@ -23,7 +23,7 @@ expect(app.output).to include("Asset precompilation completed") add_database(app, heroku) - expect(app.output).to match("WARNINGS") + expect(app.output).to match("WARNING") expect(app.output).to match("Include 'rails_12factor' gem to enable all platform features") app.run("rails console") do |console| @@ -43,8 +43,10 @@ result = app.run("bundle show rails") expect(result).to match("rails-4.0.0") - before_warnings = app.output.split("WARNINGS:").first - expect(before_warnings).to match("Removing `Gemfile.lock`") + expect(app.output).to match("Removing `Gemfile.lock`") + + before_final_warnings = app.output.split("Bundle completed").first + expect(before_final_warnings).to match("Removing `Gemfile.lock`") end end From 79ba97584be74c867abc1261a5c407f159b8df71 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Fri, 25 Jul 2014 09:41:24 -0500 Subject: [PATCH 0061/1195] unfocus test --- spec/default_cache_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/default_cache_spec.rb b/spec/default_cache_spec.rb index cf7ccb4a9..7cca755d1 100644 --- a/spec/default_cache_spec.rb +++ b/spec/default_cache_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe "Default Cache" do - fit "gets loaded successfully" do + it "gets loaded successfully" do pending("needs dep-tracker work") Hatchet::Runner.new("default_ruby").deploy do |app| expect(app.output).to match("loading default bundler cache") From 7880e0f774f296da2c95c1f973b5965dbbf0f410 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Fri, 25 Jul 2014 10:04:14 -0500 Subject: [PATCH 0062/1195] bump hatchet --- Gemfile.lock | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index ea111ea9c..4bfa227bd 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -8,23 +8,22 @@ GIT GEM remote: https://rubygems.org/ specs: - activesupport (4.0.3) - i18n (~> 0.6, >= 0.6.4) - minitest (~> 4.2) - multi_json (~> 1.3) + activesupport (4.1.4) + i18n (~> 0.6, >= 0.6.9) + json (~> 1.7, >= 1.7.7) + minitest (~> 5.1) thread_safe (~> 0.1) - tzinfo (~> 0.3.37) + tzinfo (~> 1.1) anvil-cli (0.16.1) progress (~> 2.4.0) rest-client (~> 1.6.7) thor (~> 0.15.2) - atomic (1.1.14) diff-lcs (1.1.3) - excon (0.31.0) - heroku-api (0.3.17) - excon (~> 0.27) - multi_json (~> 1.8.2) - heroku_hatchet (1.3.2) + excon (0.38.0) + heroku-api (0.3.19) + excon (~> 0.38) + multi_json (~> 1.8) + heroku_hatchet (1.3.3) activesupport (~> 4) anvil-cli (~> 0) excon (~> 0) @@ -33,20 +32,24 @@ GEM rrrretry (~> 1) thor (~> 0) threaded (~> 0) - i18n (0.6.9) - mime-types (2.1) - minitest (4.7.5) - multi_json (1.8.4) + i18n (0.6.11) + json (1.8.1) + mime-types (1.25.1) + minitest (5.4.0) + multi_json (1.10.1) netrc (0.7.7) parallel (0.6.5) parallel_tests (0.13.1) parallel progress (2.4.0) rake (10.0.4) + rdoc (4.1.1) + json (~> 1.4) repl_runner (0.0.3) activesupport - rest-client (1.6.7) - mime-types (>= 1.16) + rest-client (1.6.8) + mime-types (~> 1.16) + rdoc (>= 2.4.2) rrrretry (1.0.0) rspec (2.2.0) rspec-core (~> 2.2) @@ -59,10 +62,10 @@ GEM rspec-retry (0.2.1) rspec thor (0.15.4) - thread_safe (0.1.3) - atomic + thread_safe (0.3.4) threaded (0.0.4) - tzinfo (0.3.38) + tzinfo (1.2.1) + thread_safe (~> 0.1) PLATFORMS ruby From 3e01277685abbdba1ad2c73b39b9c11bc5d66096 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Wed, 9 Jul 2014 08:25:34 -0700 Subject: [PATCH 0063/1195] bundler cache is now stack aware make the bundler cache stack aware. This means in the cache directory: `vendor/bundle` -> `stack/vendor/bundle`. So cedar will be `cedar/vendor/bundle`. The layout on the slug itself will be unchanged. This is how the migration will work. * we assume you're coming from the cedar stack, so it won't blow the * cache away if have nothing set. * going from cedar to cedar-14 will clear the cache or vice versa * having no stack known to the cache to cedar-14 will clear the cache * after this, everyone will have a stack aware bundler cache * the layout on the slug itself will be unchanged. only the cache * directory will take the stack into account. --- lib/language_pack/base.rb | 21 +++++----- lib/language_pack/cache.rb | 21 +++++++--- lib/language_pack/helpers/bundler_cache.rb | 47 ++++++++++++++++++++++ lib/language_pack/ruby.rb | 22 +++++++--- 4 files changed, 90 insertions(+), 21 deletions(-) create mode 100644 lib/language_pack/helpers/bundler_cache.rb diff --git a/lib/language_pack/base.rb b/lib/language_pack/base.rb index 3d54af245..5984fb75e 100644 --- a/lib/language_pack/base.rb +++ b/lib/language_pack/base.rb @@ -4,6 +4,7 @@ require "digest/sha1" require "language_pack/shell_helpers" require "language_pack/cache" +require "language_pack/helpers/bundler_cache" require "language_pack/metadata" require "language_pack/fetcher" require "language_pack/instrument" @@ -14,7 +15,8 @@ class LanguagePack::Base include LanguagePack::ShellHelpers - VENDOR_URL = ENV['BUILDPACK_VENDOR_URL'] || "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby" + VENDOR_URL = ENV['BUILDPACK_VENDOR_URL'] || "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby" + DEFAULT_LEGACY_STACK = "cedar" attr_reader :build_path, :cache @@ -23,14 +25,15 @@ class LanguagePack::Base # @param [String] the path of the cache dir this is nil during detect and release def initialize(build_path, cache_path=nil) self.class.instrument "base.initialize" do - @build_path = build_path - @cache = LanguagePack::Cache.new(cache_path) if cache_path - @metadata = LanguagePack::Metadata.new(@cache) - @id = Digest::SHA1.hexdigest("#{Time.now.to_f}-#{rand(1000000)}")[0..10] - @warnings = [] - @deprecations = [] - @stack = ENV["STACK"] - @fetchers = {:buildpack => LanguagePack::Fetcher.new(VENDOR_URL) } + @build_path = build_path + @stack = ENV["STACK"] + @cache = LanguagePack::Cache.new(cache_path) if cache_path + @metadata = LanguagePack::Metadata.new(@cache) + @bundler_cache = LanguagePack::BundlerCache.new(@cache, @stack) + @id = Digest::SHA1.hexdigest("#{Time.now.to_f}-#{rand(1000000)}")[0..10] + @warnings = [] + @deprecations = [] + @fetchers = {:buildpack => LanguagePack::Fetcher.new(VENDOR_URL) } Dir.chdir build_path end diff --git a/lib/language_pack/cache.rb b/lib/language_pack/cache.rb index be363b300..478134a4c 100644 --- a/lib/language_pack/cache.rb +++ b/lib/language_pack/cache.rb @@ -17,16 +17,18 @@ def clear(path) # write cache contents # @param [String] path of contents to store. it will be stored using this a relative path from the cache_base. - # @param [Boolean] defaults to true. if set to true, the cache store directory will be cleared before writing to it. - def store(path, clear_first=true) - clear(path) if clear_first - copy path, (@cache_base + path) + # @param [String] relative path to store the cache contents, if nil it will assume the from path + def store(from, path = nil) + path ||= from + copy from, (@cache_base + path) end # load cache contents # @param [String] relative path of the cache contents - def load(path) - copy (@cache_base + path), path + # @param [String] path of where to store it locally, if nil, assume same relative path as the cache contents + def load(path, dest = nil) + dest ||= path + copy (@cache_base + path), dest end # copy cache contents @@ -38,6 +40,13 @@ def copy(from, to) system("cp -a #{from}/. #{to}") end + # copy contents between to places in the cache + # @param [String] source cache directory + # @param [String] destination directory + def cache_copy(from,to) + copy(@cache_base + from, @cache_base + to) + end + # check if the cache content exists # @param [String] relative path of the cache contents # @param [Boolean] true if the path exists in the cache and false if otherwise diff --git a/lib/language_pack/helpers/bundler_cache.rb b/lib/language_pack/helpers/bundler_cache.rb new file mode 100644 index 000000000..9b67ae07b --- /dev/null +++ b/lib/language_pack/helpers/bundler_cache.rb @@ -0,0 +1,47 @@ +require "pathname" +require "fileutils" +require "language_pack/cache" + +# manipulating the `vendor/bundle` Bundler cache directory. +# supports storing the cache in a "stack" directory +class LanguagePack::BundlerCache + attr_reader :bundler_dir + + # @param [LanguagePack::Cache] cache object + # @param [String] stack buildpack is running on + def initialize(cache, stack = nil) + @cache = cache + @stack = stack + @bundler_dir = Pathname.new("vendor/bundle") + @stack_dir = @stack ? Pathname.new(@stack) + @bundler_dir : @bundler_dir + end + + # removes the bundler cache dir BOTH in the cache and local directory + def clear(stack = nil) + stack ||= @stack + @cache.clear(stack) + @bundler_dir.rmtree + end + + # converts to cache directory to support stacks. only copy contents if the stack hasn't changed + # @param [Boolean] denote if there's a stack change or not + def convert_stack(stack_change) + @cache.cache_copy(@bundler_dir, @stack_dir) unless stack_change + @cache.clear(@bundler_dir) + end + + # detects if using the non stack directory layout + def old? + @cache.exists?(@bundler_dir) + end + + # writes cache contents to cache store + def store + @cache.store(@bundler_dir, @stack_dir) + end + + # loads cache contents from the cache store + def load + @cache.load(@stack_dir, @bundler_dir) + end +end diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 18e02e1c3..ea279dba4 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -543,7 +543,7 @@ def build_bundler end end cache.store ".bundle" - cache.store "vendor/bundle" + @bundler_cache.store # Keep gem cache out of the slug FileUtils.rm_rf("#{slug_vendor_base}/cache") @@ -741,10 +741,20 @@ def load_bundler_cache buildpack_version_cache = "buildpack_version" bundler_version_cache = "bundler_version" rubygems_version_cache = "rubygems_version" + stack_cache = "stack" old_rubygems_version = @metadata.read(ruby_version_cache).chomp if @metadata.exists?(ruby_version_cache) - - load_default_cache + old_stack = @metadata.read(stack_cache).chomp if @metadata.exists?(stack_cache) + old_stack ||= DEFAULT_LEGACY_STACK + + stack_change = old_stack != @stack + @bundler_cache.convert_stack(stack_change) if @bundler_cache.old? + if !new_app? && stack_change + puts "Purging Cache. Changing stack from #{old_stack} to #{@stack}" + purge_bundler_cache(old_stack) + elsif !new_app? + @bundler_cache.load + end # fix bug from v37 deploy if File.exists?("vendor/ruby_version") @@ -796,14 +806,14 @@ def load_bundler_cache @metadata.write(buildpack_version_cache, BUILDPACK_VERSION, false) @metadata.write(bundler_version_cache, BUNDLER_VERSION, false) @metadata.write(rubygems_version_cache, rubygems_version, false) + @metadata.write(stack_cache, @stack, false) @metadata.save end end - def purge_bundler_cache + def purge_bundler_cache(stack = nil) instrument "ruby.purge_bundler_cache" do - FileUtils.rm_rf(bundler_cache) - cache.clear bundler_cache + @bundler_cache.clear(stack) # need to reinstall language pack gems install_bundler_in_app end From a118b0c0aff11c124922c2135f9eda7d8735725b Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Thu, 10 Jul 2014 21:31:52 -0700 Subject: [PATCH 0064/1195] add stack change spec tests --- spec/stack_spec.rb | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 spec/stack_spec.rb diff --git a/spec/stack_spec.rb b/spec/stack_spec.rb new file mode 100644 index 000000000..4b0e6d6d9 --- /dev/null +++ b/spec/stack_spec.rb @@ -0,0 +1,26 @@ +require_relative "spec_helper" + +describe "Stack Changes" do + it "should reinstall gems on stack change" do + Hatchet::Runner.new("mri_200").deploy do |app, heroku| + heroku.put_stack(app.name, "cedar-14") + `git commit --allow-empty -m "cedar-14 migrate"` + + app.push! + puts app.output + expect(app.output).to match("Installing rack 1.5.0") + expect(app.output).to match("Changing stack") + end + end + + it "should not reinstall gems if the stack did not change" do + Hatchet::Runner.new("mri_200").deploy do |app, heroku| + heroku.put_stack(app.name, "cedar") + `git commit --allow-empty -m "cedar migrate"` + + app.push! + puts app.output + expect(app.output).to match("Using rack 1.5.0") + end + end +end From 40c0717c1575253080b1c05dd9734f11dc6f576b Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Fri, 25 Jul 2014 13:25:50 -0500 Subject: [PATCH 0065/1195] update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f95c650c..06cb0c4c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Master +## v122 (7/25/2014) + +* handle bundler cache for stack changes on existing apps + ## v121 (6/30/2014) * on new apps, source default envs instead of replacing them From f96fd29ccb69b9f1149f3e3f51f7c49bad0071c9 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Fri, 25 Jul 2014 13:26:09 -0500 Subject: [PATCH 0066/1195] bump to v122 --- lib/language_pack/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 80f097cac..fb6621930 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v121" + BUILDPACK_VERSION = "v122" end end From f2aabb109879bb621e15f2ed0757156eba412e60 Mon Sep 17 00:00:00 2001 From: schneems Date: Fri, 25 Jul 2014 16:04:00 -0500 Subject: [PATCH 0067/1195] rev hatchet to fix parallel app delete problem --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 4bfa227bd..0610cd1ef 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -23,7 +23,7 @@ GEM heroku-api (0.3.19) excon (~> 0.38) multi_json (~> 1.8) - heroku_hatchet (1.3.3) + heroku_hatchet (1.3.4) activesupport (~> 4) anvil-cli (~> 0) excon (~> 0) From 73f7e89463bbd3b9334fa84a1d4a5008457a8ac0 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Fri, 25 Jul 2014 18:31:06 -0500 Subject: [PATCH 0068/1195] need to clear the destination bundle store for instance in minitest: -r--r--r-- 1 hone hone 2003 Jul 25 16:33 Rakefile Don't have write permission, so the buildpack pukes when trying to overwrite the cache. --- lib/language_pack/helpers/bundler_cache.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/language_pack/helpers/bundler_cache.rb b/lib/language_pack/helpers/bundler_cache.rb index 9b67ae07b..d5416da26 100644 --- a/lib/language_pack/helpers/bundler_cache.rb +++ b/lib/language_pack/helpers/bundler_cache.rb @@ -37,6 +37,7 @@ def old? # writes cache contents to cache store def store + @cache.clear(@stack_dir) @cache.store(@bundler_dir, @stack_dir) end From 513cf06ccde6de7cb43b4a7c3f10f4bd43e38574 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Fri, 25 Jul 2014 18:57:11 -0500 Subject: [PATCH 0069/1195] don't load the cache if we just converted the stack the cache will already be loaded --- lib/language_pack/ruby.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index ea279dba4..cbf6fe6c2 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -747,12 +747,13 @@ def load_bundler_cache old_stack = @metadata.read(stack_cache).chomp if @metadata.exists?(stack_cache) old_stack ||= DEFAULT_LEGACY_STACK - stack_change = old_stack != @stack - @bundler_cache.convert_stack(stack_change) if @bundler_cache.old? + stack_change = old_stack != @stack + convert_stack = @bundler_cache.old? + @bundler_cache.convert_stack(stack_change) if convert_stack if !new_app? && stack_change puts "Purging Cache. Changing stack from #{old_stack} to #{@stack}" purge_bundler_cache(old_stack) - elsif !new_app? + elsif !new_app? && !convert_stack @bundler_cache.load end From 11a56c22da6c8733c7d5793537cc4e58e5f867e6 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Fri, 25 Jul 2014 19:03:22 -0500 Subject: [PATCH 0070/1195] update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 06cb0c4c8..9cc99ebfc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Master +## v123 (7/25/2014) + +* fix permission denied edge cases when copying the bundler cache with minitest + ## v122 (7/25/2014) * handle bundler cache for stack changes on existing apps From 965ab4c460aa39986771cc3a2dc094a5baf965bc Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Fri, 25 Jul 2014 19:04:05 -0500 Subject: [PATCH 0071/1195] bump to v123 --- lib/language_pack/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index fb6621930..9fb62505e 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v122" + BUILDPACK_VERSION = "v123" end end From 74b428420bfbc5f69cf489836e53d16ce1abdb74 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Fri, 25 Jul 2014 22:15:35 -0500 Subject: [PATCH 0072/1195] use the vendored java not the stack image one --- lib/language_pack/ruby.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index cbf6fe6c2..490608ac6 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -220,6 +220,7 @@ def ruby_versions # sets up the environment variables for the build process def setup_language_pack_environment instrument 'ruby.setup_language_pack_environment' do + ENV["PATH"] += ":bin" if ruby_version.jruby? setup_ruby_install_env ENV["PATH"] += ":#{node_bp_bin_path}" if node_js_installed? From 496f799e1465f7ed050015e4518507a4e47edc38 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Thu, 31 Jul 2014 15:16:43 -0700 Subject: [PATCH 0073/1195] extract individual files from the fetcher --- lib/language_pack/fetcher.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/language_pack/fetcher.rb b/lib/language_pack/fetcher.rb index 91e4041fe..7085c3322 100644 --- a/lib/language_pack/fetcher.rb +++ b/lib/language_pack/fetcher.rb @@ -17,14 +17,14 @@ def fetch(path) run!(curl) end - def fetch_untar(path) + def fetch_untar(path, files_to_extract = nil) curl = curl_command("#{@host_url.join(path)} -s -o") - run!("#{curl} - | tar zxf -") + run!("#{curl} - | tar zxf - #{files_to_extract}") end - def fetch_bunzip2(path) + def fetch_bunzip2(path, files_to_extract = nil) curl = curl_command("#{@host_url.join(path)} -s -o") - run!("#{curl} - | tar jxf -") + run!("#{curl} - | tar jxf - #{files_to_extract}") end private From 7d86d5d629006a3858ee6272895ebd5fde5f88db Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Thu, 31 Jul 2014 15:19:56 -0700 Subject: [PATCH 0074/1195] install node 0.10.29 for cedar-14 --- lib/language_pack/ruby.rb | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 490608ac6..7dbdffcdf 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -14,8 +14,9 @@ class LanguagePack::Ruby < LanguagePack::Base LIBYAML_PATH = "libyaml-#{LIBYAML_VERSION}" BUNDLER_VERSION = "1.6.3" BUNDLER_GEM_PATH = "bundler-#{BUNDLER_VERSION}" - NODE_VERSION = "0.4.7" - NODE_JS_BINARY_PATH = "node-#{NODE_VERSION}" + NODE_VERSION = "0.10.29" + NODE_JS_BINARY_PATH = "node-v#{NODE_VERSION}-linux-x64" + NODEJS_BASE_URL = "http://nodejs.org/dist/v#{NODE_VERSION}/" JVM_BASE_URL = "http://heroku-jdk.s3.amazonaws.com" LATEST_JVM_VERSION = "openjdk7-latest" LEGACY_JVM_VERSION = "openjdk1.7.0_25" @@ -44,6 +45,7 @@ def initialize(build_path, cache_path=nil) @fetchers[:mri] = LanguagePack::Fetcher.new(VENDOR_URL, @stack) @fetchers[:jvm] = LanguagePack::Fetcher.new(JVM_BASE_URL) @fetchers[:rbx] = LanguagePack::Fetcher.new(RBX_BASE_URL) + @fetchers[:nodejs] = LanguagePack::Fetcher.new(NODEJS_BASE_URL) end def name @@ -414,7 +416,14 @@ def install_binary(name) bin_dir = "bin" FileUtils.mkdir_p bin_dir Dir.chdir(bin_dir) do |dir| - @fetchers[:buildpack].fetch_untar("#{name}.tgz") + if name == NODE_JS_BINARY_PATH + node_bin = "#{name}/bin/node" + @fetchers[:nodejs].fetch_untar("#{name}.tar.gz", "#{name}/bin/node") + FileUtils.mv(node_bin, ".") + FileUtils.rm_rf(name) + else + @fetchers[:buildpack].fetch_untar("#{name}.tgz") + end end end From 4c513f8e94b1233e42cb1aa619d97be82fe2a161 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Thu, 31 Jul 2014 16:06:56 -0700 Subject: [PATCH 0075/1195] extract logic into NodeInstaller class, add cedar support back --- lib/language_pack/helpers/node_installer.rb | 41 +++++++++++++++++++++ lib/language_pack/ruby.rb | 22 +++++------ 2 files changed, 50 insertions(+), 13 deletions(-) create mode 100644 lib/language_pack/helpers/node_installer.rb diff --git a/lib/language_pack/helpers/node_installer.rb b/lib/language_pack/helpers/node_installer.rb new file mode 100644 index 000000000..9d9211759 --- /dev/null +++ b/lib/language_pack/helpers/node_installer.rb @@ -0,0 +1,41 @@ +class LanguagePack::NodeInstaller + LEGACY_NODE_VERSION = "0.4.7" + LEGACY_BINARY_PATH = "node-#{LEGACY_NODE_VERSION}" + + MODERN_NODE_VERSION = "0.10.29" + MODERN_BINARY_PATH = "node-v#{MODERN_NODE_VERSION}-linux-x64" + + NODEJS_BASE_URL = "http://nodejs.org/dist/v#{MODERN_NODE_VERSION}/" + + def initialize(fetchers, stack) + @fetchers = fetchers + @legacy = stack == LanguagePack::Base::DEFAULT_LEGACY_STACK + end + + def version + if @legacy + LEGACY_NODE_VERSION + else + MODERN_NODE_VERSION + end + end + + def binary_path + if @legacy + LEGACY_BINARY_PATH + else + MODERN_BINARY_PATH + end + end + + def install + if @legacy + @fetchers[:buildpack].fetch_untar("#{LEGACY_BINARY_PATH}.tgz") + else + node_bin = "#{MODERN_BINARY_PATH}/bin/node" + @fetchers[:nodejs].fetch_untar("#{MODERN_BINARY_PATH}.tar.gz", "#{MODERN_BINARY_PATH}/bin/node") + FileUtils.mv(node_bin, ".") + FileUtils.rm_rf(MODERN_BINARY_PATH) + end + end +end diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 7dbdffcdf..67cf5f064 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -5,6 +5,7 @@ require "language_pack" require "language_pack/base" require "language_pack/ruby_version" +require "language_pack/helpers/node_installer" require "language_pack/version" # base Ruby Language Pack. This is for any base ruby app. @@ -14,9 +15,6 @@ class LanguagePack::Ruby < LanguagePack::Base LIBYAML_PATH = "libyaml-#{LIBYAML_VERSION}" BUNDLER_VERSION = "1.6.3" BUNDLER_GEM_PATH = "bundler-#{BUNDLER_VERSION}" - NODE_VERSION = "0.10.29" - NODE_JS_BINARY_PATH = "node-v#{NODE_VERSION}-linux-x64" - NODEJS_BASE_URL = "http://nodejs.org/dist/v#{NODE_VERSION}/" JVM_BASE_URL = "http://heroku-jdk.s3.amazonaws.com" LATEST_JVM_VERSION = "openjdk7-latest" LEGACY_JVM_VERSION = "openjdk1.7.0_25" @@ -42,10 +40,11 @@ def bundler def initialize(build_path, cache_path=nil) super(build_path, cache_path) - @fetchers[:mri] = LanguagePack::Fetcher.new(VENDOR_URL, @stack) - @fetchers[:jvm] = LanguagePack::Fetcher.new(JVM_BASE_URL) - @fetchers[:rbx] = LanguagePack::Fetcher.new(RBX_BASE_URL) - @fetchers[:nodejs] = LanguagePack::Fetcher.new(NODEJS_BASE_URL) + @fetchers[:mri] = LanguagePack::Fetcher.new(VENDOR_URL, @stack) + @fetchers[:jvm] = LanguagePack::Fetcher.new(JVM_BASE_URL) + @fetchers[:rbx] = LanguagePack::Fetcher.new(RBX_BASE_URL) + @fetchers[:nodejs] = LanguagePack::Fetcher.new(LanguagePack::NodeInstaller::NODEJS_BASE_URL) + @node_installer = LanguagePack::NodeInstaller.new(@fetchers, @stack) end def name @@ -416,11 +415,8 @@ def install_binary(name) bin_dir = "bin" FileUtils.mkdir_p bin_dir Dir.chdir(bin_dir) do |dir| - if name == NODE_JS_BINARY_PATH - node_bin = "#{name}/bin/node" - @fetchers[:nodejs].fetch_untar("#{name}.tar.gz", "#{name}/bin/node") - FileUtils.mv(node_bin, ".") - FileUtils.rm_rf(name) + if name.match(/^node\-/) + @node_installer.install else @fetchers[:buildpack].fetch_untar("#{name}.tgz") end @@ -696,7 +692,7 @@ def add_dev_database_addon # @note execjs will blow up if no JS RUNTIME is detected and is loaded. # @return [Array] the node.js binary path if we need it or an empty Array def add_node_js_binary - bundler.has_gem?('execjs') && !node_js_installed? ? [NODE_JS_BINARY_PATH] : [] + bundler.has_gem?('execjs') && !node_js_installed? ? [@node_installer.binary_path] : [] end def node_bp_bin_path From c9ec0937c66076367d7bcea86774cd34e07b6bfa Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Thu, 31 Jul 2014 18:11:58 -0700 Subject: [PATCH 0076/1195] move fetchers into NodeInstaller class, node-0.4.7.tgz is cedar specific --- lib/language_pack/helpers/node_installer.rb | 17 ++++++++++------- lib/language_pack/ruby.rb | 3 +-- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/language_pack/helpers/node_installer.rb b/lib/language_pack/helpers/node_installer.rb index 9d9211759..6fea30b4b 100644 --- a/lib/language_pack/helpers/node_installer.rb +++ b/lib/language_pack/helpers/node_installer.rb @@ -1,14 +1,17 @@ class LanguagePack::NodeInstaller - LEGACY_NODE_VERSION = "0.4.7" - LEGACY_BINARY_PATH = "node-#{LEGACY_NODE_VERSION}" - MODERN_NODE_VERSION = "0.10.29" MODERN_BINARY_PATH = "node-v#{MODERN_NODE_VERSION}-linux-x64" + LEGACY_NODE_VERSION = "0.4.7" + LEGACY_BINARY_PATH = "node-#{LEGACY_NODE_VERSION}" + NODEJS_BASE_URL = "http://nodejs.org/dist/v#{MODERN_NODE_VERSION}/" - def initialize(fetchers, stack) - @fetchers = fetchers + def initialize(stack) + @fetchers = { + modern: LanguagePack::Fetcher.new(NODEJS_BASE_URL), + legacy: LanguagePack::Fetcher.new(LanguagePack::Base::VENDOR_URL, LanguagePack::Base::DEFAULT_LEGACY_STACK) + } @legacy = stack == LanguagePack::Base::DEFAULT_LEGACY_STACK end @@ -30,10 +33,10 @@ def binary_path def install if @legacy - @fetchers[:buildpack].fetch_untar("#{LEGACY_BINARY_PATH}.tgz") + @fetchers[:legacy].fetch_untar("#{LEGACY_BINARY_PATH}.tgz") else node_bin = "#{MODERN_BINARY_PATH}/bin/node" - @fetchers[:nodejs].fetch_untar("#{MODERN_BINARY_PATH}.tar.gz", "#{MODERN_BINARY_PATH}/bin/node") + @fetchers[:modern].fetch_untar("#{MODERN_BINARY_PATH}.tar.gz", "#{MODERN_BINARY_PATH}/bin/node") FileUtils.mv(node_bin, ".") FileUtils.rm_rf(MODERN_BINARY_PATH) end diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 67cf5f064..66f366b15 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -43,8 +43,7 @@ def initialize(build_path, cache_path=nil) @fetchers[:mri] = LanguagePack::Fetcher.new(VENDOR_URL, @stack) @fetchers[:jvm] = LanguagePack::Fetcher.new(JVM_BASE_URL) @fetchers[:rbx] = LanguagePack::Fetcher.new(RBX_BASE_URL) - @fetchers[:nodejs] = LanguagePack::Fetcher.new(LanguagePack::NodeInstaller::NODEJS_BASE_URL) - @node_installer = LanguagePack::NodeInstaller.new(@fetchers, @stack) + @node_installer = LanguagePack::NodeInstaller.new(@stack) end def name From 8aa164579d74a859c8ed6d0adbb43e727c407f5f Mon Sep 17 00:00:00 2001 From: schneems Date: Fri, 25 Jul 2014 16:56:12 -0500 Subject: [PATCH 0077/1195] rev hatchet app limit --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index d994c0faf..606b60206 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,6 +16,7 @@ env: - HATCHET_RETRIES=3 - IS_RUNNING_ON_TRAVIS=true - HATCHET_DEPLOY_STRATEGY=git + - HATCHET_APP_LIMIT=80 # sets the HEROKU_API_KEY to a dummy user for Heroku deploys - secure: |- ccqb7fKumq2+VEkSrkCqmLjALj5R/ZDgAQGZULSFYeD0O0man3hezUEbMB53 From 2e7fae37061df16be9816978dc224d000021bbc4 Mon Sep 17 00:00:00 2001 From: schneems Date: Fri, 1 Aug 2014 08:46:05 -0500 Subject: [PATCH 0078/1195] cycle travis password --- .travis.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 606b60206..0e57f54c2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,4 @@ env: - HATCHET_DEPLOY_STRATEGY=git - HATCHET_APP_LIMIT=80 # sets the HEROKU_API_KEY to a dummy user for Heroku deploys - - secure: |- - ccqb7fKumq2+VEkSrkCqmLjALj5R/ZDgAQGZULSFYeD0O0man3hezUEbMB53 - U+7gLkbqz5saFX9S5Sz26f99vmhWz1bMHkC2UtlyFSlgaqSvXMZNHJAweqRY - ptqugqtvT0VVl1g3DInVgjDZhjINICv/CIorNuHijOFanP1Zmxg= + - secure: QvDqQQV/Gtk1Og5s8879i+mYLdK6WtVkZMKlCWvJrztYwcRMOGsVVbXjq5EkEJCfxs4GWv7KqXfPPPLDS5Wumzkt4zXVh3ZS+rzQZ2IYC0XbKZYt2e14ZpSTgDUY20J0Ex/GG5dTulJaG9FBe452UDiqYrianE4p8h8w18JBfCs= From 5025dd7c6080537d6c04de2ecb2ee5c0ceec5e7b Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Fri, 1 Aug 2014 10:15:11 -0700 Subject: [PATCH 0079/1195] update changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9cc99ebfc..678a8b157 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ ## Master +## v124 (8/1/2014) + +* use node 0.10.29 on cedar-14 +* properly use vendored jvm, so not to be dependent on java on the stack image + ## v123 (7/25/2014) * fix permission denied edge cases when copying the bundler cache with minitest From 3deeeb719dea7c5bf13db08ec6ffa14045222a61 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Fri, 1 Aug 2014 10:15:31 -0700 Subject: [PATCH 0080/1195] bump to v124 --- lib/language_pack/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 9fb62505e..17f75ab8d 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v123" + BUILDPACK_VERSION = "v124" end end From 17a120b7ec640948f6f55c4ef5f22a1c2aa03e78 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Fri, 1 Aug 2014 11:34:41 -0700 Subject: [PATCH 0081/1195] bump to node 0.10.30 for http://blog.nodejs.org/2014/07/31/v8-memory-corruption-stack-overflow/ --- lib/language_pack/helpers/node_installer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/helpers/node_installer.rb b/lib/language_pack/helpers/node_installer.rb index 6fea30b4b..7f9a710de 100644 --- a/lib/language_pack/helpers/node_installer.rb +++ b/lib/language_pack/helpers/node_installer.rb @@ -1,5 +1,5 @@ class LanguagePack::NodeInstaller - MODERN_NODE_VERSION = "0.10.29" + MODERN_NODE_VERSION = "0.10.30" MODERN_BINARY_PATH = "node-v#{MODERN_NODE_VERSION}-linux-x64" LEGACY_NODE_VERSION = "0.4.7" From d09e4161585f74b2e65cb9b5c281ae57f31bf089 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Fri, 1 Aug 2014 11:38:39 -0700 Subject: [PATCH 0082/1195] update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 678a8b157..2a84e772b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Master +## v125 (8/1/2014) + +* bump to node 0.10.30 on cedar-14 + ## v124 (8/1/2014) * use node 0.10.29 on cedar-14 From bee745f480e97cee47036e4dc76891e9e226d22b Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Fri, 1 Aug 2014 11:38:56 -0700 Subject: [PATCH 0083/1195] bump to v125 --- lib/language_pack/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 17f75ab8d..c096b5fbe 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v124" + BUILDPACK_VERSION = "v125" end end From 50f2bbb3d0b0baa2cbbdbf065098ed9228ca6d21 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Fri, 1 Aug 2014 16:00:17 -0700 Subject: [PATCH 0084/1195] in cedar-14, we need to install a java runtime for yui-compressor --- lib/language_pack/ruby.rb | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 66f366b15..fea642af4 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -92,6 +92,7 @@ def compile allow_git do install_bundler_in_app build_bundler + post_bundler create_database_yml install_binaries run_assets_precompile_rake_task @@ -333,11 +334,11 @@ def new_app? end # vendors JVM into the slug for JRuby - def install_jvm + def install_jvm(forced = false) instrument 'ruby.install_jvm' do - if ruby_version.jruby? + if ruby_version.jruby? || forced jvm_version = - if Gem::Version.new(ruby_version.engine_version) >= Gem::Version.new("1.7.4") + if forced || Gem::Version.new(ruby_version.engine_version) >= Gem::Version.new("1.7.4") LATEST_JVM_VERSION else LEGACY_JVM_VERSION @@ -571,6 +572,13 @@ def build_bundler end end + def post_bundler + if bundler.has_gem?('yui-compressor') && !ruby_version.jruby? + install_jvm(true) + ENV["PATH"] += ":bin" + end + end + # RUBYOPT line that requires syck_hack file # @return [String] require string if needed or else an empty string def syck_hack From d56182692551c82aad1318895a7494fdfec2bb8e Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 4 Aug 2014 11:39:06 -0500 Subject: [PATCH 0085/1195] ensure message is a string before splitting --- lib/language_pack/shell_helpers.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/shell_helpers.rb b/lib/language_pack/shell_helpers.rb index 6d2d09422..73241a71f 100644 --- a/lib/language_pack/shell_helpers.rb +++ b/lib/language_pack/shell_helpers.rb @@ -114,7 +114,7 @@ def topic(message) # (indented by 6 spaces) # @param [String] message to be displayed def puts(message) - message.split("\n").each do |line| + message.to_s.split("\n").each do |line| super " #{line.strip}" end $stdout.flush From d677f67e1cfa9cce589d1581a1aec40fe8bd2780 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 4 Aug 2014 11:37:42 -0500 Subject: [PATCH 0086/1195] [close #295] correctly clear cache after version change This doesn't solve the problem for apps who have already switched versions and have bloated caches. --- lib/language_pack/helpers/bundler_cache.rb | 4 ++++ lib/language_pack/ruby.rb | 2 +- spec/upgrade_ruby_spec.rb | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/language_pack/helpers/bundler_cache.rb b/lib/language_pack/helpers/bundler_cache.rb index d5416da26..a89a07454 100644 --- a/lib/language_pack/helpers/bundler_cache.rb +++ b/lib/language_pack/helpers/bundler_cache.rb @@ -35,6 +35,10 @@ def old? @cache.exists?(@bundler_dir) end + def exists? + @cache.exists?(@stack_dir) + end + # writes cache contents to cache store def store @cache.clear(@stack_dir) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 66f366b15..c12897e12 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -772,7 +772,7 @@ def load_bundler_cache elsif !@metadata.exists?(buildpack_version_cache) && @metadata.exists?(ruby_version_cache) puts "Broken cache detected. Purging build cache." purge_bundler_cache - elsif cache.exists?(bundler_cache) && @metadata.exists?(ruby_version_cache) && full_ruby_version != @metadata.read(ruby_version_cache).chomp + elsif (@bundler_cache.exists? || @bundler_cache.old?) && @metadata.exists?(ruby_version_cache) && full_ruby_version != @metadata.read(ruby_version_cache).chomp puts "Ruby version change detected. Clearing bundler cache." puts "Old: #{@metadata.read(ruby_version_cache).chomp}" puts "New: #{full_ruby_version}" diff --git a/spec/upgrade_ruby_spec.rb b/spec/upgrade_ruby_spec.rb index 5336ff079..f6f05c80e 100644 --- a/spec/upgrade_ruby_spec.rb +++ b/spec/upgrade_ruby_spec.rb @@ -12,6 +12,7 @@ app.push! expect(app.output).to match("2.1.0") expect(app.run("ruby -v")).to match("2.1.0") + expect(app.output).to match("Ruby version change detected") end end end From a6c3519785225f847b9f12bab0cb742e0fc601af Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Mon, 4 Aug 2014 15:58:23 -0700 Subject: [PATCH 0087/1195] update changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a84e772b..69bd58c0f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ ## Master +## v126 (8/4/2014) + +* fix bundler cache clearing on ruby version change +* vendor the jvm when yui-compressor is detected + ## v125 (8/1/2014) * bump to node 0.10.30 on cedar-14 From bf71b01eab57390808226898cf091f08a4c93e3e Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Mon, 4 Aug 2014 15:58:58 -0700 Subject: [PATCH 0088/1195] bump to v126 --- lib/language_pack/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index c096b5fbe..675bb1e06 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v125" + BUILDPACK_VERSION = "v126" end end From 61a302b9c1220135a20110805cdde64953a4a3e3 Mon Sep 17 00:00:00 2001 From: Joe Kutner Date: Tue, 16 Sep 2014 14:14:01 -0500 Subject: [PATCH 0089/1195] corrected removal of travis key --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0e57f54c2..259ba23db 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ before_script: bundle exec rake hatchet:setup_travis script: bundle exec parallel_rspec -n 11 spec/ after_script: - - heroku keys:remove ~/.ssh/id_rsa + - heroku keys:remove $USER@`hostname` env: global: From 4ed4a800eb8403868fd2ee1e9d822f37afda8503 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Thu, 18 Sep 2014 17:20:38 -0400 Subject: [PATCH 0090/1195] rbx now supports cedar and cedar-14 --- lib/language_pack/ruby.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 45ee0bb9f..94cafb29f 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -42,7 +42,7 @@ def initialize(build_path, cache_path=nil) super(build_path, cache_path) @fetchers[:mri] = LanguagePack::Fetcher.new(VENDOR_URL, @stack) @fetchers[:jvm] = LanguagePack::Fetcher.new(JVM_BASE_URL) - @fetchers[:rbx] = LanguagePack::Fetcher.new(RBX_BASE_URL) + @fetchers[:rbx] = LanguagePack::Fetcher.new(RBX_BASE_URL, @stack) @node_installer = LanguagePack::NodeInstaller.new(@stack) end From 7d8c249585d6cc25f5a77dd605bae55378988174 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Thu, 18 Sep 2014 19:32:59 -0400 Subject: [PATCH 0091/1195] update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 69bd58c0f..5382852b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Master +## v127 (9/18/2014) + +* rbx is now stack aware + ## v126 (8/4/2014) * fix bundler cache clearing on ruby version change From c388f1223bce0fa888275011b8ee862c0f285db5 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Thu, 18 Sep 2014 19:33:27 -0400 Subject: [PATCH 0092/1195] bump to v127 --- lib/language_pack/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 675bb1e06..49fed04e9 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v126" + BUILDPACK_VERSION = "v127" end end From b84422c9c74f64aef37bd52966d0165858bf59a1 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 21 Oct 2014 13:30:41 -0500 Subject: [PATCH 0093/1195] better cedar-14 ruby install error message Show full stack trace on all unexpected errors --- .travis.yml | 11 ++---- CHANGELOG.md | 2 ++ bin/compile | 25 +++++++++---- hatchet.json | 3 +- lib/language_pack/fetcher.rb | 8 +++-- lib/language_pack/helpers/bundler_wrapper.rb | 2 +- lib/language_pack/helpers/rake_runner.rb | 5 +-- lib/language_pack/no_lockfile.rb | 2 +- lib/language_pack/ruby.rb | 38 ++++++-------------- lib/language_pack/ruby_version.rb | 7 ++-- lib/language_pack/shell_helpers.rb | 20 ++++------- spec/bugs_spec.rb | 8 +++++ 12 files changed, 64 insertions(+), 67 deletions(-) diff --git a/.travis.yml b/.travis.yml index 259ba23db..13170306c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,21 +1,14 @@ ---- language: ruby rvm: - 2.0.0 - before_script: bundle exec rake hatchet:setup_travis - -# Run tests in parallel script: bundle exec parallel_rspec -n 11 spec/ - after_script: - - heroku keys:remove $USER@`hostname` - +- heroku keys:remove $USER@`hostname` env: global: - HATCHET_RETRIES=3 - IS_RUNNING_ON_TRAVIS=true - HATCHET_DEPLOY_STRATEGY=git - HATCHET_APP_LIMIT=80 - # sets the HEROKU_API_KEY to a dummy user for Heroku deploys - - secure: QvDqQQV/Gtk1Og5s8879i+mYLdK6WtVkZMKlCWvJrztYwcRMOGsVVbXjq5EkEJCfxs4GWv7KqXfPPPLDS5Wumzkt4zXVh3ZS+rzQZ2IYC0XbKZYt2e14ZpSTgDUY20J0Ex/GG5dTulJaG9FBe452UDiqYrianE4p8h8w18JBfCs= + - secure: Xibg2pOnw+R+RRcdHsvKQA7ACS+obPw3Hq/wOEiyFzu86aLk7pOoj1163CitsQsNaG1Tj/AtKFXK1jb3aM6XI6GFLnwp44wO1y/j13x94mAZ/uh1ImvF78FHqwc/UD0mvFuKwI2C/bhJAQcOVquE+ZRKdEGQLHxwUWYbxSKvPN4= diff --git a/CHANGELOG.md b/CHANGELOG.md index 5382852b6..36e94955c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Master +* Better cedar14 Ruby install error message + ## v127 (9/18/2014) * rbx is now stack aware diff --git a/bin/compile b/bin/compile index c603d4e31..63f836295 100755 --- a/bin/compile +++ b/bin/compile @@ -7,12 +7,25 @@ $:.unshift File.expand_path("../../lib", __FILE__) require "language_pack" require "language_pack/shell_helpers" -LanguagePack::Instrument.trace 'compile', 'app.compile' do - if pack = LanguagePack.detect(ARGV[0], ARGV[1]) - LanguagePack::ShellHelpers.initialize_env(ARGV[2]) - pack.topic("Compiling #{pack.name}") - pack.log("compile") do - pack.compile +begin + LanguagePack::Instrument.trace 'compile', 'app.compile' do + if pack = LanguagePack.detect(ARGV[0], ARGV[1]) + LanguagePack::ShellHelpers.initialize_env(ARGV[2]) + pack.topic("Compiling #{pack.name}") + pack.log("compile") do + pack.compile + end end end +rescue Exception => e + Kernel.puts " !" + e.message.split("\n").each do |line| + Kernel.puts " ! #{line.strip}" + end + Kernel.puts " !" + if e.is_a?(LanguagePack::BuildpackError) + exit 1 + else + raise e + end end diff --git a/hatchet.json b/hatchet.json index 46338d6e3..df9eb7487 100644 --- a/hatchet.json +++ b/hatchet.json @@ -24,7 +24,8 @@ "sharpstone/mri_193_p484", "sharpstone/ruby_193_jruby_173", "sharpstone/ruby_193_jruby_176", - "sharpstone/empty-procfile" + "sharpstone/empty-procfile", + "sharpstone/bad_ruby_version" ], "rack": [ "sharpstone/default_ruby", diff --git a/lib/language_pack/fetcher.rb b/lib/language_pack/fetcher.rb index 7085c3322..e7a374741 100644 --- a/lib/language_pack/fetcher.rb +++ b/lib/language_pack/fetcher.rb @@ -3,6 +3,8 @@ module LanguagePack class Fetcher + class FetchError < StandardError; end + include ShellHelpers CDN_YAML_FILE = File.expand_path("../../../config/cdn.yml", __FILE__) @@ -14,17 +16,17 @@ def initialize(host_url, stack = nil) def fetch(path) curl = curl_command("-O #{@host_url.join(path)}") - run!(curl) + run!(curl, error_class: FetchError) end def fetch_untar(path, files_to_extract = nil) curl = curl_command("#{@host_url.join(path)} -s -o") - run!("#{curl} - | tar zxf - #{files_to_extract}") + run!("#{curl} - | tar zxf - #{files_to_extract}", error_class: FetchError) end def fetch_bunzip2(path, files_to_extract = nil) curl = curl_command("#{@host_url.join(path)} -s -o") - run!("#{curl} - | tar jxf - #{files_to_extract}") + run!("#{curl} - | tar jxf - #{files_to_extract}", error_class: FetchError) end private diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index 5f1893f4a..2c378aaa4 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -1,7 +1,7 @@ class LanguagePack::Helpers::BundlerWrapper include LanguagePack::ShellHelpers - class GemfileParseError < StandardError + class GemfileParseError < LanguagePack::BuildpackError def initialize(error) msg = "There was an error parsing your Gemfile, we cannot continue\n" msg << error diff --git a/lib/language_pack/helpers/rake_runner.rb b/lib/language_pack/helpers/rake_runner.rb index 84b9b2d40..7662f8c7c 100644 --- a/lib/language_pack/helpers/rake_runner.rb +++ b/lib/language_pack/helpers/rake_runner.rb @@ -26,9 +26,10 @@ def status? @status && @status != :nil end + # Is set by RakeTask#invoke to one of the ALLOWED verbs def status - raise "Status not set for #{self.inspect}" if @status == :nil - raise "Not allowed status: #{@status} for #{self.inspect}" unless ALLOWED.include?(@status) + raise LanguagePack::BuildpackError, "Status not set for #{self.inspect}" if @status == :nil + raise LanguagePack::BuildpackError, "Not allowed status: #{@status} for #{self.inspect}" unless ALLOWED.include?(@status) @status end diff --git a/lib/language_pack/no_lockfile.rb b/lib/language_pack/no_lockfile.rb index 7a52af279..4e0f41b97 100644 --- a/lib/language_pack/no_lockfile.rb +++ b/lib/language_pack/no_lockfile.rb @@ -11,6 +11,6 @@ def name end def compile - error "Gemfile.lock required. Please check it in." + raise LanguagePack::BuildpackError, "Gemfile.lock required. Please check it in." end end diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 94cafb29f..25f24419c 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -143,7 +143,7 @@ def slug_vendor_base @slug_vendor_base = "vendor/bundle/1.8" else @slug_vendor_base = run_no_pipe(%q(ruby -e "require 'rbconfig';puts \"vendor/bundle/#{RUBY_ENGINE}/#{RbConfig::CONFIG['ruby_version']}\"")).chomp - error "Problem detecting bundler vendor directory: #{@slug_vendor_base}" unless $?.success? + raise LanguagePack::BuildpackError, "Problem detecting bundler vendor directory: #{@slug_vendor_base}" unless $?.success? @slug_vendor_base end end @@ -202,22 +202,6 @@ def default_java_tool_options "-Djava.rmi.server.useCodebaseOnly=true" end - # list the available valid ruby versions - # @note the value is memoized - # @return [Array] list of Strings of the ruby versions available - def ruby_versions - return @ruby_versions if @ruby_versions - - Dir.mktmpdir("ruby_versions-") do |tmpdir| - Dir.chdir(tmpdir) do - @fetchers[:buildpack].fetch("ruby_versions.yml") - @ruby_versions = YAML::load_file("ruby_versions.yml") - end - end - - @ruby_versions - end - # sets up the environment variables for the build process def setup_language_pack_environment instrument 'ruby.setup_language_pack_environment' do @@ -258,11 +242,6 @@ def install_ruby instrument 'ruby.install_ruby' do return false unless ruby_version - invalid_ruby_version_message = < error + message = < message if respond_to?(:log) - exit 1 - end - def run!(command, options = {}) - result = run(command, options) - error("Command: '#{command}' failed unexpectedly:\n#{result}") unless $?.success? + result = run(command, options) + error_class = options.delete(:error_class) || StandardError + unless $?.success? + message = "Command: '#{command}' failed unexpectedly:\n#{result}" + raise error_class, message + end return result end diff --git a/spec/bugs_spec.rb b/spec/bugs_spec.rb index 28e55e40b..c3b4823af 100644 --- a/spec/bugs_spec.rb +++ b/spec/bugs_spec.rb @@ -24,4 +24,12 @@ end end end + + context "bad versions" do + it "fails with better error message" do + Hatchet::Runner.new("bad_ruby_version", allow_failure: true).deploy do |app| + expect(app.output).to match("devcenter.heroku.com/articles/ruby-support") + end + end + end end From 74cba7c15c64386d85c46035030d46e2a6265b63 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 3 Nov 2014 15:25:07 -0600 Subject: [PATCH 0094/1195] Keep same error interface Only suppress backtrace from likely errors --- bin/compile | 2 +- lib/language_pack/helpers/bundler_wrapper.rb | 2 +- lib/language_pack/helpers/rake_runner.rb | 4 ++-- lib/language_pack/no_lockfile.rb | 2 +- lib/language_pack/ruby.rb | 11 ++++++----- lib/language_pack/ruby_version.rb | 2 +- lib/language_pack/shell_helpers.rb | 8 ++++++++ 7 files changed, 20 insertions(+), 11 deletions(-) diff --git a/bin/compile b/bin/compile index 63f836295..1c18ff411 100755 --- a/bin/compile +++ b/bin/compile @@ -23,7 +23,7 @@ rescue Exception => e Kernel.puts " ! #{line.strip}" end Kernel.puts " !" - if e.is_a?(LanguagePack::BuildpackError) + if e.is_a?(BuildpackError) exit 1 else raise e diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index 2c378aaa4..93c62fe83 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -1,7 +1,7 @@ class LanguagePack::Helpers::BundlerWrapper include LanguagePack::ShellHelpers - class GemfileParseError < LanguagePack::BuildpackError + class GemfileParseError < BuildpackError def initialize(error) msg = "There was an error parsing your Gemfile, we cannot continue\n" msg << error diff --git a/lib/language_pack/helpers/rake_runner.rb b/lib/language_pack/helpers/rake_runner.rb index 7662f8c7c..e52f27ccd 100644 --- a/lib/language_pack/helpers/rake_runner.rb +++ b/lib/language_pack/helpers/rake_runner.rb @@ -28,8 +28,8 @@ def status? # Is set by RakeTask#invoke to one of the ALLOWED verbs def status - raise LanguagePack::BuildpackError, "Status not set for #{self.inspect}" if @status == :nil - raise LanguagePack::BuildpackError, "Not allowed status: #{@status} for #{self.inspect}" unless ALLOWED.include?(@status) + raise "Status not set for #{self.inspect}" if @status == :nil + raise "Not allowed status: #{@status} for #{self.inspect}" unless ALLOWED.include?(@status) @status end diff --git a/lib/language_pack/no_lockfile.rb b/lib/language_pack/no_lockfile.rb index 4e0f41b97..7a52af279 100644 --- a/lib/language_pack/no_lockfile.rb +++ b/lib/language_pack/no_lockfile.rb @@ -11,6 +11,6 @@ def name end def compile - raise LanguagePack::BuildpackError, "Gemfile.lock required. Please check it in." + error "Gemfile.lock required. Please check it in." end end diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 25f24419c..d8cba06db 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -143,7 +143,7 @@ def slug_vendor_base @slug_vendor_base = "vendor/bundle/1.8" else @slug_vendor_base = run_no_pipe(%q(ruby -e "require 'rbconfig';puts \"vendor/bundle/#{RUBY_ENGINE}/#{RbConfig::CONFIG['ruby_version']}\"")).chomp - raise LanguagePack::BuildpackError, "Problem detecting bundler vendor directory: #{@slug_vendor_base}" unless $?.success? + error "Problem detecting bundler vendor directory: #{@slug_vendor_base}" unless $?.success? @slug_vendor_base end end @@ -264,7 +264,7 @@ def install_ruby expected_checksum = File.read(sha_file).chomp actual_checksum = Digest::SHA1.file(file).hexdigest - raise LanguagePack::BuildpackError, <<-ERROR_MSG unless expected_checksum == actual_checksum + error <<-ERROR_MSG unless expected_checksum == actual_checksum RBX Checksum for #{file} does not match. Expected #{expected_checksum} but got #{actual_checksum}. Please try pushing again in a few minutes. @@ -309,8 +309,9 @@ def install_ruby An error occurred while installing Ruby #{ruby_version.version} For supported Ruby versions see https://devcenter.heroku.com/articles/ruby-support#supported-runtimes Note: Only the most recent version of Ruby 2.1 is supported on Cedar-14 +#{error.message} ERROR - raise LanguagePack::BuildpackError, message + error.message + error message end def new_app? @@ -550,7 +551,7 @@ def build_bundler ERROR end - raise LanguagePack::BuildpackError, error_message + error error_message end end end @@ -719,7 +720,7 @@ def precompile_fail(output) msg << "Attempted to access a nonexistent database:\n" msg << "https://devcenter.heroku.com/articles/pre-provision-database\n" end - raise LanguagePack::BuildpackError, msg + error msg end def bundler_cache diff --git a/lib/language_pack/ruby_version.rb b/lib/language_pack/ruby_version.rb index 1a7feebaa..939eb37d5 100644 --- a/lib/language_pack/ruby_version.rb +++ b/lib/language_pack/ruby_version.rb @@ -2,7 +2,7 @@ module LanguagePack class RubyVersion - class BadVersionError < LanguagePack::BuildpackError + class BadVersionError < BuildpackError def initialize(output = "") msg = "" msg << output diff --git a/lib/language_pack/shell_helpers.rb b/lib/language_pack/shell_helpers.rb index 41445a9ab..b196a836c 100644 --- a/lib/language_pack/shell_helpers.rb +++ b/lib/language_pack/shell_helpers.rb @@ -1,5 +1,9 @@ require "shellwords" + +class BuildpackError < StandardError +end + class NoShellEscape < String def shellescape self @@ -122,6 +126,10 @@ def warn(message, options = {}) @warnings << message end + def error(message) + raise BuildpackError, message + end + def deprecate(message) @deprecations ||= [] @deprecations << message From 82d182269e21ecd5f25f8fbabfa1124af4041578 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 3 Nov 2014 15:38:39 -0600 Subject: [PATCH 0095/1195] travis, again --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 13170306c..5b0f0e403 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,4 +11,4 @@ env: - IS_RUNNING_ON_TRAVIS=true - HATCHET_DEPLOY_STRATEGY=git - HATCHET_APP_LIMIT=80 - - secure: Xibg2pOnw+R+RRcdHsvKQA7ACS+obPw3Hq/wOEiyFzu86aLk7pOoj1163CitsQsNaG1Tj/AtKFXK1jb3aM6XI6GFLnwp44wO1y/j13x94mAZ/uh1ImvF78FHqwc/UD0mvFuKwI2C/bhJAQcOVquE+ZRKdEGQLHxwUWYbxSKvPN4= + - secure: bM8uWN5b9hZzzHk73EN9xHCK65vuopcbwQILcuMt0A1mHB8tSH1xyMYddNrbGdfznLAVXf8UjvKvv6rvvG4O+j3GRuIWVNukoAvZxG0FC9QxYuKbDccEPPdtqGwVEfWEKQYLajsIpF8/ACyALGV+Oe/Z28WRk6Ba3FLptfulc6s= From 37886942dbd93aeede302b4fb335111705073ffa Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 3 Nov 2014 17:17:52 -0600 Subject: [PATCH 0096/1195] bump to v128 --- lib/language_pack/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 49fed04e9..bf349e44d 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v127" + BUILDPACK_VERSION = "v128" end end From d84c20a0d63714f3cbad60e2c84d8b06a1463ee8 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 3 Nov 2014 17:20:35 -0600 Subject: [PATCH 0097/1195] v128 changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 36e94955c..1051e0715 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Master +## v128 (11/4/2014) + * Better cedar14 Ruby install error message ## v127 (9/18/2014) From 0aabadb37d12c39e281693f8d1762796610c121b Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 5 Nov 2014 13:51:42 -0600 Subject: [PATCH 0098/1195] Fix tests to work on cedar-14 by default --- Gemfile.lock | 4 ++-- hatchet.json | 4 ++-- spec/bugs_spec.rb | 6 ++++-- spec/helpers/ruby_version_spec.rb | 4 ++-- spec/rails23_spec.rb | 6 ++++-- spec/rubies_spec.rb | 12 +++++++----- spec/ruby_spec.rb | 10 +++++++--- spec/stack_spec.rb | 12 ++++++++---- spec/upgrade_ruby_spec.rb | 6 +++--- spec/user_env_compile_edge_case_spec.rb | 2 +- 10 files changed, 40 insertions(+), 26 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 0610cd1ef..3d384dc51 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -23,7 +23,7 @@ GEM heroku-api (0.3.19) excon (~> 0.38) multi_json (~> 1.8) - heroku_hatchet (1.3.4) + heroku_hatchet (1.3.7) activesupport (~> 4) anvil-cli (~> 0) excon (~> 0) @@ -37,7 +37,7 @@ GEM mime-types (1.25.1) minitest (5.4.0) multi_json (1.10.1) - netrc (0.7.7) + netrc (0.8.0) parallel (0.6.5) parallel_tests (0.13.1) parallel diff --git a/hatchet.json b/hatchet.json index df9eb7487..6ed28798c 100644 --- a/hatchet.json +++ b/hatchet.json @@ -21,7 +21,7 @@ ], "ruby": [ "sharpstone/mri_187", - "sharpstone/mri_193_p484", + "sharpstone/mri_193_p547", "sharpstone/ruby_193_jruby_173", "sharpstone/ruby_193_jruby_176", "sharpstone/empty-procfile", @@ -33,7 +33,7 @@ "sharpstone/mri_192", "sharpstone/mri_193", "sharpstone/mri_200", - "sharpstone/mri_210" + "sharpstone/mri_214" ], "rails2": [ "sharpstone/rails23_mri_187" diff --git a/spec/bugs_spec.rb b/spec/bugs_spec.rb index c3b4823af..3b6588163 100644 --- a/spec/bugs_spec.rb +++ b/spec/bugs_spec.rb @@ -1,9 +1,11 @@ require_relative 'spec_helper' describe "Bugs" do - context "MRI 1.8.7" do + context "MRI 1.8.7 on cedar" do it "should install nokogiri" do - Hatchet::Runner.new("mri_187_nokogiri").deploy do |app| + app = Hatchet::Runner.new('mri_187_nokogiri').setup! + app.heroku.put_stack(app.name, "cedar") + app.deploy do |app, heroku| expect(app.output).to match("Installing nokogiri") expect(app.output).to match("Your bundle is complete!") end diff --git a/spec/helpers/ruby_version_spec.rb b/spec/helpers/ruby_version_spec.rb index f1288400c..1ddac2be5 100644 --- a/spec/helpers/ruby_version_spec.rb +++ b/spec/helpers/ruby_version_spec.rb @@ -17,12 +17,12 @@ end it "correctly handles patch levels" do - Hatchet::App.new("mri_193_p484").in_directory do |dir| + Hatchet::App.new("mri_193_p547").in_directory do |dir| ruby_version = LanguagePack::RubyVersion.new(@bundler.install.ruby_version, is_new: true) version_number = "1.9.3" version = "ruby-#{version_number}" expect(ruby_version.version_without_patchlevel).to eq(version) - expect(ruby_version.patchlevel).to eq("p484") + expect(ruby_version.patchlevel).to eq("p547") expect(ruby_version.engine_version).to eq(version_number) expect(ruby_version.engine).to eq(:ruby) end diff --git a/spec/rails23_spec.rb b/spec/rails23_spec.rb index a09f0284b..58790379f 100644 --- a/spec/rails23_spec.rb +++ b/spec/rails23_spec.rb @@ -1,8 +1,10 @@ require_relative 'spec_helper' describe "Rails 2.3.x" do - it "should deploy on ruby 1.8.7" do - Hatchet::Runner.new("rails23_mri_187").deploy do |app, heroku| + it "should deploy on ruby 1.8.7 on cedar" do + app = Hatchet::Runner.new('rails23_mri_187').setup! + app.heroku.put_stack(app.name, "cedar") + app.deploy do |app, heroku| add_database(app, heroku) expect(successful_body(app)).to eq("hello") end diff --git a/spec/rubies_spec.rb b/spec/rubies_spec.rb index d4ab71c9f..f5ff7619d 100644 --- a/spec/rubies_spec.rb +++ b/spec/rubies_spec.rb @@ -2,16 +2,18 @@ describe "Ruby Versions" do it "should allow patchlevels" do - Hatchet::Runner.new("mri_193_p484").deploy do |app| - version = '1.9.3p484' - expect(app.output).to match("ruby-1.9.3-p484") + Hatchet::Runner.new("mri_193_p547").deploy do |app| + version = '1.9.3p547' + expect(app.output).to match("ruby-1.9.3-p547") expect(app.run('ruby -v')).to match(version) end end - it "should deploy ruby 1.8.7 properly" do - Hatchet::Runner.new("mri_187").deploy do |app| + it "should deploy ruby 1.8.7 properly on cedar" do + app = Hatchet::Runner.new('mri_187').setup! + app.heroku.put_stack(app.name, "cedar") + app.deploy do |app| version = '1.8.7' expect(app.output).to match(version) expect(app.run('ruby -v')).to match(version) diff --git a/spec/ruby_spec.rb b/spec/ruby_spec.rb index 160c74137..c7e3a3688 100644 --- a/spec/ruby_spec.rb +++ b/spec/ruby_spec.rb @@ -12,15 +12,19 @@ end end - context "Ruby 1.8.7" do + context "Ruby 1.8.7 on cedar" do it "doesn't run rake tasks if no rake gem" do - Hatchet::Runner.new('mri_187_no_rake').deploy do |app, heroku| + app = Hatchet::Runner.new('mri_187_no_rake').setup! + app.heroku.put_stack(app.name, "cedar") + app.deploy do |app, heroku| expect(app.output).not_to include("foo") end end it "runs a rake task if the gem exists" do - Hatchet::Runner.new('mri_187_rake').deploy do |app, heroku| + app = Hatchet::Runner.new('mri_187_rake').setup! + app.heroku.put_stack(app.name, "cedar") + app.deploy do |app, heroku| expect(app.output).to include("foo") end end diff --git a/spec/stack_spec.rb b/spec/stack_spec.rb index 4b0e6d6d9..e917960f6 100644 --- a/spec/stack_spec.rb +++ b/spec/stack_spec.rb @@ -2,8 +2,10 @@ describe "Stack Changes" do it "should reinstall gems on stack change" do - Hatchet::Runner.new("mri_200").deploy do |app, heroku| - heroku.put_stack(app.name, "cedar-14") + app = Hatchet::Runner.new('mri_200').setup! + app.heroku.put_stack(app.name, "cedar-14") + app.deploy do |app, heroku| + heroku.put_stack(app.name, "cedar") `git commit --allow-empty -m "cedar-14 migrate"` app.push! @@ -14,8 +16,10 @@ end it "should not reinstall gems if the stack did not change" do - Hatchet::Runner.new("mri_200").deploy do |app, heroku| - heroku.put_stack(app.name, "cedar") + app = Hatchet::Runner.new('mri_200').setup! + app.heroku.put_stack(app.name, "cedar-14") + app.deploy do |app, heroku| + heroku.put_stack(app.name, "cedar-14") `git commit --allow-empty -m "cedar migrate"` app.push! diff --git a/spec/upgrade_ruby_spec.rb b/spec/upgrade_ruby_spec.rb index f6f05c80e..2db2232b3 100644 --- a/spec/upgrade_ruby_spec.rb +++ b/spec/upgrade_ruby_spec.rb @@ -7,11 +7,11 @@ `echo "" > Gemfile; echo "" > Gemfile.lock` puts `env BUNDLE_GEMFILE=./Gemfile bundle install`.inspect - `echo "ruby '2.1.0'" > Gemfile` + `echo "ruby '2.1.4'" > Gemfile` `git add -A; git commit -m update-ruby` app.push! - expect(app.output).to match("2.1.0") - expect(app.run("ruby -v")).to match("2.1.0") + expect(app.output).to match("2.1.4") + expect(app.run("ruby -v")).to match("2.1.4") expect(app.output).to match("Ruby version change detected") end end diff --git a/spec/user_env_compile_edge_case_spec.rb b/spec/user_env_compile_edge_case_spec.rb index 164520642..139e10ab4 100644 --- a/spec/user_env_compile_edge_case_spec.rb +++ b/spec/user_env_compile_edge_case_spec.rb @@ -2,7 +2,7 @@ describe "User env compile" do it "should not cause problems with warnings" do - app = Hatchet::Runner.new("mri_210") + app = Hatchet::Runner.new("mri_214") app.setup! app.set_config("RUBY_HEAP_MIN_SLOTS" => "1000000") app.deploy do |app| From 7f9d41260c4d5e9e99b11e4a2ab5913334f890a5 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 5 Nov 2014 11:48:15 -0600 Subject: [PATCH 0099/1195] Ensure cache doesn't grow unbounded Right now when we copy files over we use `cp -a`. This can result in duplicate files as it does not clear the directory when we copy assets: ``` 2.1.4 /tmp $ touch foo/woo 2.1.4 /tmp $ cp -a foo/. bar 2.1.4 /tmp $ ls bar woo 2.1.4 /tmp $ touch foo/zoo 2.1.4 /tmp $ cp -a foo/. bar 2.1.4 /tmp $ ls bar woo zoo ``` This behavior is somewhat unintuitive when calling `LanguagePack::Cache#store`. You can see the existing behavior of `LanguagePack::BundlerCache#store` was to clear before storing. This PR makes the default behavior of store clearing out the target directory before copying over files. When you want to copy over files in a folder without deleting use `LanguagePack::BundlerCache#add` which does a slightly better job of letting the user know that what they're doing might cause unbounded cache growth. --- Gemfile.lock | 28 ++++++++++------------ lib/language_pack/cache.rb | 13 +++++++++- lib/language_pack/helpers/bundler_cache.rb | 2 +- lib/language_pack/metadata.rb | 4 ++-- lib/language_pack/ruby.rb | 1 - 5 files changed, 28 insertions(+), 20 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 3d384dc51..975b33141 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -8,18 +8,18 @@ GIT GEM remote: https://rubygems.org/ specs: - activesupport (4.1.4) + activesupport (4.1.7) i18n (~> 0.6, >= 0.6.9) json (~> 1.7, >= 1.7.7) minitest (~> 5.1) thread_safe (~> 0.1) tzinfo (~> 1.1) - anvil-cli (0.16.1) - progress (~> 2.4.0) - rest-client (~> 1.6.7) - thor (~> 0.15.2) + anvil-cli (0.16.2) + progress (~> 2.4, >= 2.4.0) + rest-client (~> 1.6, >= 1.6.7) + thor (~> 0.15, >= 0.15.2) diff-lcs (1.1.3) - excon (0.38.0) + excon (0.41.0) heroku-api (0.3.19) excon (~> 0.38) multi_json (~> 1.8) @@ -34,8 +34,8 @@ GEM threaded (~> 0) i18n (0.6.11) json (1.8.1) - mime-types (1.25.1) - minitest (5.4.0) + mime-types (2.4.3) + minitest (5.4.2) multi_json (1.10.1) netrc (0.8.0) parallel (0.6.5) @@ -43,13 +43,11 @@ GEM parallel progress (2.4.0) rake (10.0.4) - rdoc (4.1.1) - json (~> 1.4) repl_runner (0.0.3) activesupport - rest-client (1.6.8) - mime-types (~> 1.16) - rdoc (>= 2.4.2) + rest-client (1.7.2) + mime-types (>= 1.16, < 3.0) + netrc (~> 0.7) rrrretry (1.0.0) rspec (2.2.0) rspec-core (~> 2.2) @@ -61,10 +59,10 @@ GEM rspec-mocks (2.13.1) rspec-retry (0.2.1) rspec - thor (0.15.4) + thor (0.19.1) thread_safe (0.3.4) threaded (0.0.4) - tzinfo (1.2.1) + tzinfo (1.2.2) thread_safe (~> 0.1) PLATFORMS diff --git a/lib/language_pack/cache.rb b/lib/language_pack/cache.rb index 478134a4c..53b72487c 100644 --- a/lib/language_pack/cache.rb +++ b/lib/language_pack/cache.rb @@ -15,10 +15,21 @@ def clear(path) target.exist? && target.rmtree end - # write cache contents + # Overwrite cache contents + # When called the cache destination will be cleared and the new contents coppied over + # This method is perferable as LanguagePack::Cache#add can cause accidental cache bloat. + # # @param [String] path of contents to store. it will be stored using this a relative path from the cache_base. # @param [String] relative path to store the cache contents, if nil it will assume the from path def store(from, path = nil) + path ||= from + clear path + copy from, (@cache_base + path) + end + + # Adds file to cache without clearing the destination + # Use LanguagePack::Cache#store to avoid accidental cache bloat + def add(from, path = nil) path ||= from copy from, (@cache_base + path) end diff --git a/lib/language_pack/helpers/bundler_cache.rb b/lib/language_pack/helpers/bundler_cache.rb index a89a07454..72444fd23 100644 --- a/lib/language_pack/helpers/bundler_cache.rb +++ b/lib/language_pack/helpers/bundler_cache.rb @@ -41,7 +41,7 @@ def exists? # writes cache contents to cache store def store - @cache.clear(@stack_dir) + @cache.store(".bundle") @cache.store(@bundler_dir, @stack_dir) end diff --git a/lib/language_pack/metadata.rb b/lib/language_pack/metadata.rb index 3694159a6..f6979883c 100644 --- a/lib/language_pack/metadata.rb +++ b/lib/language_pack/metadata.rb @@ -15,7 +15,7 @@ def read(key) full_key = "#{FOLDER}/#{key}" File.read(full_key) if exists?(key) end - + def exists?(key) full_key = "#{FOLDER}/#{key}" File.exists?(full_key) && !Dir.exists?(full_key) @@ -30,6 +30,6 @@ def write(key, value, isave = true) end def save - @cache ? @cache.store(FOLDER) : false + @cache ? @cache.add(FOLDER) : false end end diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index d8cba06db..ca9c0ceaf 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -533,7 +533,6 @@ def build_bundler pipe("#{bundle_bin} clean", out: "2> /dev/null") end end - cache.store ".bundle" @bundler_cache.store # Keep gem cache out of the slug From f30de23beb0a7c2690f525ca7242260d2c268307 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 6 Nov 2014 10:50:54 -0600 Subject: [PATCH 0100/1195] bump to v129 --- lib/language_pack/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index bf349e44d..7067f2d79 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v128" + BUILDPACK_VERSION = "v129" end end From 33f2e18f188641a3c80606ac85b557af0774df38 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 6 Nov 2014 10:51:53 -0600 Subject: [PATCH 0101/1195] v129 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1051e0715..1a73a46a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Master +## v129 (11/6/2014) + +* Fix asset caching bug (#300) + ## v128 (11/4/2014) * Better cedar14 Ruby install error message From 83811354a5933369a258366e47fcc35dbe49a8cc Mon Sep 17 00:00:00 2001 From: Junya Hayashi Date: Tue, 18 Nov 2014 23:39:28 +0900 Subject: [PATCH 0102/1195] Create export file for subsequent processes --- lib/language_pack/base.rb | 16 +++++++++++++++- lib/language_pack/ruby.rb | 11 +++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/lib/language_pack/base.rb b/lib/language_pack/base.rb index 5984fb75e..953154ce2 100644 --- a/lib/language_pack/base.rb +++ b/lib/language_pack/base.rb @@ -154,6 +154,21 @@ def set_env_override(key, val) add_to_profiled %{export #{key}="#{val.gsub('"','\"')}"} end + def add_to_export(string) + export = File.expand_path("../../../export", __FILE__) + File.open(export, "a") do |file| + file.puts string + end + end + + def set_export_default(key, val) + add_to_export "export #{key}=${#{key}:-#{val}}" + end + + def set_export_override(key, val) + add_to_export %{export #{key}="#{val.gsub('"','\"')}"} + end + def log_internal(*args) message = build_log_message(args) %x{ logger -p user.notice -t "slugc[$$]" "buildpack-ruby #{message}" } @@ -170,4 +185,3 @@ def build_log_message(args) end.join(" ") end end - diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index ca9c0ceaf..71d61dff4 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -88,6 +88,7 @@ def compile install_ruby install_jvm setup_language_pack_environment + setup_export setup_profiled allow_git do install_bundler_in_app @@ -221,6 +222,16 @@ def setup_language_pack_environment end end + # sets up the environment variables for subsequent processes + def setup_export + instrument 'ruby.setup_export' do + paths = ENV["PATH"].split(":") + set_export_override "GEM_PATH", "#{build_path}/#{slug_vendor_base}:$GEM_PATH" + set_export_default "LANG", "en_US.UTF-8" + set_export_override "PATH", paths.map {|path| /^\/.*/ !~ path ? "#{build_path}/#{path}" : path}.join(":") + end + end + # sets up the profile.d script for this buildpack def setup_profiled instrument 'setup_profiled' do From 6db6633ce8755d5df9865d697559c7b838294191 Mon Sep 17 00:00:00 2001 From: schneems Date: Fri, 19 Dec 2014 15:38:59 -0600 Subject: [PATCH 0103/1195] ensure export file Includes minor style fixes and change log entry. --- CHANGELOG.md | 2 ++ lib/language_pack/base.rb | 3 ++- lib/language_pack/ruby.rb | 15 +++++++++++---- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a73a46a0..a01409793 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Master +* Support multibuildpack export file (#319) + ## v129 (11/6/2014) * Fix asset caching bug (#300) diff --git a/lib/language_pack/base.rb b/lib/language_pack/base.rb index 953154ce2..731576f3a 100644 --- a/lib/language_pack/base.rb +++ b/lib/language_pack/base.rb @@ -17,6 +17,7 @@ class LanguagePack::Base VENDOR_URL = ENV['BUILDPACK_VENDOR_URL'] || "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby" DEFAULT_LEGACY_STACK = "cedar" + ROOT_DIR = File.expand_path("../../..", __FILE__) attr_reader :build_path, :cache @@ -155,7 +156,7 @@ def set_env_override(key, val) end def add_to_export(string) - export = File.expand_path("../../../export", __FILE__) + export = File.join(ROOT_DIR, "export") File.open(export, "a") do |file| file.puts string end diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 71d61dff4..c48c6ac4a 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -222,25 +222,32 @@ def setup_language_pack_environment end end - # sets up the environment variables for subsequent processes + # Sets up the environment variables for subsequent processes run by + # muiltibuildpack. We can't use profile.d because $HOME isn't set up def setup_export instrument 'ruby.setup_export' do paths = ENV["PATH"].split(":") set_export_override "GEM_PATH", "#{build_path}/#{slug_vendor_base}:$GEM_PATH" set_export_default "LANG", "en_US.UTF-8" - set_export_override "PATH", paths.map {|path| /^\/.*/ !~ path ? "#{build_path}/#{path}" : path}.join(":") + set_export_override "PATH", paths.map { |path| /^\/.*/ !~ path ? "#{build_path}/#{path}" : path }.join(":") + + if ruby_version.jruby? + set_env_default "JAVA_OPTS", default_java_opts + set_env_default "JRUBY_OPTS", default_jruby_opts + set_env_default "JAVA_TOOL_OPTIONS", default_java_tool_options + end end end # sets up the profile.d script for this buildpack def setup_profiled instrument 'setup_profiled' do - set_env_override "GEM_PATH", "$HOME/#{slug_vendor_base}:$GEM_PATH" set_env_default "LANG", "en_US.UTF-8" + set_env_override "GEM_PATH", "$HOME/#{slug_vendor_base}:$GEM_PATH" set_env_override "PATH", binstubs_relative_paths.map {|path| "$HOME/#{path}" }.join(":") + ":$PATH" if ruby_version.jruby? - set_env_default "JAVA_OPTS", default_java_opts + set_env_default "JAVA_OPTS", default_java_opts set_env_default "JRUBY_OPTS", default_jruby_opts set_env_default "JAVA_TOOL_OPTIONS", default_java_tool_options end From 54b6cca4248ec526fab738e435898df446dbb870 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 7 Jan 2015 14:31:19 -0600 Subject: [PATCH 0104/1195] rev hatchet --- Gemfile.lock | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 975b33141..42697d13d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -8,22 +8,22 @@ GIT GEM remote: https://rubygems.org/ specs: - activesupport (4.1.7) - i18n (~> 0.6, >= 0.6.9) + activesupport (4.2.0) + i18n (~> 0.7) json (~> 1.7, >= 1.7.7) minitest (~> 5.1) - thread_safe (~> 0.1) + thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) anvil-cli (0.16.2) progress (~> 2.4, >= 2.4.0) rest-client (~> 1.6, >= 1.6.7) thor (~> 0.15, >= 0.15.2) diff-lcs (1.1.3) - excon (0.41.0) - heroku-api (0.3.19) + excon (0.43.0) + heroku-api (0.3.22) excon (~> 0.38) multi_json (~> 1.8) - heroku_hatchet (1.3.7) + heroku_hatchet (1.4.1) activesupport (~> 4) anvil-cli (~> 0) excon (~> 0) @@ -32,12 +32,12 @@ GEM rrrretry (~> 1) thor (~> 0) threaded (~> 0) - i18n (0.6.11) - json (1.8.1) + i18n (0.7.0) + json (1.8.2) mime-types (2.4.3) - minitest (5.4.2) + minitest (5.5.1) multi_json (1.10.1) - netrc (0.8.0) + netrc (0.10.2) parallel (0.6.5) parallel_tests (0.13.1) parallel From c4ca694d831235d0d64bf7fa70de619fb55003ee Mon Sep 17 00:00:00 2001 From: Joe Kutner Date: Thu, 2 Oct 2014 10:18:26 -0500 Subject: [PATCH 0105/1195] created a jvm_installer helper to handle all jdk installs and read sys props fixed some jvm install bugs and updated tests --- lib/language_pack/helpers/jvm_installer.rb | 56 ++++++++++++++++++++++ lib/language_pack/ruby.rb | 26 ++-------- spec/rubies_spec.rb | 2 +- 3 files changed, 60 insertions(+), 24 deletions(-) create mode 100644 lib/language_pack/helpers/jvm_installer.rb diff --git a/lib/language_pack/helpers/jvm_installer.rb b/lib/language_pack/helpers/jvm_installer.rb new file mode 100644 index 000000000..df65ad944 --- /dev/null +++ b/lib/language_pack/helpers/jvm_installer.rb @@ -0,0 +1,56 @@ +require "language_pack/shell_helpers" + +class LanguagePack::JvmInstaller + include LanguagePack::ShellHelpers + + SYS_PROPS_FILE = "system.properties" + JVM_BASE_URL = "http://lang-jvm.s3.amazonaws.com/jdk" + JVM_1_8_PATH = "openjdk1.8-latest" + JVM_1_7_PATH = "openjdk1.7-latest" + JVM_1_7_25_PATH = "openjdk1.7.0_25" + JVM_1_6_PATH = "openjdk1.6-latest" + + def initialize(slug_vendor_jvm) + @vendor_dir = slug_vendor_jvm + @fetcher = LanguagePack::Fetcher.new(JVM_BASE_URL) + end + + def system_properties + props = {} + File.read(SYS_PROPS_FILE).split("\n").each do |line| + key = line.split("=").first + val = line.split("=").last + props[key] = val + end if File.exists?(SYS_PROPS_FILE) + props + end + + def install(jruby_version, forced = false) + jvm_version = + case system_properties['java.runtime.version'] + when "1.8" + JVM_1_8_PATH + when "1.6" + JVM_1_6_PATH + else + if forced || Gem::Version.new(jruby_version) >= Gem::Version.new("1.7.4") + JVM_1_7_PATH + else + JVM_1_7_25_PATH + end + end + + topic "Installing JVM: #{jvm_version}" + + FileUtils.mkdir_p(@vendor_dir) + Dir.chdir(@vendor_dir) do + @fetcher.fetch_untar("#{jvm_version}.tar.gz") + end + + bin_dir = "bin" + FileUtils.mkdir_p bin_dir + Dir["#{@vendor_dir}/bin/*"].each do |bin| + run("ln -s ../#{bin} #{bin_dir}") + end + end +end diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index c48c6ac4a..d6f20b051 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -6,6 +6,7 @@ require "language_pack/base" require "language_pack/ruby_version" require "language_pack/helpers/node_installer" +require "language_pack/helpers/jvm_installer" require "language_pack/version" # base Ruby Language Pack. This is for any base ruby app. @@ -15,9 +16,6 @@ class LanguagePack::Ruby < LanguagePack::Base LIBYAML_PATH = "libyaml-#{LIBYAML_VERSION}" BUNDLER_VERSION = "1.6.3" BUNDLER_GEM_PATH = "bundler-#{BUNDLER_VERSION}" - JVM_BASE_URL = "http://heroku-jdk.s3.amazonaws.com" - LATEST_JVM_VERSION = "openjdk7-latest" - LEGACY_JVM_VERSION = "openjdk1.7.0_25" DEFAULT_RUBY_VERSION = "ruby-2.0.0" RBX_BASE_URL = "http://binaries.rubini.us/heroku" NODE_BP_PATH = "vendor/node/bin" @@ -41,9 +39,9 @@ def bundler def initialize(build_path, cache_path=nil) super(build_path, cache_path) @fetchers[:mri] = LanguagePack::Fetcher.new(VENDOR_URL, @stack) - @fetchers[:jvm] = LanguagePack::Fetcher.new(JVM_BASE_URL) @fetchers[:rbx] = LanguagePack::Fetcher.new(RBX_BASE_URL, @stack) @node_installer = LanguagePack::NodeInstaller.new(@stack) + @jvm_installer = LanguagePack::JvmInstaller.new(slug_vendor_jvm) end def name @@ -340,25 +338,7 @@ def new_app? def install_jvm(forced = false) instrument 'ruby.install_jvm' do if ruby_version.jruby? || forced - jvm_version = - if forced || Gem::Version.new(ruby_version.engine_version) >= Gem::Version.new("1.7.4") - LATEST_JVM_VERSION - else - LEGACY_JVM_VERSION - end - - topic "Installing JVM: #{jvm_version}" - - FileUtils.mkdir_p(slug_vendor_jvm) - Dir.chdir(slug_vendor_jvm) do - @fetchers[:jvm].fetch_untar("#{jvm_version}.tar.gz") - end - - bin_dir = "bin" - FileUtils.mkdir_p bin_dir - Dir["#{slug_vendor_jvm}/bin/*"].each do |bin| - run("ln -s ../#{bin} #{bin_dir}") - end + @jvm_installer.install(ruby_version.engine_version, forced) end end end diff --git a/spec/rubies_spec.rb b/spec/rubies_spec.rb index f5ff7619d..ccead65e2 100644 --- a/spec/rubies_spec.rb +++ b/spec/rubies_spec.rb @@ -65,7 +65,7 @@ it "should deploy jruby 1.7.6 (latest jdk) properly" do Hatchet::AnvilApp.new("ruby_193_jruby_176").deploy do |app| - expect(app.output).to match("Installing JVM: openjdk7-latest") + expect(app.output).to match("Installing JVM: openjdk1.7-latest") expect(app.output).to match("ruby-1.9.3-jruby-1.7.6") expect(app.output).not_to include("OpenJDK 64-Bit Server VM warning") expect(app.run('ruby -v')).to match("jruby 1.7.6") From 8e7beff4f4f4d9f96e94307f4cee9f8f17a4337b Mon Sep 17 00:00:00 2001 From: Joe Kutner Date: Thu, 2 Oct 2014 13:00:25 -0500 Subject: [PATCH 0106/1195] added a test for jdk8 --- spec/rubies_spec.rb | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/spec/rubies_spec.rb b/spec/rubies_spec.rb index ccead65e2..523c1704f 100644 --- a/spec/rubies_spec.rb +++ b/spec/rubies_spec.rb @@ -63,7 +63,7 @@ end end - it "should deploy jruby 1.7.6 (latest jdk) properly" do + it "should deploy jruby 1.7.6 (jdk 7) properly" do Hatchet::AnvilApp.new("ruby_193_jruby_176").deploy do |app| expect(app.output).to match("Installing JVM: openjdk1.7-latest") expect(app.output).to match("ruby-1.9.3-jruby-1.7.6") @@ -71,4 +71,22 @@ expect(app.run('ruby -v')).to match("jruby 1.7.6") end end + + it "should deploy jruby 1.7.16 (jdk 8) properly" do + app = Hatchet::AnvilApp.new("ruby_193_jruby_176") + + Dir.chdir(app.directory) do + File.open('system.properties', 'w') do |f| + f.puts "java.runtime.version=1.8" + end + `git commit -am "setting jdk version"` + end + + app.deploy do |app| + expect(app.output).to match("Installing JVM: openjdk1.8-latest") + expect(app.output).to match("ruby-1.9.3-jruby-1.7.6") + expect(app.output).not_to include("OpenJDK 64-Bit Server VM warning") + expect(app.run('ruby -v')).to match("jruby 1.7.6") + end + end end From ce97d53573d377d5a7c612023fafad548b7de9f6 Mon Sep 17 00:00:00 2001 From: Joe Kutner Date: Thu, 13 Nov 2014 16:01:47 -0600 Subject: [PATCH 0107/1195] added stack to jvm installer --- lib/language_pack/helpers/jvm_installer.rb | 5 +++-- lib/language_pack/ruby.rb | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/language_pack/helpers/jvm_installer.rb b/lib/language_pack/helpers/jvm_installer.rb index df65ad944..fc3febc7b 100644 --- a/lib/language_pack/helpers/jvm_installer.rb +++ b/lib/language_pack/helpers/jvm_installer.rb @@ -10,9 +10,9 @@ class LanguagePack::JvmInstaller JVM_1_7_25_PATH = "openjdk1.7.0_25" JVM_1_6_PATH = "openjdk1.6-latest" - def initialize(slug_vendor_jvm) + def initialize(slug_vendor_jvm, stack) @vendor_dir = slug_vendor_jvm - @fetcher = LanguagePack::Fetcher.new(JVM_BASE_URL) + @fetcher = LanguagePack::Fetcher.new(JVM_BASE_URL, stack) end def system_properties @@ -36,6 +36,7 @@ def install(jruby_version, forced = false) if forced || Gem::Version.new(jruby_version) >= Gem::Version.new("1.7.4") JVM_1_7_PATH else + # do we need to support this on cedar-14? JVM_1_7_25_PATH end end diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index d6f20b051..89b449121 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -41,7 +41,7 @@ def initialize(build_path, cache_path=nil) @fetchers[:mri] = LanguagePack::Fetcher.new(VENDOR_URL, @stack) @fetchers[:rbx] = LanguagePack::Fetcher.new(RBX_BASE_URL, @stack) @node_installer = LanguagePack::NodeInstaller.new(@stack) - @jvm_installer = LanguagePack::JvmInstaller.new(slug_vendor_jvm) + @jvm_installer = LanguagePack::JvmInstaller.new(slug_vendor_jvm, @stack) end def name From e20aac0b0632f0835c6dec0a1046bab85a04a57f Mon Sep 17 00:00:00 2001 From: Joe Kutner Date: Fri, 14 Nov 2014 07:47:49 -0600 Subject: [PATCH 0108/1195] made jdk8 the default on cedar-14 --- lib/language_pack/helpers/jvm_installer.rb | 14 ++++++++++---- spec/rubies_spec.rb | 10 +++++----- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/lib/language_pack/helpers/jvm_installer.rb b/lib/language_pack/helpers/jvm_installer.rb index fc3febc7b..ca8e672d0 100644 --- a/lib/language_pack/helpers/jvm_installer.rb +++ b/lib/language_pack/helpers/jvm_installer.rb @@ -12,6 +12,7 @@ class LanguagePack::JvmInstaller def initialize(slug_vendor_jvm, stack) @vendor_dir = slug_vendor_jvm + @stack = stack @fetcher = LanguagePack::Fetcher.new(JVM_BASE_URL, stack) end @@ -30,14 +31,19 @@ def install(jruby_version, forced = false) case system_properties['java.runtime.version'] when "1.8" JVM_1_8_PATH + when "1.7" + JVM_1_7_PATH when "1.6" JVM_1_6_PATH else - if forced || Gem::Version.new(jruby_version) >= Gem::Version.new("1.7.4") - JVM_1_7_PATH + if @stack == "cedar" + if forced || Gem::Version.new(jruby_version) >= Gem::Version.new("1.7.4") + JVM_1_7_PATH + else + JVM_1_7_25_PATH + end else - # do we need to support this on cedar-14? - JVM_1_7_25_PATH + JVM_1_8_PATH end end diff --git a/spec/rubies_spec.rb b/spec/rubies_spec.rb index 523c1704f..37553664e 100644 --- a/spec/rubies_spec.rb +++ b/spec/rubies_spec.rb @@ -63,27 +63,27 @@ end end - it "should deploy jruby 1.7.6 (jdk 7) properly" do + it "should deploy jruby 1.7.6 (jdk 8) properly" do Hatchet::AnvilApp.new("ruby_193_jruby_176").deploy do |app| - expect(app.output).to match("Installing JVM: openjdk1.7-latest") + expect(app.output).to match("Installing JVM: openjdk1.8-latest") expect(app.output).to match("ruby-1.9.3-jruby-1.7.6") expect(app.output).not_to include("OpenJDK 64-Bit Server VM warning") expect(app.run('ruby -v')).to match("jruby 1.7.6") end end - it "should deploy jruby 1.7.16 (jdk 8) properly" do + it "should deploy jruby 1.7.6 (jdk 7) properly" do app = Hatchet::AnvilApp.new("ruby_193_jruby_176") Dir.chdir(app.directory) do File.open('system.properties', 'w') do |f| - f.puts "java.runtime.version=1.8" + f.puts "java.runtime.version=1.7" end `git commit -am "setting jdk version"` end app.deploy do |app| - expect(app.output).to match("Installing JVM: openjdk1.8-latest") + expect(app.output).to match("Installing JVM: openjdk1.7-latest") expect(app.output).to match("ruby-1.9.3-jruby-1.7.6") expect(app.output).not_to include("OpenJDK 64-Bit Server VM warning") expect(app.run('ruby -v')).to match("jruby 1.7.6") From 5a99071eff8c7a91b829eb7893c9f32fab11ddbe Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Fri, 14 Nov 2014 10:40:12 -0800 Subject: [PATCH 0109/1195] add jdk7/8 default tests for cedar/cedar-14 respectively --- hatchet.json | 3 ++- spec/rubies_spec.rb | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/hatchet.json b/hatchet.json index 6ed28798c..a93a55d96 100644 --- a/hatchet.json +++ b/hatchet.json @@ -23,7 +23,8 @@ "sharpstone/mri_187", "sharpstone/mri_193_p547", "sharpstone/ruby_193_jruby_173", - "sharpstone/ruby_193_jruby_176", + "sharpstone/ruby_193_jruby_176" + "sharpstone/ruby_193_jruby_17161", "sharpstone/empty-procfile", "sharpstone/bad_ruby_version" ], diff --git a/spec/rubies_spec.rb b/spec/rubies_spec.rb index 37553664e..0c685440f 100644 --- a/spec/rubies_spec.rb +++ b/spec/rubies_spec.rb @@ -89,4 +89,26 @@ expect(app.run('ruby -v')).to match("jruby 1.7.6") end end + + it "should deploy jdk 8 on cedar-14 by default" do + app = Hatchet::GitApp.new("ruby_193_jruby_17161") + app.setup! + app.heroku.put_stack(app.name, 'cedar-14') + + app.deploy do |app| + expect(app.output).to match("Installing JVM: openjdk1.8-latest") + expect(app.output).not_to include("OpenJDK 64-Bit Server VM warning") + end + end + + it "should deploy jdk 7 on cedar by default" do + app = Hatchet::GitApp.new("ruby_193_jruby_17161") + app.setup! + app.heroku.put_stack(app.name, 'cedar') + + app.deploy do |app| + expect(app.output).to match("Installing JVM: openjdk1.7-latest") + expect(app.output).not_to include("OpenJDK 64-Bit Server VM warning") + end + end end From dc09b0dcf8eada82f24a58e407c88682f1179d28 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Fri, 14 Nov 2014 18:29:21 -0800 Subject: [PATCH 0110/1195] fix ruby specs/jdk tests --- hatchet.json | 2 ++ spec/rubies_spec.rb | 48 ++++++++++++++++++++++----------------------- 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/hatchet.json b/hatchet.json index a93a55d96..19d9c9596 100644 --- a/hatchet.json +++ b/hatchet.json @@ -25,6 +25,8 @@ "sharpstone/ruby_193_jruby_173", "sharpstone/ruby_193_jruby_176" "sharpstone/ruby_193_jruby_17161", + "sharpstone/ruby_193_jruby_17161_jdk7", + "sharpstone/ruby_193_jruby_17161_jdk8", "sharpstone/empty-procfile", "sharpstone/bad_ruby_version" ], diff --git a/spec/rubies_spec.rb b/spec/rubies_spec.rb index 0c685440f..824009136 100644 --- a/spec/rubies_spec.rb +++ b/spec/rubies_spec.rb @@ -54,8 +54,12 @@ end end - it "should deploy jruby 1.7.3 (legacy jdk) properly" do - Hatchet::AnvilApp.new("ruby_193_jruby_173").deploy do |app| + it "should deploy jruby 1.7.3 (legacy jdk) properly on cedar", stack: :cedar do + app = Hatchet::Runner.new("ruby_193_jruby_173") + app.setup! + app.heroku.put_stack(app.name, "cedar") + + app.deploy do |app| expect(app.output).to match("Installing JVM: openjdk1.7.0_25") expect(app.output).to match("ruby-1.9.3-jruby-1.7.3") expect(app.output).not_to include("OpenJDK 64-Bit Server VM warning") @@ -63,24 +67,10 @@ end end - it "should deploy jruby 1.7.6 (jdk 8) properly" do - Hatchet::AnvilApp.new("ruby_193_jruby_176").deploy do |app| - expect(app.output).to match("Installing JVM: openjdk1.8-latest") - expect(app.output).to match("ruby-1.9.3-jruby-1.7.6") - expect(app.output).not_to include("OpenJDK 64-Bit Server VM warning") - expect(app.run('ruby -v')).to match("jruby 1.7.6") - end - end - - it "should deploy jruby 1.7.6 (jdk 7) properly" do - app = Hatchet::AnvilApp.new("ruby_193_jruby_176") - - Dir.chdir(app.directory) do - File.open('system.properties', 'w') do |f| - f.puts "java.runtime.version=1.7" - end - `git commit -am "setting jdk version"` - end + it "should deploy jruby 1.7.6 (jdk 7) latest properly on cedar", stack: :cedar do + app = Hatchet::Runner.new("ruby_193_jruby_176") + app.setup! + app.heroku.put_stack(app.name, 'cedar') app.deploy do |app| expect(app.output).to match("Installing JVM: openjdk1.7-latest") @@ -91,7 +81,7 @@ end it "should deploy jdk 8 on cedar-14 by default" do - app = Hatchet::GitApp.new("ruby_193_jruby_17161") + app = Hatchet::Runner.new("ruby_193_jruby_17161") app.setup! app.heroku.put_stack(app.name, 'cedar-14') @@ -101,14 +91,24 @@ end end - it "should deploy jdk 7 on cedar by default" do - app = Hatchet::GitApp.new("ruby_193_jruby_17161") + it "should deploy jruby 1.7.16.1 (jdk 7) properly on cedar-14 with sys props file" do + app = Hatchet::Runner.new("ruby_193_jruby_17161_jdk7") app.setup! - app.heroku.put_stack(app.name, 'cedar') + app.heroku.put_stack(app.name, 'cedar-14') app.deploy do |app| expect(app.output).to match("Installing JVM: openjdk1.7-latest") expect(app.output).not_to include("OpenJDK 64-Bit Server VM warning") end end + + it "should deploy jruby 1.7.16.1 (jdk 8) properly on cedar with sys props file" do + app = Hatchet::Runner.new("ruby_193_jruby_17161_jdk8") + app.setup! + app.heroku.put_stack(app.name, 'cedar') + + app.deploy do |app| + expect(app.output).to match("Installing JVM: openjdk1.8-latest") + end + end end From 9bfab42016ff8e20825c73a9734ecf72a700a24a Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Fri, 14 Nov 2014 18:54:47 -0800 Subject: [PATCH 0111/1195] remove more ruby 1.8.7/1.9.2 tests --- hatchet.json | 7 ------- 1 file changed, 7 deletions(-) diff --git a/hatchet.json b/hatchet.json index 19d9c9596..e061703be 100644 --- a/hatchet.json +++ b/hatchet.json @@ -7,8 +7,6 @@ "sharpstone/connect_to_database_on_first_push", "sharpstone/no_rakefile", "sharpstone/bad_rakefile", - "sharpstone/mri_187_no_rake", - "sharpstone/mri_187_rake", "sharpstone/mri_200_no_rake", "sharpstone/mri_200_rake" ], @@ -32,15 +30,10 @@ ], "rack": [ "sharpstone/default_ruby", - "sharpstone/mri_187_nokogiri", - "sharpstone/mri_192", "sharpstone/mri_193", "sharpstone/mri_200", "sharpstone/mri_214" ], - "rails2": [ - "sharpstone/rails23_mri_187" - ], "rails3": [ "sharpstone/rails3_mri_193", "sharpstone/railties3_mri_193", From b070ae2e3c8adef5d68898801bd2d0026a7d4006 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Fri, 14 Nov 2014 18:55:10 -0800 Subject: [PATCH 0112/1195] fix tests that broke when cedar-14 GA'd --- spec/upgrade_ruby_spec.rb | 8 ++++++-- spec/user_env_compile_edge_case_spec.rb | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/spec/upgrade_ruby_spec.rb b/spec/upgrade_ruby_spec.rb index 2db2232b3..2699e00d3 100644 --- a/spec/upgrade_ruby_spec.rb +++ b/spec/upgrade_ruby_spec.rb @@ -1,8 +1,12 @@ require 'spec_helper' describe "Upgrading ruby apps" do - it "upgrades from 2.0.0 to 2.1.0" do - Hatchet::Runner.new("mri_200").deploy do |app| + it "upgrades from 2.0.0 to 2.1.0", stack: :cedar do + app = Hatchet::Runner.new("mri_200") + app.setup! + app.heroku.put_stack(app.name, "cedar") + + app.deploy do |app| expect(app.run("ruby -v")).to match("2.0.0") `echo "" > Gemfile; echo "" > Gemfile.lock` diff --git a/spec/user_env_compile_edge_case_spec.rb b/spec/user_env_compile_edge_case_spec.rb index 139e10ab4..6741409a0 100644 --- a/spec/user_env_compile_edge_case_spec.rb +++ b/spec/user_env_compile_edge_case_spec.rb @@ -4,6 +4,7 @@ it "should not cause problems with warnings" do app = Hatchet::Runner.new("mri_214") app.setup! + app.heroku.put_stack(app.name, 'cedar') app.set_config("RUBY_HEAP_MIN_SLOTS" => "1000000") app.deploy do |app| expect(app.run("bundle version")).to match(LanguagePack::Ruby::BUNDLER_VERSION) From d415e6ffb8759dec38ff08d4cb8f8e45cac0dd12 Mon Sep 17 00:00:00 2001 From: Joe Kutner Date: Tue, 9 Dec 2014 15:00:09 -0600 Subject: [PATCH 0113/1195] fixed improperly formated json after rebasing --- hatchet.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hatchet.json b/hatchet.json index e061703be..cf3f5b1d0 100644 --- a/hatchet.json +++ b/hatchet.json @@ -21,7 +21,7 @@ "sharpstone/mri_187", "sharpstone/mri_193_p547", "sharpstone/ruby_193_jruby_173", - "sharpstone/ruby_193_jruby_176" + "sharpstone/ruby_193_jruby_176", "sharpstone/ruby_193_jruby_17161", "sharpstone/ruby_193_jruby_17161_jdk7", "sharpstone/ruby_193_jruby_17161_jdk8", From 08931a22a105baaf9a051d7c90d693ca2e5a4b6d Mon Sep 17 00:00:00 2001 From: Joe Kutner Date: Tue, 9 Dec 2014 15:26:25 -0600 Subject: [PATCH 0114/1195] replaced some hatchet repos removed during rebase --- hatchet.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hatchet.json b/hatchet.json index cf3f5b1d0..aa14bb5c1 100644 --- a/hatchet.json +++ b/hatchet.json @@ -7,6 +7,8 @@ "sharpstone/connect_to_database_on_first_push", "sharpstone/no_rakefile", "sharpstone/bad_rakefile", + "sharpstone/mri_187_no_rake", + "sharpstone/mri_187_rake", "sharpstone/mri_200_no_rake", "sharpstone/mri_200_rake" ], @@ -30,6 +32,8 @@ ], "rack": [ "sharpstone/default_ruby", + "sharpstone/mri_187_nokogiri", + "sharpstone/mri_192", "sharpstone/mri_193", "sharpstone/mri_200", "sharpstone/mri_214" From 86f561864310542a97c8fb2bce4b373a350ef190 Mon Sep 17 00:00:00 2001 From: Joe Kutner Date: Tue, 9 Dec 2014 15:27:45 -0600 Subject: [PATCH 0115/1195] replaced the rails23 repo removed during rebase --- hatchet.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hatchet.json b/hatchet.json index aa14bb5c1..ea39bac6d 100644 --- a/hatchet.json +++ b/hatchet.json @@ -38,6 +38,9 @@ "sharpstone/mri_200", "sharpstone/mri_214" ], + "rails2": [ + "sharpstone/rails23_mri_187" + ], "rails3": [ "sharpstone/rails3_mri_193", "sharpstone/railties3_mri_193", From e9774450b6a3b906df21040dd6cf3b6bdfd57c2f Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Mon, 12 Jan 2015 15:39:40 -0800 Subject: [PATCH 0116/1195] use s3pository over nodejs.org nodejs.org is not reliable --- lib/language_pack/helpers/node_installer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/helpers/node_installer.rb b/lib/language_pack/helpers/node_installer.rb index 7f9a710de..e2c88921e 100644 --- a/lib/language_pack/helpers/node_installer.rb +++ b/lib/language_pack/helpers/node_installer.rb @@ -5,7 +5,7 @@ class LanguagePack::NodeInstaller LEGACY_NODE_VERSION = "0.4.7" LEGACY_BINARY_PATH = "node-#{LEGACY_NODE_VERSION}" - NODEJS_BASE_URL = "http://nodejs.org/dist/v#{MODERN_NODE_VERSION}/" + NODEJS_BASE_URL = "http://s3pository.heroku.com/node/v#{MODERN_NODE_VERSION}/" def initialize(stack) @fetchers = { From 6d03eaf90c886e094ce488b2a91c31225680331f Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Tue, 13 Jan 2015 18:40:23 -0800 Subject: [PATCH 0117/1195] don't write to profile.d to export file again --- lib/language_pack/ruby.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 89b449121..f651924bf 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -230,9 +230,9 @@ def setup_export set_export_override "PATH", paths.map { |path| /^\/.*/ !~ path ? "#{build_path}/#{path}" : path }.join(":") if ruby_version.jruby? - set_env_default "JAVA_OPTS", default_java_opts - set_env_default "JRUBY_OPTS", default_jruby_opts - set_env_default "JAVA_TOOL_OPTIONS", default_java_tool_options + set_export_default "JAVA_OPTS", default_java_opts + set_export_default "JRUBY_OPTS", default_jruby_opts + set_export_default "JAVA_TOOL_OPTIONS", default_java_tool_options end end end From a4a33fdfe5f1dc0de615401d09c2399c548a61fe Mon Sep 17 00:00:00 2001 From: Joe Kutner Date: Wed, 10 Dec 2014 09:00:48 -0600 Subject: [PATCH 0118/1195] added auto-scaling memory for jruby apps fixed a quoting bug in jruby opts removed problematic java tool opts removed problematic java tool opts --- lib/language_pack/ruby.rb | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index f651924bf..e48c4abaf 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -62,8 +62,7 @@ def default_config_vars ruby_version.jruby? ? vars.merge({ "JAVA_OPTS" => default_java_opts, - "JRUBY_OPTS" => default_jruby_opts, - "JAVA_TOOL_OPTIONS" => default_java_tool_options + "JRUBY_OPTS" => default_jruby_opts }) : vars end end @@ -186,7 +185,23 @@ def ruby_version # default JAVA_OPTS # return [String] string of JAVA_OPTS def default_java_opts - "-Xmx384m -Xss512k -XX:+UseCompressedOops -Dfile.encoding=UTF-8" + "-Xss512k -XX:+UseCompressedOops -Dfile.encoding=UTF-8" + end + + def set_jvm_max_heap + <<-EOF +case $(ulimit -u) in +256) # 1X Dyno + JVM_MAX_HEAP=384 + ;; +512) # 2X Dyno + JVM_MAX_HEAP=768 + ;; +32768) # PX Dyno + JVM_MAX_HEAP=6144 + ;; +esac +EOF end # default JRUBY_OPTS @@ -198,7 +213,7 @@ def default_jruby_opts # default JAVA_TOOL_OPTIONS # return [String] string of JAVA_TOOL_OPTIONS def default_java_tool_options - "-Djava.rmi.server.useCodebaseOnly=true" + "-Xmx${JVM_MAX_HEAP:-\"384\"}m -Djava.rmi.server.useCodebaseOnly=true" end # sets up the environment variables for the build process @@ -245,7 +260,8 @@ def setup_profiled set_env_override "PATH", binstubs_relative_paths.map {|path| "$HOME/#{path}" }.join(":") + ":$PATH" if ruby_version.jruby? - set_env_default "JAVA_OPTS", default_java_opts + add_to_profiled set_jvm_max_heap + set_env_default "JAVA_OPTS", default_java_opts set_env_default "JRUBY_OPTS", default_jruby_opts set_env_default "JAVA_TOOL_OPTIONS", default_java_tool_options end From 380c9aa8626d689b6d0f0bdeaf5b78c999cf7540 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Tue, 13 Jan 2015 16:22:41 -0800 Subject: [PATCH 0119/1195] setup JAVA_TOOL_OPTIONS for compile time --- lib/language_pack/ruby.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index e48c4abaf..c9105c2ba 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -219,7 +219,13 @@ def default_java_tool_options # sets up the environment variables for the build process def setup_language_pack_environment instrument 'ruby.setup_language_pack_environment' do - ENV["PATH"] += ":bin" if ruby_version.jruby? + if ruby_version.jruby? + ENV["PATH"] += ":bin" + ENV["JAVA_TOOL_OPTIONS"] = run(<<-SHELL).chomp +#{set_jvm_max_heap} +echo #{default_java_tool_options} +SHELL + end setup_ruby_install_env ENV["PATH"] += ":#{node_bp_bin_path}" if node_js_installed? From c44a27913e4f12384c353aa4de0c82f94c5f2940 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Tue, 13 Jan 2015 18:46:01 -0800 Subject: [PATCH 0120/1195] add set_jvm_max_heap to export --- lib/language_pack/ruby.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index c9105c2ba..afe779484 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -251,6 +251,7 @@ def setup_export set_export_override "PATH", paths.map { |path| /^\/.*/ !~ path ? "#{build_path}/#{path}" : path }.join(":") if ruby_version.jruby? + add_to_export set_jvm_max_heap set_export_default "JAVA_OPTS", default_java_opts set_export_default "JRUBY_OPTS", default_jruby_opts set_export_default "JAVA_TOOL_OPTIONS", default_java_tool_options From 2acf33d65c55b391a57e2e1a8623f8ea370e2179 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 7 Jan 2015 14:42:19 -0600 Subject: [PATCH 0121/1195] auto scale WEB_CONCURRENCY --- CHANGELOG.md | 1 + lib/language_pack/ruby.rb | 23 +++++++++++++++++++++++ spec/ruby_spec.rb | 10 ++++++++++ 3 files changed, 34 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a01409793..1eb4c8613 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## Master +* Auto set WEB_CONCURRENCY based on dyno size if not already set. * Support multibuildpack export file (#319) ## v129 (11/6/2014) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index afe779484..83b9c922d 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -204,6 +204,27 @@ def set_jvm_max_heap EOF end + def set_default_web_concurrency + <<-EOF +case $(ulimit -u) in +256) + export HEROKU_RAM_LIMIT_MB=${HEROKU_RAM_LIMIT_MB:-512} + export WEB_CONCURRENCY=${WEB_CONCURRENCY:-2} + ;; +512) + export HEROKU_RAM_LIMIT_MB=${HEROKU_RAM_LIMIT_MB:-1024} + export WEB_CONCURRENCY=${WEB_CONCURRENCY:-4} + ;; +32768) + export HEROKU_RAM_LIMIT_MB=${HEROKU_RAM_LIMIT_MB:-8192} + export WEB_CONCURRENCY=${WEB_CONCURRENCY:-16} + ;; +*) + ;; +esac +EOF + end + # default JRUBY_OPTS # return [String] string of JRUBY_OPTS def default_jruby_opts @@ -266,6 +287,8 @@ def setup_profiled set_env_override "GEM_PATH", "$HOME/#{slug_vendor_base}:$GEM_PATH" set_env_override "PATH", binstubs_relative_paths.map {|path| "$HOME/#{path}" }.join(":") + ":$PATH" + add_to_profiled set_default_web_concurrency + if ruby_version.jruby? add_to_profiled set_jvm_max_heap set_env_default "JAVA_OPTS", default_java_opts diff --git a/spec/ruby_spec.rb b/spec/ruby_spec.rb index c7e3a3688..895a43716 100644 --- a/spec/ruby_spec.rb +++ b/spec/ruby_spec.rb @@ -1,6 +1,16 @@ require_relative 'spec_helper' describe "Ruby apps" do + describe "default WEB_CONCURRENCY" do + it "auto scales WEB_CONCURRENCY" do + Hatchet::Runner.new('default_ruby').deploy do |app| + expect(app.run(:bash, 'echo "value: $WEB_CONCURRENCY"', heroku: { size: "1X" } )).to match("value: 2") + expect(app.run(:bash, 'echo "value: $WEB_CONCURRENCY"', heroku: { size: "2X" } )).to match("value: 4") + expect(app.run(:bash, 'echo "value: $WEB_CONCURRENCY"', heroku: { size: "PX" } )).to match("value: 16") + end + end + end + describe "Rake detection" do context "default" do it "adds default process types" do From 1fe24fc3d9fa794124e2d0e9159fe191abb5457e Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Thu, 15 Jan 2015 08:06:45 -0800 Subject: [PATCH 0122/1195] update changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1eb4c8613..d4629f903 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,12 @@ ## Master +## v130 (1/15/2015) + * Auto set WEB_CONCURRENCY based on dyno size if not already set. * Support multibuildpack export file (#319) +* Auto set the JVM MAX HEAP based on dyno size for JRuby (#323) +* Use s3 based npmjs servers for node (#336) +* Support system.properties file for specifying JDK in JRuby (#305) ## v129 (11/6/2014) From a20ebe57bfa1235f7b2ede1ece58f4a3b159a3b8 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 15 Jan 2015 10:41:36 -0600 Subject: [PATCH 0123/1195] bump to v130 --- lib/language_pack/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 7067f2d79..e46f03ac5 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v129" + BUILDPACK_VERSION = "v130" end end From 6f4dac38727b073f9145fea043d3103fb6e1919f Mon Sep 17 00:00:00 2001 From: Joe Kutner Date: Tue, 20 Jan 2015 14:52:11 -0600 Subject: [PATCH 0124/1195] Scale back JRuby heap size on PX dynos to give room for native memory allocation --- lib/language_pack/ruby.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 83b9c922d..512c9ab5f 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -198,7 +198,7 @@ def set_jvm_max_heap JVM_MAX_HEAP=768 ;; 32768) # PX Dyno - JVM_MAX_HEAP=6144 + JVM_MAX_HEAP=5120 ;; esac EOF From 8ba97852aaab56cbaea097a24375963d21618942 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 20 Jan 2015 15:25:21 -0800 Subject: [PATCH 0125/1195] wait on autoscaling --- CHANGELOG.md | 9 +++++++++ lib/language_pack/ruby.rb | 2 +- spec/ruby_spec.rb | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d4629f903..e9da5f9d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ ## Master +* Support multibuildpack export file (#319) +* Auto set the JVM MAX HEAP based on dyno size for JRuby (#323) +* Use s3 based npmjs servers for node (#336) +* Support system.properties file for specifying JDK in JRuby (#305) + +## v131 (1/15/2015) + +* Revert v130 due to lack of propper messaging around WEB_CONCURRENCY settings. + ## v130 (1/15/2015) * Auto set WEB_CONCURRENCY based on dyno size if not already set. diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 83b9c922d..e233343dc 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -287,7 +287,7 @@ def setup_profiled set_env_override "GEM_PATH", "$HOME/#{slug_vendor_base}:$GEM_PATH" set_env_override "PATH", binstubs_relative_paths.map {|path| "$HOME/#{path}" }.join(":") + ":$PATH" - add_to_profiled set_default_web_concurrency + # add_to_profiled set_default_web_concurrency if ruby_version.jruby? add_to_profiled set_jvm_max_heap diff --git a/spec/ruby_spec.rb b/spec/ruby_spec.rb index 895a43716..c3c67bd18 100644 --- a/spec/ruby_spec.rb +++ b/spec/ruby_spec.rb @@ -3,6 +3,7 @@ describe "Ruby apps" do describe "default WEB_CONCURRENCY" do it "auto scales WEB_CONCURRENCY" do + pending("Launch of web scaling project") Hatchet::Runner.new('default_ruby').deploy do |app| expect(app.run(:bash, 'echo "value: $WEB_CONCURRENCY"', heroku: { size: "1X" } )).to match("value: 2") expect(app.run(:bash, 'echo "value: $WEB_CONCURRENCY"', heroku: { size: "2X" } )).to match("value: 4") From 5a974e2739a02e5920fcf035a10464093315c8f5 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 20 Jan 2015 15:30:27 -0800 Subject: [PATCH 0126/1195] Set PX ram limits to correct value: https://devcenter.heroku.com/articles/dyno-size#available-dyno-sizes 6gb == 6144mb --- lib/language_pack/ruby.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index e233343dc..c80f617c2 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -216,7 +216,7 @@ def set_default_web_concurrency export WEB_CONCURRENCY=${WEB_CONCURRENCY:-4} ;; 32768) - export HEROKU_RAM_LIMIT_MB=${HEROKU_RAM_LIMIT_MB:-8192} + export HEROKU_RAM_LIMIT_MB=${HEROKU_RAM_LIMIT_MB:-6144} export WEB_CONCURRENCY=${WEB_CONCURRENCY:-16} ;; *) From 58ab672d6771e83f5b67573be2a8939a405f4f7e Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Tue, 20 Jan 2015 18:05:20 -0800 Subject: [PATCH 0127/1195] special case for patchlevel rubies. fixes jruby 9.0.0.0.pre1 --- hatchet.json | 1 + lib/language_pack/helpers/bundler_wrapper.rb | 2 +- spec/helpers/bundler_wrapper_spec.rb | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/hatchet.json b/hatchet.json index ea39bac6d..04f800fd0 100644 --- a/hatchet.json +++ b/hatchet.json @@ -27,6 +27,7 @@ "sharpstone/ruby_193_jruby_17161", "sharpstone/ruby_193_jruby_17161_jdk7", "sharpstone/ruby_193_jruby_17161_jdk8", + "kissaten/jruby-minimal", "sharpstone/empty-procfile", "sharpstone/bad_ruby_version" ], diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index 93c62fe83..1c4dba6d0 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -89,7 +89,7 @@ def ruby_version if output.match(/No ruby version specified/) "" else - output.chomp.sub('(', '').sub(')', '').sub("p", " p").split.join('-') + output.chomp.sub('(', '').sub(')', '').sub(/(p\d+)/, ' \1').split.join('-') end end end diff --git a/spec/helpers/bundler_wrapper_spec.rb b/spec/helpers/bundler_wrapper_spec.rb index e82abd4c2..2305e7195 100644 --- a/spec/helpers/bundler_wrapper_spec.rb +++ b/spec/helpers/bundler_wrapper_spec.rb @@ -24,5 +24,23 @@ expect(@bundler.install.windows_gemfile_lock?).to be_true end end + + describe "when executing bundler" do + before do + @bundler.install + end + + it "handles JRuby pre gemfiles" do + Hatchet::App.new("jruby-minimal").in_directory do |dir| + expect(@bundler.ruby_version).to eq("ruby-2.2.0-jruby-9.0.0.0.pre1") + end + end + + it "handles MRI patchlevel gemfiles" do + Hatchet::App.new("mri_193_p547").in_directory do |dir| + expect(@bundler.ruby_version).to eq("ruby-1.9.3-p547") + end + end + end end From 35fa3f16888ec62b24206c36263ca746b01c1ef5 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Wed, 21 Jan 2015 14:09:30 -0800 Subject: [PATCH 0128/1195] update changelog [ci skip] --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e9da5f9d0..5ec354f3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,12 @@ ## Master +## v132 (1/21/2015) + * Support multibuildpack export file (#319) * Auto set the JVM MAX HEAP based on dyno size for JRuby (#323) * Use s3 based npmjs servers for node (#336) * Support system.properties file for specifying JDK in JRuby (#305) +* Fix ruby version parsing to support JRuby 9.0.0.0.pre1 (#339) ## v131 (1/15/2015) From 2628ef9e52cee4966479df886d017767e659e4f1 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Wed, 21 Jan 2015 14:43:06 -0800 Subject: [PATCH 0129/1195] bump to v132 --- lib/language_pack/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index e46f03ac5..ff4da3dc2 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v130" + BUILDPACK_VERSION = "v132" end end From 00a39d82879769a7a86cd9cb0f661a1d5b86261a Mon Sep 17 00:00:00 2001 From: Cyril David Date: Wed, 21 Jan 2015 15:03:24 -0800 Subject: [PATCH 0130/1195] Fail fast if ENV["STACK"] is missing --- lib/language_pack/base.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/base.rb b/lib/language_pack/base.rb index 731576f3a..ec0ce28ef 100644 --- a/lib/language_pack/base.rb +++ b/lib/language_pack/base.rb @@ -27,7 +27,7 @@ class LanguagePack::Base def initialize(build_path, cache_path=nil) self.class.instrument "base.initialize" do @build_path = build_path - @stack = ENV["STACK"] + @stack = ENV.fetch("STACK") @cache = LanguagePack::Cache.new(cache_path) if cache_path @metadata = LanguagePack::Metadata.new(@cache) @bundler_cache = LanguagePack::BundlerCache.new(@cache, @stack) From 4d6c831e9ba1c67604c395d20ba153a2752b303b Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 21 Jan 2015 17:01:03 -0800 Subject: [PATCH 0131/1195] bundler 1.7 --- lib/language_pack/ruby.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 76fcb5cb0..3281f4461 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -14,7 +14,7 @@ class LanguagePack::Ruby < LanguagePack::Base NAME = "ruby" LIBYAML_VERSION = "0.1.6" LIBYAML_PATH = "libyaml-#{LIBYAML_VERSION}" - BUNDLER_VERSION = "1.6.3" + BUNDLER_VERSION = "1.7.12" BUNDLER_GEM_PATH = "bundler-#{BUNDLER_VERSION}" DEFAULT_RUBY_VERSION = "ruby-2.0.0" RBX_BASE_URL = "http://binaries.rubini.us/heroku" From a9ad1a1e9a1c10de231e307a03fc58559e8c2233 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 22 Jan 2015 13:14:57 -0800 Subject: [PATCH 0132/1195] bump to v133 --- lib/language_pack/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index ff4da3dc2..f15bd8cf2 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v132" + BUILDPACK_VERSION = "v133" end end From fc99e320ef351303ed7752d503ff3b3fe31bf6aa Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 22 Jan 2015 13:23:53 -0800 Subject: [PATCH 0133/1195] changelog for 133 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ec354f3a..12c3e3ca0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Master +## v133 (1/22/2015) + +* Bump bundler to 1.7.12 which includes multiple fixes and support for block source declaration (https://github.com/bundler/bundler/blob/1-7-stable/CHANGELOG.md). + ## v132 (1/21/2015) * Support multibuildpack export file (#319) From e375195ddbc3eff5b14e7c676fd5ea17c08792b6 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 22 Jan 2015 13:45:21 -0800 Subject: [PATCH 0134/1195] don't vendor in JVM on cedar-14 as it's now available on the stack. --- CHANGELOG.md | 2 ++ lib/language_pack/ruby.rb | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 12c3e3ca0..a48a68d3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Master +* JVM is now available on cedar-14, do not vendor in JVM based on individual gems. If customer needs a specific version they should use multibuildpack with java and ruby buildpacks. + ## v133 (1/22/2015) * Bump bundler to 1.7.12 which includes multiple fixes and support for block source declaration (https://github.com/bundler/bundler/blob/1-7-stable/CHANGELOG.md). diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 3281f4461..2cad7b2f5 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -601,10 +601,6 @@ def build_bundler end def post_bundler - if bundler.has_gem?('yui-compressor') && !ruby_version.jruby? - install_jvm(true) - ENV["PATH"] += ":bin" - end end # RUBYOPT line that requires syck_hack file From 7dbceff109ad5c296ee011f2847c1bd7ef6eeac3 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Fri, 20 Feb 2015 18:16:31 -0600 Subject: [PATCH 0135/1195] control all of our test repos --- hatchet.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hatchet.json b/hatchet.json index 04f800fd0..ab1bfb112 100644 --- a/hatchet.json +++ b/hatchet.json @@ -27,7 +27,7 @@ "sharpstone/ruby_193_jruby_17161", "sharpstone/ruby_193_jruby_17161_jdk7", "sharpstone/ruby_193_jruby_17161_jdk8", - "kissaten/jruby-minimal", + "sharpstone/jruby-minimal", "sharpstone/empty-procfile", "sharpstone/bad_ruby_version" ], From 6eac8fd260645ed3c0cd968c554839eb5fbcffd0 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Fri, 20 Feb 2015 16:55:58 -0600 Subject: [PATCH 0136/1195] use same bundler bin for every bundler command --- lib/language_pack/ruby.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 2cad7b2f5..e75c421d8 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -572,7 +572,7 @@ def build_bundler instrument "ruby.bundle_clean" do # Only show bundle clean output when not using default cache if load_default_cache? - run "bundle clean > /dev/null" + run "#{bundle_bin} clean > /dev/null" else pipe("#{bundle_bin} clean", out: "2> /dev/null") end From 89d563dea07a5af0f13edf97013ccc19b7974d67 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Fri, 20 Feb 2015 17:04:54 -0600 Subject: [PATCH 0137/1195] pass user env to bundle clean, since it should run in the same env as bundle install --- lib/language_pack/ruby.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index e75c421d8..c983c292c 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -572,9 +572,9 @@ def build_bundler instrument "ruby.bundle_clean" do # Only show bundle clean output when not using default cache if load_default_cache? - run "#{bundle_bin} clean > /dev/null" + run("#{bundle_bin} clean > /dev/null", user_env: true) else - pipe("#{bundle_bin} clean", out: "2> /dev/null") + pipe("#{bundle_bin} clean", out: "2> /dev/null", user_env: true) end end @bundler_cache.store From 1511a6e67b73ebc72e794807b6a0fe494ffc8d3c Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 18 Feb 2015 15:16:09 -0600 Subject: [PATCH 0138/1195] Allow opting in to default WEB_CONCURRENCY cc/@craigkerstiens --- CHANGELOG.md | 1 + lib/language_pack/ruby.rb | 2 +- spec/ruby_spec.rb | 8 ++++++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a48a68d3b..5052757ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## Master * JVM is now available on cedar-14, do not vendor in JVM based on individual gems. If customer needs a specific version they should use multibuildpack with java and ruby buildpacks. +* Set a default value of WEB_CONCURRENCY based on dyno size when `DEFAULT_WEB_CONCURRENCY` environment variable is present. ## v133 (1/22/2015) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index c983c292c..44e49efca 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -287,7 +287,7 @@ def setup_profiled set_env_override "GEM_PATH", "$HOME/#{slug_vendor_base}:$GEM_PATH" set_env_override "PATH", binstubs_relative_paths.map {|path| "$HOME/#{path}" }.join(":") + ":$PATH" - # add_to_profiled set_default_web_concurrency + add_to_profiled set_default_web_concurrency if env("DEFAULT_WEB_CONCURRENCY") if ruby_version.jruby? add_to_profiled set_jvm_max_heap diff --git a/spec/ruby_spec.rb b/spec/ruby_spec.rb index c3c67bd18..761747e5e 100644 --- a/spec/ruby_spec.rb +++ b/spec/ruby_spec.rb @@ -3,8 +3,12 @@ describe "Ruby apps" do describe "default WEB_CONCURRENCY" do it "auto scales WEB_CONCURRENCY" do - pending("Launch of web scaling project") - Hatchet::Runner.new('default_ruby').deploy do |app| + app = Hatchet::Runner.new("default_ruby") + app.setup! + app.set_config("DEFAULT_WEB_CONCURRENCY" => "enabled") + + app.deploy do |app| + app.run('echo "loaded"') expect(app.run(:bash, 'echo "value: $WEB_CONCURRENCY"', heroku: { size: "1X" } )).to match("value: 2") expect(app.run(:bash, 'echo "value: $WEB_CONCURRENCY"', heroku: { size: "2X" } )).to match("value: 4") expect(app.run(:bash, 'echo "value: $WEB_CONCURRENCY"', heroku: { size: "PX" } )).to match("value: 16") From e57004c04d883b1e9cce37060f75c906c02a4ad1 Mon Sep 17 00:00:00 2001 From: schneems Date: Fri, 27 Feb 2015 10:18:07 -0600 Subject: [PATCH 0139/1195] changelog for heroku/heroku-buildpack-ruby#347 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5052757ac..1d37434ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ * JVM is now available on cedar-14, do not vendor in JVM based on individual gems. If customer needs a specific version they should use multibuildpack with java and ruby buildpacks. * Set a default value of WEB_CONCURRENCY based on dyno size when `DEFAULT_WEB_CONCURRENCY` environment variable is present. +* Run `bundle clean` in the same context as `bundle install` heroku/heroku-buildpack-ruby#347 ## v133 (1/22/2015) From 479285865e85d564d4f16f3a0fbe9815b4546879 Mon Sep 17 00:00:00 2001 From: schneems Date: Fri, 27 Feb 2015 10:12:33 -0600 Subject: [PATCH 0140/1195] Enable Rails 5 to work on Heroku - Set RAILS_SERVE_STATIC_FILES by default on Rails 4.2+ (rails/rails#18100) --- CHANGELOG.md | 2 ++ hatchet.json | 6 ++++++ lib/language_pack.rb | 5 +++-- lib/language_pack/rails41.rb | 2 +- lib/language_pack/rails42.rb | 22 ++++++++++++++++++++++ lib/language_pack/rails5.rb | 16 ++++++++++++++++ spec/rails42_spec.rb | 13 +++++++++++++ spec/rails5_spec.rb | 10 ++++++++++ 8 files changed, 73 insertions(+), 3 deletions(-) create mode 100644 lib/language_pack/rails42.rb create mode 100644 lib/language_pack/rails5.rb create mode 100644 spec/rails42_spec.rb create mode 100644 spec/rails5_spec.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d37434ac..2528d7b22 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ * JVM is now available on cedar-14, do not vendor in JVM based on individual gems. If customer needs a specific version they should use multibuildpack with java and ruby buildpacks. * Set a default value of WEB_CONCURRENCY based on dyno size when `DEFAULT_WEB_CONCURRENCY` environment variable is present. * Run `bundle clean` in the same context as `bundle install` heroku/heroku-buildpack-ruby#347 +* Rails 4.2+ apps will have environment variable RAILS_SERVE_STATIC_FILES set to "enabled" by default #349 +* Rails 5 apps now work on Heroku #349 ## v133 (1/22/2015) diff --git a/hatchet.json b/hatchet.json index ab1bfb112..46d02609c 100644 --- a/hatchet.json +++ b/hatchet.json @@ -59,6 +59,12 @@ "rails41": [ "sharpstone/rails41_scaffold" ], + "rails42": [ + "sharpstone/rails42_scaffold" + ], + "rails5": [ + "sharpstone/rails5" + ], "multibuildpack": [ "sharpstone/node_multi" ] diff --git a/lib/language_pack.rb b/lib/language_pack.rb index 7dc3de377..986ce5525 100644 --- a/lib/language_pack.rb +++ b/lib/language_pack.rb @@ -13,14 +13,13 @@ def self.detect(*args) Instrument.instrument 'detect' do Dir.chdir(args.first) - pack = [ NoLockfile, Rails41, Rails4, Rails3, Rails2, Rack, Ruby ].detect do |klass| + pack = [ NoLockfile, Rails5, Rails42, Rails41, Rails4, Rails3, Rails2, Rack, Ruby ].detect do |klass| klass.use? end return pack ? pack.new(*args) : nil end end - end @@ -42,4 +41,6 @@ def self.detect(*args) require "language_pack/disable_deploys" require "language_pack/rails4" require "language_pack/rails41" +require "language_pack/rails42" +require "language_pack/rails5" require "language_pack/no_lockfile" diff --git a/lib/language_pack/rails41.rb b/lib/language_pack/rails41.rb index ed3f4dc36..2e6f7ff3b 100644 --- a/lib/language_pack/rails41.rb +++ b/lib/language_pack/rails41.rb @@ -6,7 +6,7 @@ class LanguagePack::Rails41 < LanguagePack::Rails4 # detects if this is a Rails 4.x app # @return [Boolean] true if it's a Rails 4.x app def self.use? - instrument "rails4.use" do + instrument "rails41.use" do rails_version = bundler.gem_version('railties') return false unless rails_version is_rails4 = rails_version >= Gem::Version.new('4.1.0.beta1') && diff --git a/lib/language_pack/rails42.rb b/lib/language_pack/rails42.rb new file mode 100644 index 000000000..7d2d9c6bb --- /dev/null +++ b/lib/language_pack/rails42.rb @@ -0,0 +1,22 @@ +require "language_pack" +require "language_pack/rails41" + +class LanguagePack::Rails42 < LanguagePack::Rails41 + # detects if this is a Rails 4.2 app + # @return [Boolean] true if it's a Rails 4.2 app + def self.use? + instrument "rails42.use" do + rails_version = bundler.gem_version('railties') + return false unless rails_version + is_rails42 = rails_version >= Gem::Version.new('4.2.0') && + rails_version < Gem::Version.new('5.0.0') + return is_rails42 + end + end + + def default_config_vars + super.merge({ + "RAILS_SERVE_STATIC_FILES" => env("RAILS_SERVE_STATIC_FILES") || "enabled" + }) + end +end diff --git a/lib/language_pack/rails5.rb b/lib/language_pack/rails5.rb new file mode 100644 index 000000000..1c0d60667 --- /dev/null +++ b/lib/language_pack/rails5.rb @@ -0,0 +1,16 @@ +require 'securerandom' +require "language_pack" +require "language_pack/rails42" + +class LanguagePack::Rails5 < LanguagePack::Rails42 + # @return [Boolean] true if it's a Rails 5.x app + def self.use? + instrument "rails5.use" do + rails_version = bundler.gem_version('railties') + return false unless rails_version + is_rails = rails_version >= Gem::Version.new('5.0.0') && + rails_version < Gem::Version.new('6.0.0') + return is_rails + end + end +end diff --git a/spec/rails42_spec.rb b/spec/rails42_spec.rb new file mode 100644 index 000000000..e4c874504 --- /dev/null +++ b/spec/rails42_spec.rb @@ -0,0 +1,13 @@ +require_relative 'spec_helper' + +describe "Rails 4.2.x" do + + it "set RAILS_SERVE_STATIC_FILES" do + Hatchet::Runner.new("rails42_scaffold").deploy do |app, heroku| + add_database(app, heroku) + ReplRunner.new(:rails_console, "heroku run bin/rails console -a #{app.name}").run do |console| + console.run("ENV['RAILS_SERVE_STATIC_FILES'].present?") { |result| expect(result).to match(/true/) } + end + end + end +end diff --git a/spec/rails5_spec.rb b/spec/rails5_spec.rb new file mode 100644 index 000000000..4e65a3f95 --- /dev/null +++ b/spec/rails5_spec.rb @@ -0,0 +1,10 @@ +require_relative 'spec_helper' + +describe "Rails 5.x" do + + it "works" do + Hatchet::Runner.new("rails5").deploy do |app, heroku| + expect(app.run("rails -v")).to match("") + end + end +end From ba669eb7c7548ef76964686084fd89b2c7193686 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 2 Mar 2015 10:11:11 -0600 Subject: [PATCH 0141/1195] Use more generic flag for sensible default detect --- CHANGELOG.md | 2 +- lib/language_pack/ruby.rb | 2 +- spec/ruby_spec.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d37434ac..773d5c412 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ ## Master * JVM is now available on cedar-14, do not vendor in JVM based on individual gems. If customer needs a specific version they should use multibuildpack with java and ruby buildpacks. -* Set a default value of WEB_CONCURRENCY based on dyno size when `DEFAULT_WEB_CONCURRENCY` environment variable is present. +* Set a default value of WEB_CONCURRENCY based on dyno size when `SENSIBLE_DEFAULTS` environment variable is present. * Run `bundle clean` in the same context as `bundle install` heroku/heroku-buildpack-ruby#347 ## v133 (1/22/2015) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 44e49efca..b1a7080e1 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -287,7 +287,7 @@ def setup_profiled set_env_override "GEM_PATH", "$HOME/#{slug_vendor_base}:$GEM_PATH" set_env_override "PATH", binstubs_relative_paths.map {|path| "$HOME/#{path}" }.join(":") + ":$PATH" - add_to_profiled set_default_web_concurrency if env("DEFAULT_WEB_CONCURRENCY") + add_to_profiled set_default_web_concurrency if env("SENSIBLE_DEFAULTS") if ruby_version.jruby? add_to_profiled set_jvm_max_heap diff --git a/spec/ruby_spec.rb b/spec/ruby_spec.rb index 761747e5e..bcb54befc 100644 --- a/spec/ruby_spec.rb +++ b/spec/ruby_spec.rb @@ -5,7 +5,7 @@ it "auto scales WEB_CONCURRENCY" do app = Hatchet::Runner.new("default_ruby") app.setup! - app.set_config("DEFAULT_WEB_CONCURRENCY" => "enabled") + app.set_config("SENSIBLE_DEFAULTS" => "enabled") app.deploy do |app| app.run('echo "loaded"') From 625415d8c2083d132a18a41b10a2fb289a179176 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 2 Mar 2015 10:28:00 -0600 Subject: [PATCH 0142/1195] v134 changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 82d2cddd6..fcc29a41a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Master +# v134 (3/1/2015) + * JVM is now available on cedar-14, do not vendor in JVM based on individual gems. If customer needs a specific version they should use multibuildpack with java and ruby buildpacks. * Set a default value of WEB_CONCURRENCY based on dyno size when `SENSIBLE_DEFAULTS` environment variable is present. * Run `bundle clean` in the same context as `bundle install` heroku/heroku-buildpack-ruby#347 From bac6cf0953a99f16f2fa9c1b7960c04764415423 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 2 Mar 2015 10:29:17 -0600 Subject: [PATCH 0143/1195] bump to v134 --- CHANGELOG.md | 2 +- lib/language_pack/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fcc29a41a..0ed17ad3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ## Master -# v134 (3/1/2015) +## v134 (3/1/2015) * JVM is now available on cedar-14, do not vendor in JVM based on individual gems. If customer needs a specific version they should use multibuildpack with java and ruby buildpacks. * Set a default value of WEB_CONCURRENCY based on dyno size when `SENSIBLE_DEFAULTS` environment variable is present. diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index f15bd8cf2..e28529fb5 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v133" + BUILDPACK_VERSION = "v134" end end From eaf422738b5ce54a707dda4e2f1f0434e61dcd90 Mon Sep 17 00:00:00 2001 From: Cyril David Date: Tue, 7 Apr 2015 13:30:41 -0700 Subject: [PATCH 0144/1195] Remove ctrl+C message We're proposing to remove supporting the behavior moving forward. --- lib/language_pack/helpers/rake_runner.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/language_pack/helpers/rake_runner.rb b/lib/language_pack/helpers/rake_runner.rb index e52f27ccd..9e72569c9 100644 --- a/lib/language_pack/helpers/rake_runner.rb +++ b/lib/language_pack/helpers/rake_runner.rb @@ -91,8 +91,6 @@ def load_rake_tasks!(options = {}) msg = "Could not detect rake tasks\n" msg << "ensure you can run `$ bundle exec rake -P` against your app with no environment variables present\n" msg << "and using the production group of your Gemfile.\n" - msg << "This may be intentional, if you expected rake tasks to be run\n" - msg << "cancel the build (CTRL+C) and fix the error then commit the fix:\n" msg << out puts msg if cannot_load_rakefile? return self From fd5d1a823f7a3a86b77c83315a9e672a33920f1c Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Wed, 15 Apr 2015 19:36:21 -0500 Subject: [PATCH 0145/1195] update README --- README.md | 96 +++++++++++++++++++++---------------------------------- 1 file changed, 36 insertions(+), 60 deletions(-) diff --git a/README.md b/README.md index d23812a94..ea0a8adca 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,8 @@ -Heroku buildpack: Ruby -====================== +# Heroku Buildpack for Ruby -This is a [Heroku buildpack](http://devcenter.heroku.com/articles/buildpacks) for Ruby, Rack, and Rails apps. It uses [Bundler](http://gembundler.com) for dependency management. +This is a [Heroku Buildpack](http://devcenter.heroku.com/articles/buildpacks) for Ruby, Rack, and Rails apps. It uses [Bundler](http://gembundler.com) for dependency management. -Usage ------ +## Usage ### Ruby @@ -13,7 +11,7 @@ Example Usage: $ ls Gemfile Gemfile.lock - $ heroku create --stack cedar --buildpack https://github.com/heroku/heroku-buildpack-ruby.git + $ heroku create --buildpack https://github.com/heroku/heroku-buildpack-ruby.git $ git push heroku master ... @@ -33,32 +31,6 @@ Example Usage: The buildpack will detect your app as Ruby if it has a `Gemfile` and `Gemfile.lock` files in the root directory. It will then proceed to run `bundle install` after setting up the appropriate environment for [ruby](http://ruby-lang.org) and [Bundler](http://gembundler.com). -#### Run the Tests - -The tests on this buildpack are written in Rspec to allow the use of -`focused: true`. Parallelization of testing is provided by -https://github.com/grosser/parallel_tests this lib spins up an arbitrary -number of processes and running a different test file in each process, -it does not parallelize tests within a test file. To run the tests: clone the repo, then `bundle install` then clone the test fixtures by running: - -```sh -$ hatchet install -``` - -Now run the tests: - -```sh -$ bundle exec parallel_rspec -n 6 spec/ -``` - -If you don't want to run them in parallel you can still: - -```sh -$ bundle exec rake spec -``` - -Now go take a nap or something for a really long time. - #### Bundler For non-windows `Gemfile.lock` files, the `--deployment` flag will be used. In the case of windows, the Gemfile.lock will be deleted and Bundler will do a full resolve so native gems are handled properly. The `vendor/bundle` directory is cached between builds to allow for faster `bundle install` times. `bundle clean` is used to ensure no stale gems are stored between builds. @@ -73,7 +45,7 @@ Example Usage: $ ls config/environment.rb config/environment.rb - $ heroku create --stack cedar --buildpack https://github.com/heroku/heroku-buildpack-ruby.git + $ heroku create --buildpack https://github.com/heroku/heroku-buildpack-ruby.git $ git push heroku master ... @@ -91,7 +63,7 @@ Example Usage: The buildpack will detect your app as a Rails 2 app if it has a `environment.rb` file in the `config` directory. #### Rails Log STDOUT - A [rails_log_stdout](http://github.com/ddollar/rails_log_stdout) is installed by default so Rails' logger will log to STDOUT and picked up by Heroku's [logplex](http://github.com/heroku/logplex). +A [rails_log_stdout](http://github.com/ddollar/rails_log_stdout) is installed by default so Rails' logger will log to STDOUT and picked up by Heroku's [logplex](http://github.com/heroku/logplex). #### Auto Injecting Plugins @@ -107,7 +79,7 @@ Example Usage: $ ls config/application.rb config/application.rb - $ heroku create --stack cedar --buildpack https://github.com/heroku/heroku-buildpack-ruby.git + $ heroku create --buildpack https://github.com/heroku/heroku-buildpack-ruby.git $ git push heroku master -----> Heroku receiving push @@ -131,8 +103,17 @@ The buildpack will detect your apps as a Rails 3 app if it has an `application.r To enable static assets being served on the dyno, [rails3_serve_static_assets](http://github.com/pedro/rails3_serve_static_assets) is installed by default. If the [execjs gem](http://github.com/sstephenson/execjs) is detected then [node.js](http://github.com/joyent/node) will be vendored. The `assets:precompile` rake task will get run if no `public/manifest.yml` is detected. See [this article](http://devcenter.heroku.com/articles/rails31_heroku_cedar) on how rails 3.1 works on cedar. -Hacking -------- +## Documentation + +For more information about using Ruby and buildpacks on Heroku, see these Dev Center articles: + +- [Heroku Ruby Support](https://devcenter.heroku.com/articles/ruby-support) +- [Getting Started with Ruby on Heroku](https://devcenter.heroku.com/articles/nodejs) +- [Getting Started with Rails 4 on Heroku](https://devcenter.heroku.com/articles/getting-started-with-rails4) +- [Buildpacks](https://devcenter.heroku.com/articles/buildpacks) +- [Buildpack API](https://devcenter.heroku.com/articles/buildpack-api) + +## Hacking To use this buildpack, fork it on Github. Push up changes to your fork, then create a test app with `--buildpack ` and push to it. @@ -160,33 +141,28 @@ Commit and push the changes to your buildpack to your Github fork, then push you NOTE: You'll need to vendor the plugins, node, Bundler, and libyaml by running the rake tasks for the buildpack to work properly. -Flow ----- - -Here's the basic flow of how the buildpack works: - -Ruby (Gemfile and Gemfile.lock is detected) +### Testing -* runs Bundler -* installs binaries - * installs node if the gem execjs is detected -* runs `rake assets:precompile` if the rake task is detected - -Rack (config.ru is detected) +The tests on this buildpack are written in Rspec to allow the use of +`focused: true`. Parallelization of testing is provided by +https://github.com/grosser/parallel_tests this lib spins up an arbitrary +number of processes and running a different test file in each process, +it does not parallelize tests within a test file. To run the tests: clone the repo, then `bundle install` then clone the test fixtures by running: -* everything from Ruby -* sets RACK_ENV=production +```sh +$ hatchet install +``` -Rails 2 (config/environment.rb is detected) +Now run the tests: -* everything from Rack -* sets RAILS_ENV=production -* install rails 2 plugins - * [rails_log_stdout](http://github.com/ddollar/rails_log_stdout) +```sh +$ bundle exec parallel_rspec -n 6 spec/ +``` -Rails 3 (config/application.rb is detected) +If you don't want to run them in parallel you can still: -* everything from Rails 2 -* install rails 3 plugins - * [rails3_server_static_assets](https://github.com/pedro/rails3_serve_static_assets) +```sh +$ bundle exec rake spec +``` +Now go take a nap or something for a really long time. From 10ff2183d94d0765e0a243fcc3b0c622c8ce25db Mon Sep 17 00:00:00 2001 From: Joe Kutner Date: Thu, 9 Apr 2015 13:26:12 -0500 Subject: [PATCH 0146/1195] Set dev flag for JRuby builds. This optimizes for short tasks. Fixes #356 --- lib/language_pack/ruby.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index b1a7080e1..17f365fc5 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -246,6 +246,11 @@ def setup_language_pack_environment #{set_jvm_max_heap} echo #{default_java_tool_options} SHELL + if Gem::Version.new(ruby_version.engine_version) >= Gem::Version.new("1.7.12") + ENV["JRUBY_OPTS"] = "--dev" + else + ENV["JRUBY_OPTS"] = "-Xcompile.invokedynamic=false -Xcompile.mode=OFF -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1" + end end setup_ruby_install_env ENV["PATH"] += ":#{node_bp_bin_path}" if node_js_installed? From 4ed54a0f9d4b11000efc3fd71d3ceebf7eff7da7 Mon Sep 17 00:00:00 2001 From: Joe Kutner Date: Thu, 23 Apr 2015 14:07:50 -0500 Subject: [PATCH 0147/1195] Update CHANGELOG.md [skip ci] --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ed17ad3f..3580a4b96 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Master +* Set `--dev` by default for JRuby builds (but not at runtime). This optimizes the JVM for short process and is ideal for `bundle install` and asset precompiles. + ## v134 (3/1/2015) * JVM is now available on cedar-14, do not vendor in JVM based on individual gems. If customer needs a specific version they should use multibuildpack with java and ruby buildpacks. From cd8894dd7b68a259344815c5fb17dc3906bfb898 Mon Sep 17 00:00:00 2001 From: Cyril David Date: Fri, 24 Apr 2015 09:30:46 -0700 Subject: [PATCH 0148/1195] First stab at cleaning out the .git folders --- lib/language_pack/ruby.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 17f365fc5..caa0de6e9 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -606,6 +606,11 @@ def build_bundler end def post_bundler + instrument "ruby.post_bundler" do + Dir[File.join(slug_vendor_base, "**", ".git")].each do |dir| + FileUtils.rm_rf(dir) + end + end end # RUBYOPT line that requires syck_hack file From 9fe7266ba4bb7765a2da8907ef3372b0efcc4700 Mon Sep 17 00:00:00 2001 From: Dyego Costa Date: Wed, 29 Apr 2015 22:47:16 -0300 Subject: [PATCH 0149/1195] Use shell on detect for speed --- bin/detect | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/bin/detect b/bin/detect index b87aa5660..f9dfb3bcb 100755 --- a/bin/detect +++ b/bin/detect @@ -1,11 +1,9 @@ -#!/usr/bin/env ruby +#!/bin/sh -require 'pathname' - -if Pathname.new(ARGV.first).join("Gemfile").exist? - puts "Ruby" +if [ -f $1/Gemfile ]; then + echo "Ruby" exit 0 else - puts "no" + echo "no" exit 1 -end +fi From 93b2b9433cee6363253e91932425908cb9852a3a Mon Sep 17 00:00:00 2001 From: fjg Date: Mon, 27 Apr 2015 12:10:55 +0200 Subject: [PATCH 0150/1195] feat(sprockets): support new sprockets filename Sprockets 3.0.0 introduced a [new naming convention for the manifest file](https://github.com/rails/sprockets/blob/c1f25a038c1a1aca12661b9508523dbac887dbcf/CHANGELOG.md). This PR adds support for the new manifest file name so assets generated with sprockets 3+ and committed to git will not trigger `rake assets:precompile` while deploying. --- CHANGELOG.md | 3 ++- hatchet.json | 3 ++- lib/language_pack/rails4.rb | 2 +- spec/rails4_spec.rb | 7 +++++++ 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3580a4b96..2cb431e60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## Master -* Set `--dev` by default for JRuby builds (but not at runtime). This optimizes the JVM for short process and is ideal for `bundle install` and asset precompiles. +* Support sprockets 3.0 manifest file naming convention (#367) +* Set `--dev` by default for JRuby builds (but not at runtime). This optimizes the JVM for short process and is ideal for `bundle install` and asset precompiles. ## v134 (3/1/2015) diff --git a/hatchet.json b/hatchet.json index 46d02609c..41b823bcd 100644 --- a/hatchet.json +++ b/hatchet.json @@ -60,7 +60,8 @@ "sharpstone/rails41_scaffold" ], "rails42": [ - "sharpstone/rails42_scaffold" + "sharpstone/rails42_scaffold", + "sharpstone/rails42_sprockets3_manifest" ], "rails5": [ "sharpstone/rails5" diff --git a/lib/language_pack/rails4.rb b/lib/language_pack/rails4.rb index a1c0b45e4..27c9c263f 100644 --- a/lib/language_pack/rails4.rb +++ b/lib/language_pack/rails4.rb @@ -69,7 +69,7 @@ def default_assets_cache def run_assets_precompile_rake_task instrument "rails4.run_assets_precompile_rake_task" do log("assets_precompile") do - if Dir.glob('public/assets/manifest-*.json').any? + if Dir.glob("public/assets/{.sprockets-manifest-*.json,manifest-*.json}", File::FNM_DOTMATCH).any? puts "Detected manifest file, assuming assets were compiled locally" return true end diff --git a/spec/rails4_spec.rb b/spec/rails4_spec.rb index 9d94ecf07..9d415c782 100644 --- a/spec/rails4_spec.rb +++ b/spec/rails4_spec.rb @@ -18,6 +18,13 @@ end end + it "detects new manifest file (sprockets 3.x: .sprockets-manifest-.json)" do + Hatchet::Runner.new("rails42_sprockets3_manifest").deploy do |app, heroku| + expect(app.output).to include("Detected manifest file, assuming assets were compiled locally") + end + end + + it "upgraded from 3 to 4 missing ./bin still works" do Hatchet::Runner.new("rails3-to-4-no-bin").deploy do |app, heroku| expect(app.output).to include("Asset precompilation completed") From e481b157e1d4aa0924e0c721d5c4d9a3f1ae66fe Mon Sep 17 00:00:00 2001 From: Cyril David Date: Fri, 1 May 2015 11:58:17 -0700 Subject: [PATCH 0151/1195] Add entry in changelog about cleaning `.git` folders --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2cb431e60..e43242b57 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ * Support sprockets 3.0 manifest file naming convention (#367) * Set `--dev` by default for JRuby builds (but not at runtime). This optimizes the JVM for short process and is ideal for `bundle install` and asset precompiles. +* Cleanup `.git` folders in the bundle directory after `bundle install`. ## v134 (3/1/2015) From a1714ba006cc2a7954e7c7b1005b04086196cfe8 Mon Sep 17 00:00:00 2001 From: "Samuel E. Giddins" Date: Fri, 1 May 2015 19:41:31 -0700 Subject: [PATCH 0152/1195] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ea0a8adca..72dd30407 100644 --- a/README.md +++ b/README.md @@ -150,7 +150,7 @@ number of processes and running a different test file in each process, it does not parallelize tests within a test file. To run the tests: clone the repo, then `bundle install` then clone the test fixtures by running: ```sh -$ hatchet install +$ bundle exec hatchet install ``` Now run the tests: From b89dd3582a768f9ae3053dc323f93144f93a208c Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 5 May 2015 12:55:32 -0500 Subject: [PATCH 0153/1195] [ci skip] Changelog v135 --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e43242b57..d9df3f727 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Master +## v135 (5/5/2015) + * Support sprockets 3.0 manifest file naming convention (#367) * Set `--dev` by default for JRuby builds (but not at runtime). This optimizes the JVM for short process and is ideal for `bundle install` and asset precompiles. * Cleanup `.git` folders in the bundle directory after `bundle install`. From 8c772bd3c2adcb5c317ba80b010b12dfc125205a Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 5 May 2015 13:05:24 -0500 Subject: [PATCH 0154/1195] bump to v135 --- lib/language_pack/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index e28529fb5..58d068540 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v134" + BUILDPACK_VERSION = "v135" end end From e1482d5b00fd692dc10b1965f3a3e0b53e2e0fdc Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 5 May 2015 13:25:34 -0500 Subject: [PATCH 0155/1195] [ci skip] fix buildpack release --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 42697d13d..5de54d252 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -19,7 +19,7 @@ GEM rest-client (~> 1.6, >= 1.6.7) thor (~> 0.15, >= 0.15.2) diff-lcs (1.1.3) - excon (0.43.0) + excon (0.45.3) heroku-api (0.3.22) excon (~> 0.38) multi_json (~> 1.8) From 270381f058f9ff2d5dd4c7a05f35ae64ead01b19 Mon Sep 17 00:00:00 2001 From: Joe Kutner Date: Wed, 6 May 2015 16:16:32 -0500 Subject: [PATCH 0156/1195] Added override config var to build-time jruby-opts --- lib/language_pack/ruby.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index caa0de6e9..2f865c509 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -247,9 +247,9 @@ def setup_language_pack_environment echo #{default_java_tool_options} SHELL if Gem::Version.new(ruby_version.engine_version) >= Gem::Version.new("1.7.12") - ENV["JRUBY_OPTS"] = "--dev" + ENV["JRUBY_OPTS"] = env('JRUBY_BUILD_OPTS') || "--dev" else - ENV["JRUBY_OPTS"] = "-Xcompile.invokedynamic=false -Xcompile.mode=OFF -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1" + ENV["JRUBY_OPTS"] = env('JRUBY_BUILD_OPTS') || "-Xcompile.invokedynamic=false -Xcompile.mode=OFF -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1" end end setup_ruby_install_env From b0ba46eac0c1c5cd288943c8c08892616a28f044 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Wed, 6 May 2015 17:40:38 -0500 Subject: [PATCH 0157/1195] update readme --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d9df3f727..e3de67b43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Master +## v136 (5/6/2015) + +* JRUBY_BUILD_OPTS env var will override any build time jruby opts (#381) + ## v135 (5/5/2015) * Support sprockets 3.0 manifest file naming convention (#367) From 5e693eb7f509c14aedcbd9f4b6ded960321d77a1 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Wed, 6 May 2015 18:56:14 -0500 Subject: [PATCH 0158/1195] bump to v136 --- lib/language_pack/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 58d068540..66ce52ad5 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v135" + BUILDPACK_VERSION = "v136" end end From 4f0b77a56877c0f2edfd3ecfae9683143e38b5ee Mon Sep 17 00:00:00 2001 From: Michael Hale Date: Thu, 7 May 2015 14:47:02 -0400 Subject: [PATCH 0159/1195] Ensure only one instance of BundlerWrapper is created --- lib/language_pack/ruby.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 2f865c509..08e18922d 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -29,7 +29,7 @@ def self.use? end def self.bundler - @bundler ||= LanguagePack::Helpers::BundlerWrapper.new.install + @@bundler ||= LanguagePack::Helpers::BundlerWrapper.new.install end def bundler From 17726a09c974ca02b83c57077bbb530a80fa7bcf Mon Sep 17 00:00:00 2001 From: Michael Hale Date: Thu, 7 May 2015 14:54:31 -0400 Subject: [PATCH 0160/1195] Remove the tmpdir (not just the bundler dir under it) --- lib/language_pack/helpers/bundler_wrapper.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index 1c4dba6d0..8cbd4ba0d 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -19,7 +19,8 @@ def initialize(error) def initialize(options = {}) @fetcher = options[:fetcher] || DEFAULT_FETCHER - @bundler_path = options[:bundler_path] || File.join(Dir.mktmpdir, "#{BUNDLER_DIR_NAME}") + @bundler_tmp = Dir.mktmpdir + @bundler_path = options[:bundler_path] || File.join(@bundler_tmp, "#{BUNDLER_DIR_NAME}") @gemfile_path = options[:gemfile_path] || GEMFILE_PATH @bundler_tar = options[:bundler_tar] || "#{BUNDLER_DIR_NAME}.tgz" @gemfile_lock_path = "#{@gemfile_path}.lock" @@ -37,7 +38,7 @@ def install def clean ENV['BUNDLE_GEMFILE'] = @orig_bundle_gemfile - FileUtils.remove_entry_secure(bundler_path) if Dir.exist?(bundler_path) + FileUtils.remove_entry_secure(@bundler_tmp) if Dir.exist?(@bundler_tmp) end def has_gem?(name) From 710543c001f5e74d84b9e3a4aa773099f64ef307 Mon Sep 17 00:00:00 2001 From: Michael Hale Date: Thu, 7 May 2015 15:22:21 -0400 Subject: [PATCH 0161/1195] Add hack to cleanup after bundler --- lib/language_pack/helpers/bundler_wrapper.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index 8cbd4ba0d..ff4d63685 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -39,6 +39,15 @@ def install def clean ENV['BUNDLE_GEMFILE'] = @orig_bundle_gemfile FileUtils.remove_entry_secure(@bundler_tmp) if Dir.exist?(@bundler_tmp) + + if LanguagePack::Ruby::BUNDLER_VERSION == "1.7.12" + # Hack to cleanup after pre 1.8 versions of bundler. See https://github.com/bundler/bundler/pull/3277/ + Dir["#{Dir.tmpdir}/bundler*"].each do |dir| + FileUtils.remove_entry_secure(dir) if Dir.exist?(dir) && File.stat(dir).writable? + end + else + raise "Bundler cleanup hack is out of date, please update it to be compatible with #{LanguagePack::Ruby::BUNDLER_VERSION}" + end end def has_gem?(name) From 5fac73c50ae63fb6c501f22db0e9ab6456f1db46 Mon Sep 17 00:00:00 2001 From: Michael Hale Date: Thu, 7 May 2015 17:09:45 -0400 Subject: [PATCH 0162/1195] Clean up after bundler --- lib/language_pack/ruby.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 08e18922d..862c40b2c 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -610,6 +610,7 @@ def post_bundler Dir[File.join(slug_vendor_base, "**", ".git")].each do |dir| FileUtils.rm_rf(dir) end + bundler.clean end end From f9b1c3a13f140096bf9daddbe99a0833dc2ee1b1 Mon Sep 17 00:00:00 2001 From: Joe Kutner Date: Thu, 7 May 2015 16:24:26 -0500 Subject: [PATCH 0163/1195] Added a redeploy step to JRuby test to cover jruby_opts at build time Added test for jruby_opts output during build Added jruby_opts to blacklist of env vars Only set jruby_opts for build if user sets jruby_build_opts --- lib/language_pack/ruby.rb | 6 +----- lib/language_pack/shell_helpers.rb | 2 +- spec/rubies_spec.rb | 7 +++++++ 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 2f865c509..fe186b909 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -246,11 +246,7 @@ def setup_language_pack_environment #{set_jvm_max_heap} echo #{default_java_tool_options} SHELL - if Gem::Version.new(ruby_version.engine_version) >= Gem::Version.new("1.7.12") - ENV["JRUBY_OPTS"] = env('JRUBY_BUILD_OPTS') || "--dev" - else - ENV["JRUBY_OPTS"] = env('JRUBY_BUILD_OPTS') || "-Xcompile.invokedynamic=false -Xcompile.mode=OFF -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1" - end + ENV["JRUBY_OPTS"] = env('JRUBY_BUILD_OPTS') || env('JRUBY_OPTS') end setup_ruby_install_env ENV["PATH"] += ":#{node_bp_bin_path}" if node_js_installed? diff --git a/lib/language_pack/shell_helpers.rb b/lib/language_pack/shell_helpers.rb index b196a836c..4e2d560c3 100644 --- a/lib/language_pack/shell_helpers.rb +++ b/lib/language_pack/shell_helpers.rb @@ -27,7 +27,7 @@ def env(var) end def self.blacklist?(key) - %w(PATH GEM_PATH GEM_HOME GIT_DIR).include?(key) + %w(PATH GEM_PATH GEM_HOME GIT_DIR JRUBY_OPTS).include?(key) end def self.initialize_env(path) diff --git a/spec/rubies_spec.rb b/spec/rubies_spec.rb index 824009136..de6689711 100644 --- a/spec/rubies_spec.rb +++ b/spec/rubies_spec.rb @@ -87,7 +87,13 @@ app.deploy do |app| expect(app.output).to match("Installing JVM: openjdk1.8-latest") + expect(app.output).to match("JRUBY_OPTS is: -Xcompile.invokedynamic=false") expect(app.output).not_to include("OpenJDK 64-Bit Server VM warning") + + `git commit -am "redeploy" --allow-empty` + app.set_config("JRUBY_BUILD_OPTS" => "--dev") + app.push! + expect(app.output).to match("JRUBY_OPTS is: --dev") end end @@ -98,6 +104,7 @@ app.deploy do |app| expect(app.output).to match("Installing JVM: openjdk1.7-latest") + expect(app.output).to match("JRUBY_OPTS is: -Xcompile.invokedynamic=false") expect(app.output).not_to include("OpenJDK 64-Bit Server VM warning") end end From 457805f222450de3ece1da41addfca0ee1edffa7 Mon Sep 17 00:00:00 2001 From: Joe Kutner Date: Fri, 8 May 2015 09:47:47 -0500 Subject: [PATCH 0164/1195] removed jruby_opts check from test that doesn't have the code for it --- spec/rubies_spec.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/spec/rubies_spec.rb b/spec/rubies_spec.rb index de6689711..a091ecaff 100644 --- a/spec/rubies_spec.rb +++ b/spec/rubies_spec.rb @@ -104,7 +104,6 @@ app.deploy do |app| expect(app.output).to match("Installing JVM: openjdk1.7-latest") - expect(app.output).to match("JRUBY_OPTS is: -Xcompile.invokedynamic=false") expect(app.output).not_to include("OpenJDK 64-Bit Server VM warning") end end From 02e2a24d10baffbe5be2c4204836426911cda389 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Fri, 8 May 2015 12:08:55 -0500 Subject: [PATCH 0165/1195] update changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e3de67b43..00f17b824 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ ## Master +## v137 (5/11/2015) + +* Blacklist `JRUBY_OPTS`, use `JRUBY_BUILD_OPTS` to override build `JRUBY_OPTS`. (#384) +* Revert `--dev` during JRuby build for now. (#384) + ## v136 (5/6/2015) * JRUBY_BUILD_OPTS env var will override any build time jruby opts (#381) From e99ccea2cf3343f4d8ef7ffc813f754c3d5c090d Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Mon, 11 May 2015 11:51:23 -0500 Subject: [PATCH 0166/1195] bump to v137 --- lib/language_pack/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 66ce52ad5..5dac6bbe4 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v136" + BUILDPACK_VERSION = "v137" end end From d2d08e2b1e5da6b1087e9009f62fb40646f9c6eb Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 11 May 2015 12:57:12 -0500 Subject: [PATCH 0167/1195] Don't raise on newer bundler versions --- lib/language_pack/helpers/bundler_wrapper.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index ff4d63685..ad590f921 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -45,8 +45,6 @@ def clean Dir["#{Dir.tmpdir}/bundler*"].each do |dir| FileUtils.remove_entry_secure(dir) if Dir.exist?(dir) && File.stat(dir).writable? end - else - raise "Bundler cleanup hack is out of date, please update it to be compatible with #{LanguagePack::Ruby::BUNDLER_VERSION}" end end From 6b3f3c71f4a98309e29748132be8e84b41d890de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andre=CC=81=20Arko?= Date: Mon, 4 May 2015 09:54:10 -0700 Subject: [PATCH 0168/1195] Update Bundler version This updates the version of Bundler used to the current newest version, 1.9.7. We've been continuing to backport bugfixs to the 1.7.x series just for Heroku, but unless Heroku joins Ruby Together I don't have enough time available to make sure that continues to happen. In addition, there are _many_ features that are simply unavailable to Heroku users who want or need to use them, including the ability to keep Gem server credentials out of checked in files. --- lib/language_pack/ruby.rb | 2 +- spec/bugs_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index e27023ddb..84092b942 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -14,7 +14,7 @@ class LanguagePack::Ruby < LanguagePack::Base NAME = "ruby" LIBYAML_VERSION = "0.1.6" LIBYAML_PATH = "libyaml-#{LIBYAML_VERSION}" - BUNDLER_VERSION = "1.7.12" + BUNDLER_VERSION = "1.9.7" BUNDLER_GEM_PATH = "bundler-#{BUNDLER_VERSION}" DEFAULT_RUBY_VERSION = "ruby-2.0.0" RBX_BASE_URL = "http://binaries.rubini.us/heroku" diff --git a/spec/bugs_spec.rb b/spec/bugs_spec.rb index 3b6588163..ed39bb6bf 100644 --- a/spec/bugs_spec.rb +++ b/spec/bugs_spec.rb @@ -7,7 +7,7 @@ app.heroku.put_stack(app.name, "cedar") app.deploy do |app, heroku| expect(app.output).to match("Installing nokogiri") - expect(app.output).to match("Your bundle is complete!") + expect(app.output).to match("Bundle complete") end end end From 5c5ed3fc054f08b5ab015dd598114f9227702cae Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 13 May 2015 14:30:18 -0500 Subject: [PATCH 0169/1195] Fix for bundler 1.9 regression Previously bundler would emit an error message when `bundle platform --ruby` was executed. It no longer does this. To provide a user with relevant debugging information we now call `bundle check` when an error is observed, as this will emit the correct debugging info. --- lib/language_pack/helpers/bundler_wrapper.rb | 5 ++++- spec/helpers/ruby_version_spec.rb | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index ad590f921..3a12e0999 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -92,8 +92,11 @@ def ruby_version } command = "bundle platform --ruby" + # Silently check for ruby version output = run_stdout(command, user_env: true, env: env) - raise GemfileParseError.new(run(command, user_env: true, env: env)) unless $?.success? + + # If there's a gem in the Gemfile (i.e. syntax error) emit error + raise GemfileParseError.new(run("bundle check", user_env: true, env: env)) unless $?.success? if output.match(/No ruby version specified/) "" else diff --git a/spec/helpers/ruby_version_spec.rb b/spec/helpers/ruby_version_spec.rb index 1ddac2be5..8087a0627 100644 --- a/spec/helpers/ruby_version_spec.rb +++ b/spec/helpers/ruby_version_spec.rb @@ -98,7 +98,7 @@ error_klass = LanguagePack::Helpers::BundlerWrapper::GemfileParseError Hatchet::App.new("bad_gemfile_on_platform").in_directory do |dir| @bundler = LanguagePack::Helpers::BundlerWrapper.new().install - expect {LanguagePack::RubyVersion.new(@bundler.ruby_version)}.to raise_error(error_klass, /#{Regexp.escape(bundle_error_msg)}/) + expect { LanguagePack::RubyVersion.new(@bundler.ruby_version) }.to raise_error(error_klass, /#{Regexp.escape(bundle_error_msg)}/) end end end From 1636c7d71e4b3615959b85e89e5c5eb341a4b412 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Thu, 14 May 2015 10:55:22 -0500 Subject: [PATCH 0170/1195] Update Changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 00f17b824..cc9c7fd19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Master +* * Bump bundler to 1.9.7 [Bundler changelog](https://github.com/bundler/bundler/blob/master/CHANGELOG.md#196-2015-05-02) (#378) + ## v137 (5/11/2015) * Blacklist `JRUBY_OPTS`, use `JRUBY_BUILD_OPTS` to override build `JRUBY_OPTS`. (#384) From ef74a70258950920ac971d7d7586919e5e1c2199 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 19 May 2015 14:35:58 -0500 Subject: [PATCH 0171/1195] [ci skip] v138 changelog --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cc9c7fd19..9133ee646 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ ## Master -* * Bump bundler to 1.9.7 [Bundler changelog](https://github.com/bundler/bundler/blob/master/CHANGELOG.md#196-2015-05-02) (#378) +## v138 (5/19/2015) + +* Bump bundler to 1.9.7 [Bundler changelog](https://github.com/bundler/bundler/blob/master/CHANGELOG.md#196-2015-05-02) (#378) ## v137 (5/11/2015) From 4b493f80ed9ea9ae7bf8cd743068fb79e3c8b9a2 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 19 May 2015 14:36:12 -0500 Subject: [PATCH 0172/1195] bump to v138 --- lib/language_pack/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 5dac6bbe4..d32f67204 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v137" + BUILDPACK_VERSION = "v138" end end From ef6dbd2a678c12d49a1d2da781578adeedcdf2c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trung=20L=C3=AA?= Date: Thu, 2 Jul 2015 22:21:19 +1000 Subject: [PATCH 0173/1195] Fix the link to Getting Started with Ruby I know, Ruby is not yet replaced by NodeJS yet.... :trollface: --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 72dd30407..05bc93136 100644 --- a/README.md +++ b/README.md @@ -108,7 +108,7 @@ To enable static assets being served on the dyno, [rails3_serve_static_assets](h For more information about using Ruby and buildpacks on Heroku, see these Dev Center articles: - [Heroku Ruby Support](https://devcenter.heroku.com/articles/ruby-support) -- [Getting Started with Ruby on Heroku](https://devcenter.heroku.com/articles/nodejs) +- [Getting Started with Ruby on Heroku](https://devcenter.heroku.com/articles/getting-started-with-ruby) - [Getting Started with Rails 4 on Heroku](https://devcenter.heroku.com/articles/getting-started-with-rails4) - [Buildpacks](https://devcenter.heroku.com/articles/buildpacks) - [Buildpack API](https://devcenter.heroku.com/articles/buildpack-api) From 6c0b352b46e0aa0052b0b879be5d23e1e4693584 Mon Sep 17 00:00:00 2001 From: Dyego Costa Date: Thu, 2 Jul 2015 19:19:26 +0200 Subject: [PATCH 0174/1195] Allow path with spaces to be detected as Ruby --- bin/detect | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/detect b/bin/detect index f9dfb3bcb..66237255d 100755 --- a/bin/detect +++ b/bin/detect @@ -1,6 +1,6 @@ #!/bin/sh -if [ -f $1/Gemfile ]; then +if [ -f "$1/Gemfile" ]; then echo "Ruby" exit 0 else From bf92fc02e96210a9227974cd9fda99a6226457fa Mon Sep 17 00:00:00 2001 From: Matt Graham Date: Fri, 24 Jul 2015 14:01:54 -0400 Subject: [PATCH 0175/1195] Update readme with banner image. Thoughts? --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 05bc93136..89b6eac48 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # Heroku Buildpack for Ruby +![ruby_buildpack](https://cloud.githubusercontent.com/assets/51578/8881228/3b244e32-320c-11e5-866c-4a5c4fac5e47.jpg) This is a [Heroku Buildpack](http://devcenter.heroku.com/articles/buildpacks) for Ruby, Rack, and Rails apps. It uses [Bundler](http://gembundler.com) for dependency management. From 6efb03536f045db209f4ee9f7aa51c7d3194e2ed Mon Sep 17 00:00:00 2001 From: Matt Graham Date: Fri, 24 Jul 2015 15:21:49 -0400 Subject: [PATCH 0176/1195] updated image, already --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 89b6eac48..aa9696c72 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Heroku Buildpack for Ruby -![ruby_buildpack](https://cloud.githubusercontent.com/assets/51578/8881228/3b244e32-320c-11e5-866c-4a5c4fac5e47.jpg) +![ruby](https://cloud.githubusercontent.com/assets/51578/8882726/52caf102-3217-11e5-8a6c-2d47c57f0030.jpg) This is a [Heroku Buildpack](http://devcenter.heroku.com/articles/buildpacks) for Ruby, Rack, and Rails apps. It uses [Bundler](http://gembundler.com) for dependency management. From 249624ee45f536df017bd3a520fe7b1ee87df1c5 Mon Sep 17 00:00:00 2001 From: Orlando Del Aguila Date: Tue, 28 Jul 2015 18:58:28 -0500 Subject: [PATCH 0177/1195] adding hatchet setup information to readme --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 05bc93136..369eca68d 100644 --- a/README.md +++ b/README.md @@ -153,6 +153,9 @@ it does not parallelize tests within a test file. To run the tests: clone the re $ bundle exec hatchet install ``` +then go to [hatchet](https://github.com/heroku/hatchet) and follow the +instructions to set it up. + Now run the tests: ```sh From 2a044313d63808d751296304317a8d114e453a1f Mon Sep 17 00:00:00 2001 From: Orlando Del Aguila Date: Tue, 28 Jul 2015 19:00:22 -0500 Subject: [PATCH 0178/1195] improving copy --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 369eca68d..2b47f379c 100644 --- a/README.md +++ b/README.md @@ -153,7 +153,7 @@ it does not parallelize tests within a test file. To run the tests: clone the re $ bundle exec hatchet install ``` -then go to [hatchet](https://github.com/heroku/hatchet) and follow the +then go to [hatchet](https://github.com/heroku/hatchet) repo and follow the instructions to set it up. Now run the tests: From 61b910f793f9cdc259977f649f97aed02651a8c7 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 3 Aug 2015 14:18:03 -0500 Subject: [PATCH 0179/1195] Fix status 422 The DATABASE_URL was already being set correctly on some apps so when we tried to provision and update the DATABASE_URL we were getting a 422 http://stackoverflow.com/questions/30611801/how-to-change-database-url-on-heroku Pretty sure we don't need this --- spec/rails23_spec.rb | 1 - spec/rails3_spec.rb | 4 ---- spec/rails41_spec.rb | 2 -- spec/rails42_spec.rb | 1 - spec/rails4_spec.rb | 2 -- spec/ruby_spec.rb | 1 + spec/spec_helper.rb | 8 -------- 7 files changed, 1 insertion(+), 18 deletions(-) diff --git a/spec/rails23_spec.rb b/spec/rails23_spec.rb index 58790379f..bdccc33de 100644 --- a/spec/rails23_spec.rb +++ b/spec/rails23_spec.rb @@ -5,7 +5,6 @@ app = Hatchet::Runner.new('rails23_mri_187').setup! app.heroku.put_stack(app.name, "cedar") app.deploy do |app, heroku| - add_database(app, heroku) expect(successful_body(app)).to eq("hello") end end diff --git a/spec/rails3_spec.rb b/spec/rails3_spec.rb index 5935b7d27..dd4abc170 100644 --- a/spec/rails3_spec.rb +++ b/spec/rails3_spec.rb @@ -4,7 +4,6 @@ it "should deploy on ruby 1.9.3" do Hatchet::Runner.new("rails3_mri_193").deploy do |app, heroku| expect(app.output).to include("Asset precompilation completed") - add_database(app, heroku) expect(app.output).to match("WARNING") expect(app.output).to match("Add 'rails_12factor' gem to your Gemfile to skip plugin injection") @@ -19,7 +18,6 @@ it "should not have warnings when using the rails_12factor gem" do Hatchet::Runner.new("rails3_12factor").deploy do |app, heroku| - add_database(app, heroku) expect(app.output).not_to match("Add 'rails_12factor' gem to your Gemfile to skip plugin injection") expect(successful_body(app)).to eq("hello") end @@ -27,7 +25,6 @@ it "should only display the correct plugin warning" do Hatchet::Runner.new("rails3_one_plugin").deploy do |app, heroku| - add_database(app, heroku) expect(app.output).not_to match("rails_log_stdout") expect(app.output).to match("rails3_serve_static_assets") expect(app.output).to match("Add 'rails_12factor' gem to your Gemfile to skip plugin injection") @@ -39,7 +36,6 @@ it "should deploy on ruby 1.9.3" do Hatchet::Runner.new("railties3_mri_193").deploy do |app, heroku| expect(app.output).to include("Asset precompilation completed") - add_database(app, heroku) expect(app.output).to match("Ruby/Rails") expect(successful_body(app)).to eq("hello") end diff --git a/spec/rails41_spec.rb b/spec/rails41_spec.rb index ca43052ab..fa565473e 100644 --- a/spec/rails41_spec.rb +++ b/spec/rails41_spec.rb @@ -12,7 +12,6 @@ it "should be able to run a migration without heroku specific database.yml" do Hatchet::Runner.new("rails41_scaffold").deploy do |app, heroku| - add_database(app, heroku) expect(app.output).not_to include("Writing config/database.yml to read from DATABASE_URL") expect(app.run("rake db:migrate")).to include("20140218165801 CreatePeople") end @@ -20,7 +19,6 @@ it "should handle secrets.yml properly" do Hatchet::Runner.new("rails41_scaffold").deploy do |app, heroku| - add_database(app, heroku) ReplRunner.new(:rails_console, "heroku run bin/rails console -a #{app.name}").run do |console| console.run("ENV['SECRET_KEY_BASE'] == Rails.application.config.secrets.secret_key_base") {|result| expect(result).not_to eq("true") } end diff --git a/spec/rails42_spec.rb b/spec/rails42_spec.rb index e4c874504..6d9bfaeba 100644 --- a/spec/rails42_spec.rb +++ b/spec/rails42_spec.rb @@ -4,7 +4,6 @@ it "set RAILS_SERVE_STATIC_FILES" do Hatchet::Runner.new("rails42_scaffold").deploy do |app, heroku| - add_database(app, heroku) ReplRunner.new(:rails_console, "heroku run bin/rails console -a #{app.name}").run do |console| console.run("ENV['RAILS_SERVE_STATIC_FILES'].present?") { |result| expect(result).to match(/true/) } end diff --git a/spec/rails4_spec.rb b/spec/rails4_spec.rb index 9d415c782..fe38c10f3 100644 --- a/spec/rails4_spec.rb +++ b/spec/rails4_spec.rb @@ -12,7 +12,6 @@ it "should deploy on ruby 2.0.0" do Hatchet::Runner.new("rails4-manifest").deploy do |app, heroku| - add_database(app, heroku) expect(app.output).to include("Detected manifest file, assuming assets were compiled locally") expect(app.output).not_to match("Include 'rails_12factor' gem to enable all platform features") end @@ -28,7 +27,6 @@ it "upgraded from 3 to 4 missing ./bin still works" do Hatchet::Runner.new("rails3-to-4-no-bin").deploy do |app, heroku| expect(app.output).to include("Asset precompilation completed") - add_database(app, heroku) expect(app.output).to match("WARNING") expect(app.output).to match("Include 'rails_12factor' gem to enable all platform features") diff --git a/spec/ruby_spec.rb b/spec/ruby_spec.rb index bcb54befc..2bcb7d786 100644 --- a/spec/ruby_spec.rb +++ b/spec/ruby_spec.rb @@ -3,6 +3,7 @@ describe "Ruby apps" do describe "default WEB_CONCURRENCY" do it "auto scales WEB_CONCURRENCY" do + pending("https://github.com/heroku/api/issues/4426") app = Hatchet::Runner.new("default_ruby") app.setup! app.set_config("SENSIBLE_DEFAULTS" => "enabled") diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 73c465db8..3187615ac 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -27,14 +27,6 @@ def git_repo "https://github.com/heroku/heroku-buildpack-ruby.git" end -def add_database(app, heroku) - Hatchet::RETRIES.times.retry do - heroku.post_addon(app.name, 'heroku-postgresql:hobby-dev') - _, value = heroku.get_config_vars(app.name).body.detect {|key, value| key.match(/HEROKU_POSTGRESQL_[A-Z]+_URL/) } - heroku.put_config_vars(app.name, 'DATABASE_URL' => value) - end -end - def successful_body(app, options = {}) retry_limit = options[:retry_limit] || 50 Excon.get("http://#{app.name}.herokuapp.com", :idempotent => true, :expects => 200, :retry_limit => retry_limit).body From 613defce8ec18b6416d527d2183db93cf8702b28 Mon Sep 17 00:00:00 2001 From: Orlando Del Aguila Date: Tue, 28 Jul 2015 19:02:16 -0500 Subject: [PATCH 0180/1195] don't overwrite files when loading public/assets from cache --- CHANGELOG.md | 2 ++ lib/language_pack/cache.rb | 9 +++++++-- lib/language_pack/rails4.rb | 2 +- spec/rails41_spec.rb | 23 +++++++++++++++++++++++ 4 files changed, 33 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9133ee646..99eae538a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Master +* Cached asset file should never take precedent over existing file (#402) + ## v138 (5/19/2015) * Bump bundler to 1.9.7 [Bundler changelog](https://github.com/bundler/bundler/blob/master/CHANGELOG.md#196-2015-05-02) (#378) diff --git a/lib/language_pack/cache.rb b/lib/language_pack/cache.rb index 53b72487c..e3e86c377 100644 --- a/lib/language_pack/cache.rb +++ b/lib/language_pack/cache.rb @@ -42,13 +42,18 @@ def load(path, dest = nil) copy (@cache_base + path), dest end + def load_without_overwrite(path, dest=nil) + dest ||= path + copy (@cache_base + path), dest, '-a -n' + end + # copy cache contents # @param [String] source directory # @param [String] destination directory - def copy(from, to) + def copy(from, to, options='-a') return false unless File.exist?(from) FileUtils.mkdir_p File.dirname(to) - system("cp -a #{from}/. #{to}") + system("cp #{options} #{from}/. #{to}") end # copy contents between to places in the cache diff --git a/lib/language_pack/rails4.rb b/lib/language_pack/rails4.rb index 27c9c263f..650840571 100644 --- a/lib/language_pack/rails4.rb +++ b/lib/language_pack/rails4.rb @@ -79,7 +79,7 @@ def run_assets_precompile_rake_task topic("Preparing app for Rails asset pipeline") - @cache.load public_assets_folder + @cache.load_without_overwrite public_assets_folder @cache.load default_assets_cache precompile.invoke(env: rake_env) diff --git a/spec/rails41_spec.rb b/spec/rails41_spec.rb index fa565473e..db0204fcf 100644 --- a/spec/rails41_spec.rb +++ b/spec/rails41_spec.rb @@ -24,4 +24,27 @@ end end end + + it "should not overwrite existing files with cached files" do + string = SecureRandom.hex(13) + new_string = SecureRandom.hex(13) + + Hatchet::Runner.new("rails41_scaffold").deploy do |app, heroku| + # First Deploy + `mkdir public/assets` + `echo #{string} > public/assets/file.txt` + `git add -A; git commit -m 'adding file.txt'` + app.push! + + # Second Deploy + `echo #{new_string} > public/assets/file.txt` + `git add -A; git commit -m 'updating file.txt'` + app.push! + + # Asserts + result = app.run('cat public/assets/file.txt') + expect(result).not_to match(string) + expect(result).to match(new_string) + end + end end From be1ac0d8c6187ae366a9bdd668f2a00d7fdd1914 Mon Sep 17 00:00:00 2001 From: Damon Morgan Date: Tue, 28 Jul 2015 15:13:27 +0100 Subject: [PATCH 0181/1195] Don't write database.yml if using ActiveRecord >= 4.1 --- hatchet.json | 3 ++- lib/language_pack/rails41.rb | 5 ----- lib/language_pack/ruby.rb | 15 +++++++++------ spec/ruby_spec.rb | 26 ++++++++++++++++++++++++++ 4 files changed, 37 insertions(+), 12 deletions(-) diff --git a/hatchet.json b/hatchet.json index 41b823bcd..b365a7bfe 100644 --- a/hatchet.json +++ b/hatchet.json @@ -29,7 +29,8 @@ "sharpstone/ruby_193_jruby_17161_jdk8", "sharpstone/jruby-minimal", "sharpstone/empty-procfile", - "sharpstone/bad_ruby_version" + "sharpstone/bad_ruby_version", + "sharpstone/activerecord41_scaffold" ], "rack": [ "sharpstone/default_ruby", diff --git a/lib/language_pack/rails41.rb b/lib/language_pack/rails41.rb index 2e6f7ff3b..a738ea29a 100644 --- a/lib/language_pack/rails41.rb +++ b/lib/language_pack/rails41.rb @@ -15,11 +15,6 @@ def self.use? end end - def create_database_yml - instrument 'ruby.create_database_yml' do - end - end - def setup_profiled instrument 'setup_profiled' do super diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 84092b942..70b571580 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -628,11 +628,13 @@ def syck_hack # writes ERB based database.yml for Rails. The database.yml uses the DATABASE_URL from the environment during runtime. def create_database_yml instrument 'ruby.create_database_yml' do - log("create_database_yml") do - return unless File.directory?("config") - topic("Writing config/database.yml to read from DATABASE_URL") - File.open("config/database.yml", "w") do |file| - file.puts <<-DATABASE_YML + active_record_version = bundler.gem_version('activerecord') + unless active_record_version && active_record_version >= Gem::Version.new('4.1.0') + log("create_database_yml") do + return unless File.directory?("config") + topic("Writing config/database.yml to read from DATABASE_URL") + File.open("config/database.yml", "w") do |file| + file.puts <<-DATABASE_YML <% require 'cgi' @@ -686,7 +688,8 @@ def attribute(name, value, force_string = false) <% params.each do |key, value| %> <%= key %>: <%= value.first %> <% end %> - DATABASE_YML + DATABASE_YML + end end end end diff --git a/spec/ruby_spec.rb b/spec/ruby_spec.rb index 2bcb7d786..651507475 100644 --- a/spec/ruby_spec.rb +++ b/spec/ruby_spec.rb @@ -60,4 +60,30 @@ end end end + + describe "database configuration" do + context "no active record" do + it "writes a heroku specific database.yml" do + Hatchet::Runner.new("default_ruby").deploy do |app, heroku| + expect(app.output).to include("Writing config/database.yml to read from DATABASE_URL") + end + end + end + + context "active record 4.0-" do + it "writes a heroku specific database.yml" do + Hatchet::Runner.new("rails4-manifest").deploy do |app, heroku| + expect(app.output).to include("Writing config/database.yml to read from DATABASE_URL") + end + end + end + + context "active record 4.1+" do + it "doesn't write a heroku specific database.yml" do + Hatchet::Runner.new("activerecord41_scaffold").deploy do |app, heroku| + expect(app.output).not_to include("Writing config/database.yml to read from DATABASE_URL") + end + end + end + end end From a80bba6ca2175b50d4af7f89a36893457f3fe71d Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 3 Aug 2015 13:44:18 -0500 Subject: [PATCH 0182/1195] Clean up some logic and changelog We want to preserve functionality people may be relying on (i.e. apps without active_record were accidentally getting a database.yml if they had a config/ directory. We can re-visit this later, but for now want to preserve backwards compat. Remove duplicate test already tested in rails4_spec.rb --- CHANGELOG.md | 1 + lib/language_pack/ruby.rb | 15 +++++++-------- spec/ruby_spec.rb | 8 -------- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 99eae538a..daa739e8f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## Master * Cached asset file should never take precedent over existing file (#402) +* Do not write `database.yml` when using active record >= 4.1 (previously we only detected >= Rails 4.1) (#403) ## v138 (5/19/2015) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 70b571580..5116fe4ff 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -628,13 +628,13 @@ def syck_hack # writes ERB based database.yml for Rails. The database.yml uses the DATABASE_URL from the environment during runtime. def create_database_yml instrument 'ruby.create_database_yml' do - active_record_version = bundler.gem_version('activerecord') - unless active_record_version && active_record_version >= Gem::Version.new('4.1.0') - log("create_database_yml") do - return unless File.directory?("config") - topic("Writing config/database.yml to read from DATABASE_URL") - File.open("config/database.yml", "w") do |file| - file.puts <<-DATABASE_YML + return false unless File.directory?("config") + return false if bundler.has_gem?('activerecord') && bundler.gem_version('activerecord') >= Gem::Version.new('4.1.0.beta1') + + log("create_database_yml") do + topic("Writing config/database.yml to read from DATABASE_URL") + File.open("config/database.yml", "w") do |file| + file.puts <<-DATABASE_YML <% require 'cgi' @@ -689,7 +689,6 @@ def attribute(name, value, force_string = false) <%= key %>: <%= value.first %> <% end %> DATABASE_YML - end end end end diff --git a/spec/ruby_spec.rb b/spec/ruby_spec.rb index 651507475..e9a6a40c4 100644 --- a/spec/ruby_spec.rb +++ b/spec/ruby_spec.rb @@ -70,14 +70,6 @@ end end - context "active record 4.0-" do - it "writes a heroku specific database.yml" do - Hatchet::Runner.new("rails4-manifest").deploy do |app, heroku| - expect(app.output).to include("Writing config/database.yml to read from DATABASE_URL") - end - end - end - context "active record 4.1+" do it "doesn't write a heroku specific database.yml" do Hatchet::Runner.new("activerecord41_scaffold").deploy do |app, heroku| From 69f40b726e7f5b92184e9121d6a65c7432fa2621 Mon Sep 17 00:00:00 2001 From: zunda Date: Mon, 17 Aug 2015 13:42:01 -1000 Subject: [PATCH 0183/1195] Clarify top is showing version of bundler --- lib/language_pack/ruby.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 5116fe4ff..cfc073351 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -532,7 +532,7 @@ def build_bundler cache.load ".bundle" end - topic("Installing dependencies using #{bundler.version}") + topic("Installing dependencies using bundler #{bundler.version}") load_bundler_cache bundler_output = "" From 300ec22afb0f1fab3343547c3bb3dc658f1d24bf Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 31 Aug 2015 11:37:09 -0500 Subject: [PATCH 0184/1195] [ci skip] v139 --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index daa739e8f..8a4a4ed97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Master +## v139 (8/31/2015) + * Cached asset file should never take precedent over existing file (#402) * Do not write `database.yml` when using active record >= 4.1 (previously we only detected >= Rails 4.1) (#403) From bde621b40c8e08bcce3847615ba1dcfc229e3273 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 31 Aug 2015 11:37:53 -0500 Subject: [PATCH 0185/1195] bump to v139 --- lib/language_pack/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index d32f67204..4bd15ad5f 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v138" + BUILDPACK_VERSION = "v139" end end From 29dea02b1e1faca52be03a28c8b1e6027da6ad7a Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Fri, 4 Sep 2015 12:31:16 -0400 Subject: [PATCH 0186/1195] remove/fix tests referencing cedar-10 --- hatchet.json | 2 +- spec/bugs_spec.rb | 11 ------ spec/rails23_spec.rb | 6 ++-- spec/rubies_spec.rb | 47 ------------------------- spec/ruby_spec.rb | 18 ---------- spec/stack_spec.rb | 2 +- spec/upgrade_ruby_spec.rb | 2 +- spec/user_env_compile_edge_case_spec.rb | 2 +- 8 files changed, 7 insertions(+), 83 deletions(-) diff --git a/hatchet.json b/hatchet.json index b365a7bfe..091d739f9 100644 --- a/hatchet.json +++ b/hatchet.json @@ -41,7 +41,7 @@ "sharpstone/mri_214" ], "rails2": [ - "sharpstone/rails23_mri_187" + "sharpstone/rails23_mri_193" ], "rails3": [ "sharpstone/rails3_mri_193", diff --git a/spec/bugs_spec.rb b/spec/bugs_spec.rb index ed39bb6bf..222210556 100644 --- a/spec/bugs_spec.rb +++ b/spec/bugs_spec.rb @@ -1,17 +1,6 @@ require_relative 'spec_helper' describe "Bugs" do - context "MRI 1.8.7 on cedar" do - it "should install nokogiri" do - app = Hatchet::Runner.new('mri_187_nokogiri').setup! - app.heroku.put_stack(app.name, "cedar") - app.deploy do |app, heroku| - expect(app.output).to match("Installing nokogiri") - expect(app.output).to match("Bundle complete") - end - end - end - it "nokogiri should use the system libxml2" do Hatchet::Runner.new("nokogiri_160").deploy do |app| expect(app.output).to match("nokogiri") diff --git a/spec/rails23_spec.rb b/spec/rails23_spec.rb index bdccc33de..18a125366 100644 --- a/spec/rails23_spec.rb +++ b/spec/rails23_spec.rb @@ -1,9 +1,9 @@ require_relative 'spec_helper' describe "Rails 2.3.x" do - it "should deploy on ruby 1.8.7 on cedar" do - app = Hatchet::Runner.new('rails23_mri_187').setup! - app.heroku.put_stack(app.name, "cedar") + it "should deploy on ruby 1.9.3 on cedar-14" do + app = Hatchet::Runner.new('rails23_mri_193').setup! + app.heroku.put_stack(app.name, "cedar-14") app.deploy do |app, heroku| expect(successful_body(app)).to eq("hello") end diff --git a/spec/rubies_spec.rb b/spec/rubies_spec.rb index a091ecaff..28b029d53 100644 --- a/spec/rubies_spec.rb +++ b/spec/rubies_spec.rb @@ -9,17 +9,6 @@ end end - - it "should deploy ruby 1.8.7 properly on cedar" do - app = Hatchet::Runner.new('mri_187').setup! - app.heroku.put_stack(app.name, "cedar") - app.deploy do |app| - version = '1.8.7' - expect(app.output).to match(version) - expect(app.run('ruby -v')).to match(version) - end - end - it "should deploy ruby 1.9.2 properly" do Hatchet::Runner.new("mri_192").deploy do |app| version = '1.9.2' @@ -54,32 +43,6 @@ end end - it "should deploy jruby 1.7.3 (legacy jdk) properly on cedar", stack: :cedar do - app = Hatchet::Runner.new("ruby_193_jruby_173") - app.setup! - app.heroku.put_stack(app.name, "cedar") - - app.deploy do |app| - expect(app.output).to match("Installing JVM: openjdk1.7.0_25") - expect(app.output).to match("ruby-1.9.3-jruby-1.7.3") - expect(app.output).not_to include("OpenJDK 64-Bit Server VM warning") - expect(app.run('ruby -v')).to match("jruby 1.7.3") - end - end - - it "should deploy jruby 1.7.6 (jdk 7) latest properly on cedar", stack: :cedar do - app = Hatchet::Runner.new("ruby_193_jruby_176") - app.setup! - app.heroku.put_stack(app.name, 'cedar') - - app.deploy do |app| - expect(app.output).to match("Installing JVM: openjdk1.7-latest") - expect(app.output).to match("ruby-1.9.3-jruby-1.7.6") - expect(app.output).not_to include("OpenJDK 64-Bit Server VM warning") - expect(app.run('ruby -v')).to match("jruby 1.7.6") - end - end - it "should deploy jdk 8 on cedar-14 by default" do app = Hatchet::Runner.new("ruby_193_jruby_17161") app.setup! @@ -107,14 +70,4 @@ expect(app.output).not_to include("OpenJDK 64-Bit Server VM warning") end end - - it "should deploy jruby 1.7.16.1 (jdk 8) properly on cedar with sys props file" do - app = Hatchet::Runner.new("ruby_193_jruby_17161_jdk8") - app.setup! - app.heroku.put_stack(app.name, 'cedar') - - app.deploy do |app| - expect(app.output).to match("Installing JVM: openjdk1.8-latest") - end - end end diff --git a/spec/ruby_spec.rb b/spec/ruby_spec.rb index e9a6a40c4..32ae29980 100644 --- a/spec/ruby_spec.rb +++ b/spec/ruby_spec.rb @@ -28,24 +28,6 @@ end end - context "Ruby 1.8.7 on cedar" do - it "doesn't run rake tasks if no rake gem" do - app = Hatchet::Runner.new('mri_187_no_rake').setup! - app.heroku.put_stack(app.name, "cedar") - app.deploy do |app, heroku| - expect(app.output).not_to include("foo") - end - end - - it "runs a rake task if the gem exists" do - app = Hatchet::Runner.new('mri_187_rake').setup! - app.heroku.put_stack(app.name, "cedar") - app.deploy do |app, heroku| - expect(app.output).to include("foo") - end - end - end - context "Ruby 1.9+" do it "runs rake tasks if no rake gem" do Hatchet::Runner.new('mri_200_no_rake').deploy do |app, heroku| diff --git a/spec/stack_spec.rb b/spec/stack_spec.rb index e917960f6..0c02450f9 100644 --- a/spec/stack_spec.rb +++ b/spec/stack_spec.rb @@ -1,7 +1,7 @@ require_relative "spec_helper" describe "Stack Changes" do - it "should reinstall gems on stack change" do + xit "should reinstall gems on stack change" do app = Hatchet::Runner.new('mri_200').setup! app.heroku.put_stack(app.name, "cedar-14") app.deploy do |app, heroku| diff --git a/spec/upgrade_ruby_spec.rb b/spec/upgrade_ruby_spec.rb index 2699e00d3..b30fd842b 100644 --- a/spec/upgrade_ruby_spec.rb +++ b/spec/upgrade_ruby_spec.rb @@ -4,7 +4,7 @@ it "upgrades from 2.0.0 to 2.1.0", stack: :cedar do app = Hatchet::Runner.new("mri_200") app.setup! - app.heroku.put_stack(app.name, "cedar") + app.heroku.put_stack(app.name, "cedar-14") app.deploy do |app| expect(app.run("ruby -v")).to match("2.0.0") diff --git a/spec/user_env_compile_edge_case_spec.rb b/spec/user_env_compile_edge_case_spec.rb index 6741409a0..4bea8ce01 100644 --- a/spec/user_env_compile_edge_case_spec.rb +++ b/spec/user_env_compile_edge_case_spec.rb @@ -4,7 +4,7 @@ it "should not cause problems with warnings" do app = Hatchet::Runner.new("mri_214") app.setup! - app.heroku.put_stack(app.name, 'cedar') + app.heroku.put_stack(app.name, 'cedar-14') app.set_config("RUBY_HEAP_MIN_SLOTS" => "1000000") app.deploy do |app| expect(app.run("bundle version")).to match(LanguagePack::Ruby::BUNDLER_VERSION) From 075809162f43baa7e4d8d99be1e26c62467ba719 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Tue, 8 Sep 2015 14:18:32 -0400 Subject: [PATCH 0187/1195] upgrade to container based travis http://docs.travis-ci.com/user/migrating-from-legacy/ --- .travis.yml | 9 ++++++++- Rakefile | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 5b0f0e403..e97c0057f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: ruby rvm: - 2.0.0 -before_script: bundle exec rake hatchet:setup_travis +before_script: bundle exec rake travis:setup script: bundle exec parallel_rspec -n 11 spec/ after_script: - heroku keys:remove $USER@`hostname` @@ -12,3 +12,10 @@ env: - HATCHET_DEPLOY_STRATEGY=git - HATCHET_APP_LIMIT=80 - secure: bM8uWN5b9hZzzHk73EN9xHCK65vuopcbwQILcuMt0A1mHB8tSH1xyMYddNrbGdfznLAVXf8UjvKvv6rvvG4O+j3GRuIWVNukoAvZxG0FC9QxYuKbDccEPPdtqGwVEfWEKQYLajsIpF8/ACyALGV+Oe/Z28WRk6Ba3FLptfulc6s= +sudo: false +addons: + apt: + sources: + - heroku + packages: + - heroku-toolbelt diff --git a/Rakefile b/Rakefile index 83616153f..8daba69ad 100644 --- a/Rakefile +++ b/Rakefile @@ -292,3 +292,21 @@ begin task :default => :spec rescue LoadError => e end + +namespace :travis do + task :setup do + sh "bundle exec hatchet install" + sh "if [ `git config --get user.email` ]; then echo 'already set'; else `git config --global user.email 'buildpack@example.com'`; fi" + sh "if [ `git config --get user.name` ]; then echo 'already set'; else `git config --global user.name 'BuildpackTester'` ; fi" + sh "echo ' +Host heroku.com + StrictHostKeyChecking no + CheckHostIP no + UserKnownHostsFile=/dev/null +Host github.com + StrictHostKeyChecking no +' >> ~/.ssh/config" + sh "ssh-keygen -f ~/.ssh/id_rsa -t rsa -N ''" + sh "yes | heroku keys:add" + end +end From 8150fb62ca6c24100fcccc54cc5240e09dd8a1c0 Mon Sep 17 00:00:00 2001 From: Joe Kutner Date: Thu, 27 Aug 2015 13:14:48 -0500 Subject: [PATCH 0188/1195] Added a JRuby specific error message if version is not found --- lib/language_pack/ruby.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index cfc073351..eff8732f2 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -368,12 +368,21 @@ def install_ruby true rescue LanguagePack::Fetcher::FetchError => error - message = < Date: Tue, 8 Sep 2015 18:44:23 -0400 Subject: [PATCH 0189/1195] update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a4a4ed97..d1c7dae17 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Master +* JRuby specific ruby error message (#412) + ## v139 (8/31/2015) * Cached asset file should never take precedent over existing file (#402) From 09b01b426fa2fb00d14b8b0ce58ad375390ab00e Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Wed, 9 Sep 2015 13:20:34 -0400 Subject: [PATCH 0190/1195] v140 changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d1c7dae17..2ebf7df20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Master +## v140 (9/9/2015) + * JRuby specific ruby error message (#412) ## v139 (8/31/2015) From b017193b6774476d86bcbc87d526e79f541bf99a Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Wed, 9 Sep 2015 13:21:14 -0400 Subject: [PATCH 0191/1195] bump to v140 --- lib/language_pack/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 4bd15ad5f..0ed085cc8 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v139" + BUILDPACK_VERSION = "v140" end end From c4a7cfb403e27228eb769aa23d7a10fd7f2295aa Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 22 Sep 2015 14:18:16 -0500 Subject: [PATCH 0192/1195] Emit more best practice warnings. Instead of waiting for users to do bad things, and open support tickets to tell them about best practices, lets be a bit more proactive. Using asset_sync is bad, don't do it. Using RAILS_ENV=staging is bad, don't do it. Switching all HEREDOCS in ruby.rb to `<<-` so my editor parses them correctly. --- lib/language_pack/rails2.rb | 10 ++++++++++ lib/language_pack/ruby.rb | 16 +++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/lib/language_pack/rails2.rb b/lib/language_pack/rails2.rb index 3ced58c21..44237f791 100644 --- a/lib/language_pack/rails2.rb +++ b/lib/language_pack/rails2.rb @@ -50,6 +50,16 @@ def compile end end + def best_practice_warnings + if env("RAILS_ENV") != "production" + warn(<<-WARNING) +You are deploying to a non-production environment: #{ env("RAILS_ENV").inspect }. +See https://devcenter.heroku.com/articles/deploying-to-a-custom-rails-environment for more information. +WARNING + end + super + end + private def install_plugins diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index cfc073351..97e524f5f 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -76,6 +76,15 @@ def default_process_types end end + def best_practice_warnings + if bundler.has_gem?("asset_sync") + warn(<<-WARNING) +You are using the `asset_sync` gem. +See https://devcenter.heroku.com/articles/please-do-not-use-asset-sync for more information. +WARNING + end + end + def compile instrument 'ruby.compile' do # check for new app at the beginning of the compile @@ -95,6 +104,7 @@ def compile install_binaries run_assets_precompile_rake_task end + best_practice_warnings super end end @@ -357,7 +367,7 @@ def install_ruby topic "Using Ruby version: #{ruby_version.version}" if !ruby_version.set - warn(< Date: Wed, 30 Sep 2015 11:36:04 -0500 Subject: [PATCH 0193/1195] Added support for custom JDK versions --- lib/language_pack/helpers/jvm_installer.rb | 76 +++++++++++------- spec/helpers/jvm_installer_spec.rb | 91 ++++++++++++++++++++++ spec/rubies_spec.rb | 4 +- 3 files changed, 142 insertions(+), 29 deletions(-) create mode 100644 spec/helpers/jvm_installer_spec.rb diff --git a/lib/language_pack/helpers/jvm_installer.rb b/lib/language_pack/helpers/jvm_installer.rb index ca8e672d0..0f9a746d6 100644 --- a/lib/language_pack/helpers/jvm_installer.rb +++ b/lib/language_pack/helpers/jvm_installer.rb @@ -4,11 +4,12 @@ class LanguagePack::JvmInstaller include LanguagePack::ShellHelpers SYS_PROPS_FILE = "system.properties" - JVM_BASE_URL = "http://lang-jvm.s3.amazonaws.com/jdk" - JVM_1_8_PATH = "openjdk1.8-latest" - JVM_1_7_PATH = "openjdk1.7-latest" - JVM_1_7_25_PATH = "openjdk1.7.0_25" - JVM_1_6_PATH = "openjdk1.6-latest" + JVM_BASE_URL = "https://lang-jvm.s3.amazonaws.com/jdk" + JVM_1_9_PATH = "openjdk1.9-latest.tar.gz" + JVM_1_8_PATH = "openjdk1.8-latest.tar.gz" + JVM_1_7_PATH = "openjdk1.7-latest.tar.gz" + JVM_1_7_25_PATH = "openjdk1.7.0_25.tar.gz" + JVM_1_6_PATH = "openjdk1.6-latest.tar.gz" def initialize(slug_vendor_jvm, stack) @vendor_dir = slug_vendor_jvm @@ -27,31 +28,26 @@ def system_properties end def install(jruby_version, forced = false) - jvm_version = - case system_properties['java.runtime.version'] - when "1.8" - JVM_1_8_PATH - when "1.7" - JVM_1_7_PATH - when "1.6" - JVM_1_6_PATH - else - if @stack == "cedar" - if forced || Gem::Version.new(jruby_version) >= Gem::Version.new("1.7.4") - JVM_1_7_PATH - else - JVM_1_7_25_PATH - end + jvm_version = system_properties['java.runtime.version'] + case jvm_version + when "1.9", "9" + fetch_env_untar('JDK_URL_1_9') || fetch_untar(JVM_1_9_PATH, "openjdk-9") + when "1.7", "7" + fetch_env_untar('JDK_URL_1_7') || fetch_untar(JVM_1_7_PATH, "openjdk-7") + when "1.6", "6" + fetch_env_untar('JDK_URL_1_6') || fetch_untar(JVM_1_6_PATH, "openjdk-6") + when nil + if @stack == "cedar" + if forced || Gem::Version.new(jruby_version) >= Gem::Version.new("1.7.4") + fetch_untar(JVM_1_7_PATH, "openjdk-7") else - JVM_1_8_PATH + fetch_untar(JVM_1_7_25_PATH) end + else + fetch_env_untar('JDK_URL_1_8') || fetch_untar(JVM_1_8_PATH, "openjdk-8") end - - topic "Installing JVM: #{jvm_version}" - - FileUtils.mkdir_p(@vendor_dir) - Dir.chdir(@vendor_dir) do - @fetcher.fetch_untar("#{jvm_version}.tar.gz") + else + fetch_untar("openjdk#{jvm_version}.tar.gz", "openjdk-#{jvm_version}") end bin_dir = "bin" @@ -60,4 +56,30 @@ def install(jruby_version, forced = false) run("ln -s ../#{bin} #{bin_dir}") end end + + def fetch_untar(jvm_path, jvm_version=nil) + topic "Installing JVM: #{jvm_version || jvm_path}" + FileUtils.mkdir_p(@vendor_dir) + Dir.chdir(@vendor_dir) do + @fetcher.fetch_untar(jvm_path) + end + rescue LanguagePack::Fetcher::FetchError + error <&1`).to match("1.8.0_51") + ensure + ENV['JDK_URL_1_8'] = nil + end + end + end + end + + it "downloads standard JDK 7" do + Dir.mktmpdir do |dir| + Dir.chdir(dir) do + File.open('system.properties', 'w') { |f| f.write("java.runtime.version=1.7") } + + jvm_installer = LanguagePack::JvmInstaller.new(dir, "cedar-14") + jvm_installer.install("9.0.1.0") + + expect(`ls bin`).to match("java") + expect(`cat release 2>&1`).not_to match("1.8.0") + expect(`cat release 2>&1`).to match("1.7.0") + end + end + end + + it "downloads standard JDK 9" do + Dir.mktmpdir do |dir| + Dir.chdir(dir) do + File.open('system.properties', 'w') { |f| f.write("java.runtime.version=1.9") } + + jvm_installer = LanguagePack::JvmInstaller.new(dir, "cedar-14") + jvm_installer.install("9.0.1.0") + + expect(`ls bin`).to match("java") + expect(`cat release 2>&1`).not_to match("1.8.0") + expect(`cat release 2>&1`).to match("1.9.0") + end + end + end + + it "downloads previous JDK version" do + Dir.mktmpdir do |dir| + Dir.chdir(dir) do + File.open('system.properties', 'w') { |f| f.write("java.runtime.version=1.8.0_51") } + + jvm_installer = LanguagePack::JvmInstaller.new(dir, "cedar-14") + jvm_installer.install("9.0.1.0") + + expect(`ls bin`).to match("java") + expect(`cat release 2>&1`).to match("1.8.0_51") + end + end + end + + it "downloads default JDK" do + Dir.mktmpdir do |dir| + Dir.chdir(dir) do + jvm_installer = LanguagePack::JvmInstaller.new(dir, "cedar-14") + jvm_installer.install("9.0.1.0") + + expect(`ls bin`).to match("java") + expect(`cat release 2>&1`).not_to match("1.8.0_51") + expect(`cat release 2>&1`).to match("1.8.0") + end + end + end + + it "fails download gracefully" do + Dir.mktmpdir do |dir| + Dir.chdir(dir) do + File.open('system.properties', 'w') { |f| f.write("java.runtime.version=foobar") } + + jvm_installer = LanguagePack::JvmInstaller.new(dir, "cedar-14") + + expect{ jvm_installer.install("9.0.1.0") }.to raise_error(BuildpackError) + end + end + end +end diff --git a/spec/rubies_spec.rb b/spec/rubies_spec.rb index 28b029d53..5d611397c 100644 --- a/spec/rubies_spec.rb +++ b/spec/rubies_spec.rb @@ -49,7 +49,7 @@ app.heroku.put_stack(app.name, 'cedar-14') app.deploy do |app| - expect(app.output).to match("Installing JVM: openjdk1.8-latest") + expect(app.output).to match("Installing JVM: openjdk-8") expect(app.output).to match("JRUBY_OPTS is: -Xcompile.invokedynamic=false") expect(app.output).not_to include("OpenJDK 64-Bit Server VM warning") @@ -66,7 +66,7 @@ app.heroku.put_stack(app.name, 'cedar-14') app.deploy do |app| - expect(app.output).to match("Installing JVM: openjdk1.7-latest") + expect(app.output).to match("Installing JVM: openjdk-7") expect(app.output).not_to include("OpenJDK 64-Bit Server VM warning") end end From 0f1b898b64e8614449a7b6b5bf41da4d4e54013e Mon Sep 17 00:00:00 2001 From: Stefan Sundin Date: Tue, 6 Oct 2015 12:53:17 -0700 Subject: [PATCH 0194/1195] Add note that the buildpack requires 64-bit Linux to README.md. --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index f129a17e2..da1420cb3 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,8 @@ This is a [Heroku Buildpack](http://devcenter.heroku.com/articles/buildpacks) for Ruby, Rack, and Rails apps. It uses [Bundler](http://gembundler.com) for dependency management. +This buildpack requires 64-bit Linux. + ## Usage ### Ruby From 85cb56b9e2b12c8dd0031dd78d160bf81209777f Mon Sep 17 00:00:00 2001 From: Joe Kutner Date: Wed, 14 Oct 2015 07:53:50 -0500 Subject: [PATCH 0195/1195] Update changelog [skip ci] --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ebf7df20..cecfb4c72 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Master +* Support for custom JDK versions in system.properties (#423) + ## v140 (9/9/2015) * JRuby specific ruby error message (#412) From 4fc28792b139650c8d93a9e8955ebcdea44d3dce Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Thu, 15 Oct 2015 14:43:51 -0500 Subject: [PATCH 0196/1195] Use non default node version for tests Previously we were checking for a custom version that coincidentally matched the default version of node that the ruby buildpack was using. This was a mistake and not noticed when the default version was rev-d. The fixture has been updated to use 4.1.2. --- spec/multibuildpack_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/multibuildpack_spec.rb b/spec/multibuildpack_spec.rb index 6a7cf7efe..8b569361e 100644 --- a/spec/multibuildpack_spec.rb +++ b/spec/multibuildpack_spec.rb @@ -4,7 +4,7 @@ it "works with node" do Hatchet::Runner.new("node_multi", buildpack_url: "https://github.com/ddollar/heroku-buildpack-multi.git").deploy do |app| puts app.output - expect(app.output).to match("Node Version in Ruby buildpack is: v0.10.3") + expect(app.output).to match("Node Version in Ruby buildpack is: v4.1.2") end end end From 38fa92b0ec3f4a20d4492d9a7d28a610b8d8c1b4 Mon Sep 17 00:00:00 2001 From: Joe Kutner Date: Wed, 28 Oct 2015 11:31:55 -0500 Subject: [PATCH 0197/1195] Added automatic heap settings for IX dyno --- lib/language_pack/ruby.rb | 5 ++++- spec/rubies_spec.rb | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index ea5c5feb4..08a536654 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -207,6 +207,9 @@ def set_jvm_max_heap 512) # 2X Dyno JVM_MAX_HEAP=768 ;; +16384) # IX Dyno + JVM_MAX_HEAP=2048 + ;; 32768) # PX Dyno JVM_MAX_HEAP=5120 ;; @@ -244,7 +247,7 @@ def default_jruby_opts # default JAVA_TOOL_OPTIONS # return [String] string of JAVA_TOOL_OPTIONS def default_java_tool_options - "-Xmx${JVM_MAX_HEAP:-\"384\"}m -Djava.rmi.server.useCodebaseOnly=true" + "-Xmx${JVM_MAX_HEAP:-\"384\"}m" end # sets up the environment variables for the build process diff --git a/spec/rubies_spec.rb b/spec/rubies_spec.rb index 5d611397c..cfc7ad8d9 100644 --- a/spec/rubies_spec.rb +++ b/spec/rubies_spec.rb @@ -50,6 +50,7 @@ app.deploy do |app| expect(app.output).to match("Installing JVM: openjdk-8") + expect(app.output).to match("Picked up JAVA_TOOL_OPTIONS: -Xmx2048m") expect(app.output).to match("JRUBY_OPTS is: -Xcompile.invokedynamic=false") expect(app.output).not_to include("OpenJDK 64-Bit Server VM warning") From cf2bc04c9ec1698cf3c9da750e909ce89736445c Mon Sep 17 00:00:00 2001 From: Joe Kutner Date: Wed, 28 Oct 2015 15:22:14 -0500 Subject: [PATCH 0198/1195] Use run_stdout to ensure JAVA_TOOL_OPTS --- lib/language_pack/ruby.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index ea5c5feb4..833817b3a 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -150,7 +150,7 @@ def slug_vendor_base elsif ruby_version.ruby_version == "1.8.7" @slug_vendor_base = "vendor/bundle/1.8" else - @slug_vendor_base = run_no_pipe(%q(ruby -e "require 'rbconfig';puts \"vendor/bundle/#{RUBY_ENGINE}/#{RbConfig::CONFIG['ruby_version']}\"")).chomp + @slug_vendor_base = run_stdout(%q(ruby -e "require 'rbconfig';puts \"vendor/bundle/#{RUBY_ENGINE}/#{RbConfig::CONFIG['ruby_version']}\"")).chomp error "Problem detecting bundler vendor directory: #{@slug_vendor_base}" unless $?.success? @slug_vendor_base end From 19c1dd553592635ae7c190b23ac6211ba1d82d86 Mon Sep 17 00:00:00 2001 From: Joe Kutner Date: Wed, 28 Oct 2015 15:31:42 -0500 Subject: [PATCH 0199/1195] Added jruby build opts msg --- lib/language_pack/helpers/jvm_installer.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/language_pack/helpers/jvm_installer.rb b/lib/language_pack/helpers/jvm_installer.rb index 0f9a746d6..b19f2d1e2 100644 --- a/lib/language_pack/helpers/jvm_installer.rb +++ b/lib/language_pack/helpers/jvm_installer.rb @@ -59,6 +59,8 @@ def install(jruby_version, forced = false) def fetch_untar(jvm_path, jvm_version=nil) topic "Installing JVM: #{jvm_version || jvm_path}" + puts "Setting JAVA_TOOL_OPTIONS for dyno size. Use JRUBY_BUILD_OPTS to override." + FileUtils.mkdir_p(@vendor_dir) Dir.chdir(@vendor_dir) do @fetcher.fetch_untar(jvm_path) From 3a10c6cf522d4834683ddd8d584f14e87c8136b7 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 28 Oct 2015 13:55:57 -0700 Subject: [PATCH 0200/1195] Fix node buildpack detection --- lib/language_pack/ruby.rb | 27 +++++++++++++++++++-------- spec/multibuildpack_spec.rb | 11 ----------- spec/node_spec.rb | 29 +++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 19 deletions(-) delete mode 100644 spec/multibuildpack_spec.rb create mode 100644 spec/node_spec.rb diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 08a536654..afcbd3cb8 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -262,7 +262,7 @@ def setup_language_pack_environment ENV["JRUBY_OPTS"] = env('JRUBY_BUILD_OPTS') || env('JRUBY_OPTS') end setup_ruby_install_env - ENV["PATH"] += ":#{node_bp_bin_path}" if node_js_installed? + ENV["PATH"] += ":#{node_preinstall_bin_path}" if node_js_installed? # TODO when buildpack-env-args rolls out, we can get rid of # ||= and the manual setting below @@ -754,17 +754,28 @@ def add_dev_database_addon # @note execjs will blow up if no JS RUNTIME is detected and is loaded. # @return [Array] the node.js binary path if we need it or an empty Array def add_node_js_binary - bundler.has_gem?('execjs') && !node_js_installed? ? [@node_installer.binary_path] : [] + bundler.has_gem?('execjs') && node_not_preinstalled? ? [@node_installer.binary_path] : [] end - def node_bp_bin_path - "#{Dir.pwd}/#{NODE_BP_PATH}" + # checks if node.js is installed via the official heroku-buildpack-nodejs using multibuildpack + # @return String if it's detected and false if it isn't + def node_preinstall_bin_path + return @node_preinstall_bin_path if defined?(@node_preinstall_bin_path) + + legacy_path = "#{Dir.pwd}/#{NODE_BP_PATH}" + path = run("which node") + if path && $?.success? + @node_preinstall_bin_path = path + elsif run("#{legacy_path}/node -v") && $?.success? + @node_preinstall_bin_path = legacy_path + else + @node_preinstall_bin_path = false + end end + alias :node_js_installed? :node_preinstall_bin_path - # checks if node.js is installed via the official heroku-buildpack-nodejs using multibuildpack - # @return [Boolean] true if it's detected and false if it isn't - def node_js_installed? - @node_js_installed ||= run("#{node_bp_bin_path}/node -v") && $?.success? + def node_not_preinstalled? + !node_js_installed? end def run_assets_precompile_rake_task diff --git a/spec/multibuildpack_spec.rb b/spec/multibuildpack_spec.rb deleted file mode 100644 index 8b569361e..000000000 --- a/spec/multibuildpack_spec.rb +++ /dev/null @@ -1,11 +0,0 @@ -require 'spec_helper' - -describe "Multibuildpack" do - it "works with node" do - Hatchet::Runner.new("node_multi", buildpack_url: "https://github.com/ddollar/heroku-buildpack-multi.git").deploy do |app| - puts app.output - expect(app.output).to match("Node Version in Ruby buildpack is: v4.1.2") - end - end -end - diff --git a/spec/node_spec.rb b/spec/node_spec.rb new file mode 100644 index 000000000..64ab85465 --- /dev/null +++ b/spec/node_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' + +describe "Multibuildpack" do + it "works with node" do + Hatchet::Runner.new("node_multi", buildpack_url: "https://github.com/ddollar/heroku-buildpack-multi.git").deploy do |app| + expect(app.output).to match("Node Version in Ruby buildpack is: v4.1.2") + expect(app.run("node -v")).to match("v4.1.2") + end + end + + it "node is installed by default without multi buildpack" do + default_node_version = LanguagePack::NodeInstaller::MODERN_NODE_VERSION + Hatchet::Runner.new("node_multi").deploy do |app| + expect(app.output).to match("Node Version in Ruby buildpack is: v#{default_node_version}") + expect(app.run("node -v")).to match(default_node_version) + end + end + + it "doesn't install node without exec JS" do + Hatchet::Runner.new("default_ruby").deploy do |app| + expect(app.run("node -v")).to match("node: command not found") + end + end + + it "works with buildpack set" do + pending("buildpack:set support with hatchet") + end +end + From 694c3039e710778d6286989ba6a006fd582b88c1 Mon Sep 17 00:00:00 2001 From: Joe Kutner Date: Mon, 2 Nov 2015 22:52:13 -0600 Subject: [PATCH 0201/1195] Replace JAVA_TOOL_OPTIONS with JAVA_MEM to avoid JRuby overriding --- lib/language_pack/helpers/jvm_installer.rb | 1 - lib/language_pack/ruby.rb | 26 ++++++++++++++-------- spec/rubies_spec.rb | 1 - 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/lib/language_pack/helpers/jvm_installer.rb b/lib/language_pack/helpers/jvm_installer.rb index b19f2d1e2..b987233d4 100644 --- a/lib/language_pack/helpers/jvm_installer.rb +++ b/lib/language_pack/helpers/jvm_installer.rb @@ -59,7 +59,6 @@ def install(jruby_version, forced = false) def fetch_untar(jvm_path, jvm_version=nil) topic "Installing JVM: #{jvm_version || jvm_path}" - puts "Setting JAVA_TOOL_OPTIONS for dyno size. Use JRUBY_BUILD_OPTS to override." FileUtils.mkdir_p(@vendor_dir) Dir.chdir(@vendor_dir) do diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 876fe2d87..94ea3c30f 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -150,7 +150,7 @@ def slug_vendor_base elsif ruby_version.ruby_version == "1.8.7" @slug_vendor_base = "vendor/bundle/1.8" else - @slug_vendor_base = run_stdout(%q(ruby -e "require 'rbconfig';puts \"vendor/bundle/#{RUBY_ENGINE}/#{RbConfig::CONFIG['ruby_version']}\"")).chomp + @slug_vendor_base = run_no_pipe(%q(ruby -e "require 'rbconfig';puts \"vendor/bundle/#{RUBY_ENGINE}/#{RbConfig::CONFIG['ruby_version']}\"")).chomp error "Problem detecting bundler vendor directory: #{@slug_vendor_base}" unless $?.success? @slug_vendor_base end @@ -217,6 +217,14 @@ def set_jvm_max_heap EOF end + def set_java_mem + <<-EOF +if ! [[ "${JAVA_OPTS}" == *-Xmx* ]]; then + export JAVA_MEM=${JAVA_MEM:--Xmx${JVM_MAX_HEAP}m} +fi +EOF + end + def set_default_web_concurrency <<-EOF case $(ulimit -u) in @@ -244,10 +252,10 @@ def default_jruby_opts "-Xcompile.invokedynamic=false" end - # default JAVA_TOOL_OPTIONS - # return [String] string of JAVA_TOOL_OPTIONS - def default_java_tool_options - "-Xmx${JVM_MAX_HEAP:-\"384\"}m" + # default Java Xmx + # return [String] string of Java Xmx + def default_java_mem + "-Xmx${JVM_MAX_HEAP:-384}m" end # sets up the environment variables for the build process @@ -255,9 +263,9 @@ def setup_language_pack_environment instrument 'ruby.setup_language_pack_environment' do if ruby_version.jruby? ENV["PATH"] += ":bin" - ENV["JAVA_TOOL_OPTIONS"] = run(<<-SHELL).chomp + ENV["JAVA_MEM"] = run(<<-SHELL).chomp #{set_jvm_max_heap} -echo #{default_java_tool_options} +echo #{default_java_mem} SHELL ENV["JRUBY_OPTS"] = env('JRUBY_BUILD_OPTS') || env('JRUBY_OPTS') end @@ -287,9 +295,9 @@ def setup_export if ruby_version.jruby? add_to_export set_jvm_max_heap + add_to_export set_java_mem set_export_default "JAVA_OPTS", default_java_opts set_export_default "JRUBY_OPTS", default_jruby_opts - set_export_default "JAVA_TOOL_OPTIONS", default_java_tool_options end end end @@ -305,9 +313,9 @@ def setup_profiled if ruby_version.jruby? add_to_profiled set_jvm_max_heap + add_to_profiled set_java_mem set_env_default "JAVA_OPTS", default_java_opts set_env_default "JRUBY_OPTS", default_jruby_opts - set_env_default "JAVA_TOOL_OPTIONS", default_java_tool_options end end end diff --git a/spec/rubies_spec.rb b/spec/rubies_spec.rb index cfc7ad8d9..5d611397c 100644 --- a/spec/rubies_spec.rb +++ b/spec/rubies_spec.rb @@ -50,7 +50,6 @@ app.deploy do |app| expect(app.output).to match("Installing JVM: openjdk-8") - expect(app.output).to match("Picked up JAVA_TOOL_OPTIONS: -Xmx2048m") expect(app.output).to match("JRUBY_OPTS is: -Xcompile.invokedynamic=false") expect(app.output).not_to include("OpenJDK 64-Bit Server VM warning") From f1cf3c874e872b4d9c6e4fa6f56b2e8cd51db4fa Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 3 Nov 2015 09:42:38 -0600 Subject: [PATCH 0202/1195] [ci skip] Changelog for v141 --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cecfb4c72..0a6a91fa6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ ## Master +## v141 (11/03/2015) + * Support for custom JDK versions in system.properties (#423) +* Fix nodejs buildpack integration (#429) +* Automatic jruby heap setting for IX dynos (#426) +* Warn when RAILS_ENV != production (https://devcenter.heroku.com/articles/deploying-to-a-custom-rails-environment) +* Warn when using asset_sync (https://devcenter.heroku.com/articles/please-do-not-use-asset-sync) ## v140 (9/9/2015) From 8d7d58a77c8df1f027217093c49a54c07c10fe5f Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 3 Nov 2015 09:43:22 -0600 Subject: [PATCH 0203/1195] bump to v141 --- lib/language_pack/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 0ed085cc8..2c4e44363 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v140" + BUILDPACK_VERSION = "v141" end end From ec8f64314bb3a39db0307114d1283772780f2532 Mon Sep 17 00:00:00 2001 From: Joe Kutner Date: Wed, 11 Nov 2015 05:17:09 -0600 Subject: [PATCH 0204/1195] Added a check for preinstalled JDK. Used with jvm-common bp --- lib/language_pack/helpers/jvm_installer.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/language_pack/helpers/jvm_installer.rb b/lib/language_pack/helpers/jvm_installer.rb index b987233d4..3e1561265 100644 --- a/lib/language_pack/helpers/jvm_installer.rb +++ b/lib/language_pack/helpers/jvm_installer.rb @@ -28,6 +28,11 @@ def system_properties end def install(jruby_version, forced = false) + if Dir.exist?(".jdk") + topic "Using pre-installed JDK" + return + end + jvm_version = system_properties['java.runtime.version'] case jvm_version when "1.9", "9" From 490e62687102a31611824e1f0b89de40c8f8b8c6 Mon Sep 17 00:00:00 2001 From: Joe Kutner Date: Sun, 15 Nov 2015 03:37:06 -0600 Subject: [PATCH 0205/1195] Added jvm spec and upgraded heroku-api gem --- Gemfile.lock | 8 ++++---- spec/jvm_spec.rb | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 spec/jvm_spec.rb diff --git a/Gemfile.lock b/Gemfile.lock index 5de54d252..0e12d28c7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -19,9 +19,9 @@ GEM rest-client (~> 1.6, >= 1.6.7) thor (~> 0.15, >= 0.15.2) diff-lcs (1.1.3) - excon (0.45.3) - heroku-api (0.3.22) - excon (~> 0.38) + excon (0.45.4) + heroku-api (0.3.23) + excon (~> 0.44) multi_json (~> 1.8) heroku_hatchet (1.4.1) activesupport (~> 4) @@ -36,7 +36,7 @@ GEM json (1.8.2) mime-types (2.4.3) minitest (5.5.1) - multi_json (1.10.1) + multi_json (1.11.2) netrc (0.10.2) parallel (0.6.5) parallel_tests (0.13.1) diff --git a/spec/jvm_spec.rb b/spec/jvm_spec.rb new file mode 100644 index 000000000..4329fd601 --- /dev/null +++ b/spec/jvm_spec.rb @@ -0,0 +1,16 @@ +require 'spec_helper' + +describe "JvmInstaller" do + it "JVM is installed by jvm-common only" do + app = Hatchet::Runner.new("ruby_193_jruby_17161") + app.setup! + bp = app.heroku.get_config_vars(app.name).body["BUILDPACK_URL"] + app.heroku.delete_config_var(app.name, "BUILDPACK_URL") + app.heroku.put_buildpacks(app.name, ["https://github.com/heroku/heroku-buildpack-jvm-common", bp]) + + app.deploy do |app| + expect(app.output).to match("Using pre-installed JDK") + expect(app.run("java -version")).to match("1.8.0") + end + end +end From d6dde3cc6218630d7eb8e407cf2dfdbf1bd20ba6 Mon Sep 17 00:00:00 2001 From: Amin Jams Date: Mon, 16 Nov 2015 15:28:11 -0500 Subject: [PATCH 0206/1195] Java Memory should use the default 384m Java Memory should use the default 384m when setting the JAVA_MEM env variable Signed-off-by: Brandon Shroyer --- lib/language_pack/ruby.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 94ea3c30f..423435d61 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -220,7 +220,7 @@ def set_jvm_max_heap def set_java_mem <<-EOF if ! [[ "${JAVA_OPTS}" == *-Xmx* ]]; then - export JAVA_MEM=${JAVA_MEM:--Xmx${JVM_MAX_HEAP}m} + export JAVA_MEM=${JAVA_MEM:--Xmx${JVM_MAX_HEAP:-384}m} fi EOF end From 632eca67b1523706fab9d4236745abe2504d7521 Mon Sep 17 00:00:00 2001 From: Joe Kutner Date: Tue, 17 Nov 2015 10:45:12 -0600 Subject: [PATCH 0207/1195] Updated heroku-api to 0.4.0 --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 0e12d28c7..2c6c08ed4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -20,8 +20,8 @@ GEM thor (~> 0.15, >= 0.15.2) diff-lcs (1.1.3) excon (0.45.4) - heroku-api (0.3.23) - excon (~> 0.44) + heroku-api (0.4.0) + excon (~> 0.45) multi_json (~> 1.8) heroku_hatchet (1.4.1) activesupport (~> 4) From cd90f65a981775d46d7ba23313426a3580ba4f92 Mon Sep 17 00:00:00 2001 From: Brian Shirai Date: Mon, 21 Dec 2015 10:41:35 -0800 Subject: [PATCH 0208/1195] Instruct curl to follow redirects. --- lib/language_pack/fetcher.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/fetcher.rb b/lib/language_pack/fetcher.rb index e7a374741..0165ac821 100644 --- a/lib/language_pack/fetcher.rb +++ b/lib/language_pack/fetcher.rb @@ -31,7 +31,7 @@ def fetch_bunzip2(path, files_to_extract = nil) private def curl_command(command) - "set -o pipefail; curl --fail --retry 3 --retry-delay 1 --connect-timeout #{curl_connect_timeout_in_seconds} --max-time #{curl_timeout_in_seconds} #{command}" + "set -o pipefail; curl -L --fail --retry 3 --retry-delay 1 --connect-timeout #{curl_connect_timeout_in_seconds} --max-time #{curl_timeout_in_seconds} #{command}" end def curl_timeout_in_seconds From 3063d8026f98107f5e856b247ed2347f2ba4fb3b Mon Sep 17 00:00:00 2001 From: "Rico Sta. Cruz" Date: Tue, 22 Dec 2015 15:38:11 +0800 Subject: [PATCH 0209/1195] Readme: fix typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index da1420cb3..8e81f7c64 100644 --- a/README.md +++ b/README.md @@ -171,4 +171,4 @@ If you don't want to run them in parallel you can still: $ bundle exec rake spec ``` -Now go take a nap or something for a really long time. +Now go take a nap or do something for a really long time. From 37c0375cf664630919a7b2916f128b77e2888c3e Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Wed, 6 Jan 2016 15:11:21 -0800 Subject: [PATCH 0210/1195] don't specify the heroku-postgresql plan, let addon pick --- lib/language_pack/rails2.rb | 2 +- lib/language_pack/ruby.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/language_pack/rails2.rb b/lib/language_pack/rails2.rb index 44237f791..0e714bd5e 100644 --- a/lib/language_pack/rails2.rb +++ b/lib/language_pack/rails2.rb @@ -73,7 +73,7 @@ def install_plugins # most rails apps need a database # @return [Array] shared database addon def add_dev_database_addon - ['heroku-postgresql:hobby-dev'] + ['heroku-postgresql'] end # sets up the profile.d script for this buildpack diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 423435d61..d4728f7bc 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -755,7 +755,7 @@ def allow_git(&blk) # decides if we need to enable the dev database addon # @return [Array] the database addon if the pg gem is detected or an empty Array if it isn't. def add_dev_database_addon - bundler.has_gem?("pg") ? ['heroku-postgresql:hobby-dev'] : [] + bundler.has_gem?("pg") ? ['heroku-postgresql'] : [] end # decides if we need to install the node.js binary From 248b30a420766fa3ec2e0b29581571e6089f7aee Mon Sep 17 00:00:00 2001 From: Joe Kutner Date: Tue, 12 Jan 2016 15:03:36 -0600 Subject: [PATCH 0211/1195] Added pgconfig jar to JDK for JRuby JDBC --- lib/language_pack/helpers/jvm_installer.rb | 8 ++++++++ spec/helpers/jvm_installer_spec.rb | 1 + spec/jvm_spec.rb | 1 + spec/rubies_spec.rb | 2 ++ 4 files changed, 12 insertions(+) diff --git a/lib/language_pack/helpers/jvm_installer.rb b/lib/language_pack/helpers/jvm_installer.rb index 3e1561265..527cd20e2 100644 --- a/lib/language_pack/helpers/jvm_installer.rb +++ b/lib/language_pack/helpers/jvm_installer.rb @@ -11,6 +11,8 @@ class LanguagePack::JvmInstaller JVM_1_7_25_PATH = "openjdk1.7.0_25.tar.gz" JVM_1_6_PATH = "openjdk1.6-latest.tar.gz" + PG_CONFIG_JAR = "https://lang-jvm.s3.amazonaws.com/pgconfig.jar" + def initialize(slug_vendor_jvm, stack) @vendor_dir = slug_vendor_jvm @stack = stack @@ -60,6 +62,8 @@ def install(jruby_version, forced = false) Dir["#{@vendor_dir}/bin/*"].each do |bin| run("ln -s ../#{bin} #{bin_dir}") end + + install_pgconfig_jar(PG_CONFIG_JAR) end def fetch_untar(jvm_path, jvm_version=nil) @@ -88,4 +92,8 @@ def fetch_env_untar(key) fetch_untar(jvm_version) true end + + def install_pgconfig_jar(url) + run("curl --retry 3 -s -L #{url} -o #{@vendor_dir}/jre/lib/ext/pgconfig.jar") + end end diff --git a/spec/helpers/jvm_installer_spec.rb b/spec/helpers/jvm_installer_spec.rb index 918918073..95265f3a6 100644 --- a/spec/helpers/jvm_installer_spec.rb +++ b/spec/helpers/jvm_installer_spec.rb @@ -73,6 +73,7 @@ expect(`ls bin`).to match("java") expect(`cat release 2>&1`).not_to match("1.8.0_51") expect(`cat release 2>&1`).to match("1.8.0") + expect(`ls #{dir}/jre/lib/ext`).to match("pgconfig.jar") end end end diff --git a/spec/jvm_spec.rb b/spec/jvm_spec.rb index 4329fd601..9ade6101f 100644 --- a/spec/jvm_spec.rb +++ b/spec/jvm_spec.rb @@ -11,6 +11,7 @@ app.deploy do |app| expect(app.output).to match("Using pre-installed JDK") expect(app.run("java -version")).to match("1.8.0") + expect(app.run("ls .jdk/jre/lib/ext")).to match("pgconfig.jar") end end end diff --git a/spec/rubies_spec.rb b/spec/rubies_spec.rb index 5d611397c..c72e8f209 100644 --- a/spec/rubies_spec.rb +++ b/spec/rubies_spec.rb @@ -57,6 +57,8 @@ app.set_config("JRUBY_BUILD_OPTS" => "--dev") app.push! expect(app.output).to match("JRUBY_OPTS is: --dev") + + expect(app.run("ls vendor/jvm/jre/lib/ext")).to match("pgconfig.jar") end end From 119bc88311c9e5e9f9e0f5ea73c4c46611f7cd5c Mon Sep 17 00:00:00 2001 From: Joe Kutner Date: Wed, 13 Jan 2016 15:10:09 -0600 Subject: [PATCH 0212/1195] Use a fetcher to retrieve pgconfig.jar --- lib/language_pack/helpers/jvm_installer.rb | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/language_pack/helpers/jvm_installer.rb b/lib/language_pack/helpers/jvm_installer.rb index 527cd20e2..3f89bf4f2 100644 --- a/lib/language_pack/helpers/jvm_installer.rb +++ b/lib/language_pack/helpers/jvm_installer.rb @@ -4,19 +4,21 @@ class LanguagePack::JvmInstaller include LanguagePack::ShellHelpers SYS_PROPS_FILE = "system.properties" - JVM_BASE_URL = "https://lang-jvm.s3.amazonaws.com/jdk" + JVM_BUCKET = "https://lang-jvm.s3.amazonaws.com" + JVM_BASE_URL = "#{JVM_BUCKET}/jdk" JVM_1_9_PATH = "openjdk1.9-latest.tar.gz" JVM_1_8_PATH = "openjdk1.8-latest.tar.gz" JVM_1_7_PATH = "openjdk1.7-latest.tar.gz" JVM_1_7_25_PATH = "openjdk1.7.0_25.tar.gz" JVM_1_6_PATH = "openjdk1.6-latest.tar.gz" - PG_CONFIG_JAR = "https://lang-jvm.s3.amazonaws.com/pgconfig.jar" + PG_CONFIG_JAR = "pgconfig.jar" def initialize(slug_vendor_jvm, stack) @vendor_dir = slug_vendor_jvm @stack = stack @fetcher = LanguagePack::Fetcher.new(JVM_BASE_URL, stack) + @pg_config_jar_fetcher = LanguagePack::Fetcher.new(JVM_BUCKET) end def system_properties @@ -63,7 +65,7 @@ def install(jruby_version, forced = false) run("ln -s ../#{bin} #{bin_dir}") end - install_pgconfig_jar(PG_CONFIG_JAR) + install_pgconfig_jar end def fetch_untar(jvm_path, jvm_version=nil) @@ -93,7 +95,12 @@ def fetch_env_untar(key) true end - def install_pgconfig_jar(url) - run("curl --retry 3 -s -L #{url} -o #{@vendor_dir}/jre/lib/ext/pgconfig.jar") + def install_pgconfig_jar + jdk_ext_dir="#{@vendor_dir}/jre/lib/ext" + if Dir.exist?(jdk_ext_dir) + Dir.chdir(jdk_ext_dir) do + @pg_config_jar_fetcher.fetch(PG_CONFIG_JAR) + end + end end end From 230fa0dcbe8fa71f20ca0c43e6a6d4fe7ddf9482 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 14 Jan 2016 13:42:13 -0600 Subject: [PATCH 0213/1195] v142 --- CHANGELOG.md | 7 +++++++ lib/language_pack/version.rb | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a6a91fa6..6b143e354 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ ## Master +## v142 (01/14/2016) + +* Added pgconfig jar to JDK for JRuby JDBC (#450) +* Let API pick exact postgres plan (#449) +* Follow redirects on `curl` command (#443) +* Check for preinstalled JDK (#434) + ## v141 (11/03/2015) * Support for custom JDK versions in system.properties (#423) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 2c4e44363..1270480db 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v141" + BUILDPACK_VERSION = "v142" end end From d5853968994c06b4ec88a4da6cbd937719a72455 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Thu, 28 Jan 2016 17:22:04 -0600 Subject: [PATCH 0214/1195] JDK9 test should check for 9-internal from @jkutner --- spec/helpers/jvm_installer_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/helpers/jvm_installer_spec.rb b/spec/helpers/jvm_installer_spec.rb index 95265f3a6..1c2030191 100644 --- a/spec/helpers/jvm_installer_spec.rb +++ b/spec/helpers/jvm_installer_spec.rb @@ -45,7 +45,7 @@ expect(`ls bin`).to match("java") expect(`cat release 2>&1`).not_to match("1.8.0") - expect(`cat release 2>&1`).to match("1.9.0") + expect(`cat release 2>&1`).to match("9-internal") end end end From 20c3e4fdb0d50870e2eb7f6bd3e436b2be3e29f8 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Thu, 28 Jan 2016 14:57:09 -0600 Subject: [PATCH 0215/1195] change default ruby to 2.2.4 from 2.0.0 Ruby 2.0.0 is being sunset on Feb. 24, 2016. This changes the default for new apps that haven't set a ruby in their Gemfile. By doing so, we won't be putting users on a Ruby being sunset soon. In addition to Ruby being sunset, Rails 5 beta needs a newer Ruby as well. --- lib/language_pack/ruby.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index d4728f7bc..4b7609c56 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -16,7 +16,7 @@ class LanguagePack::Ruby < LanguagePack::Base LIBYAML_PATH = "libyaml-#{LIBYAML_VERSION}" BUNDLER_VERSION = "1.9.7" BUNDLER_GEM_PATH = "bundler-#{BUNDLER_VERSION}" - DEFAULT_RUBY_VERSION = "ruby-2.0.0" + DEFAULT_RUBY_VERSION = "ruby-2.2.4" RBX_BASE_URL = "http://binaries.rubini.us/heroku" NODE_BP_PATH = "vendor/node/bin" From bc1152d5e40fb76c9adb6f5317ed9119978e87c5 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Thu, 28 Jan 2016 18:05:00 -0600 Subject: [PATCH 0216/1195] update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b143e354..08a7270ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Master +## v143 (01/28/2016) + +* Change default for new apps to Ruby 2.2.4 (#454) + ## v142 (01/14/2016) * Added pgconfig jar to JDK for JRuby JDBC (#450) From 33d6b2a8198a023907aef5eccea0f83c1decf4b8 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Thu, 28 Jan 2016 18:15:04 -0600 Subject: [PATCH 0217/1195] bump to v143 --- lib/language_pack/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 1270480db..8221eafe5 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v142" + BUILDPACK_VERSION = "v143" end end From 3ac83a711a573c5ff7de69a60eb0d8de63264403 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Mon, 1 Feb 2016 14:45:13 -0600 Subject: [PATCH 0218/1195] actually set 2.2.4 --- lib/language_pack/ruby_version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/ruby_version.rb b/lib/language_pack/ruby_version.rb index 939eb37d5..049592dfd 100644 --- a/lib/language_pack/ruby_version.rb +++ b/lib/language_pack/ruby_version.rb @@ -12,7 +12,7 @@ def initialize(output = "") end end - DEFAULT_VERSION_NUMBER = "2.0.0" + DEFAULT_VERSION_NUMBER = "2.2.4" DEFAULT_VERSION = "ruby-#{DEFAULT_VERSION_NUMBER}" LEGACY_VERSION_NUMBER = "1.9.2" LEGACY_VERSION = "ruby-#{LEGACY_VERSION_NUMBER}" From b728d25acc2395fa30e4bd2d1c263dddc089c84c Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Mon, 1 Feb 2016 14:52:43 -0600 Subject: [PATCH 0219/1195] remove duplicate DEFAULT_RUBY_VERSION constant --- lib/language_pack/ruby.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 4b7609c56..01d5474f0 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -16,7 +16,6 @@ class LanguagePack::Ruby < LanguagePack::Base LIBYAML_PATH = "libyaml-#{LIBYAML_VERSION}" BUNDLER_VERSION = "1.9.7" BUNDLER_GEM_PATH = "bundler-#{BUNDLER_VERSION}" - DEFAULT_RUBY_VERSION = "ruby-2.2.4" RBX_BASE_URL = "http://binaries.rubini.us/heroku" NODE_BP_PATH = "vendor/node/bin" @@ -499,7 +498,7 @@ def load_default_cache if false # load_default_cache? puts "New app detected loading default bundler cache" patchlevel = run("ruby -e 'puts RUBY_PATCHLEVEL'").chomp - cache_name = "#{DEFAULT_RUBY_VERSION}-p#{patchlevel}-default-cache" + cache_name = "#{LanguagePack::RubyVersion::DEFAULT_VERSION}-p#{patchlevel}-default-cache" @fetchers[:buildpack].fetch_untar("#{cache_name}.tgz") end end From fc29f3fc35d93d6eacfb445d69637cfaf899ad62 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Mon, 1 Feb 2016 15:45:02 -0600 Subject: [PATCH 0220/1195] set this test to pending for now until free allows more than 1 process type --- spec/rails4_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/rails4_spec.rb b/spec/rails4_spec.rb index fe38c10f3..914bcbcb6 100644 --- a/spec/rails4_spec.rb +++ b/spec/rails4_spec.rb @@ -38,6 +38,7 @@ end it "works with windows" do + pending("failing due to free dynos not being able to have more than 1 process type") Hatchet::Runner.new("rails4_windows_mri193").deploy do |app, heroku| result = app.run("rails -v") expect(result).to match("4.0.0") From be351c37c52c6d2da454cc8d78e292306172632a Mon Sep 17 00:00:00 2001 From: Joe Kutner Date: Mon, 1 Feb 2016 16:38:22 -0600 Subject: [PATCH 0221/1195] Added sleep between one-off dyno runs in test --- spec/jvm_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/jvm_spec.rb b/spec/jvm_spec.rb index 9ade6101f..a3e7acd73 100644 --- a/spec/jvm_spec.rb +++ b/spec/jvm_spec.rb @@ -11,6 +11,7 @@ app.deploy do |app| expect(app.output).to match("Using pre-installed JDK") expect(app.run("java -version")).to match("1.8.0") + sleep 3 expect(app.run("ls .jdk/jre/lib/ext")).to match("pgconfig.jar") end end From da95cd705f0fd899e2661cedd009c2590f3862ba Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Wed, 28 Oct 2015 17:09:46 -0700 Subject: [PATCH 0222/1195] initial circleci support --- Rakefile | 1 + circle.yml | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 circle.yml diff --git a/Rakefile b/Rakefile index 8daba69ad..8dbd7c532 100644 --- a/Rakefile +++ b/Rakefile @@ -303,6 +303,7 @@ Host heroku.com StrictHostKeyChecking no CheckHostIP no UserKnownHostsFile=/dev/null + IdentityFile ~/.ssh/id_rsa Host github.com StrictHostKeyChecking no ' >> ~/.ssh/config" diff --git a/circle.yml b/circle.yml new file mode 100644 index 000000000..13ead642d --- /dev/null +++ b/circle.yml @@ -0,0 +1,16 @@ +machine: + ruby: + version: 2.0.0 + environment: + HATCHET_RETRIES: 3 + IS_RUNNING_ON_TRAVIS: true + HATCHET_DEPLOY_STRATEGY: git + HATCHET_APP_LIMIT: 80 + +test: + pre: + - bundle exec rake travis:setup + override: + - bundle exec parallel_rspec -n 11 spec/ + post: + - heroku keys:remove $USER@`hostname` From 4d211caf6d568097a10a29cdbcb207ea92636ce7 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Mon, 1 Feb 2016 16:29:45 -0600 Subject: [PATCH 0223/1195] replace TRAVIS with generic CI --- .travis.yml | 2 +- circle.yml | 2 +- spec/spec_helper.rb | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index e97c0057f..0d3d1f78e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,7 @@ after_script: env: global: - HATCHET_RETRIES=3 - - IS_RUNNING_ON_TRAVIS=true + - IS_RUNNING_ON_CI=true - HATCHET_DEPLOY_STRATEGY=git - HATCHET_APP_LIMIT=80 - secure: bM8uWN5b9hZzzHk73EN9xHCK65vuopcbwQILcuMt0A1mHB8tSH1xyMYddNrbGdfznLAVXf8UjvKvv6rvvG4O+j3GRuIWVNukoAvZxG0FC9QxYuKbDccEPPdtqGwVEfWEKQYLajsIpF8/ACyALGV+Oe/Z28WRk6Ba3FLptfulc6s= diff --git a/circle.yml b/circle.yml index 13ead642d..69fc52fb6 100644 --- a/circle.yml +++ b/circle.yml @@ -3,7 +3,7 @@ machine: version: 2.0.0 environment: HATCHET_RETRIES: 3 - IS_RUNNING_ON_TRAVIS: true + IS_RUNNING_ON_CI: true HATCHET_DEPLOY_STRATEGY: git HATCHET_APP_LIMIT: 80 diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 3187615ac..490452b75 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -10,12 +10,12 @@ ENV['RACK_ENV'] = 'test' RSpec.configure do |config| - config.filter_run focused: true unless ENV['IS_RUNNING_ON_TRAVIS'] + config.filter_run focused: true unless ENV['IS_RUNNING_ON_CI'] config.run_all_when_everything_filtered = true config.alias_example_to :fit, focused: true config.full_backtrace = true config.verbose_retry = true # show retry status in spec process - config.default_retry_count = 2 if ENV['IS_RUNNING_ON_TRAVIS'] # retry all tests that fail again + config.default_retry_count = 2 if ENV['IS_RUNNING_ON_CI'] # retry all tests that fail again config.expect_with :rspec do |c| c.syntax = :expect From c4fc3c2805ab62b0afb058221590b3fffe646c66 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Mon, 1 Feb 2016 17:11:51 -0600 Subject: [PATCH 0224/1195] update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 08a7270ff..b12bcc91b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Master +## v144 (02/01/2016) + +* Fix default ruby to actually be Ruby 2.2.4 (#456) + ## v143 (01/28/2016) * Change default for new apps to Ruby 2.2.4 (#454) From 7f8b1a0172daad43a19b768052b59170020cc847 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Mon, 1 Feb 2016 17:13:41 -0600 Subject: [PATCH 0225/1195] bump to v144 --- lib/language_pack/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 8221eafe5..bef851cdf 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v143" + BUILDPACK_VERSION = "v144" end end From f4a51f795fd4e8a70565ca490519b7c8faca1e2d Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 17 Feb 2016 10:18:09 -0600 Subject: [PATCH 0226/1195] Warn on no Procfile use, don't mention Webrick While someone __may__ be using webrick they may also be puma or some other webserver with an integrated rack handler. Make the error more generic. The webpage was updated to say that a `Procfile` is best practice. It still talks about WEBrick but this is secondary. --- lib/language_pack/base.rb | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/language_pack/base.rb b/lib/language_pack/base.rb index ec0ce28ef..c41ff735f 100644 --- a/lib/language_pack/base.rb +++ b/lib/language_pack/base.rb @@ -104,13 +104,19 @@ def write_release_yaml f.write(release.to_yaml) end - unless File.exist?("Procfile") - msg = "No Procfile detected, using the default web server (webrick)\n" - msg << "https://devcenter.heroku.com/articles/ruby-default-web-server" - warn msg - end + warn_webserver + end + + def warn_webserver + return if File.exist?("Procfile") + msg = "No Procfile detected, using the default web server.\n" + msg << "We recommend explicitly declaring how to boot your server process via a Procfile.\n" + msg << "https://devcenter.heroku.com/articles/ruby-default-web-server" + warn msg end + + # log output # Ex. log "some_message", "here", :someattr="value" def log(*args) From 362d624c07e62a9c338a521a63471b02374c0575 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 23 Feb 2016 15:15:12 -0600 Subject: [PATCH 0227/1195] Allow beta versions to be flagged into Rails 5 --- lib/language_pack/rails5.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/rails5.rb b/lib/language_pack/rails5.rb index 1c0d60667..9582c78cc 100644 --- a/lib/language_pack/rails5.rb +++ b/lib/language_pack/rails5.rb @@ -8,7 +8,7 @@ def self.use? instrument "rails5.use" do rails_version = bundler.gem_version('railties') return false unless rails_version - is_rails = rails_version >= Gem::Version.new('5.0.0') && + is_rails = rails_version >= Gem::Version.new('5.x') && rails_version < Gem::Version.new('6.0.0') return is_rails end From c9fae9a460763117fdbec1c0e2a983f879b18b03 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 23 Feb 2016 15:15:35 -0600 Subject: [PATCH 0228/1195] Enable STDOUT logging via rails/rails#23734 Do not warn when rails_12factor not enabled. --- lib/language_pack/rails5.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/language_pack/rails5.rb b/lib/language_pack/rails5.rb index 9582c78cc..c1c68d5eb 100644 --- a/lib/language_pack/rails5.rb +++ b/lib/language_pack/rails5.rb @@ -13,4 +13,14 @@ def self.use? return is_rails end end + + def default_config_vars + super.merge({ + "RAILS_LOG_TO_STDOUT" => "enabled" + }) + end + + def install_plugins + # do not install plugins, do not call super, do not warn + end end From 5c6f078ef825f4369a559ada4d6c947cb8211598 Mon Sep 17 00:00:00 2001 From: Damien Mathieu Date: Wed, 24 Feb 2016 14:01:35 +0100 Subject: [PATCH 0229/1195] upgrade bundler to 1.11.2 --- README.md | 2 +- lib/language_pack/ruby.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8e81f7c64..b8e741678 100644 --- a/README.md +++ b/README.md @@ -132,7 +132,7 @@ First you'll need to build a Heroku-compatible version of Node.js: Open `lib/language_pack/ruby.rb` in your editor, and change the following line: - BUNDLER_VERSION = "1.1.rc" + BUNDLER_VERSION = "1.11.2" Open `lib/language_pack/base.rb` in your editor, and change the following line: diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 01d5474f0..4bcafc8ec 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -14,7 +14,7 @@ class LanguagePack::Ruby < LanguagePack::Base NAME = "ruby" LIBYAML_VERSION = "0.1.6" LIBYAML_PATH = "libyaml-#{LIBYAML_VERSION}" - BUNDLER_VERSION = "1.9.7" + BUNDLER_VERSION = "1.11.2" BUNDLER_GEM_PATH = "bundler-#{BUNDLER_VERSION}" RBX_BASE_URL = "http://binaries.rubini.us/heroku" NODE_BP_PATH = "vendor/node/bin" From e738ee04d2c30ae156bef620ba69ce071804ef03 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 29 Feb 2016 10:56:26 -0600 Subject: [PATCH 0230/1195] [ci skip] changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b12bcc91b..fe92b58bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ ## Master +* Bump bundler to 1.11.2 [Bundler changelog](https://github.com/bundler/bundler/blob/master/CHANGELOG.md#1112-2015-12-15) (#461) +* Rails 5 Support for logging to STDOUT via environment variable (#460) + ## v144 (02/01/2016) * Fix default ruby to actually be Ruby 2.2.4 (#456) From 8057f8e4b3930b8961917963fa6211209dfa94f4 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 1 Mar 2016 08:47:16 -0600 Subject: [PATCH 0231/1195] Platform changes prevent unacceptable env vars Due to platform changes we can no longer set weird env var names. This test was for a very intermittent problem not likely to reproduce again, we can safely get rid of this test for now and reintroduce if needed. Originally introduced in - https://github.com/heroku/heroku-buildpack-ruby/pull/229 - https://github.com/heroku/heroku-buildpack-ruby/commit/8b6126f1497a85dff8b897bf0426b5d8333c6d7f --- spec/user_env_compile_edge_case_spec.rb | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/spec/user_env_compile_edge_case_spec.rb b/spec/user_env_compile_edge_case_spec.rb index 4bea8ce01..fd1e261f7 100644 --- a/spec/user_env_compile_edge_case_spec.rb +++ b/spec/user_env_compile_edge_case_spec.rb @@ -16,14 +16,4 @@ expect(app.output).to match("Asset precompilation completed") end end - - it "allows weird characters in the env" do - app = Hatchet::Runner.new("rails41_scaffold") - app.setup! - app.set_config("BAD VALUE" => %Q{ )(*&^%$#'$'\n''@!~\'\ }) - app.set_config(%Q{ un"matched } => "bad key" ) - app.deploy do |app| - expect(app.output).to match("Launching") - end - end end From 9d2bef702d4b441021df4a0d3a8611be2bd61d23 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 29 Feb 2016 12:48:31 -0600 Subject: [PATCH 0232/1195] Alternative to #463 always warn on Bundler change Warn when upgrading bundler version. Instead of trying to detect errors or problems make the fact that we upgraded bundler much more noticeable. This may result in more false flag support ticketes but it also points people to how to test their app to ensure the problem was not in-fact caused by the bundler version change by setting the release version on their app. This warning will only be present for one successful build. --- lib/language_pack/ruby.rb | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 4bcafc8ec..186a55493 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -829,10 +829,24 @@ def load_bundler_cache rubygems_version_cache = "rubygems_version" stack_cache = "stack" + old_bundler_version = @metadata.read(buildpack_version_cache) old_rubygems_version = @metadata.read(ruby_version_cache).chomp if @metadata.exists?(ruby_version_cache) old_stack = @metadata.read(stack_cache).chomp if @metadata.exists?(stack_cache) old_stack ||= DEFAULT_LEGACY_STACK + + if old_bundler_version && old_bundler_version != BUNDLER_VERSION + puts(<<-WARNING) +Your app was upgraded to bundler #{ BUNDLER_VERSION }. +Previously you had a successful deploy with bundler #{ old_bundler_version }. + +If you see problems related to the bundler version please refer to: +https://devcenter.heroku.com/articles/bundler-version +WARNING + end + + + stack_change = old_stack != @stack convert_stack = @bundler_cache.old? @bundler_cache.convert_stack(stack_change) if convert_stack @@ -850,7 +864,7 @@ def load_bundler_cache FileUtils.rm_rf("vendor/ruby_version") purge_bundler_cache # fix bug introduced in v38 - elsif !@metadata.exists?(buildpack_version_cache) && @metadata.exists?(ruby_version_cache) + elsif !old_bundler_version && @metadata.exists?(ruby_version_cache) puts "Broken cache detected. Purging build cache." purge_bundler_cache elsif (@bundler_cache.exists? || @bundler_cache.old?) && @metadata.exists?(ruby_version_cache) && full_ruby_version != @metadata.read(ruby_version_cache).chomp From bd34c649654ac2cb13d8714901a9bb04a6a6261a Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 2 Mar 2016 19:53:30 -0600 Subject: [PATCH 0233/1195] Fix config vars for existing apps We weren't setting the environment variables for older apps :( --- lib/language_pack/rails42.rb | 7 +++++++ lib/language_pack/rails5.rb | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/lib/language_pack/rails42.rb b/lib/language_pack/rails42.rb index 7d2d9c6bb..0e6cd5341 100644 --- a/lib/language_pack/rails42.rb +++ b/lib/language_pack/rails42.rb @@ -14,6 +14,13 @@ def self.use? end end + def setup_profiled + instrument 'setup_profiled' do + super + set_env_default "RAILS_SERVE_STATIC_FILES", "enabled" + end + end + def default_config_vars super.merge({ "RAILS_SERVE_STATIC_FILES" => env("RAILS_SERVE_STATIC_FILES") || "enabled" diff --git a/lib/language_pack/rails5.rb b/lib/language_pack/rails5.rb index c1c68d5eb..81bed4d8d 100644 --- a/lib/language_pack/rails5.rb +++ b/lib/language_pack/rails5.rb @@ -14,6 +14,13 @@ def self.use? end end + def setup_profiled + instrument 'setup_profiled' do + super + set_env_default "RAILS_LOG_TO_STDOUT", "enabled" + end + end + def default_config_vars super.merge({ "RAILS_LOG_TO_STDOUT" => "enabled" From c7ccbbbe491f224d5ddf2b288f3f3ce024efa428 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Thu, 3 Mar 2016 10:22:48 -0600 Subject: [PATCH 0234/1195] Update ruby.rb --- lib/language_pack/ruby.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 186a55493..106a9f69c 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -829,7 +829,7 @@ def load_bundler_cache rubygems_version_cache = "rubygems_version" stack_cache = "stack" - old_bundler_version = @metadata.read(buildpack_version_cache) + old_bundler_version = @metadata.read(buildpack_version_cache).chomp old_rubygems_version = @metadata.read(ruby_version_cache).chomp if @metadata.exists?(ruby_version_cache) old_stack = @metadata.read(stack_cache).chomp if @metadata.exists?(stack_cache) old_stack ||= DEFAULT_LEGACY_STACK From 0287055d60a85fab7bbb82b7b75c5b40d48ab8d7 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Thu, 3 Mar 2016 10:23:18 -0600 Subject: [PATCH 0235/1195] Update ruby.rb --- lib/language_pack/ruby.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 106a9f69c..ef825a452 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -829,7 +829,7 @@ def load_bundler_cache rubygems_version_cache = "rubygems_version" stack_cache = "stack" - old_bundler_version = @metadata.read(buildpack_version_cache).chomp + old_bundler_version = @metadata.read(buildpack_version_cache).chomp if @metadata.exists?(buildpack_version_cache) old_rubygems_version = @metadata.read(ruby_version_cache).chomp if @metadata.exists?(ruby_version_cache) old_stack = @metadata.read(stack_cache).chomp if @metadata.exists?(stack_cache) old_stack ||= DEFAULT_LEGACY_STACK From 92ca39e3d411585568ee027d474a6515f188c13a Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 29 Feb 2016 11:28:14 -0600 Subject: [PATCH 0236/1195] [close #358] Fail on Rake detect for Rails Apps Rails applications should be reasonably expected to run `rake` when a Rakefile is present. Right now this is the behavior we support https://github.com/heroku/heroku-buildpack-ruby/issues/358#issuecomment-90250883. While it might be reasonable that a Ruby application might not expect us to run Rake, a Rails app with the asset pipeline, while they might not be using the asset pipeline, should be able to run the `rake` command when a Rakefile is present. --- hatchet.json | 4 ++- lib/language_pack/helpers/rake_runner.rb | 32 +++++++++++++++++------- lib/language_pack/ruby.rb | 9 ++++--- spec/rails3_spec.rb | 7 ++++++ 4 files changed, 39 insertions(+), 13 deletions(-) diff --git a/hatchet.json b/hatchet.json index 091d739f9..0c43840e9 100644 --- a/hatchet.json +++ b/hatchet.json @@ -49,7 +49,9 @@ "sharpstone/rails3_12factor", "sharpstone/rails3_one_plugin", "sharpstone/rails3_runtime_assets", - "sharpstone/rails3-fail-assets-compile" + "sharpstone/rails3-fail-assets-compile", + "sharpstone/rails3-fail-rakefile" + ], "rails4": [ "sharpstone/rails4-manifest", diff --git a/lib/language_pack/helpers/rake_runner.rb b/lib/language_pack/helpers/rake_runner.rb index 9e72569c9..4fa54cc28 100644 --- a/lib/language_pack/helpers/rake_runner.rb +++ b/lib/language_pack/helpers/rake_runner.rb @@ -1,6 +1,9 @@ class LanguagePack::Helpers::RakeRunner include LanguagePack::ShellHelpers + class CannotLoadRakefileError < StandardError + end + class RakeTask ALLOWED = [:pass, :fail, :no_load, :not_found] include LanguagePack::ShellHelpers @@ -59,8 +62,8 @@ def invoke(options = {}) end def initialize(has_rake_gem = true) - @has_rake = has_rake_gem && has_rakefile? - if !@has_rake + @has_rake_gem = has_rake_gem + if !has_rake_installed? @rake_tasks = "" @rakefile_can_load = false end @@ -86,13 +89,20 @@ def load_rake_tasks(options = {}) end end - def load_rake_tasks!(options = {}) - out = load_rake_tasks(options) - msg = "Could not detect rake tasks\n" - msg << "ensure you can run `$ bundle exec rake -P` against your app with no environment variables present\n" - msg << "and using the production group of your Gemfile.\n" - msg << out - puts msg if cannot_load_rakefile? + def load_rake_tasks!(options = {}, raise_on_fail = false) + return if !has_rake_installed? + + out = load_rake_tasks(options) + + if cannot_load_rakefile? + msg = "Could not detect rake tasks\n" + msg << "ensure you can run `$ bundle exec rake -P` against your app\n" + msg << "and using the production group of your Gemfile.\n" + msg << out + raise CannotLoadRakefileError, msg if raise_on_fail + puts msg + end + return self end @@ -117,6 +127,10 @@ def invoke(task, options = {}) self.task(task, options).invoke end + def has_rake_installed? + @has_rake ||= (@has_rake_gem && has_rakefile?) + end + private def has_rakefile? diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 4bcafc8ec..f6f311042 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -725,9 +725,12 @@ def attribute(name, value, force_string = false) def rake @rake ||= begin - LanguagePack::Helpers::RakeRunner.new( - bundler.has_gem?("rake") || ruby_version.rake_is_vendored? - ).load_rake_tasks!(env: rake_env) + rake_gem_available = bundler.has_gem?("rake") || ruby_version.rake_is_vendored? + raise_on_fail = bundler.gem_version('railties') && bundler.gem_version('railties') < Gem::Version.new('3.x') + + rake = LanguagePack::Helpers::RakeRunner.new(rake_gem_available) + rake.load_rake_tasks!({ env: rake_env }, raise_on_fail) + rake end end diff --git a/spec/rails3_spec.rb b/spec/rails3_spec.rb index dd4abc170..476f8482a 100644 --- a/spec/rails3_spec.rb +++ b/spec/rails3_spec.rb @@ -42,6 +42,13 @@ end end + it "fails if rake tasks cannot be detected" do + Hatchet::Runner.new("rails3-fail-rakefile", allow_failure: true).deploy do |app| + expect(app.output).to include("raising so the rake task will not load") + expect(app).not_to be_deployed + end + end + it "fails compile if assets:precompile fails" do Hatchet::Runner.new("rails3-fail-assets-compile", allow_failure: true).deploy do |app, heroku| expect(app.output).to include("raising on assets:precompile on purpose") From 5b67306175542e494fe01b0c3402622ef1ee4adf Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 3 Mar 2016 10:35:13 -0600 Subject: [PATCH 0237/1195] Use correct metadata directory --- lib/language_pack/ruby.rb | 4 ++-- spec/ruby_spec.rb | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index ef825a452..a0a5b0ca4 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -829,7 +829,7 @@ def load_bundler_cache rubygems_version_cache = "rubygems_version" stack_cache = "stack" - old_bundler_version = @metadata.read(buildpack_version_cache).chomp if @metadata.exists?(buildpack_version_cache) + old_bundler_version = @metadata.read(bundler_version_cache).chomp if @metadata.exists?(bundler_version_cache) old_rubygems_version = @metadata.read(ruby_version_cache).chomp if @metadata.exists?(ruby_version_cache) old_stack = @metadata.read(stack_cache).chomp if @metadata.exists?(stack_cache) old_stack ||= DEFAULT_LEGACY_STACK @@ -864,7 +864,7 @@ def load_bundler_cache FileUtils.rm_rf("vendor/ruby_version") purge_bundler_cache # fix bug introduced in v38 - elsif !old_bundler_version && @metadata.exists?(ruby_version_cache) + elsif !@metadata.exists?(buildpack_version_cache) && @metadata.exists?(ruby_version_cache) puts "Broken cache detected. Purging build cache." purge_bundler_cache elsif (@bundler_cache.exists? || @bundler_cache.old?) && @metadata.exists?(ruby_version_cache) && full_ruby_version != @metadata.read(ruby_version_cache).chomp diff --git a/spec/ruby_spec.rb b/spec/ruby_spec.rb index 32ae29980..20482c570 100644 --- a/spec/ruby_spec.rb +++ b/spec/ruby_spec.rb @@ -48,6 +48,7 @@ it "writes a heroku specific database.yml" do Hatchet::Runner.new("default_ruby").deploy do |app, heroku| expect(app.output).to include("Writing config/database.yml to read from DATABASE_URL") + expect(app.output).not_to include("Your app was upgraded to bundler") end end end From ad42bdde3cf78512ad5e53bb76a227df37912aa0 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Thu, 3 Mar 2016 11:04:37 -0600 Subject: [PATCH 0238/1195] Update ruby.rb --- lib/language_pack/ruby.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index a0a5b0ca4..916f6d255 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -842,6 +842,7 @@ def load_bundler_cache If you see problems related to the bundler version please refer to: https://devcenter.heroku.com/articles/bundler-version + WARNING end From e9e442eb706aeb139a6ff1bdae881287d2fd6ce6 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 8 Mar 2016 13:42:08 -0600 Subject: [PATCH 0239/1195] [ci skip] v145 --- CHANGELOG.md | 2 ++ lib/language_pack/version.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fe92b58bb..57949b246 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Master +## v145 (03/08/2016) + * Bump bundler to 1.11.2 [Bundler changelog](https://github.com/bundler/bundler/blob/master/CHANGELOG.md#1112-2015-12-15) (#461) * Rails 5 Support for logging to STDOUT via environment variable (#460) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index bef851cdf..3dd08b5be 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v144" + BUILDPACK_VERSION = "v145" end end From 0b7ad94efc871995dc2e4736878f5be19b71ca61 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 10 Mar 2016 10:37:08 -0600 Subject: [PATCH 0240/1195] Warn on .bundle/config file presence Discussion at https://github.com/bundler/bundler/issues/4351#issuecomment-194490139 Also do not load the stored `.bundle` directory. We are passing in all the flags that we need to `bundle install`. If we also store a `.bundle/config` file between builds than if you accidentally include `.bundle/config` file in your repo with a `BUNDLE_WITHOUT` value ,it will get persisted to the `.bundle/config` file to the cache and deleting the file from your repo does not get rid of the problem. The config is un-needed, since we're using all flags all the time, let's not rely on the `.bundle/config` file. --- lib/language_pack/helpers/bundler_cache.rb | 1 - lib/language_pack/ruby.rb | 14 ++++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/language_pack/helpers/bundler_cache.rb b/lib/language_pack/helpers/bundler_cache.rb index 72444fd23..0b4988db0 100644 --- a/lib/language_pack/helpers/bundler_cache.rb +++ b/lib/language_pack/helpers/bundler_cache.rb @@ -41,7 +41,6 @@ def exists? # writes cache contents to cache store def store - @cache.store(".bundle") @cache.store(@bundler_dir, @stack_dir) end diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 9c332afcb..8678a824a 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -544,6 +544,16 @@ def build_bundler bundle_command = "#{bundle_bin} install --without #{bundle_without} --path vendor/bundle --binstubs #{bundler_binstubs_path}" bundle_command << " -j4" + if File.exist?("#{Dir.pwd}/.bundle/config") + warn(<<-WARNING, inline: true) +You have the `.bundle/config` file checked into your repository + It contains local state like the location of the installed bundle + as well as configured git local gems, and other settings that should +not be shared between multiple checkouts of a single repo. Please +remove the `.bundle/` folder from your repo and add it to your `.gitignore` file. +WARNING + end + if bundler.windows_gemfile_lock? warn(<<-WARNING, inline: true) Removing `Gemfile.lock` because it was generated on Windows. @@ -558,7 +568,6 @@ def build_bundler else # using --deployment is preferred if we can bundle_command += " --deployment" - cache.load ".bundle" end topic("Installing dependencies using bundler #{bundler.version}") @@ -837,7 +846,6 @@ def load_bundler_cache old_stack = @metadata.read(stack_cache).chomp if @metadata.exists?(stack_cache) old_stack ||= DEFAULT_LEGACY_STACK - if old_bundler_version && old_bundler_version != BUNDLER_VERSION puts(<<-WARNING) Your app was upgraded to bundler #{ BUNDLER_VERSION }. @@ -849,8 +857,6 @@ def load_bundler_cache WARNING end - - stack_change = old_stack != @stack convert_stack = @bundler_cache.old? @bundler_cache.convert_stack(stack_change) if convert_stack From a58aa352814b34ead8495b3afb4c0cfce93bc03b Mon Sep 17 00:00:00 2001 From: Matt Graham Date: Fri, 11 Mar 2016 14:12:20 -0500 Subject: [PATCH 0241/1195] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b8e741678..d4dd03b47 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Heroku Buildpack for Ruby -![ruby](https://cloud.githubusercontent.com/assets/51578/8882726/52caf102-3217-11e5-8a6c-2d47c57f0030.jpg) +![ruby](https://cloud.githubusercontent.com/assets/51578/13712725/3c6b3368-e793-11e5-83c1-728440111358.png) This is a [Heroku Buildpack](http://devcenter.heroku.com/articles/buildpacks) for Ruby, Rack, and Rails apps. It uses [Bundler](http://gembundler.com) for dependency management. From 2ba32e6489f7a194967c417a35fd17e9f79f06d5 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Fri, 11 Mar 2016 13:50:08 -0600 Subject: [PATCH 0242/1195] Performance-M WEB_CONCURRENCY data --- lib/language_pack/ruby.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 9c332afcb..e2f918770 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -235,6 +235,10 @@ def set_default_web_concurrency export HEROKU_RAM_LIMIT_MB=${HEROKU_RAM_LIMIT_MB:-1024} export WEB_CONCURRENCY=${WEB_CONCURRENCY:-4} ;; +16384) + export HEROKU_RAM_LIMIT_MB=${HEROKU_RAM_LIMIT_MB:-2560} + export WEB_CONCURRENCY=${WEB_CONCURRENCY:-8} + ;; 32768) export HEROKU_RAM_LIMIT_MB=${HEROKU_RAM_LIMIT_MB:-6144} export WEB_CONCURRENCY=${WEB_CONCURRENCY:-16} From 413879d1f266c6a5db9fe375fdc34ee1ab08f10d Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 17 Mar 2016 10:45:58 -0500 Subject: [PATCH 0243/1195] Fix raise on fail behavior --- lib/language_pack/ruby.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 4a265b404..f5d3452ab 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -739,7 +739,7 @@ def attribute(name, value, force_string = false) def rake @rake ||= begin rake_gem_available = bundler.has_gem?("rake") || ruby_version.rake_is_vendored? - raise_on_fail = bundler.gem_version('railties') && bundler.gem_version('railties') < Gem::Version.new('3.x') + raise_on_fail = bundler.gem_version('railties') && bundler.gem_version('railties') > Gem::Version.new('3.x') rake = LanguagePack::Helpers::RakeRunner.new(rake_gem_available) rake.load_rake_tasks!({ env: rake_env }, raise_on_fail) From ea1e8140f00b611b516503be2127a564b02c960a Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Thu, 17 Mar 2016 20:07:50 -0500 Subject: [PATCH 0244/1195] Link to bundler configuration article --- lib/language_pack/ruby.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index f5d3452ab..bc6629e07 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -555,6 +555,7 @@ def build_bundler as well as configured git local gems, and other settings that should not be shared between multiple checkouts of a single repo. Please remove the `.bundle/` folder from your repo and add it to your `.gitignore` file. +https://devcenter.heroku.com/articles/bundler-configuration WARNING end From c8ba623992ceb3e3df9bacc042d83540214c3234 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 23 Mar 2016 11:10:50 -0500 Subject: [PATCH 0245/1195] v146 --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 57949b246..a312a5130 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,17 @@ ## Master +## v146 (03/23/2016) + +* Warn when `.bundle/config` is checked in (#471) +* Do not cache `.bundle/config` betwee builds (#471) +* Set WEB_CONCURRENCY for M-Performance dynos using sensible defaults (#474) +* Fix rake task detection in Rails apps actually fails builds (#475) + ## v145 (03/08/2016) * Bump bundler to 1.11.2 [Bundler changelog](https://github.com/bundler/bundler/blob/master/CHANGELOG.md#1112-2015-12-15) (#461) * Rails 5 Support for logging to STDOUT via environment variable (#460) +* Fail build when rake tasks cannot be detected in a Rails app (#462) ## v144 (02/01/2016) From a309797a663ca2cf103591aa31caa4bf6dc92e59 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 23 Mar 2016 11:11:06 -0500 Subject: [PATCH 0246/1195] bump to v146 --- lib/language_pack/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 3dd08b5be..575e012f5 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v145" + BUILDPACK_VERSION = "v146" end end From 8e8a777f169e51ed61114eef36eab2847bc894ff Mon Sep 17 00:00:00 2001 From: Kazuhiro NISHIYAMA Date: Thu, 31 Mar 2016 23:02:10 +0900 Subject: [PATCH 0247/1195] Fix a typo --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a312a5130..c2a4183bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ ## v146 (03/23/2016) * Warn when `.bundle/config` is checked in (#471) -* Do not cache `.bundle/config` betwee builds (#471) +* Do not cache `.bundle/config` between builds (#471) * Set WEB_CONCURRENCY for M-Performance dynos using sensible defaults (#474) * Fix rake task detection in Rails apps actually fails builds (#475) From 28f8a8da0b0b188c9de22b618dc961e2283d0692 Mon Sep 17 00:00:00 2001 From: TheNotary Date: Sun, 22 May 2016 15:29:41 -0700 Subject: [PATCH 0248/1195] makes node come in over https rather than http I haven't tested this on Heroku, so be sure to double check nothing odd happens. --- lib/language_pack/helpers/node_installer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/helpers/node_installer.rb b/lib/language_pack/helpers/node_installer.rb index e2c88921e..710f768ce 100644 --- a/lib/language_pack/helpers/node_installer.rb +++ b/lib/language_pack/helpers/node_installer.rb @@ -5,7 +5,7 @@ class LanguagePack::NodeInstaller LEGACY_NODE_VERSION = "0.4.7" LEGACY_BINARY_PATH = "node-#{LEGACY_NODE_VERSION}" - NODEJS_BASE_URL = "http://s3pository.heroku.com/node/v#{MODERN_NODE_VERSION}/" + NODEJS_BASE_URL = "https://s3pository.heroku.com/node/v#{MODERN_NODE_VERSION}/" def initialize(stack) @fetchers = { From 9a03fa010171e1432ec3c9159e6e22c3946b8b9b Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 24 May 2016 09:17:55 -0500 Subject: [PATCH 0249/1195] Update parallel_test && rspec retry Apparently some rspec behavior changed with regard to the `pending` tag. Commenting out for now Fixing runner test, The replrunner is returning "loworld" instead of "helloworld" --- Gemfile.lock | 27 ++++++++-------- spec/default_cache_spec.rb | 16 +++++----- spec/helpers/bundler_wrapper_spec.rb | 2 +- spec/helpers/rake_runner_spec.rb | 8 ++--- spec/helpers/stale_file_cleaner_spec.rb | 16 +++++----- spec/node_spec.rb | 4 --- spec/rails42_spec.rb | 5 ++- spec/rails4_spec.rb | 35 ++++++++++----------- spec/ruby_spec.rb | 42 ++++++++++++------------- spec/spec_helper.rb | 2 +- 10 files changed, 75 insertions(+), 82 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 2c6c08ed4..9e1110002 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -18,7 +18,7 @@ GEM progress (~> 2.4, >= 2.4.0) rest-client (~> 1.6, >= 1.6.7) thor (~> 0.15, >= 0.15.2) - diff-lcs (1.1.3) + diff-lcs (1.2.5) excon (0.45.4) heroku-api (0.4.0) excon (~> 0.45) @@ -38,8 +38,8 @@ GEM minitest (5.5.1) multi_json (1.11.2) netrc (0.10.2) - parallel (0.6.5) - parallel_tests (0.13.1) + parallel (1.8.0) + parallel_tests (2.5.0) parallel progress (2.4.0) rake (10.0.4) @@ -49,16 +49,14 @@ GEM mime-types (>= 1.16, < 3.0) netrc (~> 0.7) rrrretry (1.0.0) - rspec (2.2.0) - rspec-core (~> 2.2) - rspec-expectations (~> 2.2) - rspec-mocks (~> 2.2) - rspec-core (2.13.1) - rspec-expectations (2.12.1) - diff-lcs (~> 1.1.3) - rspec-mocks (2.13.1) - rspec-retry (0.2.1) - rspec + rspec-core (3.4.4) + rspec-support (~> 3.4.0) + rspec-expectations (3.4.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.4.0) + rspec-retry (0.4.5) + rspec-core + rspec-support (3.4.1) thor (0.19.1) thread_safe (0.3.4) threaded (0.0.4) @@ -78,3 +76,6 @@ DEPENDENCIES rspec-core rspec-expectations rspec-retry + +BUNDLED WITH + 1.12.3 diff --git a/spec/default_cache_spec.rb b/spec/default_cache_spec.rb index 7cca755d1..736f7395f 100644 --- a/spec/default_cache_spec.rb +++ b/spec/default_cache_spec.rb @@ -1,11 +1,11 @@ require 'spec_helper' -describe "Default Cache" do - it "gets loaded successfully" do - pending("needs dep-tracker work") - Hatchet::Runner.new("default_ruby").deploy do |app| - expect(app.output).to match("loading default bundler cache") - end - end -end +# describe "Default Cache" do +# it "gets loaded successfully" do +# pending("needs dep-tracker work") +# Hatchet::Runner.new("default_ruby").deploy do |app| +# expect(app.output).to match("loading default bundler cache") +# end +# end +# end diff --git a/spec/helpers/bundler_wrapper_spec.rb b/spec/helpers/bundler_wrapper_spec.rb index 2305e7195..2a55ffd69 100644 --- a/spec/helpers/bundler_wrapper_spec.rb +++ b/spec/helpers/bundler_wrapper_spec.rb @@ -21,7 +21,7 @@ it "detects windows gemfiles" do Hatchet::App.new("rails4_windows_mri193").in_directory do |dir| - expect(@bundler.install.windows_gemfile_lock?).to be_true + expect(@bundler.install.windows_gemfile_lock?).to be_truthy end end diff --git a/spec/helpers/rake_runner_spec.rb b/spec/helpers/rake_runner_spec.rb index deecb1ddf..89ba78a1e 100644 --- a/spec/helpers/rake_runner_spec.rb +++ b/spec/helpers/rake_runner_spec.rb @@ -29,22 +29,22 @@ Hatchet::App.new('bad_rakefile').in_directory do rake = LanguagePack::Helpers::RakeRunner.new.load_rake_tasks! task = rake.task("assets:precompile") - expect(rake.rakefile_can_load?).to be_false - expect(task.task_defined?).to be_false + expect(rake.rakefile_can_load?).to be_falsey + expect(task.task_defined?).to be_falsey end end it "detects if task is missing" do Hatchet::App.new('asset_precompile_not_found').in_directory do task = LanguagePack::Helpers::RakeRunner.new.task("assets:precompile") - expect(task.task_defined?).to be_false + expect(task.task_defined?).to be_falsey end end it "detects when no rakefile is present" do Hatchet::App.new('no_rakefile').in_directory do runner = LanguagePack::Helpers::RakeRunner.new - expect(runner.rakefile_can_load?).to be_false + expect(runner.rakefile_can_load?).to be_falsey end end end diff --git a/spec/helpers/stale_file_cleaner_spec.rb b/spec/helpers/stale_file_cleaner_spec.rb index 52fef9632..5c23f1a35 100644 --- a/spec/helpers/stale_file_cleaner_spec.rb +++ b/spec/helpers/stale_file_cleaner_spec.rb @@ -9,13 +9,13 @@ sleep 1 # need mtime of files to be different new_file = create_file_with_size_in(file_size, dir) - expect(old_file.exist?).to be_true - expect(new_file.exist?).to be_true + expect(old_file.exist?).to be_truthy + expect(new_file.exist?).to be_truthy ::LanguagePack::Helpers::StaleFileCleaner.new(dir).clean_over(2*file_size - 50) - expect(old_file.exist?).to be_false - expect(new_file.exist?).to be_true + expect(old_file.exist?).to be_falsey + expect(new_file.exist?).to be_truthy end end @@ -26,14 +26,14 @@ sleep 1 # need mtime of files to be different new_file = create_file_with_size_in(file_size, dir) - expect(old_file.exist?).to be_true - expect(new_file.exist?).to be_true + expect(old_file.exist?).to be_truthy + expect(new_file.exist?).to be_truthy dir_size = File.stat(dir) ::LanguagePack::Helpers::StaleFileCleaner.new(dir).clean_over(2*file_size + 50) - expect(old_file.exist?).to be_true - expect(new_file.exist?).to be_true + expect(old_file.exist?).to be_truthy + expect(new_file.exist?).to be_truthy end end end diff --git a/spec/node_spec.rb b/spec/node_spec.rb index 64ab85465..0f54ec46b 100644 --- a/spec/node_spec.rb +++ b/spec/node_spec.rb @@ -21,9 +21,5 @@ expect(app.run("node -v")).to match("node: command not found") end end - - it "works with buildpack set" do - pending("buildpack:set support with hatchet") - end end diff --git a/spec/rails42_spec.rb b/spec/rails42_spec.rb index 6d9bfaeba..3afd465fa 100644 --- a/spec/rails42_spec.rb +++ b/spec/rails42_spec.rb @@ -4,9 +4,8 @@ it "set RAILS_SERVE_STATIC_FILES" do Hatchet::Runner.new("rails42_scaffold").deploy do |app, heroku| - ReplRunner.new(:rails_console, "heroku run bin/rails console -a #{app.name}").run do |console| - console.run("ENV['RAILS_SERVE_STATIC_FILES'].present?") { |result| expect(result).to match(/true/) } - end + output = app.run("rails runner 'puts ENV[%Q{RAILS_SERVE_STATIC_FILES}].present?'") + expect(output).to match(/true/) end end end diff --git a/spec/rails4_spec.rb b/spec/rails4_spec.rb index 914bcbcb6..7ae5c9740 100644 --- a/spec/rails4_spec.rb +++ b/spec/rails4_spec.rb @@ -23,7 +23,6 @@ end end - it "upgraded from 3 to 4 missing ./bin still works" do Hatchet::Runner.new("rails3-to-4-no-bin").deploy do |app, heroku| expect(app.output).to include("Asset precompilation completed") @@ -31,30 +30,28 @@ expect(app.output).to match("WARNING") expect(app.output).to match("Include 'rails_12factor' gem to enable all platform features") - app.run("rails console") do |console| - console.run("'hello' + 'world'") {|result| expect(result).to match('helloworld')} - end + output = app.run("rails runner 'puts %Q{hello} + %Q{world}'") + expect(output).to match('helloworld') end end - it "works with windows" do - pending("failing due to free dynos not being able to have more than 1 process type") - Hatchet::Runner.new("rails4_windows_mri193").deploy do |app, heroku| - result = app.run("rails -v") - expect(result).to match("4.0.0") - - result = app.run("rake -T") - expect(result).to match("assets:precompile") + # it "works with windows" do + # pending("failing due to free dynos not being able to have more than 1 process type") + # Hatchet::Runner.new("rails4_windows_mri193").deploy do |app, heroku| + # result = app.run("rails -v") + # expect(result).to match("4.0.0") - result = app.run("bundle show rails") - expect(result).to match("rails-4.0.0") + # result = app.run("rake -T") + # expect(result).to match("assets:precompile") - expect(app.output).to match("Removing `Gemfile.lock`") + # result = app.run("bundle show rails") + # expect(result).to match("rails-4.0.0") + # expect(app.output).to match("Removing `Gemfile.lock`") - before_final_warnings = app.output.split("Bundle completed").first - expect(before_final_warnings).to match("Removing `Gemfile.lock`") - end - end + # before_final_warnings = app.output.split("Bundle completed").first + # expect(before_final_warnings).to match("Removing `Gemfile.lock`") + # end + # end it "fails compile if assets:precompile fails" do Hatchet::Runner.new("rails4-fail-assets-compile", allow_failure: true).deploy do |app, heroku| diff --git a/spec/ruby_spec.rb b/spec/ruby_spec.rb index 20482c570..ef6c997d7 100644 --- a/spec/ruby_spec.rb +++ b/spec/ruby_spec.rb @@ -1,31 +1,31 @@ require_relative 'spec_helper' describe "Ruby apps" do - describe "default WEB_CONCURRENCY" do - it "auto scales WEB_CONCURRENCY" do - pending("https://github.com/heroku/api/issues/4426") - app = Hatchet::Runner.new("default_ruby") - app.setup! - app.set_config("SENSIBLE_DEFAULTS" => "enabled") - app.deploy do |app| - app.run('echo "loaded"') - expect(app.run(:bash, 'echo "value: $WEB_CONCURRENCY"', heroku: { size: "1X" } )).to match("value: 2") - expect(app.run(:bash, 'echo "value: $WEB_CONCURRENCY"', heroku: { size: "2X" } )).to match("value: 4") - expect(app.run(:bash, 'echo "value: $WEB_CONCURRENCY"', heroku: { size: "PX" } )).to match("value: 16") - end - end - end + # describe "default WEB_CONCURRENCY" do + # it "auto scales WEB_CONCURRENCY" do + # pending("https://github.com/heroku/api/issues/4426") + # app = Hatchet::Runner.new("default_ruby") + # app.setup! + # app.set_config("SENSIBLE_DEFAULTS" => "enabled") + # app.deploy do |app| + # app.run('echo "loaded"') + # expect(app.run(:bash, 'echo "value: $WEB_CONCURRENCY"', heroku: { size: "1X" } )).to match("value: 2") + # expect(app.run(:bash, 'echo "value: $WEB_CONCURRENCY"', heroku: { size: "2X" } )).to match("value: 4") + # expect(app.run(:bash, 'echo "value: $WEB_CONCURRENCY"', heroku: { size: "PX" } )).to match("value: 16") + # end + # end + # end describe "Rake detection" do context "default" do - it "adds default process types" do - Hatchet::Runner.new('empty-procfile').deploy do |app| - app.run("console") do |console| - console.run("'hello' + 'world'") {|result| expect(result).to match('helloworld')} - end - end - end + # it "adds default process types" do + # Hatchet::Runner.new('empty-procfile').deploy do |app| + # app.run("console") do |console| + # console.run("puts 'hello' + 'world'") {|result| expect(result).to match('helloworld')} + # end + # end + # end end context "Ruby 1.9+" do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 490452b75..17568fc70 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -20,7 +20,7 @@ config.expect_with :rspec do |c| c.syntax = :expect end - config.mock_with :none + config.mock_with :nothing end def git_repo From 377d8536b9d2571e9b78b14b90a8dc11da7bca8d Mon Sep 17 00:00:00 2001 From: schneems Date: Sat, 14 May 2016 13:44:41 -0500 Subject: [PATCH 0250/1195] Bump bundler 1.12.5 Allows for Ruby version operators such as ``` ruby "~> 2.3.1" ``` When you bundle with this set a Ruby version is written to the `Gemfile.lock`. --- CHANGELOG.md | 2 ++ hatchet.json | 3 ++- lib/language_pack/ruby.rb | 2 +- spec/rails4_spec.rb | 1 - spec/ruby_spec.rb | 8 ++++++++ 5 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c2a4183bf..c2ea0e3da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Master +* Bump bundler to 1.12.5 [Bundler changfelog](https://github.com/bundler/bundler/blob/master/CHANGELOG.md#1123-2016-05-06). Allows for use of Ruby version operators. + ## v146 (03/23/2016) * Warn when `.bundle/config` is checked in (#471) diff --git a/hatchet.json b/hatchet.json index 0c43840e9..cf8be100a 100644 --- a/hatchet.json +++ b/hatchet.json @@ -17,7 +17,8 @@ "sharpstone/git_gemspec", "sharpstone/no_lockfile", "sharpstone/sqlite3_gemfile", - "sharpstone/nokogiri_160" + "sharpstone/nokogiri_160", + "sharpstone/bundle-ruby-version-not-in-lockfile" ], "ruby": [ "sharpstone/mri_187", diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index bc6629e07..4688d267b 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -14,7 +14,7 @@ class LanguagePack::Ruby < LanguagePack::Base NAME = "ruby" LIBYAML_VERSION = "0.1.6" LIBYAML_PATH = "libyaml-#{LIBYAML_VERSION}" - BUNDLER_VERSION = "1.11.2" + BUNDLER_VERSION = "1.12.5" BUNDLER_GEM_PATH = "bundler-#{BUNDLER_VERSION}" RBX_BASE_URL = "http://binaries.rubini.us/heroku" NODE_BP_PATH = "vendor/node/bin" diff --git a/spec/rails4_spec.rb b/spec/rails4_spec.rb index 7ae5c9740..5045b14dd 100644 --- a/spec/rails4_spec.rb +++ b/spec/rails4_spec.rb @@ -40,7 +40,6 @@ # Hatchet::Runner.new("rails4_windows_mri193").deploy do |app, heroku| # result = app.run("rails -v") # expect(result).to match("4.0.0") - # result = app.run("rake -T") # expect(result).to match("assets:precompile") diff --git a/spec/ruby_spec.rb b/spec/ruby_spec.rb index ef6c997d7..cf1c39b0e 100644 --- a/spec/ruby_spec.rb +++ b/spec/ruby_spec.rb @@ -1,6 +1,14 @@ require_relative 'spec_helper' describe "Ruby apps" do + describe "bundler ruby version matcher" do + it "installs a version even when not present in the Gemfile.lock" do + Hatchet::Runner.new('bundle-ruby-version-not-in-lockfile').deploy do |app| + expect(app.output).to match("2.3.1") + expect(app.run("ruby -v")).to match("2.3.1") + end + end + end # describe "default WEB_CONCURRENCY" do # it "auto scales WEB_CONCURRENCY" do From 088683acf9f6edde85179061480ec1850956cc2f Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 26 May 2016 12:58:14 -0500 Subject: [PATCH 0251/1195] Revert "Bump bundler 1.12.5" This reverts commit 377d8536b9d2571e9b78b14b90a8dc11da7bca8d. Caused an issue internal ticket reference 364182 Gemfile: ``` ruby "2.3.0" ``` Gemfile.lock ``` RUBY VERSION ruby 2.3.0p0 BUNDLED WITH 1.12.4 ``` Results in an invalid download URL ``` ! An error occurred while installing Ruby ruby-2.3.0-p0 ! For supported Ruby versions see https://devcenter.heroku.com/articles/ruby-support#supported-runtimes ! Note: Only the most recent version of Ruby 2.1 is supported on Cedar-14 ! Command: 'set -o pipefail; curl -L --fail --retry 3 --retry-delay 1 --connect-timeout 3 --max-time 30 https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/cedar-14/ruby-2.3.0-p0.tgz -s -o - | tar zxf - ' failed unexpectedly: ! ! gzip: stdin: unexpected end of file ! tar: Child returned status 1 ! tar: Error is not recoverable: exiting now ``` The URL should be: ``` https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/cedar-14/ruby-2.3.0.tgz ``` Without the p0. Investigating --- CHANGELOG.md | 2 -- hatchet.json | 3 +-- lib/language_pack/ruby.rb | 2 +- spec/rails4_spec.rb | 1 + spec/ruby_spec.rb | 8 -------- 5 files changed, 3 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c2ea0e3da..c2a4183bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,5 @@ ## Master -* Bump bundler to 1.12.5 [Bundler changfelog](https://github.com/bundler/bundler/blob/master/CHANGELOG.md#1123-2016-05-06). Allows for use of Ruby version operators. - ## v146 (03/23/2016) * Warn when `.bundle/config` is checked in (#471) diff --git a/hatchet.json b/hatchet.json index cf8be100a..0c43840e9 100644 --- a/hatchet.json +++ b/hatchet.json @@ -17,8 +17,7 @@ "sharpstone/git_gemspec", "sharpstone/no_lockfile", "sharpstone/sqlite3_gemfile", - "sharpstone/nokogiri_160", - "sharpstone/bundle-ruby-version-not-in-lockfile" + "sharpstone/nokogiri_160" ], "ruby": [ "sharpstone/mri_187", diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 4688d267b..bc6629e07 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -14,7 +14,7 @@ class LanguagePack::Ruby < LanguagePack::Base NAME = "ruby" LIBYAML_VERSION = "0.1.6" LIBYAML_PATH = "libyaml-#{LIBYAML_VERSION}" - BUNDLER_VERSION = "1.12.5" + BUNDLER_VERSION = "1.11.2" BUNDLER_GEM_PATH = "bundler-#{BUNDLER_VERSION}" RBX_BASE_URL = "http://binaries.rubini.us/heroku" NODE_BP_PATH = "vendor/node/bin" diff --git a/spec/rails4_spec.rb b/spec/rails4_spec.rb index 5045b14dd..7ae5c9740 100644 --- a/spec/rails4_spec.rb +++ b/spec/rails4_spec.rb @@ -40,6 +40,7 @@ # Hatchet::Runner.new("rails4_windows_mri193").deploy do |app, heroku| # result = app.run("rails -v") # expect(result).to match("4.0.0") + # result = app.run("rake -T") # expect(result).to match("assets:precompile") diff --git a/spec/ruby_spec.rb b/spec/ruby_spec.rb index cf1c39b0e..ef6c997d7 100644 --- a/spec/ruby_spec.rb +++ b/spec/ruby_spec.rb @@ -1,14 +1,6 @@ require_relative 'spec_helper' describe "Ruby apps" do - describe "bundler ruby version matcher" do - it "installs a version even when not present in the Gemfile.lock" do - Hatchet::Runner.new('bundle-ruby-version-not-in-lockfile').deploy do |app| - expect(app.output).to match("2.3.1") - expect(app.run("ruby -v")).to match("2.3.1") - end - end - end # describe "default WEB_CONCURRENCY" do # it "auto scales WEB_CONCURRENCY" do From 0ec19283b6e601037439e74745b19b5168bddcb0 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 26 May 2016 15:27:38 -0500 Subject: [PATCH 0252/1195] Revert "Revert "Bump bundler 1.12.5"" This reverts commit 088683acf9f6edde85179061480ec1850956cc2f. This PR bumps up the version of bundler to 1.12.5 which allows us to use Ruby version specifiers. Due to change in behavior in bundler https://github.com/bundler/bundler/issues/4621 we must now detect the when patchlevel is not needed and strip it everywhere we were previously using a version. Right now there is no way to know when a bundle platform failed with an invalid output, it doesn't do Ruby version validations so if you put "2.3.x" in your Gemfile, then it will return `ruby 2.3.x` back out at you which isn't a valid version and we can't download it. I'm going to update the "specify a ruby version" docs to include the ruby version specifiers. I've made this error when a build fails a bit cleaner. We're now only warning about Ruby 2.1 when they're trying to use Ruby 2.1. Also i'm identifying the curl output as "debug information" so hopefully fewer people will think that there is some really strange buildpack error and instead focus on our well written message with links. I would like to call out that for failed downloads people should try to re-deploy before declaring it a lost cause, but that's a bit too verbose for writing in an encyclopedic way inside the error output. Think most people will retry anyway. I'm also bumping up the retries to 5, because why not? It might mean that people deploying bad versions of Ruby get delayed by an extra 2 seconds, but hopefully it will cut down on the number of tickets that are solved by people re-running the deploy. --- CHANGELOG.md | 2 ++ hatchet.json | 4 ++- lib/language_pack/fetcher.rb | 2 +- lib/language_pack/ruby.rb | 43 ++++++++++++++++------------ lib/language_pack/ruby_version.rb | 15 ++++++++++ spec/helpers/bundler_wrapper_spec.rb | 9 ++++++ spec/rails4_spec.rb | 1 - spec/ruby_spec.rb | 14 +++++++++ 8 files changed, 68 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c2a4183bf..c2ea0e3da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Master +* Bump bundler to 1.12.5 [Bundler changfelog](https://github.com/bundler/bundler/blob/master/CHANGELOG.md#1123-2016-05-06). Allows for use of Ruby version operators. + ## v146 (03/23/2016) * Warn when `.bundle/config` is checked in (#471) diff --git a/hatchet.json b/hatchet.json index 0c43840e9..f5dbc79f5 100644 --- a/hatchet.json +++ b/hatchet.json @@ -14,10 +14,12 @@ ], "bundler": [ "sharpstone/bad_gemfile_on_platform", + "sharpstone/problem_gemfile_version", "sharpstone/git_gemspec", "sharpstone/no_lockfile", "sharpstone/sqlite3_gemfile", - "sharpstone/nokogiri_160" + "sharpstone/nokogiri_160", + "sharpstone/bundle-ruby-version-not-in-lockfile" ], "ruby": [ "sharpstone/mri_187", diff --git a/lib/language_pack/fetcher.rb b/lib/language_pack/fetcher.rb index 0165ac821..454b2b03e 100644 --- a/lib/language_pack/fetcher.rb +++ b/lib/language_pack/fetcher.rb @@ -31,7 +31,7 @@ def fetch_bunzip2(path, files_to_extract = nil) private def curl_command(command) - "set -o pipefail; curl -L --fail --retry 3 --retry-delay 1 --connect-timeout #{curl_connect_timeout_in_seconds} --max-time #{curl_timeout_in_seconds} #{command}" + "set -o pipefail; curl -L --fail --retry 5 --retry-delay 1 --connect-timeout #{curl_connect_timeout_in_seconds} --max-time #{curl_timeout_in_seconds} #{command}" end def curl_timeout_in_seconds diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index bc6629e07..d54536555 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -14,7 +14,7 @@ class LanguagePack::Ruby < LanguagePack::Base NAME = "ruby" LIBYAML_VERSION = "0.1.6" LIBYAML_PATH = "libyaml-#{LIBYAML_VERSION}" - BUNDLER_VERSION = "1.11.2" + BUNDLER_VERSION = "1.12.5" BUNDLER_GEM_PATH = "bundler-#{BUNDLER_VERSION}" RBX_BASE_URL = "http://binaries.rubini.us/heroku" NODE_BP_PATH = "vendor/node/bin" @@ -334,7 +334,7 @@ def install_ruby Dir.chdir(build_ruby_path) do ruby_vm = "ruby" instrument "ruby.fetch_build_ruby" do - @fetchers[:mri].fetch_untar("#{ruby_version.version.sub(ruby_vm, "#{ruby_vm}-build")}.tgz") + @fetchers[:mri].fetch_untar("#{ruby_version.version_for_download.sub(ruby_vm, "#{ruby_vm}-build")}.tgz") end end end @@ -343,7 +343,7 @@ def install_ruby Dir.chdir(slug_vendor_ruby) do instrument "ruby.fetch_ruby" do if ruby_version.rbx? - file = "#{ruby_version.version}.tar.bz2" + file = "#{ruby_version.version_for_download}.tar.bz2" sha_file = "#{file}.sha1" @fetchers[:rbx].fetch(file) @fetchers[:rbx].fetch(sha_file) @@ -363,7 +363,7 @@ def install_ruby FileUtils.rm(file) FileUtils.rm(sha_file) else - @fetchers[:mri].fetch_untar("#{ruby_version.version}.tgz") + @fetchers[:mri].fetch_untar("#{ruby_version.version_for_download}.tgz") end end end @@ -377,9 +377,9 @@ def install_ruby run("ln -s ../#{vendor_bin} #{app_bin_dir}") end - @metadata.write("buildpack_ruby_version", ruby_version.version) + @metadata.write("buildpack_ruby_version", ruby_version.version_for_download) - topic "Using Ruby version: #{ruby_version.version}" + topic "Using Ruby version: #{ruby_version.version_for_download}" if !ruby_version.set warn(<<-WARNING) You have not declared a Ruby version in your Gemfile. @@ -392,21 +392,26 @@ def install_ruby true rescue LanguagePack::Fetcher::FetchError => error - if ruby_version.jruby? - message = <= Gem::Version.new("1.9") end diff --git a/spec/helpers/bundler_wrapper_spec.rb b/spec/helpers/bundler_wrapper_spec.rb index 2a55ffd69..bbba1f58c 100644 --- a/spec/helpers/bundler_wrapper_spec.rb +++ b/spec/helpers/bundler_wrapper_spec.rb @@ -30,6 +30,15 @@ @bundler.install end + it "handles apps with ruby versions locked in Gemfile.lock" do + Hatchet::App.new("problem_gemfile_version").in_directory do |dir| + expect(@bundler.ruby_version).to eq("ruby-2.3.0-p0") + + ruby_version = LanguagePack::RubyVersion.new(@bundler.ruby_version, is_new: true) + expect(ruby_version.version_for_download).to eq("ruby-2.3.0") + end + end + it "handles JRuby pre gemfiles" do Hatchet::App.new("jruby-minimal").in_directory do |dir| expect(@bundler.ruby_version).to eq("ruby-2.2.0-jruby-9.0.0.0.pre1") diff --git a/spec/rails4_spec.rb b/spec/rails4_spec.rb index 7ae5c9740..5045b14dd 100644 --- a/spec/rails4_spec.rb +++ b/spec/rails4_spec.rb @@ -40,7 +40,6 @@ # Hatchet::Runner.new("rails4_windows_mri193").deploy do |app, heroku| # result = app.run("rails -v") # expect(result).to match("4.0.0") - # result = app.run("rake -T") # expect(result).to match("assets:precompile") diff --git a/spec/ruby_spec.rb b/spec/ruby_spec.rb index ef6c997d7..533dec70b 100644 --- a/spec/ruby_spec.rb +++ b/spec/ruby_spec.rb @@ -1,6 +1,20 @@ require_relative 'spec_helper' describe "Ruby apps" do + describe "bundler ruby version matcher" do + it "installs a version even when not present in the Gemfile.lock" do + Hatchet::Runner.new('bundle-ruby-version-not-in-lockfile').deploy do |app| + expect(app.output).to match("2.3.1") + expect(app.run("ruby -v")).to match("2.3.1") + end + end + + it "works even when patchfile is specified" do + Hatchet::Runner.new('problem_gemfile_version').deploy do |app| + expect(app.output).to match("2.3.0") + end + end + end # describe "default WEB_CONCURRENCY" do # it "auto scales WEB_CONCURRENCY" do From 21775d62252ccfc2a041bad4f6df45c129383905 Mon Sep 17 00:00:00 2001 From: Jonah Hirsch Date: Mon, 16 Nov 2015 11:43:53 -0700 Subject: [PATCH 0253/1195] Mention that non-recommended usages are not recommended in warning output --- lib/language_pack/rails2.rb | 1 + lib/language_pack/ruby.rb | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/language_pack/rails2.rb b/lib/language_pack/rails2.rb index 0e714bd5e..4586230fe 100644 --- a/lib/language_pack/rails2.rb +++ b/lib/language_pack/rails2.rb @@ -54,6 +54,7 @@ def best_practice_warnings if env("RAILS_ENV") != "production" warn(<<-WARNING) You are deploying to a non-production environment: #{ env("RAILS_ENV").inspect }. +This is not recommended. See https://devcenter.heroku.com/articles/deploying-to-a-custom-rails-environment for more information. WARNING end diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index d54536555..eec2b3bec 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -79,6 +79,7 @@ def best_practice_warnings if bundler.has_gem?("asset_sync") warn(<<-WARNING) You are using the `asset_sync` gem. +This is not recommended. See https://devcenter.heroku.com/articles/please-do-not-use-asset-sync for more information. WARNING end From 79a2fa2a59487b0cc3b56c3bd48acdd739e862ea Mon Sep 17 00:00:00 2001 From: JuanitoFatas Date: Tue, 30 Aug 2016 20:30:26 +0800 Subject: [PATCH 0254/1195] Update Bundler website url [ci skip] --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d4dd03b47..9def42bc5 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Heroku Buildpack for Ruby ![ruby](https://cloud.githubusercontent.com/assets/51578/13712725/3c6b3368-e793-11e5-83c1-728440111358.png) -This is a [Heroku Buildpack](http://devcenter.heroku.com/articles/buildpacks) for Ruby, Rack, and Rails apps. It uses [Bundler](http://gembundler.com) for dependency management. +This is a [Heroku Buildpack](http://devcenter.heroku.com/articles/buildpacks) for Ruby, Rack, and Rails apps. It uses [Bundler](https://bundler.io) for dependency management. This buildpack requires 64-bit Linux. @@ -32,7 +32,7 @@ Example Usage: Procfile declares types -> (none) Default types for Ruby -> console, rake -The buildpack will detect your app as Ruby if it has a `Gemfile` and `Gemfile.lock` files in the root directory. It will then proceed to run `bundle install` after setting up the appropriate environment for [ruby](http://ruby-lang.org) and [Bundler](http://gembundler.com). +The buildpack will detect your app as Ruby if it has a `Gemfile` and `Gemfile.lock` files in the root directory. It will then proceed to run `bundle install` after setting up the appropriate environment for [ruby](http://ruby-lang.org) and [Bundler](https://bundler.io). #### Bundler From 496a64c31c151f37ab43650f19fddfee5036f1af Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 22 Sep 2016 11:05:10 -0500 Subject: [PATCH 0255/1195] Bundler v1.13.1 --- CHANGELOG.md | 2 +- lib/language_pack/ruby.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c2ea0e3da..a025f52ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ## Master -* Bump bundler to 1.12.5 [Bundler changfelog](https://github.com/bundler/bundler/blob/master/CHANGELOG.md#1123-2016-05-06). Allows for use of Ruby version operators. +* Bump bundler to 1.13.1 [Bundler changfelog](https://github.com/bundler/bundler/blob/master/CHANGELOG.md#1131-2016-09-13). Allows for use of Ruby version operators. ## v146 (03/23/2016) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index d54536555..c71119e9d 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -14,7 +14,7 @@ class LanguagePack::Ruby < LanguagePack::Base NAME = "ruby" LIBYAML_VERSION = "0.1.6" LIBYAML_PATH = "libyaml-#{LIBYAML_VERSION}" - BUNDLER_VERSION = "1.12.5" + BUNDLER_VERSION = "1.13.1" BUNDLER_GEM_PATH = "bundler-#{BUNDLER_VERSION}" RBX_BASE_URL = "http://binaries.rubini.us/heroku" NODE_BP_PATH = "vendor/node/bin" From 8d8e0ae2aa1039021b39fbbc262cbc321972ef11 Mon Sep 17 00:00:00 2001 From: Kazuhiro NISHIYAMA Date: Sat, 24 Sep 2016 00:47:19 +0900 Subject: [PATCH 0256/1195] Fix a typo --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a025f52ba..7994caf55 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ## Master -* Bump bundler to 1.13.1 [Bundler changfelog](https://github.com/bundler/bundler/blob/master/CHANGELOG.md#1131-2016-09-13). Allows for use of Ruby version operators. +* Bump bundler to 1.13.1 [Bundler changelog](https://github.com/bundler/bundler/blob/master/CHANGELOG.md#1131-2016-09-13). Allows for use of Ruby version operators. ## v146 (03/23/2016) From c76f9e89b2acf18219474e79025dbe6a7b96c63a Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 28 Sep 2016 14:45:01 -0500 Subject: [PATCH 0257/1195] Announce when we detect Rake tasks Right now people are putting infinite scripts in their rakefile and it looks like it's getting stuck in `bundle clean` when it should look like it's getting stuck while detecting rake tasks. --- lib/language_pack/ruby.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index c71119e9d..260174111 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -747,6 +747,7 @@ def rake rake_gem_available = bundler.has_gem?("rake") || ruby_version.rake_is_vendored? raise_on_fail = bundler.gem_version('railties') && bundler.gem_version('railties') > Gem::Version.new('3.x') + topic "Detecting rake tasks" rake = LanguagePack::Helpers::RakeRunner.new(rake_gem_available) rake.load_rake_tasks!({ env: rake_env }, raise_on_fail) rake From 69493df17d7dd897bf247e9cc2d7b8679a73303d Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 4 Oct 2016 10:46:08 -0500 Subject: [PATCH 0258/1195] Bundler 1.13.2 --- CHANGELOG.md | 2 +- lib/language_pack/ruby.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7994caf55..84950e504 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ## Master -* Bump bundler to 1.13.1 [Bundler changelog](https://github.com/bundler/bundler/blob/master/CHANGELOG.md#1131-2016-09-13). Allows for use of Ruby version operators. +* Bump bundler to 1.13.2 [Bundler changelog](https://github.com/bundler/bundler/blob/master/CHANGELOG.md#1132-2016-09-30). Allows for use of Ruby version operators. ## v146 (03/23/2016) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index c71119e9d..5bc4e198d 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -14,7 +14,7 @@ class LanguagePack::Ruby < LanguagePack::Base NAME = "ruby" LIBYAML_VERSION = "0.1.6" LIBYAML_PATH = "libyaml-#{LIBYAML_VERSION}" - BUNDLER_VERSION = "1.13.1" + BUNDLER_VERSION = "1.13.2" BUNDLER_GEM_PATH = "bundler-#{BUNDLER_VERSION}" RBX_BASE_URL = "http://binaries.rubini.us/heroku" NODE_BP_PATH = "vendor/node/bin" From e0c6c985dea4b362645c22aa464b13b9ad8b88d2 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 13 Oct 2016 09:59:59 -0500 Subject: [PATCH 0259/1195] Bundler 1.13.3 --- CHANGELOG.md | 2 +- lib/language_pack/ruby.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 84950e504..1e0cee0f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ## Master -* Bump bundler to 1.13.2 [Bundler changelog](https://github.com/bundler/bundler/blob/master/CHANGELOG.md#1132-2016-09-30). Allows for use of Ruby version operators. +* Bump bundler to 1.13.3 [Bundler changelog](https://github.com/bundler/bundler/blob/master/CHANGELOG.md#1133-2016-10-10). Allows for use of Ruby version operators. ## v146 (03/23/2016) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 03a103619..35f76e38e 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -14,7 +14,7 @@ class LanguagePack::Ruby < LanguagePack::Base NAME = "ruby" LIBYAML_VERSION = "0.1.6" LIBYAML_PATH = "libyaml-#{LIBYAML_VERSION}" - BUNDLER_VERSION = "1.13.2" + BUNDLER_VERSION = "1.13.3" BUNDLER_GEM_PATH = "bundler-#{BUNDLER_VERSION}" RBX_BASE_URL = "http://binaries.rubini.us/heroku" NODE_BP_PATH = "vendor/node/bin" From aca9eeefcd6c55552eb7299772abf703bd848776 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 17 Oct 2016 09:19:22 -0500 Subject: [PATCH 0260/1195] Bundler v1.13.4 --- CHANGELOG.md | 2 +- lib/language_pack/ruby.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e0cee0f8..21f85e44f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ## Master -* Bump bundler to 1.13.3 [Bundler changelog](https://github.com/bundler/bundler/blob/master/CHANGELOG.md#1133-2016-10-10). Allows for use of Ruby version operators. +* Bump bundler to 1.13.4 [Bundler changelog](https://github.com/bundler/bundler/blob/master/CHANGELOG.md#1133-2016-10-10). Allows for use of Ruby version operators. ## v146 (03/23/2016) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 35f76e38e..e28844ece 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -14,7 +14,7 @@ class LanguagePack::Ruby < LanguagePack::Base NAME = "ruby" LIBYAML_VERSION = "0.1.6" LIBYAML_PATH = "libyaml-#{LIBYAML_VERSION}" - BUNDLER_VERSION = "1.13.3" + BUNDLER_VERSION = "1.13.4" BUNDLER_GEM_PATH = "bundler-#{BUNDLER_VERSION}" RBX_BASE_URL = "http://binaries.rubini.us/heroku" NODE_BP_PATH = "vendor/node/bin" From 9af3a7549480096fc581b45410986a7fe2cd151d Mon Sep 17 00:00:00 2001 From: Kazuhiro NISHIYAMA Date: Tue, 18 Oct 2016 21:19:01 +0900 Subject: [PATCH 0261/1195] Fix URL of Bundler changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 21f85e44f..1bbb7ce2c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ## Master -* Bump bundler to 1.13.4 [Bundler changelog](https://github.com/bundler/bundler/blob/master/CHANGELOG.md#1133-2016-10-10). Allows for use of Ruby version operators. +* Bump bundler to 1.13.4 [Bundler changelog](https://github.com/bundler/bundler/blob/master/CHANGELOG.md#1134-2016-10-11). Allows for use of Ruby version operators. ## v146 (03/23/2016) From 48ac2c0801aeb03c320c058d5c1232aa422337a9 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 24 Oct 2016 09:53:12 -0500 Subject: [PATCH 0262/1195] Bundler 1.13.6 --- CHANGELOG.md | 2 +- lib/language_pack/ruby.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1bbb7ce2c..b6b3ba63e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ## Master -* Bump bundler to 1.13.4 [Bundler changelog](https://github.com/bundler/bundler/blob/master/CHANGELOG.md#1134-2016-10-11). Allows for use of Ruby version operators. +* Bump bundler to 1.13.6 [Bundler changelog](https://github.com/bundler/bundler/blob/master/CHANGELOG.md). Allows for use of Ruby version operators. ## v146 (03/23/2016) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index e28844ece..f45088e62 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -14,7 +14,7 @@ class LanguagePack::Ruby < LanguagePack::Base NAME = "ruby" LIBYAML_VERSION = "0.1.6" LIBYAML_PATH = "libyaml-#{LIBYAML_VERSION}" - BUNDLER_VERSION = "1.13.4" + BUNDLER_VERSION = "1.13.6" BUNDLER_GEM_PATH = "bundler-#{BUNDLER_VERSION}" RBX_BASE_URL = "http://binaries.rubini.us/heroku" NODE_BP_PATH = "vendor/node/bin" From 7ec0f3d00789cd79bf8cd146159b399b37ba6fb5 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 24 Oct 2016 11:19:15 -0500 Subject: [PATCH 0263/1195] [CI Skip] Fix changelog link --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b6b3ba63e..0e75ab86d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ## Master -* Bump bundler to 1.13.6 [Bundler changelog](https://github.com/bundler/bundler/blob/master/CHANGELOG.md). Allows for use of Ruby version operators. +* Bump bundler to 1.13.6 [Bundler changelog](https://github.com/bundler/bundler/blob/v1.13.6/CHANGELOG.md). Allows for use of Ruby version operators. ## v146 (03/23/2016) From 0405e71d768b806fa3f412ad696af86873dd20ca Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 15 Nov 2016 12:29:25 -0600 Subject: [PATCH 0264/1195] Ruby 2.4.0-preview3 support --- Gemfile | 1 + Gemfile.lock | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/Gemfile b/Gemfile index c8b4a4f5f..270070c44 100644 --- a/Gemfile +++ b/Gemfile @@ -10,4 +10,5 @@ group :development, :test do gem 'rspec-retry' gem "netrc" gem "git", github: "hone/ruby-git", branch: "master" + gem 'json', '~> 2.0.2' end diff --git a/Gemfile.lock b/Gemfile.lock index 9e1110002..3f10d116b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -8,12 +8,12 @@ GIT GEM remote: https://rubygems.org/ specs: - activesupport (4.2.0) - i18n (~> 0.7) - json (~> 1.7, >= 1.7.7) - minitest (~> 5.1) - thread_safe (~> 0.3, >= 0.3.4) - tzinfo (~> 1.1) + activesupport (4.0.13) + i18n (~> 0.6, >= 0.6.9) + minitest (~> 4.2) + multi_json (~> 1.3) + thread_safe (~> 0.1) + tzinfo (~> 0.3.37) anvil-cli (0.16.2) progress (~> 2.4, >= 2.4.0) rest-client (~> 1.6, >= 1.6.7) @@ -33,9 +33,9 @@ GEM thor (~> 0) threaded (~> 0) i18n (0.7.0) - json (1.8.2) + json (2.0.2) mime-types (2.4.3) - minitest (5.5.1) + minitest (4.7.5) multi_json (1.11.2) netrc (0.10.2) parallel (1.8.0) @@ -58,10 +58,9 @@ GEM rspec-core rspec-support (3.4.1) thor (0.19.1) - thread_safe (0.3.4) + thread_safe (0.3.5) threaded (0.0.4) - tzinfo (1.2.2) - thread_safe (~> 0.1) + tzinfo (0.3.52) PLATFORMS ruby @@ -70,6 +69,7 @@ DEPENDENCIES excon git! heroku_hatchet + json (~> 2.0.2) netrc parallel_tests rake @@ -78,4 +78,4 @@ DEPENDENCIES rspec-retry BUNDLED WITH - 1.12.3 + 1.13.6 From 5eb906e9d79a0d60e95e7f7faeaa10dcbd6864c2 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 15 Nov 2016 12:29:33 -0600 Subject: [PATCH 0265/1195] bump to v147 --- lib/language_pack/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 575e012f5..fb26242e8 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v146" + BUILDPACK_VERSION = "v147" end end From 148a08554cf98b6e2c48c758674914fec8cdc455 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 15 Nov 2016 12:30:07 -0600 Subject: [PATCH 0266/1195] [ci skip] v147 --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e75ab86d..1bbda3f8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Master +## v147 (11/15/2016) + * Bump bundler to 1.13.6 [Bundler changelog](https://github.com/bundler/bundler/blob/v1.13.6/CHANGELOG.md). Allows for use of Ruby version operators. ## v146 (03/23/2016) From 1e3a9c795eb6e9a7af306abec4001ae66d706db9 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Tue, 15 Nov 2016 14:15:23 -0600 Subject: [PATCH 0267/1195] purge bundler cache for the libyaml 0.1.7 update on Ruby 2.1.9/2.1.10 --- lib/language_pack/ruby.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index f45088e62..7c6877718 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -923,6 +923,14 @@ def load_bundler_cache purge_bundler_cache end + # recompile gems for libyaml 0.1.7 update + if @metadata.exists?(buildpack_version_cache) && (bv = @metadata.read(buildpack_version_cache).sub('v', '').to_i) && bv != 0 && bv <= 147 && + @metadata.exists?(ruby_version_cache) && @metadata.read(ruby_version_cache).chomp.match(/ruby 2\.1\.(9|10)/) + puts "Need to recompile gems for CVE-2014-2014-9130. Clearing bundler cache." + puts "See https://devcenter.heroku.com/changelog-items/1016." + purge_bundler_cache + end + FileUtils.mkdir_p(heroku_metadata) @metadata.write(ruby_version_cache, full_ruby_version, false) @metadata.write(buildpack_version_cache, BUILDPACK_VERSION, false) From 151078985f39d43aacc4edf55f838ed5faf7484e Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Tue, 15 Nov 2016 17:46:28 -0600 Subject: [PATCH 0268/1195] recompile gems if using the psych gem to pick up libyaml 0.1.7 --- lib/language_pack/ruby.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 7c6877718..e8e5c2728 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -12,7 +12,7 @@ # base Ruby Language Pack. This is for any base ruby app. class LanguagePack::Ruby < LanguagePack::Base NAME = "ruby" - LIBYAML_VERSION = "0.1.6" + LIBYAML_VERSION = "0.1.7" LIBYAML_PATH = "libyaml-#{LIBYAML_VERSION}" BUNDLER_VERSION = "1.13.6" BUNDLER_GEM_PATH = "bundler-#{BUNDLER_VERSION}" @@ -519,7 +519,7 @@ def install_libyaml(dir) instrument 'ruby.install_libyaml' do FileUtils.mkdir_p dir Dir.chdir(dir) do |dir| - @fetchers[:buildpack].fetch_untar("#{LIBYAML_PATH}.tgz") + @fetchers[:buildpack].fetch_untar("#{@stack}/#{LIBYAML_PATH}.tgz") end end end @@ -925,7 +925,9 @@ def load_bundler_cache # recompile gems for libyaml 0.1.7 update if @metadata.exists?(buildpack_version_cache) && (bv = @metadata.read(buildpack_version_cache).sub('v', '').to_i) && bv != 0 && bv <= 147 && - @metadata.exists?(ruby_version_cache) && @metadata.read(ruby_version_cache).chomp.match(/ruby 2\.1\.(9|10)/) + (@metadata.exists?(ruby_version_cache) && @metadata.read(ruby_version_cache).chomp.match(/ruby 2\.1\.(9|10)/) || + bundler.has_gem?("psych") + ) puts "Need to recompile gems for CVE-2014-2014-9130. Clearing bundler cache." puts "See https://devcenter.heroku.com/changelog-items/1016." purge_bundler_cache From f4128be1f96bf83fbca78ec356b6f339d63c2d7d Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Wed, 16 Nov 2016 16:17:09 -0600 Subject: [PATCH 0269/1195] bump default ruby version to 2.2.6 --- lib/language_pack/ruby_version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/ruby_version.rb b/lib/language_pack/ruby_version.rb index f95226abe..9dfd0d522 100644 --- a/lib/language_pack/ruby_version.rb +++ b/lib/language_pack/ruby_version.rb @@ -12,7 +12,7 @@ def initialize(output = "") end end - DEFAULT_VERSION_NUMBER = "2.2.4" + DEFAULT_VERSION_NUMBER = "2.2.6" DEFAULT_VERSION = "ruby-#{DEFAULT_VERSION_NUMBER}" LEGACY_VERSION_NUMBER = "1.9.2" LEGACY_VERSION = "ruby-#{LEGACY_VERSION_NUMBER}" From 769af8cd500156548a0a973bf980ce4e03ae5b94 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Thu, 17 Nov 2016 15:40:49 -0600 Subject: [PATCH 0270/1195] update changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1bbda3f8b..4843eb8e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ ## Master +## v148 (11/17/2016) + +* Default Ruby Version is 2.2.6 +* Update libyaml to 0.1.7 for [CVE-2014-9130](https://devcenter.heroku.com/changelog-items/1016) + ## v147 (11/15/2016) * Bump bundler to 1.13.6 [Bundler changelog](https://github.com/bundler/bundler/blob/v1.13.6/CHANGELOG.md). Allows for use of Ruby version operators. From bebfa5fd68da49c8ca0d2e2d3f8c8bc9d7aa9153 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Thu, 17 Nov 2016 15:42:07 -0600 Subject: [PATCH 0271/1195] bump to v148 --- lib/language_pack/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index fb26242e8..85ab6b7e0 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v147" + BUILDPACK_VERSION = "v148" end end From d621ce9371f86717655946781a5ccac640545eb9 Mon Sep 17 00:00:00 2001 From: Damien Mathieu Date: Fri, 25 Nov 2016 14:55:26 +0100 Subject: [PATCH 0272/1195] initialize env before detecting the app type Detecting the app type requires bundler, which makes a curl call. Initializing the env after means we cannot override CURL_CONNECT_TIMEOUT or CURL_TIMEOUT. --- bin/compile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/compile b/bin/compile index 1c18ff411..d5eb40a33 100755 --- a/bin/compile +++ b/bin/compile @@ -9,8 +9,8 @@ require "language_pack/shell_helpers" begin LanguagePack::Instrument.trace 'compile', 'app.compile' do + LanguagePack::ShellHelpers.initialize_env(ARGV[2]) if pack = LanguagePack.detect(ARGV[0], ARGV[1]) - LanguagePack::ShellHelpers.initialize_env(ARGV[2]) pack.topic("Compiling #{pack.name}") pack.log("compile") do pack.compile From 730679883d35d98a3f1f0f8ef6400caf7463f575 Mon Sep 17 00:00:00 2001 From: Damien Mathieu Date: Mon, 28 Nov 2016 10:09:51 +0100 Subject: [PATCH 0273/1195] use ShellHelper#env in language pack fetcher Custom env vars aren't set into the global `ENV` variable. Without this change, we can't set custom CURL timeouts in curl requests. --- lib/language_pack/fetcher.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/language_pack/fetcher.rb b/lib/language_pack/fetcher.rb index 454b2b03e..56daf5951 100644 --- a/lib/language_pack/fetcher.rb +++ b/lib/language_pack/fetcher.rb @@ -35,11 +35,11 @@ def curl_command(command) end def curl_timeout_in_seconds - ENV['CURL_TIMEOUT'] || 30 + env('CURL_TIMEOUT') || 30 end def curl_connect_timeout_in_seconds - ENV['CURL_CONNECT_TIMEOUT'] || 3 + env('CURL_CONNECT_TIMEOUT') || 3 end def load_config From 7190c68c9d61f6463aead8a3e9139359ac60259d Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 28 Nov 2016 14:31:37 -0600 Subject: [PATCH 0274/1195] [close #507] Show bundler warning earlier We should be showing a bundler upgrade warning as soon as possible. Currently if you select a "bad" version of ruby in your Gemfile.lock you will not get this error. This is a problem for users who are running into https://devcenter.heroku.com/articles/bundler-version#known-upgrade-issues, while the bug is well known and documented, they're not being directed to that page. This patch will emit an upgrade warning for bundler before we even try downloading it. This should ensure the warning is always present in build outputs. --- CHANGELOG.md | 2 ++ hatchet.json | 1 + lib/language_pack/ruby.rb | 28 ++++++++++++++++------------ 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4843eb8e7..5bc4729b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Master +* Guarantee we always show warning when upgrading bundler version. + ## v148 (11/17/2016) * Default Ruby Version is 2.2.6 diff --git a/hatchet.json b/hatchet.json index f5dbc79f5..1cc3ab6be 100644 --- a/hatchet.json +++ b/hatchet.json @@ -29,6 +29,7 @@ "sharpstone/ruby_193_jruby_17161", "sharpstone/ruby_193_jruby_17161_jdk7", "sharpstone/ruby_193_jruby_17161_jdk8", + "sharpstone/ruby_193_bad_patch_cedar_14", "sharpstone/jruby-minimal", "sharpstone/empty-procfile", "sharpstone/bad_ruby_version", diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index e8e5c2728..70d93abfd 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -90,6 +90,7 @@ def compile new_app? Dir.chdir(build_path) remove_vendor_bundle + warn_bundler_upgrade install_ruby install_jvm setup_language_pack_environment @@ -110,6 +111,21 @@ def compile private + def warn_bundler_upgrade + old_bundler_version = @metadata.read("bundler_version").chomp if @metadata.exists?("bundler_version") + + if old_bundler_version && old_bundler_version != BUNDLER_VERSION + puts(<<-WARNING) +Your app was upgraded to bundler #{ BUNDLER_VERSION }. +Previously you had a successful deploy with bundler #{ old_bundler_version }. + +If you see problems related to the bundler version please refer to: +https://devcenter.heroku.com/articles/bundler-version + +WARNING + end + end + # the base PATH environment variable to be used # @return [String] the resulting PATH def default_path @@ -852,22 +868,10 @@ def load_bundler_cache rubygems_version_cache = "rubygems_version" stack_cache = "stack" - old_bundler_version = @metadata.read(bundler_version_cache).chomp if @metadata.exists?(bundler_version_cache) old_rubygems_version = @metadata.read(ruby_version_cache).chomp if @metadata.exists?(ruby_version_cache) old_stack = @metadata.read(stack_cache).chomp if @metadata.exists?(stack_cache) old_stack ||= DEFAULT_LEGACY_STACK - if old_bundler_version && old_bundler_version != BUNDLER_VERSION - puts(<<-WARNING) -Your app was upgraded to bundler #{ BUNDLER_VERSION }. -Previously you had a successful deploy with bundler #{ old_bundler_version }. - -If you see problems related to the bundler version please refer to: -https://devcenter.heroku.com/articles/bundler-version - -WARNING - end - stack_change = old_stack != @stack convert_stack = @bundler_cache.old? @bundler_cache.convert_stack(stack_change) if convert_stack From b2ed5cd4917415f84ea205f6d07124f7dd6dd4a7 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 1 Dec 2016 12:45:19 -0600 Subject: [PATCH 0275/1195] v149 --- CHANGELOG.md | 2 ++ lib/language_pack/version.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5bc4729b0..a30ef758a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Master +## v149 (12/01/2016) + * Guarantee we always show warning when upgrading bundler version. ## v148 (11/17/2016) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 85ab6b7e0..994f665cd 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v148" + BUILDPACK_VERSION = "v149" end end From f041dc9bbbc8f32693f4aecb7fc73b2207df651b Mon Sep 17 00:00:00 2001 From: schneems Date: Fri, 9 Dec 2016 12:40:20 -0800 Subject: [PATCH 0276/1195] Error formatting --- lib/language_pack/ruby.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 9f8a86dcd..f2df43253 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -652,12 +652,11 @@ def build_bundler error_message = "Failed to install gems via Bundler." puts "Bundler Output: #{bundler_output}" if bundler_output.match(/An error occurred while installing sqlite3/) - error_message += < Date: Fri, 9 Dec 2016 12:40:40 -0800 Subject: [PATCH 0277/1195] Emit helpful url on Ruby version mismatch --- lib/language_pack/ruby.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index f2df43253..769f19a04 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -659,6 +659,15 @@ def build_bundler ERROR end + if bundler_output.match(/but your Gemfile specified/) + error_message += <<-ERROR + +Detected a mismatch between your Ruby version installed and +Ruby version specified in Gemfile or Gemfile.lock: +https://devcenter.heroku.com/articles/ruby-versions#your-ruby-version-is-x-but-your-gemfile-specified-y + ERROR + end + error error_message end end From 26811fee58acd359d2a6ed514d8a50e785f7247d Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Tue, 20 Dec 2016 17:06:52 -0600 Subject: [PATCH 0278/1195] handle lockfile having negative patchlevels coming from Gemfile.lock --- lib/language_pack/helpers/bundler_wrapper.rb | 2 +- lib/language_pack/ruby_version.rb | 6 +++--- spec/helpers/ruby_version_spec.rb | 8 ++++++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index 3a12e0999..8ec410e7f 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -100,7 +100,7 @@ def ruby_version if output.match(/No ruby version specified/) "" else - output.chomp.sub('(', '').sub(')', '').sub(/(p\d+)/, ' \1').split.join('-') + output.chomp.sub('(', '').sub(')', '').sub(/(p-?\d+)/, ' \1').split.join('-') end end end diff --git a/lib/language_pack/ruby_version.rb b/lib/language_pack/ruby_version.rb index 9dfd0d522..58d79de82 100644 --- a/lib/language_pack/ruby_version.rb +++ b/lib/language_pack/ruby_version.rb @@ -18,7 +18,7 @@ def initialize(output = "") LEGACY_VERSION = "ruby-#{LEGACY_VERSION_NUMBER}" RUBY_VERSION_REGEX = %r{ (?\d+\.\d+\.\d+){0} - (?p\d+){0} + (?p-?\d+){0} (?\w+){0} (?.+){0} @@ -35,12 +35,12 @@ def initialize(bundler_output, app = {}) set_version parse_version - @version_without_patchlevel = @version.sub(/-p[\d]+/, '') + @version_without_patchlevel = @version.sub(/-p-?\d+/, '') end # https://github.com/bundler/bundler/issues/4621 def version_for_download - if patchlevel_is_significant? + if patchlevel_is_significant? && @patchlevel.sub(/p/, '').to_i >= 0 @version else version_without_patchlevel diff --git a/spec/helpers/ruby_version_spec.rb b/spec/helpers/ruby_version_spec.rb index 8087a0627..5c339b728 100644 --- a/spec/helpers/ruby_version_spec.rb +++ b/spec/helpers/ruby_version_spec.rb @@ -28,6 +28,14 @@ end end + it "does not include patchlevels when the patchlevel is negative for download" do + ruby_version = LanguagePack::RubyVersion.new("ruby-2.0.0-p-1") + expect(ruby_version.version_for_download).to eq("ruby-2.0.0") + + ruby_version = LanguagePack::RubyVersion.new("ruby-2.4.0-p-1") + expect(ruby_version.version_for_download).to eq("ruby-2.4.0") + end + it "correctly sets ruby version for bundler specified versions" do Hatchet::App.new("mri_193").in_directory do |dir| ruby_version = LanguagePack::RubyVersion.new(@bundler.install.ruby_version, is_new: true) From 3c3ec4d1568950fe36315de8c194008300b9c871 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 21 Dec 2016 13:29:01 -0600 Subject: [PATCH 0279/1195] Revert "handle lockfile having negative patchlevels coming from Gemfile.lock" This reverts commit 26811fee58acd359d2a6ed514d8a50e785f7247d. --- lib/language_pack/helpers/bundler_wrapper.rb | 2 +- lib/language_pack/ruby_version.rb | 6 +++--- spec/helpers/ruby_version_spec.rb | 8 -------- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index 8ec410e7f..3a12e0999 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -100,7 +100,7 @@ def ruby_version if output.match(/No ruby version specified/) "" else - output.chomp.sub('(', '').sub(')', '').sub(/(p-?\d+)/, ' \1').split.join('-') + output.chomp.sub('(', '').sub(')', '').sub(/(p\d+)/, ' \1').split.join('-') end end end diff --git a/lib/language_pack/ruby_version.rb b/lib/language_pack/ruby_version.rb index 58d79de82..9dfd0d522 100644 --- a/lib/language_pack/ruby_version.rb +++ b/lib/language_pack/ruby_version.rb @@ -18,7 +18,7 @@ def initialize(output = "") LEGACY_VERSION = "ruby-#{LEGACY_VERSION_NUMBER}" RUBY_VERSION_REGEX = %r{ (?\d+\.\d+\.\d+){0} - (?p-?\d+){0} + (?p\d+){0} (?\w+){0} (?.+){0} @@ -35,12 +35,12 @@ def initialize(bundler_output, app = {}) set_version parse_version - @version_without_patchlevel = @version.sub(/-p-?\d+/, '') + @version_without_patchlevel = @version.sub(/-p[\d]+/, '') end # https://github.com/bundler/bundler/issues/4621 def version_for_download - if patchlevel_is_significant? && @patchlevel.sub(/p/, '').to_i >= 0 + if patchlevel_is_significant? @version else version_without_patchlevel diff --git a/spec/helpers/ruby_version_spec.rb b/spec/helpers/ruby_version_spec.rb index 5c339b728..8087a0627 100644 --- a/spec/helpers/ruby_version_spec.rb +++ b/spec/helpers/ruby_version_spec.rb @@ -28,14 +28,6 @@ end end - it "does not include patchlevels when the patchlevel is negative for download" do - ruby_version = LanguagePack::RubyVersion.new("ruby-2.0.0-p-1") - expect(ruby_version.version_for_download).to eq("ruby-2.0.0") - - ruby_version = LanguagePack::RubyVersion.new("ruby-2.4.0-p-1") - expect(ruby_version.version_for_download).to eq("ruby-2.4.0") - end - it "correctly sets ruby version for bundler specified versions" do Hatchet::App.new("mri_193").in_directory do |dir| ruby_version = LanguagePack::RubyVersion.new(@bundler.install.ruby_version, is_new: true) From 6488de8c7b50f4ebaec3ea9a93520de8a6a3c46f Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 21 Dec 2016 13:29:42 -0600 Subject: [PATCH 0280/1195] Revert "Revert "handle lockfile having negative patchlevels coming from Gemfile.lock"" This reverts commit 3c3ec4d1568950fe36315de8c194008300b9c871. --- lib/language_pack/helpers/bundler_wrapper.rb | 2 +- lib/language_pack/ruby_version.rb | 6 +++--- spec/helpers/ruby_version_spec.rb | 8 ++++++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index 3a12e0999..8ec410e7f 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -100,7 +100,7 @@ def ruby_version if output.match(/No ruby version specified/) "" else - output.chomp.sub('(', '').sub(')', '').sub(/(p\d+)/, ' \1').split.join('-') + output.chomp.sub('(', '').sub(')', '').sub(/(p-?\d+)/, ' \1').split.join('-') end end end diff --git a/lib/language_pack/ruby_version.rb b/lib/language_pack/ruby_version.rb index 9dfd0d522..58d79de82 100644 --- a/lib/language_pack/ruby_version.rb +++ b/lib/language_pack/ruby_version.rb @@ -18,7 +18,7 @@ def initialize(output = "") LEGACY_VERSION = "ruby-#{LEGACY_VERSION_NUMBER}" RUBY_VERSION_REGEX = %r{ (?\d+\.\d+\.\d+){0} - (?p\d+){0} + (?p-?\d+){0} (?\w+){0} (?.+){0} @@ -35,12 +35,12 @@ def initialize(bundler_output, app = {}) set_version parse_version - @version_without_patchlevel = @version.sub(/-p[\d]+/, '') + @version_without_patchlevel = @version.sub(/-p-?\d+/, '') end # https://github.com/bundler/bundler/issues/4621 def version_for_download - if patchlevel_is_significant? + if patchlevel_is_significant? && @patchlevel.sub(/p/, '').to_i >= 0 @version else version_without_patchlevel diff --git a/spec/helpers/ruby_version_spec.rb b/spec/helpers/ruby_version_spec.rb index 8087a0627..5c339b728 100644 --- a/spec/helpers/ruby_version_spec.rb +++ b/spec/helpers/ruby_version_spec.rb @@ -28,6 +28,14 @@ end end + it "does not include patchlevels when the patchlevel is negative for download" do + ruby_version = LanguagePack::RubyVersion.new("ruby-2.0.0-p-1") + expect(ruby_version.version_for_download).to eq("ruby-2.0.0") + + ruby_version = LanguagePack::RubyVersion.new("ruby-2.4.0-p-1") + expect(ruby_version.version_for_download).to eq("ruby-2.4.0") + end + it "correctly sets ruby version for bundler specified versions" do Hatchet::App.new("mri_193").in_directory do |dir| ruby_version = LanguagePack::RubyVersion.new(@bundler.install.ruby_version, is_new: true) From e20a282ca00e1c60adb3830ef779620317536b74 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 21 Dec 2016 13:32:23 -0600 Subject: [PATCH 0281/1195] Check for nil patchlevel --- CHANGELOG.md | 7 +++++++ lib/language_pack/ruby_version.rb | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a30ef758a..86a1328b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ ## Master +* Allow deployment of pre-release rubies (preview and rc) with Bundler 1.13.6+. This is needed because the patch level is recorded in the gemfile as `-1` since it is not released yet. For example 2.4.0rc1 will show up in a `Gemfile.lock` like this: + +``` +RUBY VERSION + ruby 2.4.0p-1 +``` + ## v149 (12/01/2016) * Guarantee we always show warning when upgrading bundler version. diff --git a/lib/language_pack/ruby_version.rb b/lib/language_pack/ruby_version.rb index 58d79de82..051fdef20 100644 --- a/lib/language_pack/ruby_version.rb +++ b/lib/language_pack/ruby_version.rb @@ -40,7 +40,7 @@ def initialize(bundler_output, app = {}) # https://github.com/bundler/bundler/issues/4621 def version_for_download - if patchlevel_is_significant? && @patchlevel.sub(/p/, '').to_i >= 0 + if patchlevel_is_significant? && @patchlevel && @patchlevel.sub(/p/, '').to_i >= 0 @version else version_without_patchlevel From ddc1566877c1d731874c5af9f3bbd5ab301e3e87 Mon Sep 17 00:00:00 2001 From: schneems Date: Fri, 23 Dec 2016 13:37:54 -0500 Subject: [PATCH 0282/1195] [CI Skip] v150 --- CHANGELOG.md | 2 ++ lib/language_pack/version.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 86a1328b1..bfbb5e30b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Master +## v150 (12/23/2016) + * Allow deployment of pre-release rubies (preview and rc) with Bundler 1.13.6+. This is needed because the patch level is recorded in the gemfile as `-1` since it is not released yet. For example 2.4.0rc1 will show up in a `Gemfile.lock` like this: ``` diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 994f665cd..a4e2834a9 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v149" + BUILDPACK_VERSION = "v150" end end From d70f7a89f64fd621d286c4a347b4ec10ae981c43 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 29 Dec 2016 09:35:44 -0600 Subject: [PATCH 0283/1195] Bundler 1.13.7 --- CHANGELOG.md | 2 ++ lib/language_pack/ruby.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bfbb5e30b..e2eba9669 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Master +* Upgrade to bundler 1.13.7. + ## v150 (12/23/2016) * Allow deployment of pre-release rubies (preview and rc) with Bundler 1.13.6+. This is needed because the patch level is recorded in the gemfile as `-1` since it is not released yet. For example 2.4.0rc1 will show up in a `Gemfile.lock` like this: diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 769f19a04..9dea070b5 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -14,7 +14,7 @@ class LanguagePack::Ruby < LanguagePack::Base NAME = "ruby" LIBYAML_VERSION = "0.1.7" LIBYAML_PATH = "libyaml-#{LIBYAML_VERSION}" - BUNDLER_VERSION = "1.13.6" + BUNDLER_VERSION = "1.13.7" BUNDLER_GEM_PATH = "bundler-#{BUNDLER_VERSION}" RBX_BASE_URL = "http://binaries.rubini.us/heroku" NODE_BP_PATH = "vendor/node/bin" From 8a13cf8e7762ac52993ac32e5f06bed54a7328f2 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Tue, 3 Jan 2017 13:48:40 -0600 Subject: [PATCH 0284/1195] switch from ddollar multi to heroku multi --- spec/node_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/node_spec.rb b/spec/node_spec.rb index 0f54ec46b..164360280 100644 --- a/spec/node_spec.rb +++ b/spec/node_spec.rb @@ -2,7 +2,7 @@ describe "Multibuildpack" do it "works with node" do - Hatchet::Runner.new("node_multi", buildpack_url: "https://github.com/ddollar/heroku-buildpack-multi.git").deploy do |app| + Hatchet::Runner.new("node_multi", buildpack_url: "https://github.com/heroku/heroku-buildpack-multi.git").deploy do |app| expect(app.output).to match("Node Version in Ruby buildpack is: v4.1.2") expect(app.run("node -v")).to match("v4.1.2") end From 7b66f87927ed0a337d71ffcb51bcd5a6effa78f0 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Tue, 13 Dec 2016 15:48:15 -0600 Subject: [PATCH 0285/1195] refactor ruby installer code into their own classes --- lib/language_pack.rb | 3 ++ lib/language_pack/installers/mri_installer.rb | 25 +++++++++ lib/language_pack/installers/rbx_installer.rb | 20 ++++++++ .../installers/ruby_installer.rb | 30 +++++++++++ lib/language_pack/ruby.rb | 49 ++---------------- lib/language_pack/ruby_version.rb | 4 +- spec/installers/mri_insaller_spec.rb | 51 +++++++++++++++++++ spec/installers/rbx_installer_spec.rb | 20 ++++++++ spec/spec_helper.rb | 4 +- 9 files changed, 157 insertions(+), 49 deletions(-) create mode 100644 lib/language_pack/installers/mri_installer.rb create mode 100644 lib/language_pack/installers/rbx_installer.rb create mode 100644 lib/language_pack/installers/ruby_installer.rb create mode 100644 spec/installers/mri_insaller_spec.rb create mode 100644 spec/installers/rbx_installer_spec.rb diff --git a/lib/language_pack.rb b/lib/language_pack.rb index 986ce5525..600de0951 100644 --- a/lib/language_pack.rb +++ b/lib/language_pack.rb @@ -33,6 +33,9 @@ def self.detect(*args) require "language_pack/helpers/stale_file_cleaner" require "language_pack/helpers/rake_runner" require "language_pack/helpers/bundler_wrapper" +require "language_pack/installers/ruby_installer" +require "language_pack/installers/mri_installer" +require "language_pack/installers/rbx_installer" require "language_pack/ruby" require "language_pack/rack" diff --git a/lib/language_pack/installers/mri_installer.rb b/lib/language_pack/installers/mri_installer.rb new file mode 100644 index 000000000..964c79795 --- /dev/null +++ b/lib/language_pack/installers/mri_installer.rb @@ -0,0 +1,25 @@ +require 'language_pack/installers/ruby_installer' +require 'language_pack/shell_helpers' + +class LanguagePack::Installers::MriInstaller + include LanguagePack::ShellHelpers, LanguagePack::Installers::RubyInstaller + + BASE_URL = LanguagePack::Base::VENDOR_URL + + def initialize(stack) + @fetcher = LanguagePack::Fetcher.new(BASE_URL, stack) + end + + def fetch_unpack(ruby_version, install_dir, build = false) + FileUtils.mkdir_p(install_dir) + Dir.chdir(install_dir) do + file = "#{ruby_version.version_for_download}.tgz" + if build + ruby_vm = "ruby" + file.sub!(ruby_vm, "#{ruby_vm}-build") + end + @fetcher.fetch_untar(file) + end + end +end + diff --git a/lib/language_pack/installers/rbx_installer.rb b/lib/language_pack/installers/rbx_installer.rb new file mode 100644 index 000000000..91e870e25 --- /dev/null +++ b/lib/language_pack/installers/rbx_installer.rb @@ -0,0 +1,20 @@ +require "language_pack/installers/ruby_installer" +require "language_pack/shell_helpers" + +class LanguagePack::Installers::RbxInstaller + include LanguagePack::ShellHelpers, LanguagePack::Installers::RubyInstaller + + BASE_URL = "https://rubinius-binaries-rubinius-com.s3.amazonaws.com/ubuntu/14.04/x86_64/" + + def initialize(stack) + @fetcher = LanguagePack::Fetcher.new(BASE_URL) + end + + def fetch_unpack(ruby_version, install_dir) + file = "#{ruby_version.version_for_download}.tar.bz2" + @fetcher.fetch_bunzip2(file) + FileUtils.mv(Dir.glob("rubinius/#{ruby_version.engine_version}/*"), ".") + FileUtils.rm_rf("rubinius") + end +end + diff --git a/lib/language_pack/installers/ruby_installer.rb b/lib/language_pack/installers/ruby_installer.rb new file mode 100644 index 000000000..7aa8d56b7 --- /dev/null +++ b/lib/language_pack/installers/ruby_installer.rb @@ -0,0 +1,30 @@ +require "language_pack/shell_helpers" +module LanguagePack::Installers; end + +module LanguagePack::Installers::RubyInstaller + include LanguagePack::ShellHelpers + + DEFAULT_BIN_DIR = "bin" + + def self.installer(ruby_version) + if ruby_version.rbx? + LanguagePack::Installers::RbxInstaller + else + LanguagePack::Installers::MriInstaller + end + end + + def install(ruby_version, install_dir) + fetch_unpack(ruby_version, install_dir) + setup_binstubs(install_dir) + end + + def setup_binstubs(install_dir) + FileUtils.mkdir_p DEFAULT_BIN_DIR + run("ln -s ruby #{install_dir}/bin/ruby.exe") + + Dir["#{install_dir}/bin/*"].each do |vendor_bin| + run("ln -s ../#{vendor_bin} #{DEFAULT_BIN_DIR}") + end + end +end diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 9dea070b5..6567ad7a7 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -346,53 +346,12 @@ def install_ruby instrument 'ruby.install_ruby' do return false unless ruby_version - if ruby_version.build? - FileUtils.mkdir_p(build_ruby_path) - Dir.chdir(build_ruby_path) do - ruby_vm = "ruby" - instrument "ruby.fetch_build_ruby" do - @fetchers[:mri].fetch_untar("#{ruby_version.version_for_download.sub(ruby_vm, "#{ruby_vm}-build")}.tgz") - end - end - end + installer = LanguagePack::Installers::RubyInstaller.installer(ruby_version).new(@stack) - FileUtils.mkdir_p(slug_vendor_ruby) - Dir.chdir(slug_vendor_ruby) do - instrument "ruby.fetch_ruby" do - if ruby_version.rbx? - file = "#{ruby_version.version_for_download}.tar.bz2" - sha_file = "#{file}.sha1" - @fetchers[:rbx].fetch(file) - @fetchers[:rbx].fetch(sha_file) - - expected_checksum = File.read(sha_file).chomp - actual_checksum = Digest::SHA1.file(file).hexdigest - - error <<-ERROR_MSG unless expected_checksum == actual_checksum -RBX Checksum for #{file} does not match. -Expected #{expected_checksum} but got #{actual_checksum}. -Please try pushing again in a few minutes. -ERROR_MSG - - run("tar jxf #{file}") - FileUtils.mv(Dir.glob("app/#{slug_vendor_ruby}/*"), ".") - FileUtils.rm_rf("app") - FileUtils.rm(file) - FileUtils.rm(sha_file) - else - @fetchers[:mri].fetch_untar("#{ruby_version.version_for_download}.tgz") - end - end - end - - app_bin_dir = "bin" - FileUtils.mkdir_p app_bin_dir - - run("ln -s ruby #{slug_vendor_ruby}/bin/ruby.exe") - - Dir["#{slug_vendor_ruby}/bin/*"].each do |vendor_bin| - run("ln -s ../#{vendor_bin} #{app_bin_dir}") + if ruby_version.build? + installer.fetch_unpack(ruby_version, build_ruby_path, true) end + installer.install(ruby_version, slug_vendor_ruby) @metadata.write("buildpack_ruby_version", ruby_version.version_for_download) diff --git a/lib/language_pack/ruby_version.rb b/lib/language_pack/ruby_version.rb index 051fdef20..dd7392d79 100644 --- a/lib/language_pack/ruby_version.rb +++ b/lib/language_pack/ruby_version.rb @@ -40,7 +40,9 @@ def initialize(bundler_output, app = {}) # https://github.com/bundler/bundler/issues/4621 def version_for_download - if patchlevel_is_significant? && @patchlevel && @patchlevel.sub(/p/, '').to_i >= 0 + if rbx? + "rubinius-#{engine_version}" + elsif patchlevel_is_significant? && @patchlevel && @patchlevel.sub(/p/, '').to_i >= 0 @version else version_without_patchlevel diff --git a/spec/installers/mri_insaller_spec.rb b/spec/installers/mri_insaller_spec.rb new file mode 100644 index 000000000..25bb648bf --- /dev/null +++ b/spec/installers/mri_insaller_spec.rb @@ -0,0 +1,51 @@ +require "spec_helper" + +describe LanguagePack::Installers::MriInstaller do + let(:installer) { LanguagePack::Installers::MriInstaller.new("cedar-14") } + let(:ruby_version) { LanguagePack::RubyVersion.new("ruby-2.3.3") } + + describe "#fetch_unpack" do + + it "should fetch and unpack mri" do + Dir.mktmpdir do |dir| + Dir.chdir(dir) do + installer.fetch_unpack(ruby_version, dir) + + expect(File).to exist("bin/ruby") + end + end + end + + context "build rubies" do + let(:ruby_version) { LanguagePack::RubyVersion.new("ruby-1.9.2") } + + it "should fetch and unpack the build ruby" do + Dir.mktmpdir do |dir| + Dir.chdir(dir) do + installer.fetch_unpack(ruby_version, dir, true) + + expect(File.read("lib/ruby/1.9.1/x86_64-linux/rbconfig.rb")).to include(%q{CONFIG["prefix"] = (TOPDIR || DESTDIR + "/tmp/ruby-1.9.2")}) + expect(File).to exist("bin/ruby") + end + end + end + + end + end + + describe "#install" do + + it "should install ruby and setup binstubs" do + Dir.mktmpdir do |dir| + Dir.chdir(dir) do + installer.install(ruby_version, "#{dir}/vendor/ruby") + + expect(File.symlink?("#{dir}/bin/ruby")).to be true + expect(File.symlink?("#{dir}/bin/ruby.exe")).to be true + expect(File).to exist("#{dir}/vendor/ruby/bin/ruby") + end + end + end + + end +end diff --git a/spec/installers/rbx_installer_spec.rb b/spec/installers/rbx_installer_spec.rb new file mode 100644 index 000000000..d446ed5d1 --- /dev/null +++ b/spec/installers/rbx_installer_spec.rb @@ -0,0 +1,20 @@ +require "spec_helper" + +describe LanguagePack::Installers::RbxInstaller do + let(:installer) { LanguagePack::Installers::RbxInstaller.new("cedar-14") } + let(:ruby_version) { LanguagePack::RubyVersion.new("ruby-2.3.1-rbx-3.69") } + + describe "#fetch_unpack" do + + it "should fetch and unpack rbx" do + Dir.mktmpdir do |dir| + Dir.chdir(dir) do + installer.fetch_unpack(ruby_version, dir) + + expect(File).to exist("bin/ruby") + end + end + end + + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 17568fc70..510a7033e 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -5,8 +5,6 @@ require 'rspec/retry' require 'language_pack' -require 'language_pack' - ENV['RACK_ENV'] = 'test' RSpec.configure do |config| @@ -44,4 +42,4 @@ def create_file_with_size_in(size, dir) config.startup_timeout 60 # seconds to boot config.return_char "\n" # the character that submits the command config.sync_stdout "STDOUT.sync = true" # force REPL to not buffer standard out -end \ No newline at end of file +end From 51aaadf97bf2be62f4fd60fd3af0923b3a3e70c5 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Thu, 15 Dec 2016 15:22:18 -0600 Subject: [PATCH 0286/1195] bootstrap ruby for running the buildpack --- bin/bootstrap | 15 +++++++++++++++ bin/compile | 38 ++++++++++---------------------------- bin/ruby_compile | 31 +++++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+), 28 deletions(-) create mode 100755 bin/bootstrap create mode 100755 bin/ruby_compile diff --git a/bin/bootstrap b/bin/bootstrap new file mode 100755 index 000000000..eda686628 --- /dev/null +++ b/bin/bootstrap @@ -0,0 +1,15 @@ +#!/usr/bin/env ruby + +# sync output +$stdout.sync = true + +$:.unshift File.expand_path("../../lib", __FILE__) +require "language_pack" + +DEFAULT_STACK = "cedar-14" + +bootstrap_ruby_dir = Dir.mktmpdir +installer = LanguagePack::Installers::MriInstaller.new(ENV['STACK'] || DEFAULT_STACK) +ruby_version = LanguagePack::RubyVersion.new("ruby-#{LanguagePack::RubyVersion::DEFAULT_VERSION_NUMBER}") +installer.fetch_unpack(ruby_version, bootstrap_ruby_dir) +print bootstrap_ruby_dir diff --git a/bin/compile b/bin/compile index d5eb40a33..1db100e45 100755 --- a/bin/compile +++ b/bin/compile @@ -1,31 +1,13 @@ -#!/usr/bin/env ruby +#!/bin/bash -# sync output -$stdout.sync = true +BIN_DIR=$(cd $(dirname $0); pwd) -$:.unshift File.expand_path("../../lib", __FILE__) -require "language_pack" -require "language_pack/shell_helpers" +# bootstrap ruby +ruby_dir=`$BIN_DIR/bootstrap $2` +echo $ruby_dir +function atexit { + rm -rf $ruby_dir +} +trap atexit EXIT -begin - LanguagePack::Instrument.trace 'compile', 'app.compile' do - LanguagePack::ShellHelpers.initialize_env(ARGV[2]) - if pack = LanguagePack.detect(ARGV[0], ARGV[1]) - pack.topic("Compiling #{pack.name}") - pack.log("compile") do - pack.compile - end - end - end -rescue Exception => e - Kernel.puts " !" - e.message.split("\n").each do |line| - Kernel.puts " ! #{line.strip}" - end - Kernel.puts " !" - if e.is_a?(BuildpackError) - exit 1 - else - raise e - end -end +$ruby_dir/bin/ruby $BIN_DIR/ruby_compile $@ diff --git a/bin/ruby_compile b/bin/ruby_compile new file mode 100755 index 000000000..d5eb40a33 --- /dev/null +++ b/bin/ruby_compile @@ -0,0 +1,31 @@ +#!/usr/bin/env ruby + +# sync output +$stdout.sync = true + +$:.unshift File.expand_path("../../lib", __FILE__) +require "language_pack" +require "language_pack/shell_helpers" + +begin + LanguagePack::Instrument.trace 'compile', 'app.compile' do + LanguagePack::ShellHelpers.initialize_env(ARGV[2]) + if pack = LanguagePack.detect(ARGV[0], ARGV[1]) + pack.topic("Compiling #{pack.name}") + pack.log("compile") do + pack.compile + end + end + end +rescue Exception => e + Kernel.puts " !" + e.message.split("\n").each do |line| + Kernel.puts " ! #{line.strip}" + end + Kernel.puts " !" + if e.is_a?(BuildpackError) + exit 1 + else + raise e + end +end From 5dbf21383a51bbdcadbdf9e092d3d1035dd809ab Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Thu, 15 Dec 2016 19:38:59 -0600 Subject: [PATCH 0287/1195] don't bootstrap ruby for buildpack if it is vendored --- Rakefile | 13 +++++++++++-- bin/compile | 18 +++++++++++------- lib/language_pack/helpers/bundler_wrapper.rb | 2 ++ lib/language_pack/installers/mri_installer.rb | 1 + 4 files changed, 25 insertions(+), 9 deletions(-) diff --git a/Rakefile b/Rakefile index 8dbd7c532..c5abd3f4c 100644 --- a/Rakefile +++ b/Rakefile @@ -203,12 +203,21 @@ FILE task :stage do Dir.mktmpdir("heroku-buildpack-ruby") do |tmpdir| Git.clone(File.expand_path("."), 'heroku-buildpack-ruby', path: tmpdir) - Dir.chdir(tmpdir) do |dir| + Dir.chdir(tmpdir) do streamer = lambda do |chunk, remaining_bytes, total_bytes| File.open("ruby.tgz", "w") {|file| file.print(chunk) } end Excon.get(latest_release["tar_link"], :response_block => streamer) - Dir.chdir("heroku-buildpack-ruby") do |dir| + Dir.chdir("heroku-buildpack-ruby") do |buildpack_dir| + $:.unshift File.expand_path("../lib", __FILE__) + require "language_pack/installers/mri_installer" + require "language_pack/ruby_version" + + ["cedar-14"].each do |stack| + installer = LanguagePack::Installers::MriInstaller.new(stack) + ruby_version = LanguagePack::RubyVersion.new("ruby-#{LanguagePack::RubyVersion::DEFAULT_VERSION_NUMBER}") + installer.fetch_unpack(ruby_version, "vendor/ruby/#{stack}") + end sh "tar xzf ../ruby.tgz .env" sh "tar czf ../buildpack.tgz * .env" end diff --git a/bin/compile b/bin/compile index 1db100e45..16f01addc 100755 --- a/bin/compile +++ b/bin/compile @@ -1,13 +1,17 @@ #!/bin/bash BIN_DIR=$(cd $(dirname $0); pwd) +ROOT_DIR=$(dirname $BIN_DIR) -# bootstrap ruby -ruby_dir=`$BIN_DIR/bootstrap $2` -echo $ruby_dir -function atexit { - rm -rf $ruby_dir -} -trap atexit EXIT +ruby_dir="$ROOT_DIR/vendor/ruby/$STACK" +if [ ! -d "$ROOT_DIR/vendor/ruby/$STACK" ]; then + # bootstrap ruby + ruby_dir=`$BIN_DIR/bootstrap $2` + echo $ruby_dir + function atexit { + rm -rf $ruby_dir + } + trap atexit EXIT +fi $ruby_dir/bin/ruby $BIN_DIR/ruby_compile $@ diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index 8ec410e7f..ab0baaee9 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -1,3 +1,5 @@ +require 'language_pack/fetcher' + class LanguagePack::Helpers::BundlerWrapper include LanguagePack::ShellHelpers diff --git a/lib/language_pack/installers/mri_installer.rb b/lib/language_pack/installers/mri_installer.rb index 964c79795..af2777739 100644 --- a/lib/language_pack/installers/mri_installer.rb +++ b/lib/language_pack/installers/mri_installer.rb @@ -1,4 +1,5 @@ require 'language_pack/installers/ruby_installer' +require 'language_pack/base' require 'language_pack/shell_helpers' class LanguagePack::Installers::MriInstaller From e0454435926814ba41ffc74a31da43b2a6cd3736 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Fri, 16 Dec 2016 15:30:05 -0600 Subject: [PATCH 0288/1195] move mktemp logic into bash --- bin/bootstrap | 4 +--- bin/compile | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/bin/bootstrap b/bin/bootstrap index eda686628..2dcad13dd 100755 --- a/bin/bootstrap +++ b/bin/bootstrap @@ -8,8 +8,6 @@ require "language_pack" DEFAULT_STACK = "cedar-14" -bootstrap_ruby_dir = Dir.mktmpdir installer = LanguagePack::Installers::MriInstaller.new(ENV['STACK'] || DEFAULT_STACK) ruby_version = LanguagePack::RubyVersion.new("ruby-#{LanguagePack::RubyVersion::DEFAULT_VERSION_NUMBER}") -installer.fetch_unpack(ruby_version, bootstrap_ruby_dir) -print bootstrap_ruby_dir +installer.fetch_unpack(ruby_version, ARGV[0]) diff --git a/bin/compile b/bin/compile index 16f01addc..c3c52a401 100755 --- a/bin/compile +++ b/bin/compile @@ -5,9 +5,9 @@ ROOT_DIR=$(dirname $BIN_DIR) ruby_dir="$ROOT_DIR/vendor/ruby/$STACK" if [ ! -d "$ROOT_DIR/vendor/ruby/$STACK" ]; then + ruby_dir=$(mktemp -d) # bootstrap ruby - ruby_dir=`$BIN_DIR/bootstrap $2` - echo $ruby_dir + $BIN_DIR/bootstrap $ruby_dir function atexit { rm -rf $ruby_dir } From ab5190fcc16e5329bc865affe70760c6adbe8e5d Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Tue, 20 Dec 2016 12:46:32 -0600 Subject: [PATCH 0289/1195] add comment to describe what bin/compile does now --- bin/compile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/compile b/bin/compile index c3c52a401..4ac488f1d 100755 --- a/bin/compile +++ b/bin/compile @@ -1,4 +1,6 @@ #!/bin/bash +# The actual `bin/compile` code lives in `bin/ruby_compile`. This file instead +# bootstraps the ruby needed and then executes `bin/ruby_compile` BIN_DIR=$(cd $(dirname $0); pwd) ROOT_DIR=$(dirname $BIN_DIR) From 3c879c1028b13851a667cd131f91b5555f5f6b05 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Tue, 20 Dec 2016 12:55:24 -0600 Subject: [PATCH 0290/1195] rename MriInstaller to HerokuRubyInstaller --- Rakefile | 4 ++-- bin/bootstrap | 2 +- lib/language_pack.rb | 2 +- .../installers/{mri_installer.rb => heroku_ruby_installer.rb} | 2 +- lib/language_pack/installers/ruby_installer.rb | 2 +- .../{mri_insaller_spec.rb => heroku_ruby_installer_spec.rb} | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) rename lib/language_pack/installers/{mri_installer.rb => heroku_ruby_installer.rb} (92%) rename spec/installers/{mri_insaller_spec.rb => heroku_ruby_installer_spec.rb} (89%) diff --git a/Rakefile b/Rakefile index c5abd3f4c..fe13031fd 100644 --- a/Rakefile +++ b/Rakefile @@ -210,11 +210,11 @@ FILE Excon.get(latest_release["tar_link"], :response_block => streamer) Dir.chdir("heroku-buildpack-ruby") do |buildpack_dir| $:.unshift File.expand_path("../lib", __FILE__) - require "language_pack/installers/mri_installer" + require "language_pack/installers/heroku_ruby_installer" require "language_pack/ruby_version" ["cedar-14"].each do |stack| - installer = LanguagePack::Installers::MriInstaller.new(stack) + installer = LanguagePack::Installers::HerokuRubyInstaller.new(stack) ruby_version = LanguagePack::RubyVersion.new("ruby-#{LanguagePack::RubyVersion::DEFAULT_VERSION_NUMBER}") installer.fetch_unpack(ruby_version, "vendor/ruby/#{stack}") end diff --git a/bin/bootstrap b/bin/bootstrap index 2dcad13dd..6a8370068 100755 --- a/bin/bootstrap +++ b/bin/bootstrap @@ -8,6 +8,6 @@ require "language_pack" DEFAULT_STACK = "cedar-14" -installer = LanguagePack::Installers::MriInstaller.new(ENV['STACK'] || DEFAULT_STACK) +installer = LanguagePack::Installers::HerokuRubyInstaller.new(ENV['STACK'] || DEFAULT_STACK) ruby_version = LanguagePack::RubyVersion.new("ruby-#{LanguagePack::RubyVersion::DEFAULT_VERSION_NUMBER}") installer.fetch_unpack(ruby_version, ARGV[0]) diff --git a/lib/language_pack.rb b/lib/language_pack.rb index 600de0951..4bbe201a7 100644 --- a/lib/language_pack.rb +++ b/lib/language_pack.rb @@ -34,7 +34,7 @@ def self.detect(*args) require "language_pack/helpers/rake_runner" require "language_pack/helpers/bundler_wrapper" require "language_pack/installers/ruby_installer" -require "language_pack/installers/mri_installer" +require "language_pack/installers/heroku_ruby_installer" require "language_pack/installers/rbx_installer" require "language_pack/ruby" diff --git a/lib/language_pack/installers/mri_installer.rb b/lib/language_pack/installers/heroku_ruby_installer.rb similarity index 92% rename from lib/language_pack/installers/mri_installer.rb rename to lib/language_pack/installers/heroku_ruby_installer.rb index af2777739..c752be37e 100644 --- a/lib/language_pack/installers/mri_installer.rb +++ b/lib/language_pack/installers/heroku_ruby_installer.rb @@ -2,7 +2,7 @@ require 'language_pack/base' require 'language_pack/shell_helpers' -class LanguagePack::Installers::MriInstaller +class LanguagePack::Installers::HerokuRubyInstaller include LanguagePack::ShellHelpers, LanguagePack::Installers::RubyInstaller BASE_URL = LanguagePack::Base::VENDOR_URL diff --git a/lib/language_pack/installers/ruby_installer.rb b/lib/language_pack/installers/ruby_installer.rb index 7aa8d56b7..fc884ae18 100644 --- a/lib/language_pack/installers/ruby_installer.rb +++ b/lib/language_pack/installers/ruby_installer.rb @@ -10,7 +10,7 @@ def self.installer(ruby_version) if ruby_version.rbx? LanguagePack::Installers::RbxInstaller else - LanguagePack::Installers::MriInstaller + LanguagePack::Installers::HerokuRubyInstaller end end diff --git a/spec/installers/mri_insaller_spec.rb b/spec/installers/heroku_ruby_installer_spec.rb similarity index 89% rename from spec/installers/mri_insaller_spec.rb rename to spec/installers/heroku_ruby_installer_spec.rb index 25bb648bf..6648a870a 100644 --- a/spec/installers/mri_insaller_spec.rb +++ b/spec/installers/heroku_ruby_installer_spec.rb @@ -1,7 +1,7 @@ require "spec_helper" -describe LanguagePack::Installers::MriInstaller do - let(:installer) { LanguagePack::Installers::MriInstaller.new("cedar-14") } +describe LanguagePack::Installers::HerokuRubyInstaller do + let(:installer) { LanguagePack::Installers::HerokuRubyInstaller.new("cedar-14") } let(:ruby_version) { LanguagePack::RubyVersion.new("ruby-2.3.3") } describe "#fetch_unpack" do From 05e36bcfc8ed2e474f9a0d33160cfd0632560f0f Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Tue, 10 Jan 2017 17:16:45 -0600 Subject: [PATCH 0291/1195] put vendored ruby on the buildpack path, so when shelling out the right ruby is picked up --- bin/compile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/compile b/bin/compile index 4ac488f1d..0be697f94 100755 --- a/bin/compile +++ b/bin/compile @@ -16,4 +16,6 @@ if [ ! -d "$ROOT_DIR/vendor/ruby/$STACK" ]; then trap atexit EXIT fi +export PATH=$ruby_dir/bin/:$PATH + $ruby_dir/bin/ruby $BIN_DIR/ruby_compile $@ From 2fc5320236fad3eaa46ad207edf1e7dbde15bfa4 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Fri, 7 Oct 2016 17:33:47 -0500 Subject: [PATCH 0292/1195] remove ruby warnings --- lib/language_pack/ruby.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 6567ad7a7..7f71fb381 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -294,7 +294,7 @@ def setup_language_pack_environment # TODO when buildpack-env-args rolls out, we can get rid of # ||= and the manual setting below - config_vars = default_config_vars.each do |key, value| + default_config_vars.each do |key, value| ENV[key] ||= value end @@ -494,7 +494,7 @@ def load_default_cache def install_libyaml(dir) instrument 'ruby.install_libyaml' do FileUtils.mkdir_p dir - Dir.chdir(dir) do |dir| + Dir.chdir(dir) do @fetchers[:buildpack].fetch_untar("#{@stack}/#{LIBYAML_PATH}.tgz") end end From bcc74ad47a502cdad4bcfc434fd0ef435e01164d Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Thu, 1 Sep 2016 13:53:56 -0500 Subject: [PATCH 0293/1195] initial spike to add Heroku CI support --- bin/test | 51 ++++++++++++++++++++++++++++++++ bin/test-compile | 32 ++++++++++++++++++++ lib/language_pack/rails2.rb | 21 +++++++++---- lib/language_pack/rails3.rb | 23 ++++---------- lib/language_pack/rails4.rb | 2 +- lib/language_pack/ruby.rb | 6 ++-- lib/language_pack/test.rb | 8 +++++ lib/language_pack/test/rails2.rb | 20 +++++++++++++ lib/language_pack/test/rails5.rb | 15 ++++++++++ lib/language_pack/test/ruby.rb | 43 +++++++++++++++++++++++++++ 10 files changed, 194 insertions(+), 27 deletions(-) create mode 100755 bin/test create mode 100755 bin/test-compile create mode 100644 lib/language_pack/test.rb create mode 100644 lib/language_pack/test/rails2.rb create mode 100644 lib/language_pack/test/rails5.rb create mode 100644 lib/language_pack/test/ruby.rb diff --git a/bin/test b/bin/test new file mode 100755 index 000000000..19fa7bfa2 --- /dev/null +++ b/bin/test @@ -0,0 +1,51 @@ +#!/usr/bin/env ruby + +# sync output +$stdout.sync = true + +$:.unshift File.expand_path("../../lib", __FILE__) +require "language_pack" +require "language_pack/shell_helpers" +require "language_pack/test" + +include LanguagePack::ShellHelpers + +def execute_test(command) + topic("Running test: #{command}") + execute_command(command) + exit $?.exitstatus +end + +def execute_command(command) + pipe(command, :user_env => true) +end + +# bin/test BUILD_DIR ENV_DIR ARTIFACT_DIR +build_dir, env_dir, artifact_dir = ARGV +LanguagePack::ShellHelpers.initialize_env(env_dir) +# point bundler wrapper to app's bundler gem +bundler_path = "#{build_dir}/vendor/bundle/ruby/2.3.0/gems/" +bundler = LanguagePack::Helpers::BundlerWrapper.new( + bundler_path: bundler_path, + gemfile_path: "#{build_dir}/Gemfile" +) +# load bundler +bundler.install + +Dir.chdir(build_dir) + +execute_test( + if bundler.has_gem?("rspec-core") + if File.exist?("bin/rspec") + "bin/rspec" + else + "bundle exec rspec" + end + elsif File.exist?("bin/rails") + "bin/rails test" + elsif File.exist?("bin/rake") + "bin/rake test" + else + "rake test" + end +) diff --git a/bin/test-compile b/bin/test-compile new file mode 100755 index 000000000..61f82f4ff --- /dev/null +++ b/bin/test-compile @@ -0,0 +1,32 @@ +#!/usr/bin/env ruby + +# sync output +$stdout.sync = true + +$:.unshift File.expand_path("../../lib", __FILE__) +require "language_pack" +require "language_pack/shell_helpers" +require "language_pack/test" + +begin + LanguagePack::Instrument.trace 'test_compile', 'app.test_compile' do + if pack = LanguagePack.detect(ARGV[0], ARGV[1]) + LanguagePack::ShellHelpers.initialize_env(ARGV[2]) + pack.topic("Setting up Test for #{pack.name}") + pack.log("test_compile") do + pack.compile + end + end + end +rescue Exception => e + Kernel.puts " !" + e.message.split("\n").each do |line| + Kernel.puts " ! #{line.strip}" + end + Kernel.puts " !" + if e.is_a?(BuildpackError) + exit 1 + else + raise e + end +end diff --git a/lib/language_pack/rails2.rb b/lib/language_pack/rails2.rb index 4586230fe..c87d58323 100644 --- a/lib/language_pack/rails2.rb +++ b/lib/language_pack/rails2.rb @@ -20,12 +20,20 @@ def name "Ruby/Rails" end + def default_env_vars + { + "RAILS_ENV" => "production", + "RACK_ENV" => "production" + } + end + def default_config_vars instrument "rails2.default_config_vars" do - super.merge({ - "RAILS_ENV" => env("RAILS_ENV") || "production", - "RACK_ENV" => env("RACK_ENV") || "production", - }) + super.merge(Hash[ + default_env_vars.map do |key, value| + [key, env(key) || value] + end + ]) end end @@ -80,8 +88,9 @@ def add_dev_database_addon # sets up the profile.d script for this buildpack def setup_profiled super - set_env_default "RACK_ENV", "production" - set_env_default "RAILS_ENV", "production" + default_env_vars.each do |key, value| + set_env_default key, value + end end end diff --git a/lib/language_pack/rails3.rb b/lib/language_pack/rails3.rb index 55bdc2ec5..f84edbdfa 100644 --- a/lib/language_pack/rails3.rb +++ b/lib/language_pack/rails3.rb @@ -19,6 +19,12 @@ def name "Ruby/Rails" end + def default_env_vars + super.merge({ + "RAILS_GROUPS" => "assets" + }) + end + def default_process_types instrument "rails3.default_process_types" do # let's special case thin here @@ -81,23 +87,6 @@ def run_assets_precompile_rake_task end end - def rake_env - if user_env_hash.empty? - default_env = { - "RAILS_GROUPS" => ENV["RAILS_GROUPS"] || "assets", - "RAILS_ENV" => ENV["RAILS_ENV"] || "production", - "DATABASE_URL" => database_url - } - else - default_env = { - "RAILS_GROUPS" => "assets", - "RAILS_ENV" => "production", - "DATABASE_URL" => database_url - } - end - default_env.merge(user_env_hash) - end - # generate a dummy database_url def database_url instrument "rails3.setup_database_url_env" do diff --git a/lib/language_pack/rails4.rb b/lib/language_pack/rails4.rb index 650840571..1b44521c2 100644 --- a/lib/language_pack/rails4.rb +++ b/lib/language_pack/rails4.rb @@ -30,7 +30,7 @@ def default_process_types end end - def build_bundler + def build_bundler(default_bundle_without) instrument "rails4.build_bundler" do super end diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 7f71fb381..e28d8604c 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -99,7 +99,7 @@ def compile setup_profiled allow_git do install_bundler_in_app - build_bundler + build_bundler("development:test") post_bundler create_database_yml install_binaries @@ -521,10 +521,10 @@ def bundler_binstubs_path end # runs bundler to install the dependencies - def build_bundler + def build_bundler(default_bundle_without) instrument 'ruby.build_bundler' do log("bundle") do - bundle_without = env("BUNDLE_WITHOUT") || "development:test" + bundle_without = env("BUNDLE_WITHOUT") || default_bundle_without bundle_bin = "bundle" bundle_command = "#{bundle_bin} install --without #{bundle_without} --path vendor/bundle --binstubs #{bundler_binstubs_path}" bundle_command << " -j4" diff --git a/lib/language_pack/test.rb b/lib/language_pack/test.rb new file mode 100644 index 000000000..5ba816f6d --- /dev/null +++ b/lib/language_pack/test.rb @@ -0,0 +1,8 @@ +require "language_pack" + +module LanguagePack::Test +end + +require "language_pack/test/ruby" +require "language_pack/test/rails2" +require "language_pack/test/rails5" diff --git a/lib/language_pack/test/rails2.rb b/lib/language_pack/test/rails2.rb new file mode 100644 index 000000000..e57599636 --- /dev/null +++ b/lib/language_pack/test/rails2.rb @@ -0,0 +1,20 @@ +#module LanguagePack::Test::Rails2 +class LanguagePack::Rails2 + # sets up the profile.d script for this buildpack + def setup_profiled + super + set_env_default "RACK_ENV", "test" + set_env_default "RAILS_ENV", "test" + end + + def default_env_vars + { + "RAILS_ENV" => "test", + "RACK_ENV" => "test" + } + end + + def rake_env + super.merge(default_env_vars) + end +end diff --git a/lib/language_pack/test/rails5.rb b/lib/language_pack/test/rails5.rb new file mode 100644 index 000000000..93ed20850 --- /dev/null +++ b/lib/language_pack/test/rails5.rb @@ -0,0 +1,15 @@ +class LanguagePack::Rails5 + def prepare_tests + if bundler.has_gem?("activerecord") + topic "Preparing rails test database schema" + pipe("rails db:schema:load", env: rake_env) + schema_load_status = $?.success? + pipe("rails db:migrate", env: rake_env) + db_migrate_status = $?.success? + + if !schema_load_status or !db_migrate_status + error "Could not load test database schema" + end + end + end +end diff --git a/lib/language_pack/test/ruby.rb b/lib/language_pack/test/ruby.rb new file mode 100644 index 000000000..2725c659b --- /dev/null +++ b/lib/language_pack/test/ruby.rb @@ -0,0 +1,43 @@ +#module LanguagePack::Test::Ruby +class LanguagePack::Ruby + def compile + instrument 'ruby.test.compile' do + new_app? + Dir.chdir(build_path) + remove_vendor_bundle + install_ruby + install_jvm + setup_language_pack_environment + setup_profiled + allow_git do + install_bundler_in_app + build_bundler("development") + post_bundler + create_database_yml + install_binaries + prepare_tests + end + super + end + end + + private + def prepare_tests + schema_load = rake.task("db:schema:load") + db_migrate = rake.task("db:migrate") + return true unless (schema_load.is_defined? || db_migrate.is_defined?) + + topic "Preparing test database schema" + + [schema_load, db_migrate].each do |rake_task| + if rake_task.is_defined? + rake_task.invoke(env: rake_env) + if rake_task.success? + puts "#{rake_task.task} completed (#{"%.2f" % rake_task.time}s)" + else + error "Could not load test database schema" + end + end + end + end +end From b8179978414ec0d7ae58ec3d9aab40899212ca24 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Tue, 3 Jan 2017 17:26:12 -0600 Subject: [PATCH 0294/1195] bootstrap bin/test-compile with our own ruby --- bin/ruby_test-compile | 33 ++++++++++++++++++++++++++++++ bin/test-compile | 47 +++++++++++++++++-------------------------- 2 files changed, 51 insertions(+), 29 deletions(-) create mode 100644 bin/ruby_test-compile diff --git a/bin/ruby_test-compile b/bin/ruby_test-compile new file mode 100644 index 000000000..c93184dfb --- /dev/null +++ b/bin/ruby_test-compile @@ -0,0 +1,33 @@ +#!/usr/bin/env ruby + +# sync output +$stdout.sync = true + +$:.unshift File.expand_path("../../lib", __FILE__) +require "language_pack" +require "language_pack/shell_helpers" +require "language_pack/test" + +begin + LanguagePack::Instrument.trace 'test_compile', 'app.test_compile' do + if pack = LanguagePack.detect(ARGV[0], ARGV[1]) + LanguagePack::ShellHelpers.initialize_env(ARGV[2]) + pack.topic("Setting up Test for #{pack.name}") + pack.log("test_compile") do + pack.compile + end + end + end +rescue Exception => e + Kernel.puts " !" + e.message.split("\n").each do |line| + Kernel.puts " ! #{line.strip}" + end + Kernel.puts " !" + if e.is_a?(BuildpackError) + exit 1 + else + raise e + end +end + diff --git a/bin/test-compile b/bin/test-compile index 61f82f4ff..18bf623ff 100755 --- a/bin/test-compile +++ b/bin/test-compile @@ -1,32 +1,21 @@ -#!/usr/bin/env ruby +#!/bin/bash +# The actual `bin/test-compile` code lives in `bin/ruby_test-compile`. This file instead +# bootstraps the ruby needed and then executes `bin/ruby_test-compile` -# sync output -$stdout.sync = true +BIN_DIR=$(cd $(dirname $0); pwd) +ROOT_DIR=$(dirname $BIN_DIR) -$:.unshift File.expand_path("../../lib", __FILE__) -require "language_pack" -require "language_pack/shell_helpers" -require "language_pack/test" +ruby_dir="$ROOT_DIR/vendor/ruby/$STACK" +if [ ! -d "$ROOT_DIR/vendor/ruby/$STACK" ]; then + ruby_dir=$(mktemp -d) + # bootstrap ruby + $BIN_DIR/bootstrap $ruby_dir + function atexit { + rm -rf $ruby_dir + } + trap atexit EXIT +fi -begin - LanguagePack::Instrument.trace 'test_compile', 'app.test_compile' do - if pack = LanguagePack.detect(ARGV[0], ARGV[1]) - LanguagePack::ShellHelpers.initialize_env(ARGV[2]) - pack.topic("Setting up Test for #{pack.name}") - pack.log("test_compile") do - pack.compile - end - end - end -rescue Exception => e - Kernel.puts " !" - e.message.split("\n").each do |line| - Kernel.puts " ! #{line.strip}" - end - Kernel.puts " !" - if e.is_a?(BuildpackError) - exit 1 - else - raise e - end -end +export PATH=$ruby_dir/bin/:$PATH + +$ruby_dir/bin/ruby $BIN_DIR/ruby_test-compile $@ From 31dc4db3605b8c6e54b6d8e3441a70a652bd0a18 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Wed, 11 Jan 2017 18:02:28 -0600 Subject: [PATCH 0295/1195] blank out db:test:purge for rails --- lib/language_pack/test/rails2.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lib/language_pack/test/rails2.rb b/lib/language_pack/test/rails2.rb index e57599636..cde12cc91 100644 --- a/lib/language_pack/test/rails2.rb +++ b/lib/language_pack/test/rails2.rb @@ -17,4 +17,25 @@ def default_env_vars def rake_env super.merge(default_env_vars) end + + def prepare_tests + super + topic "Clearing db:test:purge rake task" + blank_db_test_purge_task + end + + # rails test runner + rspec depend on db:test:purge which drops/creates a db which doesn't work on Heroku's DB plans + def blank_db_test_purge_task + File.open("lib/tasks/heroku_db_test_purge.rake", "w") do |file| + file.puts < Date: Thu, 12 Jan 2017 15:36:04 -0600 Subject: [PATCH 0296/1195] @schneems memory optimization --- lib/language_pack/rails2.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/language_pack/rails2.rb b/lib/language_pack/rails2.rb index c87d58323..75dc3e03f 100644 --- a/lib/language_pack/rails2.rb +++ b/lib/language_pack/rails2.rb @@ -29,11 +29,11 @@ def default_env_vars def default_config_vars instrument "rails2.default_config_vars" do - super.merge(Hash[ - default_env_vars.map do |key, value| - [key, env(key) || value] - end - ]) + config_vars = super + default_env_vars.map do |key, value| + config_vars[key] = env(key) || value + end + config_vars end end From d6cacc4ef06846cbb2432fc666c6bbdc02495835 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Thu, 12 Jan 2017 15:43:36 -0600 Subject: [PATCH 0297/1195] remove this namespace nonsense --- lib/language_pack/test/rails2.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/language_pack/test/rails2.rb b/lib/language_pack/test/rails2.rb index cde12cc91..34df62a72 100644 --- a/lib/language_pack/test/rails2.rb +++ b/lib/language_pack/test/rails2.rb @@ -29,11 +29,7 @@ def blank_db_test_purge_task File.open("lib/tasks/heroku_db_test_purge.rake", "w") do |file| file.puts < Date: Thu, 12 Jan 2017 16:03:29 -0600 Subject: [PATCH 0298/1195] use vendored ruby to execute bin/ruby_test --- bin/ruby_test | 52 ++++++++++++++++++++++++++++++++++++++ bin/test | 70 ++++++++++++++------------------------------------- 2 files changed, 71 insertions(+), 51 deletions(-) create mode 100755 bin/ruby_test diff --git a/bin/ruby_test b/bin/ruby_test new file mode 100755 index 000000000..22773c4ee --- /dev/null +++ b/bin/ruby_test @@ -0,0 +1,52 @@ +#!/usr/bin/env ruby + +# sync output +$stdout.sync = true + +$:.unshift File.expand_path("../../lib", __FILE__) +require "language_pack" +require "language_pack/shell_helpers" +require "language_pack/test" + +include LanguagePack::ShellHelpers + +def execute_test(command) + topic("Running test: #{command}") + execute_command(command) + exit $?.exitstatus +end + +def execute_command(command) + pipe(command, :user_env => true) +end + +# bin/test BUILD_DIR ENV_DIR ARTIFACT_DIR +build_dir, env_dir, artifact_dir = ARGV +LanguagePack::ShellHelpers.initialize_env(env_dir) +# point bundler wrapper to app's bundler gem +bundler_path = "#{build_dir}/vendor/bundle/ruby/2.3.0/gems/" +bundler = LanguagePack::Helpers::BundlerWrapper.new( + bundler_path: bundler_path, + gemfile_path: "#{build_dir}/Gemfile" +) +# load bundler +bundler.install + +Dir.chdir(build_dir) + +execute_test( + if bundler.has_gem?("rspec-core") + if File.exist?("bin/rspec") + "bin/rspec" + else + "bundle exec rspec" + end + elsif File.exist?("bin/rails") + "bin/rails test" + elsif File.exist?("bin/rake") + "bin/rake test" + else + "rake test" + end +) + diff --git a/bin/test b/bin/test index 19fa7bfa2..f1bbde721 100755 --- a/bin/test +++ b/bin/test @@ -1,51 +1,19 @@ -#!/usr/bin/env ruby - -# sync output -$stdout.sync = true - -$:.unshift File.expand_path("../../lib", __FILE__) -require "language_pack" -require "language_pack/shell_helpers" -require "language_pack/test" - -include LanguagePack::ShellHelpers - -def execute_test(command) - topic("Running test: #{command}") - execute_command(command) - exit $?.exitstatus -end - -def execute_command(command) - pipe(command, :user_env => true) -end - -# bin/test BUILD_DIR ENV_DIR ARTIFACT_DIR -build_dir, env_dir, artifact_dir = ARGV -LanguagePack::ShellHelpers.initialize_env(env_dir) -# point bundler wrapper to app's bundler gem -bundler_path = "#{build_dir}/vendor/bundle/ruby/2.3.0/gems/" -bundler = LanguagePack::Helpers::BundlerWrapper.new( - bundler_path: bundler_path, - gemfile_path: "#{build_dir}/Gemfile" -) -# load bundler -bundler.install - -Dir.chdir(build_dir) - -execute_test( - if bundler.has_gem?("rspec-core") - if File.exist?("bin/rspec") - "bin/rspec" - else - "bundle exec rspec" - end - elsif File.exist?("bin/rails") - "bin/rails test" - elsif File.exist?("bin/rake") - "bin/rake test" - else - "rake test" - end -) +#!/bin/bash +# The actual `bin/test-compile` code lives in `bin/ruby_test-compile`. This file instead +# bootstraps the ruby needed and then executes `bin/ruby_test-compile` + +BIN_DIR=$(cd $(dirname $0); pwd) +ROOT_DIR=$(dirname $BIN_DIR) + +ruby_dir="$ROOT_DIR/vendor/ruby/$STACK" +if [ ! -d "$ROOT_DIR/vendor/ruby/$STACK" ]; then + ruby_dir=$(mktemp -d) + # bootstrap ruby + $BIN_DIR/bootstrap $ruby_dir + function atexit { + rm -rf $ruby_dir + } + trap atexit EXIT +fi + +$ruby_dir/bin/ruby $BIN_DIR/ruby_test $@ From c1dfe9784d7fd7de7561bf592c1e284b7e272544 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Thu, 12 Jan 2017 16:04:11 -0600 Subject: [PATCH 0299/1195] set +x bit on bin/ruby_test-compile --- bin/ruby_test-compile | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 bin/ruby_test-compile diff --git a/bin/ruby_test-compile b/bin/ruby_test-compile old mode 100644 new mode 100755 From 42407f9fbe3fdc1637cf6a097415d6ac9cb0f4ae Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Mon, 16 Jan 2017 16:14:47 -0600 Subject: [PATCH 0300/1195] vendor for cedar-14 and heroku-16 --- Rakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index fe13031fd..3e5393b8d 100644 --- a/Rakefile +++ b/Rakefile @@ -213,7 +213,7 @@ FILE require "language_pack/installers/heroku_ruby_installer" require "language_pack/ruby_version" - ["cedar-14"].each do |stack| + %w(cedar-14 heroku-16).each do |stack| installer = LanguagePack::Installers::HerokuRubyInstaller.new(stack) ruby_version = LanguagePack::RubyVersion.new("ruby-#{LanguagePack::RubyVersion::DEFAULT_VERSION_NUMBER}") installer.fetch_unpack(ruby_version, "vendor/ruby/#{stack}") From 1b75f62a8afd3bccb602d14dbc5d723cf6f3ba9c Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Mon, 16 Jan 2017 16:10:50 -0600 Subject: [PATCH 0301/1195] update changelog v151 --- CHANGELOG.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e2eba9669..f0b21869e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ ## Master -* Upgrade to bundler 1.13.7. +## v151 (01/16/2016) + +* Upgrade to bundler 1.13.7 (#519) +* Vendor Default Ruby to execute the buildpack (#515) +* Heroku CI Support (#516) ## v150 (12/23/2016) From 2324a12c8a28b339ee91227d6b1b473912aaf75f Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Mon, 16 Jan 2017 16:11:33 -0600 Subject: [PATCH 0302/1195] bump to v151 --- lib/language_pack/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index a4e2834a9..455d4720f 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v150" + BUILDPACK_VERSION = "v151" end end From 4a6e48a2bc494b5dd808b24fddf70b55f4c42ca7 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Tue, 17 Jan 2017 18:22:51 -0600 Subject: [PATCH 0303/1195] RAILS_GROUPS should only be used for rake execution and not set in .profile.d --- lib/language_pack/rails3.rb | 10 ++++------ spec/rails3_spec.rb | 4 ++++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/language_pack/rails3.rb b/lib/language_pack/rails3.rb index f84edbdfa..7125bda4f 100644 --- a/lib/language_pack/rails3.rb +++ b/lib/language_pack/rails3.rb @@ -19,12 +19,6 @@ def name "Ruby/Rails" end - def default_env_vars - super.merge({ - "RAILS_GROUPS" => "assets" - }) - end - def default_process_types instrument "rails3.default_process_types" do # let's special case thin here @@ -39,6 +33,10 @@ def default_process_types end end + def rake_env + super.merge(default_env_vars.merge("RAILS_GROUPS" => "assets")) + end + def compile instrument "rails3.compile" do super diff --git a/spec/rails3_spec.rb b/spec/rails3_spec.rb index 476f8482a..533313b5d 100644 --- a/spec/rails3_spec.rb +++ b/spec/rails3_spec.rb @@ -20,6 +20,10 @@ Hatchet::Runner.new("rails3_12factor").deploy do |app, heroku| expect(app.output).not_to match("Add 'rails_12factor' gem to your Gemfile to skip plugin injection") expect(successful_body(app)).to eq("hello") + + # https://github.com/heroku/heroku-buildpack-ruby/issues/525 + env = app.run("env") + expect(env).not_to match("RAILS_GROUPS") end end From 709f19dc5ba02569f8d3fb1a07eb1a21bd774002 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Wed, 18 Jan 2017 12:23:19 -0600 Subject: [PATCH 0304/1195] update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f0b21869e..6fafb9acf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Master +## v152 (01/18/2016) + +* Remove RAILS_GROUPS=assets from being set in .profile.d (#526) + ## v151 (01/16/2016) * Upgrade to bundler 1.13.7 (#519) From 19f792e2eb215d4ed15d8811192176b59eb6e4b4 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Wed, 18 Jan 2017 12:23:58 -0600 Subject: [PATCH 0305/1195] bump to v152 --- lib/language_pack/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 455d4720f..ccd6aeb8c 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v151" + BUILDPACK_VERSION = "v152" end end From c997e32d50d95708175a0445a2a125d498488a7c Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Wed, 18 Jan 2017 17:06:09 -0600 Subject: [PATCH 0306/1195] fix regression where rake env defaults would override the user_env --- hatchet.json | 1 + lib/language_pack/rails3.rb | 2 +- spec/rails4_spec.rb | 9 +++++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/hatchet.json b/hatchet.json index 1cc3ab6be..1e7c17626 100644 --- a/hatchet.json +++ b/hatchet.json @@ -60,6 +60,7 @@ "sharpstone/rails4-manifest", "sharpstone/rails3-to-4-no-bin", "sharpstone/rails4_windows_mri193", + "sharpstone/rails4-env-assets-compile", "sharpstone/rails4-fail-assets-compile" ], "rails41": [ diff --git a/lib/language_pack/rails3.rb b/lib/language_pack/rails3.rb index 7125bda4f..4ec822645 100644 --- a/lib/language_pack/rails3.rb +++ b/lib/language_pack/rails3.rb @@ -34,7 +34,7 @@ def default_process_types end def rake_env - super.merge(default_env_vars.merge("RAILS_GROUPS" => "assets")) + default_env_vars.merge("RAILS_GROUPS" => "assets").merge(super) end def compile diff --git a/spec/rails4_spec.rb b/spec/rails4_spec.rb index 5045b14dd..d06552c2a 100644 --- a/spec/rails4_spec.rb +++ b/spec/rails4_spec.rb @@ -58,4 +58,13 @@ expect(app).not_to be_deployed end end + + it "should not override user settings" do + app = Hatchet::Runner.new("rails4-env-assets-compile") + app.setup! + app.set_config("RAILS_ENV" => "staging") + app.deploy do |a, heroku| + expect(a.output).to include("w00t") + end + end end From 6fc21063f42fca708fc5013f093f2f813dfb2314 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Wed, 18 Jan 2017 18:35:02 -0600 Subject: [PATCH 0307/1195] update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6fafb9acf..a5573e74d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Master +## v153 (01/18/2016) + +* Fix regression, where defaults would override user env with rake (#528) + ## v152 (01/18/2016) * Remove RAILS_GROUPS=assets from being set in .profile.d (#526) From bff3bd207fa3539810a02042dde3221f9866f113 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Wed, 18 Jan 2017 18:36:05 -0600 Subject: [PATCH 0308/1195] bump to v153 --- lib/language_pack/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index ccd6aeb8c..bdf0f5631 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v152" + BUILDPACK_VERSION = "v153" end end From 8e0dec97fd3991cfe9e1628260e4fda58746e483 Mon Sep 17 00:00:00 2001 From: Justin Filip Date: Tue, 24 Jan 2017 10:39:18 -0500 Subject: [PATCH 0309/1195] New year rollovers are hard. =) --- CHANGELOG.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a5573e74d..70d6f790a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,14 +1,14 @@ ## Master -## v153 (01/18/2016) +## v153 (01/18/2017) * Fix regression, where defaults would override user env with rake (#528) -## v152 (01/18/2016) +## v152 (01/18/2017) * Remove RAILS_GROUPS=assets from being set in .profile.d (#526) -## v151 (01/16/2016) +## v151 (01/16/2017) * Upgrade to bundler 1.13.7 (#519) * Vendor Default Ruby to execute the buildpack (#515) From 647a27067c9ed04b0c2c091faedef4913a4e192c Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Wed, 8 Feb 2017 16:35:09 -0600 Subject: [PATCH 0310/1195] Some people using rails 5 don't have db rake tasks defined --- lib/language_pack/test.rb | 1 - lib/language_pack/test/rails5.rb | 15 --------------- 2 files changed, 16 deletions(-) delete mode 100644 lib/language_pack/test/rails5.rb diff --git a/lib/language_pack/test.rb b/lib/language_pack/test.rb index 5ba816f6d..fc52af6d4 100644 --- a/lib/language_pack/test.rb +++ b/lib/language_pack/test.rb @@ -5,4 +5,3 @@ module LanguagePack::Test require "language_pack/test/ruby" require "language_pack/test/rails2" -require "language_pack/test/rails5" diff --git a/lib/language_pack/test/rails5.rb b/lib/language_pack/test/rails5.rb deleted file mode 100644 index 93ed20850..000000000 --- a/lib/language_pack/test/rails5.rb +++ /dev/null @@ -1,15 +0,0 @@ -class LanguagePack::Rails5 - def prepare_tests - if bundler.has_gem?("activerecord") - topic "Preparing rails test database schema" - pipe("rails db:schema:load", env: rake_env) - schema_load_status = $?.success? - pipe("rails db:migrate", env: rake_env) - db_migrate_status = $?.success? - - if !schema_load_status or !db_migrate_status - error "Could not load test database schema" - end - end - end -end From de82a91007474bacbf9247bc28135c28de51b110 Mon Sep 17 00:00:00 2001 From: Joe Kutner Date: Wed, 22 Feb 2017 10:57:32 -0500 Subject: [PATCH 0311/1195] Add jruby to patchlevel_is_significant? test --- lib/language_pack/ruby_version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/ruby_version.rb b/lib/language_pack/ruby_version.rb index dd7392d79..b3a461760 100644 --- a/lib/language_pack/ruby_version.rb +++ b/lib/language_pack/ruby_version.rb @@ -52,7 +52,7 @@ def version_for_download # Before Ruby 2.1 patch releases were done via patchlevel i.e. 1.9.3-p426 versus 1.9.3-p448 # With 2.1 and above patches are released in the "minor" version instead i.e. 2.1.0 versus 2.1.1 def patchlevel_is_significant? - Gem::Version.new(self.ruby_version) <= Gem::Version.new("2.1") + !jruby? && Gem::Version.new(self.ruby_version) <= Gem::Version.new("2.1") end def rake_is_vendored? From 93be99d394ecf84e490cf98564bb7a68ed03072e Mon Sep 17 00:00:00 2001 From: Joe Kutner Date: Wed, 22 Feb 2017 12:09:38 -0500 Subject: [PATCH 0312/1195] Updated jruby-minimal test for latest jruby --- spec/helpers/bundler_wrapper_spec.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/spec/helpers/bundler_wrapper_spec.rb b/spec/helpers/bundler_wrapper_spec.rb index bbba1f58c..e9768bd90 100644 --- a/spec/helpers/bundler_wrapper_spec.rb +++ b/spec/helpers/bundler_wrapper_spec.rb @@ -41,7 +41,7 @@ it "handles JRuby pre gemfiles" do Hatchet::App.new("jruby-minimal").in_directory do |dir| - expect(@bundler.ruby_version).to eq("ruby-2.2.0-jruby-9.0.0.0.pre1") + expect(@bundler.ruby_version).to eq("ruby-2.3.1-p0-jruby-9.1.7.0") end end @@ -52,4 +52,3 @@ end end end - From 0ab5b77b85b49ac6dc5b29420018fc97a3457243 Mon Sep 17 00:00:00 2001 From: dmathieu <42@dmathieu.com> Date: Fri, 17 Feb 2017 10:37:15 +0100 Subject: [PATCH 0313/1195] check for the presence of more postgres adapters There are other adapters than `pg`. We need to check for their presence to determine whether the app needs a postgresql database or not. --- lib/language_pack/ruby.rb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index e28d8604c..7caed43ce 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -761,7 +761,19 @@ def allow_git(&blk) # decides if we need to enable the dev database addon # @return [Array] the database addon if the pg gem is detected or an empty Array if it isn't. def add_dev_database_addon - bundler.has_gem?("pg") ? ['heroku-postgresql'] : [] + pg_adapters.any? {|a| bundler.has_gem?(a) } ? ['heroku-postgresql'] : [] + end + + def pg_adapters + [ + "pg", + "activerecord-jdbcpostgresql-adapter", + "jdbc-postgres", + "jdbc-postgresql", + "jruby-pg", + "rjack-jdbc-postgres", + "tgbyte-activerecord-jdbcpostgresql-adapter" + ] end # decides if we need to install the node.js binary From 4102732009d0312075b6ed7be1e823b317f69b50 Mon Sep 17 00:00:00 2001 From: dmathieu <42@dmathieu.com> Date: Fri, 17 Feb 2017 10:38:25 +0100 Subject: [PATCH 0314/1195] do not override which database we add for rails2+ apps The rack language pack filters which apps we need to add a database for, so we do it only for apps with a pg adapter. Rely on that for rails apps as well. --- lib/language_pack/rails2.rb | 6 ------ 1 file changed, 6 deletions(-) diff --git a/lib/language_pack/rails2.rb b/lib/language_pack/rails2.rb index 75dc3e03f..656e65eef 100644 --- a/lib/language_pack/rails2.rb +++ b/lib/language_pack/rails2.rb @@ -79,12 +79,6 @@ def install_plugins end end - # most rails apps need a database - # @return [Array] shared database addon - def add_dev_database_addon - ['heroku-postgresql'] - end - # sets up the profile.d script for this buildpack def setup_profiled super From 6c1558ab3b844d7c48a7cf63e508062e00c80ad8 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Thu, 23 Feb 2017 17:23:23 -0600 Subject: [PATCH 0315/1195] update buildkits app being moved to private space --- Rakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index 3e5393b8d..63f499af6 100644 --- a/Rakefile +++ b/Rakefile @@ -100,7 +100,7 @@ namespace :buildpack do def connection @connection ||= begin user, password = Netrc.read["api.heroku.com"] - Excon.new("https://#{CGI.escape(user)}:#{password}@buildkits.herokuapp.com") + Excon.new("https://#{CGI.escape(user)}:#{password}@buildkits.heroku.com") end end From 10e3070d6138ecbacd3156e8e0f860e1ab3082f3 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 1 Mar 2017 14:43:18 -0800 Subject: [PATCH 0316/1195] [ci skip] v154 Changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 70d6f790a..1c86d9705 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ ## Master +## v154 (03/01/2017) + +* Postgres database add-on will only be provisioned if app has a postgres driver in the `Gemfile`. (#535) +* Fix regression, where JRuby patchlevel was being pulled from `Gemfile.lock` and used when not appropriate (#536) + ## v153 (01/18/2017) * Fix regression, where defaults would override user env with rake (#528) From 09d898e07d8e193c4c9e4114f522773f722d768f Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 1 Mar 2017 14:43:58 -0800 Subject: [PATCH 0317/1195] bump to v154 --- lib/language_pack/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index bdf0f5631..06cd58f49 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v153" + BUILDPACK_VERSION = "v154" end end From 99d2a2cfe3cba11662b1b1d254a996f16cd1eb68 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 1 Mar 2017 16:25:05 -0800 Subject: [PATCH 0318/1195] Fix previous slug download in Rake task --- Rakefile | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Rakefile b/Rakefile index 63f499af6..d5befb225 100644 --- a/Rakefile +++ b/Rakefile @@ -204,10 +204,8 @@ FILE Dir.mktmpdir("heroku-buildpack-ruby") do |tmpdir| Git.clone(File.expand_path("."), 'heroku-buildpack-ruby', path: tmpdir) Dir.chdir(tmpdir) do - streamer = lambda do |chunk, remaining_bytes, total_bytes| - File.open("ruby.tgz", "w") {|file| file.print(chunk) } - end - Excon.get(latest_release["tar_link"], :response_block => streamer) + sh "curl #{latest_release["tar_link"]} > ruby.tgz" + Dir.chdir("heroku-buildpack-ruby") do |buildpack_dir| $:.unshift File.expand_path("../lib", __FILE__) require "language_pack/installers/heroku_ruby_installer" From 446d08f6b8af68de89064899b157e043353df3df Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 1 Mar 2017 16:27:10 -0800 Subject: [PATCH 0319/1195] Enable yubikey in buildpack publishing --- Rakefile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index d5befb225..051ac62ad 100644 --- a/Rakefile +++ b/Rakefile @@ -256,7 +256,15 @@ FILE task :publish do buildpack_name = "heroku/ruby" puts "Publishing #{buildpack_name} buildpack" - resp = connection.post(multipart_form_data("buildpacks/buildpack.tgz").merge(path: "/buildpacks/#{buildpack_name}")) + + print "Enter your yubikey > " + yubikey = STDIN.gets.chomp + + request_hash = multipart_form_data("buildpacks/buildpack.tgz").merge(path: "/buildpacks/#{buildpack_name}") + request_hash[:headers]["heroku-two-factor-code"] = yubikey + + resp = connection.post(request_hash) + puts resp.status puts resp.body end From 5319d448aceeba215f4a477cb167044b72d9ec79 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Fri, 24 Feb 2017 19:11:47 -0600 Subject: [PATCH 0320/1195] replace s3pository with nodebin upgrade node to latest Node LTS for Rails 5.1 s3pository is being replaced with nodebin can't push to cedar-10 stack anymore, so don't need "legacy" node 0.12 is ancient at this point, we should pin to LTS now --- lib/language_pack/helpers/node_installer.rb | 53 ++++++++------------- lib/language_pack/helpers/nodebin.rb | 20 ++++++++ lib/language_pack/ruby.rb | 3 +- spec/helpers/node_installer_spec.rb | 16 +++++++ spec/node_spec.rb | 2 +- 5 files changed, 59 insertions(+), 35 deletions(-) create mode 100644 lib/language_pack/helpers/nodebin.rb create mode 100644 spec/helpers/node_installer_spec.rb diff --git a/lib/language_pack/helpers/node_installer.rb b/lib/language_pack/helpers/node_installer.rb index 710f768ce..7921e7b7c 100644 --- a/lib/language_pack/helpers/node_installer.rb +++ b/lib/language_pack/helpers/node_installer.rb @@ -1,44 +1,31 @@ class LanguagePack::NodeInstaller - MODERN_NODE_VERSION = "0.10.30" - MODERN_BINARY_PATH = "node-v#{MODERN_NODE_VERSION}-linux-x64" + attr_reader :version - LEGACY_NODE_VERSION = "0.4.7" - LEGACY_BINARY_PATH = "node-#{LEGACY_NODE_VERSION}" - - NODEJS_BASE_URL = "https://s3pository.heroku.com/node/v#{MODERN_NODE_VERSION}/" - - def initialize(stack) - @fetchers = { - modern: LanguagePack::Fetcher.new(NODEJS_BASE_URL), - legacy: LanguagePack::Fetcher.new(LanguagePack::Base::VENDOR_URL, LanguagePack::Base::DEFAULT_LEGACY_STACK) - } - @legacy = stack == LanguagePack::Base::DEFAULT_LEGACY_STACK - end - - def version - if @legacy - LEGACY_NODE_VERSION - else - MODERN_NODE_VERSION - end + def initialize + nodebin = LanguagePack::Nodebin.node_lts + @version = nodebin["number"] + @url = nodebin["url"] + @fetcher = LanguagePack::Fetcher.new("") end def binary_path - if @legacy - LEGACY_BINARY_PATH - else - MODERN_BINARY_PATH - end + node_folder(@version) end def install - if @legacy - @fetchers[:legacy].fetch_untar("#{LEGACY_BINARY_PATH}.tgz") - else - node_bin = "#{MODERN_BINARY_PATH}/bin/node" - @fetchers[:modern].fetch_untar("#{MODERN_BINARY_PATH}.tar.gz", "#{MODERN_BINARY_PATH}/bin/node") - FileUtils.mv(node_bin, ".") - FileUtils.rm_rf(MODERN_BINARY_PATH) + Dir.mktmpdir do |dir| + node_bin = "#{binary_path}/bin/node" + + Dir.chdir(dir) do + @fetcher.fetch_untar(@url, node_bin) + end + + FileUtils.mv("#{dir}/#{node_bin}", ".") end end + + private + def node_folder(version) + "node-v#{version}-linux-x64" + end end diff --git a/lib/language_pack/helpers/nodebin.rb b/lib/language_pack/helpers/nodebin.rb new file mode 100644 index 000000000..36e6d87f4 --- /dev/null +++ b/lib/language_pack/helpers/nodebin.rb @@ -0,0 +1,20 @@ +require 'json' + +class LanguagePack::Nodebin + URL = "https://nodebin.herokai.com/v1/" + + def self.query(q) + response = Net::HTTP.get_response(URI("#{URL}/#{q}")) + if response.code == '200' + JSON.parse(response.body) + end + end + + def self.node(q) + query("node/linux-x64/#{q}") + end + + def self.node_lts + node("latest?range=6.x") + end +end diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 7caed43ce..94cdcaae2 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -5,6 +5,7 @@ require "language_pack" require "language_pack/base" require "language_pack/ruby_version" +require "language_pack/helpers/nodebin" require "language_pack/helpers/node_installer" require "language_pack/helpers/jvm_installer" require "language_pack/version" @@ -39,7 +40,7 @@ def initialize(build_path, cache_path=nil) super(build_path, cache_path) @fetchers[:mri] = LanguagePack::Fetcher.new(VENDOR_URL, @stack) @fetchers[:rbx] = LanguagePack::Fetcher.new(RBX_BASE_URL, @stack) - @node_installer = LanguagePack::NodeInstaller.new(@stack) + @node_installer = LanguagePack::NodeInstaller.new @jvm_installer = LanguagePack::JvmInstaller.new(slug_vendor_jvm, @stack) end diff --git a/spec/helpers/node_installer_spec.rb b/spec/helpers/node_installer_spec.rb new file mode 100644 index 000000000..d0a794e9f --- /dev/null +++ b/spec/helpers/node_installer_spec.rb @@ -0,0 +1,16 @@ +require 'spec_helper' + +describe LanguagePack::NodeInstaller do + describe "#install" do + it "should extract a node binary" do + installer = LanguagePack::NodeInstaller.new + Dir.mktmpdir do |dir| + Dir.chdir(dir) do + installer.install + + expect(File.exist?("node")).to be(true) + end + end + end + end +end diff --git a/spec/node_spec.rb b/spec/node_spec.rb index 164360280..5a027cb05 100644 --- a/spec/node_spec.rb +++ b/spec/node_spec.rb @@ -9,7 +9,7 @@ end it "node is installed by default without multi buildpack" do - default_node_version = LanguagePack::NodeInstaller::MODERN_NODE_VERSION + default_node_version = LanguagePack::NodeInstaller.new.version Hatchet::Runner.new("node_multi").deploy do |app| expect(app.output).to match("Node Version in Ruby buildpack is: v#{default_node_version}") expect(app.run("node -v")).to match(default_node_version) From eacc4e08d246c6cc4998674eea9af2b109efeb0e Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Tue, 7 Mar 2017 19:54:16 -0600 Subject: [PATCH 0321/1195] move hatchet tests into spec/hatchet --- spec/{ => hatchet}/bugs_spec.rb | 2 +- spec/{ => hatchet}/gem_detect_errors_spec.rb | 0 spec/{ => hatchet}/jvm_spec.rb | 0 spec/{ => hatchet}/no_lockfile_spec.rb | 0 spec/{ => hatchet}/node_spec.rb | 0 spec/{ => hatchet}/rack_spec.rb | 2 +- spec/{ => hatchet}/rails23_spec.rb | 2 +- spec/{ => hatchet}/rails3_spec.rb | 2 +- spec/{ => hatchet}/rails41_spec.rb | 2 +- spec/{ => hatchet}/rails42_spec.rb | 2 +- spec/{ => hatchet}/rails4_spec.rb | 2 +- spec/{ => hatchet}/rails5_spec.rb | 2 +- spec/{ => hatchet}/rubies_spec.rb | 2 +- spec/{ => hatchet}/ruby_spec.rb | 2 +- spec/{ => hatchet}/stack_spec.rb | 2 +- spec/{ => hatchet}/upgrade_ruby_spec.rb | 0 spec/{ => hatchet}/user_env_compile_edge_case_spec.rb | 0 17 files changed, 11 insertions(+), 11 deletions(-) rename spec/{ => hatchet}/bugs_spec.rb (96%) rename spec/{ => hatchet}/gem_detect_errors_spec.rb (100%) rename spec/{ => hatchet}/jvm_spec.rb (100%) rename spec/{ => hatchet}/no_lockfile_spec.rb (100%) rename spec/{ => hatchet}/node_spec.rb (100%) rename spec/{ => hatchet}/rack_spec.rb (91%) rename spec/{ => hatchet}/rails23_spec.rb (89%) rename spec/{ => hatchet}/rails3_spec.rb (98%) rename spec/{ => hatchet}/rails41_spec.rb (98%) rename spec/{ => hatchet}/rails42_spec.rb (89%) rename spec/{ => hatchet}/rails4_spec.rb (98%) rename spec/{ => hatchet}/rails5_spec.rb (82%) rename spec/{ => hatchet}/rubies_spec.rb (98%) rename spec/{ => hatchet}/ruby_spec.rb (98%) rename spec/{ => hatchet}/stack_spec.rb (96%) rename spec/{ => hatchet}/upgrade_ruby_spec.rb (100%) rename spec/{ => hatchet}/user_env_compile_edge_case_spec.rb (100%) diff --git a/spec/bugs_spec.rb b/spec/hatchet/bugs_spec.rb similarity index 96% rename from spec/bugs_spec.rb rename to spec/hatchet/bugs_spec.rb index 222210556..31f220655 100644 --- a/spec/bugs_spec.rb +++ b/spec/hatchet/bugs_spec.rb @@ -1,4 +1,4 @@ -require_relative 'spec_helper' +require_relative '../spec_helper' describe "Bugs" do it "nokogiri should use the system libxml2" do diff --git a/spec/gem_detect_errors_spec.rb b/spec/hatchet/gem_detect_errors_spec.rb similarity index 100% rename from spec/gem_detect_errors_spec.rb rename to spec/hatchet/gem_detect_errors_spec.rb diff --git a/spec/jvm_spec.rb b/spec/hatchet/jvm_spec.rb similarity index 100% rename from spec/jvm_spec.rb rename to spec/hatchet/jvm_spec.rb diff --git a/spec/no_lockfile_spec.rb b/spec/hatchet/no_lockfile_spec.rb similarity index 100% rename from spec/no_lockfile_spec.rb rename to spec/hatchet/no_lockfile_spec.rb diff --git a/spec/node_spec.rb b/spec/hatchet/node_spec.rb similarity index 100% rename from spec/node_spec.rb rename to spec/hatchet/node_spec.rb diff --git a/spec/rack_spec.rb b/spec/hatchet/rack_spec.rb similarity index 91% rename from spec/rack_spec.rb rename to spec/hatchet/rack_spec.rb index 6464bfdc6..60b79bf6e 100644 --- a/spec/rack_spec.rb +++ b/spec/hatchet/rack_spec.rb @@ -1,4 +1,4 @@ -require_relative 'spec_helper' +require_relative '../spec_helper' describe "Rack" do it "should not overwrite already set environment variables" do diff --git a/spec/rails23_spec.rb b/spec/hatchet/rails23_spec.rb similarity index 89% rename from spec/rails23_spec.rb rename to spec/hatchet/rails23_spec.rb index 18a125366..7f7f193a9 100644 --- a/spec/rails23_spec.rb +++ b/spec/hatchet/rails23_spec.rb @@ -1,4 +1,4 @@ -require_relative 'spec_helper' +require_relative '../spec_helper' describe "Rails 2.3.x" do it "should deploy on ruby 1.9.3 on cedar-14" do diff --git a/spec/rails3_spec.rb b/spec/hatchet/rails3_spec.rb similarity index 98% rename from spec/rails3_spec.rb rename to spec/hatchet/rails3_spec.rb index 533313b5d..264f0b4be 100644 --- a/spec/rails3_spec.rb +++ b/spec/hatchet/rails3_spec.rb @@ -1,4 +1,4 @@ -require_relative 'spec_helper' +require_relative '../spec_helper' describe "Rails 3.x" do it "should deploy on ruby 1.9.3" do diff --git a/spec/rails41_spec.rb b/spec/hatchet/rails41_spec.rb similarity index 98% rename from spec/rails41_spec.rb rename to spec/hatchet/rails41_spec.rb index db0204fcf..edd00f027 100644 --- a/spec/rails41_spec.rb +++ b/spec/hatchet/rails41_spec.rb @@ -1,4 +1,4 @@ -require_relative 'spec_helper' +require_relative '../spec_helper' describe "Rails 4.1.x" do it "should detect rails successfully" do diff --git a/spec/rails42_spec.rb b/spec/hatchet/rails42_spec.rb similarity index 89% rename from spec/rails42_spec.rb rename to spec/hatchet/rails42_spec.rb index 3afd465fa..5581bcb09 100644 --- a/spec/rails42_spec.rb +++ b/spec/hatchet/rails42_spec.rb @@ -1,4 +1,4 @@ -require_relative 'spec_helper' +require_relative '../spec_helper' describe "Rails 4.2.x" do diff --git a/spec/rails4_spec.rb b/spec/hatchet/rails4_spec.rb similarity index 98% rename from spec/rails4_spec.rb rename to spec/hatchet/rails4_spec.rb index d06552c2a..1ba648d83 100644 --- a/spec/rails4_spec.rb +++ b/spec/hatchet/rails4_spec.rb @@ -1,4 +1,4 @@ -require_relative 'spec_helper' +require_relative '../spec_helper' describe "Rails 4.0.x" do it "should detect rails successfully" do diff --git a/spec/rails5_spec.rb b/spec/hatchet/rails5_spec.rb similarity index 82% rename from spec/rails5_spec.rb rename to spec/hatchet/rails5_spec.rb index 4e65a3f95..da7f89dc8 100644 --- a/spec/rails5_spec.rb +++ b/spec/hatchet/rails5_spec.rb @@ -1,4 +1,4 @@ -require_relative 'spec_helper' +require_relative '../spec_helper' describe "Rails 5.x" do diff --git a/spec/rubies_spec.rb b/spec/hatchet/rubies_spec.rb similarity index 98% rename from spec/rubies_spec.rb rename to spec/hatchet/rubies_spec.rb index c72e8f209..321e68e0b 100644 --- a/spec/rubies_spec.rb +++ b/spec/hatchet/rubies_spec.rb @@ -1,4 +1,4 @@ -require_relative 'spec_helper' +require_relative '../spec_helper' describe "Ruby Versions" do it "should allow patchlevels" do diff --git a/spec/ruby_spec.rb b/spec/hatchet/ruby_spec.rb similarity index 98% rename from spec/ruby_spec.rb rename to spec/hatchet/ruby_spec.rb index 533dec70b..532cb8ac6 100644 --- a/spec/ruby_spec.rb +++ b/spec/hatchet/ruby_spec.rb @@ -1,4 +1,4 @@ -require_relative 'spec_helper' +require_relative '../spec_helper' describe "Ruby apps" do describe "bundler ruby version matcher" do diff --git a/spec/stack_spec.rb b/spec/hatchet/stack_spec.rb similarity index 96% rename from spec/stack_spec.rb rename to spec/hatchet/stack_spec.rb index 0c02450f9..b9ace237f 100644 --- a/spec/stack_spec.rb +++ b/spec/hatchet/stack_spec.rb @@ -1,4 +1,4 @@ -require_relative "spec_helper" +require_relative "../spec_helper" describe "Stack Changes" do xit "should reinstall gems on stack change" do diff --git a/spec/upgrade_ruby_spec.rb b/spec/hatchet/upgrade_ruby_spec.rb similarity index 100% rename from spec/upgrade_ruby_spec.rb rename to spec/hatchet/upgrade_ruby_spec.rb diff --git a/spec/user_env_compile_edge_case_spec.rb b/spec/hatchet/user_env_compile_edge_case_spec.rb similarity index 100% rename from spec/user_env_compile_edge_case_spec.rb rename to spec/hatchet/user_env_compile_edge_case_spec.rb From ad7234b64bf4333354f985c05f05b94021182266 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Tue, 7 Mar 2017 19:57:16 -0600 Subject: [PATCH 0322/1195] install yarn for webpacker gem --- hatchet.json | 3 ++ lib/language_pack/helpers/nodebin.rb | 4 +++ lib/language_pack/helpers/yarn_installer.rb | 30 ++++++++++++++++ lib/language_pack/ruby.rb | 40 +++++++++++++++++++-- spec/hatchet/rails51_spec.rb | 10 ++++++ spec/helpers/yarn_installer_spec.rb | 20 +++++++++++ 6 files changed, 105 insertions(+), 2 deletions(-) create mode 100644 lib/language_pack/helpers/yarn_installer.rb create mode 100644 spec/hatchet/rails51_spec.rb create mode 100644 spec/helpers/yarn_installer_spec.rb diff --git a/hatchet.json b/hatchet.json index 1e7c17626..aad4ed565 100644 --- a/hatchet.json +++ b/hatchet.json @@ -73,6 +73,9 @@ "rails5": [ "sharpstone/rails5" ], + "rails51": [ + "schneems/rails51_webpacker" + ], "multibuildpack": [ "sharpstone/node_multi" ] diff --git a/lib/language_pack/helpers/nodebin.rb b/lib/language_pack/helpers/nodebin.rb index 36e6d87f4..03172e1ca 100644 --- a/lib/language_pack/helpers/nodebin.rb +++ b/lib/language_pack/helpers/nodebin.rb @@ -17,4 +17,8 @@ def self.node(q) def self.node_lts node("latest?range=6.x") end + + def self.yarn(q) + query("yarn/linux-x64/#{q}") + end end diff --git a/lib/language_pack/helpers/yarn_installer.rb b/lib/language_pack/helpers/yarn_installer.rb new file mode 100644 index 000000000..c38124fc9 --- /dev/null +++ b/lib/language_pack/helpers/yarn_installer.rb @@ -0,0 +1,30 @@ +class LanguagePack::YarnInstaller + attr_reader :version + + def initialize + # Grab latest yarn, until release practice stabilizes + # https://github.com/yarnpkg/yarn/issues/376#issuecomment-253366910 + nodebin = LanguagePack::Nodebin.yarn("latest") + @version = nodebin["number"] + @url = nodebin["url"] + @fetcher = LanguagePack::Fetcher.new("") + end + + def name + "yarn-#{@version}" + end + + def binary_path + "#{name}/bin/" + end + + def install + Dir.mktmpdir do |dir| + Dir.chdir(dir) do + @fetcher.fetch_untar(@url, "dist") + end + + FileUtils.mv("#{dir}/dist", name) + end + end +end diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 94cdcaae2..d6f09cb4f 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -7,6 +7,7 @@ require "language_pack/ruby_version" require "language_pack/helpers/nodebin" require "language_pack/helpers/node_installer" +require "language_pack/helpers/yarn_installer" require "language_pack/helpers/jvm_installer" require "language_pack/version" @@ -41,6 +42,7 @@ def initialize(build_path, cache_path=nil) @fetchers[:mri] = LanguagePack::Fetcher.new(VENDOR_URL, @stack) @fetchers[:rbx] = LanguagePack::Fetcher.new(RBX_BASE_URL, @stack) @node_installer = LanguagePack::NodeInstaller.new + @yarn_installer = LanguagePack::YarnInstaller.new @jvm_installer = LanguagePack::JvmInstaller.new(slug_vendor_jvm, @stack) end @@ -292,6 +294,7 @@ def setup_language_pack_environment end setup_ruby_install_env ENV["PATH"] += ":#{node_preinstall_bin_path}" if node_js_installed? + ENV["PATH"] += ":#{yarn_preinstall_bin_path}" if !yarn_not_preinstalled? # TODO when buildpack-env-args rolls out, we can get rid of # ||= and the manual setting below @@ -326,9 +329,13 @@ def setup_export # sets up the profile.d script for this buildpack def setup_profiled instrument 'setup_profiled' do + profiled_path = [binstubs_relative_paths.map {|path| "$HOME/#{path}" }.join(":")] + profiled_path << "vendor/#{@yarn_installer.binary_path}" if add_yarn_binary + profiled_path << "$PATH" + set_env_default "LANG", "en_US.UTF-8" set_env_override "GEM_PATH", "$HOME/#{slug_vendor_base}:$GEM_PATH" - set_env_override "PATH", binstubs_relative_paths.map {|path| "$HOME/#{path}" }.join(":") + ":$PATH" + set_env_override "PATH", profiled_path.join(":") add_to_profiled set_default_web_concurrency if env("SENSIBLE_DEFAULTS") @@ -442,7 +449,7 @@ def install_bundler_in_app # default set of binaries to install # @return [Array] resulting list def binaries - add_node_js_binary + add_node_js_binary + add_yarn_binary end # vendors binaries into the slug @@ -457,11 +464,21 @@ def install_binaries # @param [String] name of the binary package from S3. # Example: https://s3.amazonaws.com/language-pack-ruby/node-0.4.7.tgz, where name is "node-0.4.7" def install_binary(name) + topic "Installing #{name}" bin_dir = "bin" FileUtils.mkdir_p bin_dir Dir.chdir(bin_dir) do |dir| if name.match(/^node\-/) @node_installer.install + node_bin_path = File.absolute_path(".") + ENV["PATH"] = "#{node_bin_path}:#{ENV["PATH"]}" + elsif name.match(/^yarn\-/) + FileUtils.mkdir_p("../vendor") + Dir.chdir("../vendor") do |vendor_dir| + @yarn_installer.install + yarn_path = File.absolute_path("#{vendor_dir}/#{@yarn_installer.binary_path}") + ENV["PATH"] = "#{yarn_path}:#{ENV["PATH"]}" + end else @fetchers[:buildpack].fetch_untar("#{name}.tgz") end @@ -784,6 +801,10 @@ def add_node_js_binary bundler.has_gem?('execjs') && node_not_preinstalled? ? [@node_installer.binary_path] : [] end + def add_yarn_binary + bundler.has_gem?('webpacker') && yarn_not_preinstalled? ? [@yarn_installer.name] : [] + end + # checks if node.js is installed via the official heroku-buildpack-nodejs using multibuildpack # @return String if it's detected and false if it isn't def node_preinstall_bin_path @@ -805,6 +826,21 @@ def node_not_preinstalled? !node_js_installed? end + def yarn_preinstall_bin_path + return @yarn_preinstall_bin_path if defined?(@yarn_preinstall_bin_path) + + path = run("which yarn") + if path && $?.success? + @yarn_preinstall_bin_path = path + else + @yarn_preinstall_bin_path = false + end + end + + def yarn_not_preinstalled? + !yarn_preinstall_bin_path + end + def run_assets_precompile_rake_task instrument 'ruby.run_assets_precompile_rake_task' do diff --git a/spec/hatchet/rails51_spec.rb b/spec/hatchet/rails51_spec.rb new file mode 100644 index 000000000..d8318797a --- /dev/null +++ b/spec/hatchet/rails51_spec.rb @@ -0,0 +1,10 @@ +require "spec_helper" + +describe "Rails 5.1" do + fit "works with webpacker + yarn (js friends)" do + Hatchet::Runner.new("rails51_webpacker").deploy do |app, heroku| + puts app.output + expect(app.run("rails -v")).to match("") + end + end +end diff --git a/spec/helpers/yarn_installer_spec.rb b/spec/helpers/yarn_installer_spec.rb new file mode 100644 index 000000000..eee2f6a5f --- /dev/null +++ b/spec/helpers/yarn_installer_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +describe LanguagePack::YarnInstaller do + describe "#install" do + + it "should extract the yarn package" do + installer = LanguagePack::YarnInstaller.new + + Dir.mktmpdir do |dir| + Dir.chdir(dir) do + installer.install + + # webpacker gem checks for yarnpkg + # https://github.com/rails/webpacker/blob/master/lib/install/bin/yarn.tt#L5 + expect(File.exist?("yarn-#{installer.version}/bin/yarnpkg")).to be(true) + end + end + end + end +end From 2bc72b88a66f01f9c69e1ccf9ed8720e7fd0c84a Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Thu, 9 Mar 2017 17:30:16 -0600 Subject: [PATCH 0323/1195] add unit tests for install_binary with yarn --- spec/ruby_spec.rb | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 spec/ruby_spec.rb diff --git a/spec/ruby_spec.rb b/spec/ruby_spec.rb new file mode 100644 index 000000000..02d9c97fc --- /dev/null +++ b/spec/ruby_spec.rb @@ -0,0 +1,31 @@ +require "spec_helper" + +describe LanguagePack::Ruby do + describe "#install_binary" do + context "installing yarn" do + before do + @old_path = ENV['PATH'] + @old_stack = ENV['STACK'] + ENV['STACK'] = 'cedar-14' + end + + after do + ENV['PATH'] = @old_path + ENV['STACK'] = @old_stack + end + + it "sets up PATH" do + Dir.mktmpdir do |build_path| + Dir.mktmpdir do |cache_path| + Dir.chdir(build_path) do + ruby = LanguagePack::Ruby.new(build_path, cache_path) + ruby.send(:install_binary, "yarn-0.22.0") + expect(ENV["PATH"]).to include("vendor/yarn") + end + end + end + end + + end + end +end From 704696b022243497a4cbb5192a11265e7cf6e42c Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Fri, 10 Mar 2017 16:35:56 -0600 Subject: [PATCH 0324/1195] put node bin path at the end of the PATH --- lib/language_pack/ruby.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index d6f09cb4f..db9d5af55 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -471,7 +471,7 @@ def install_binary(name) if name.match(/^node\-/) @node_installer.install node_bin_path = File.absolute_path(".") - ENV["PATH"] = "#{node_bin_path}:#{ENV["PATH"]}" + ENV["PATH"] = "#{ENV["PATH"]}:#{node_bin_path}" elsif name.match(/^yarn\-/) FileUtils.mkdir_p("../vendor") Dir.chdir("../vendor") do |vendor_dir| From 4c6a582e4eae04516515930ded5b2cba11da1f22 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Fri, 10 Mar 2017 18:28:18 -0600 Subject: [PATCH 0325/1195] update yarn test --- spec/hatchet/rails51_spec.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spec/hatchet/rails51_spec.rb b/spec/hatchet/rails51_spec.rb index d8318797a..12e0b2332 100644 --- a/spec/hatchet/rails51_spec.rb +++ b/spec/hatchet/rails51_spec.rb @@ -1,9 +1,10 @@ require "spec_helper" describe "Rails 5.1" do - fit "works with webpacker + yarn (js friends)" do + it "works with webpacker + yarn (js friends)" do Hatchet::Runner.new("rails51_webpacker").deploy do |app, heroku| - puts app.output + expect(app.output).to include("Installing yarn") + expect(app.output).to include("yarn install") expect(app.run("rails -v")).to match("") end end From 098cd1493ec18c4e29d69f18f90f9aaefbc5e0b1 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Mon, 13 Mar 2017 16:57:49 -0500 Subject: [PATCH 0326/1195] namespace classes in the Helpers directory --- lib/language_pack/helpers/jvm_installer.rb | 2 +- lib/language_pack/helpers/node_installer.rb | 4 ++-- lib/language_pack/helpers/nodebin.rb | 2 +- lib/language_pack/helpers/yarn_installer.rb | 4 ++-- lib/language_pack/ruby.rb | 6 +++--- spec/hatchet/node_spec.rb | 2 +- spec/helpers/jvm_installer_spec.rb | 12 ++++++------ spec/helpers/node_installer_spec.rb | 4 ++-- spec/helpers/yarn_installer_spec.rb | 4 ++-- 9 files changed, 20 insertions(+), 20 deletions(-) diff --git a/lib/language_pack/helpers/jvm_installer.rb b/lib/language_pack/helpers/jvm_installer.rb index 3f89bf4f2..2817d4fbb 100644 --- a/lib/language_pack/helpers/jvm_installer.rb +++ b/lib/language_pack/helpers/jvm_installer.rb @@ -1,6 +1,6 @@ require "language_pack/shell_helpers" -class LanguagePack::JvmInstaller +class LanguagePack::Helpers::JvmInstaller include LanguagePack::ShellHelpers SYS_PROPS_FILE = "system.properties" diff --git a/lib/language_pack/helpers/node_installer.rb b/lib/language_pack/helpers/node_installer.rb index 7921e7b7c..b197119f3 100644 --- a/lib/language_pack/helpers/node_installer.rb +++ b/lib/language_pack/helpers/node_installer.rb @@ -1,8 +1,8 @@ -class LanguagePack::NodeInstaller +class LanguagePack::Helpers::NodeInstaller attr_reader :version def initialize - nodebin = LanguagePack::Nodebin.node_lts + nodebin = LanguagePack::Helpers::Nodebin.node_lts @version = nodebin["number"] @url = nodebin["url"] @fetcher = LanguagePack::Fetcher.new("") diff --git a/lib/language_pack/helpers/nodebin.rb b/lib/language_pack/helpers/nodebin.rb index 03172e1ca..8a8471102 100644 --- a/lib/language_pack/helpers/nodebin.rb +++ b/lib/language_pack/helpers/nodebin.rb @@ -1,6 +1,6 @@ require 'json' -class LanguagePack::Nodebin +class LanguagePack::Helpers::Nodebin URL = "https://nodebin.herokai.com/v1/" def self.query(q) diff --git a/lib/language_pack/helpers/yarn_installer.rb b/lib/language_pack/helpers/yarn_installer.rb index c38124fc9..6514bffbf 100644 --- a/lib/language_pack/helpers/yarn_installer.rb +++ b/lib/language_pack/helpers/yarn_installer.rb @@ -1,10 +1,10 @@ -class LanguagePack::YarnInstaller +class LanguagePack::Helpers::YarnInstaller attr_reader :version def initialize # Grab latest yarn, until release practice stabilizes # https://github.com/yarnpkg/yarn/issues/376#issuecomment-253366910 - nodebin = LanguagePack::Nodebin.yarn("latest") + nodebin = LanguagePack::Helpers::Nodebin.yarn("latest") @version = nodebin["number"] @url = nodebin["url"] @fetcher = LanguagePack::Fetcher.new("") diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index db9d5af55..1a50c2d29 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -41,9 +41,9 @@ def initialize(build_path, cache_path=nil) super(build_path, cache_path) @fetchers[:mri] = LanguagePack::Fetcher.new(VENDOR_URL, @stack) @fetchers[:rbx] = LanguagePack::Fetcher.new(RBX_BASE_URL, @stack) - @node_installer = LanguagePack::NodeInstaller.new - @yarn_installer = LanguagePack::YarnInstaller.new - @jvm_installer = LanguagePack::JvmInstaller.new(slug_vendor_jvm, @stack) + @node_installer = LanguagePack::Helpers::NodeInstaller.new + @yarn_installer = LanguagePack::Helpers::YarnInstaller.new + @jvm_installer = LanguagePack::Helpers::JvmInstaller.new(slug_vendor_jvm, @stack) end def name diff --git a/spec/hatchet/node_spec.rb b/spec/hatchet/node_spec.rb index 5a027cb05..8766538d1 100644 --- a/spec/hatchet/node_spec.rb +++ b/spec/hatchet/node_spec.rb @@ -9,7 +9,7 @@ end it "node is installed by default without multi buildpack" do - default_node_version = LanguagePack::NodeInstaller.new.version + default_node_version = LanguagePack::Helpers::NodeInstaller.new.version Hatchet::Runner.new("node_multi").deploy do |app| expect(app.output).to match("Node Version in Ruby buildpack is: v#{default_node_version}") expect(app.run("node -v")).to match(default_node_version) diff --git a/spec/helpers/jvm_installer_spec.rb b/spec/helpers/jvm_installer_spec.rb index 1c2030191..e6fbb72c0 100644 --- a/spec/helpers/jvm_installer_spec.rb +++ b/spec/helpers/jvm_installer_spec.rb @@ -8,7 +8,7 @@ begin ENV['JDK_URL_1_8'] = "http://lang-jvm.s3.amazonaws.com/jdk/openjdk1.8.0_51-cedar14.tar.gz" - jvm_installer = LanguagePack::JvmInstaller.new(dir, "cedar-14") + jvm_installer = LanguagePack::Helpers::JvmInstaller.new(dir, "cedar-14") jvm_installer.install("9.0.1.0") expect(`ls bin`).to match("java") @@ -25,7 +25,7 @@ Dir.chdir(dir) do File.open('system.properties', 'w') { |f| f.write("java.runtime.version=1.7") } - jvm_installer = LanguagePack::JvmInstaller.new(dir, "cedar-14") + jvm_installer = LanguagePack::Helpers::JvmInstaller.new(dir, "cedar-14") jvm_installer.install("9.0.1.0") expect(`ls bin`).to match("java") @@ -40,7 +40,7 @@ Dir.chdir(dir) do File.open('system.properties', 'w') { |f| f.write("java.runtime.version=1.9") } - jvm_installer = LanguagePack::JvmInstaller.new(dir, "cedar-14") + jvm_installer = LanguagePack::Helpers::JvmInstaller.new(dir, "cedar-14") jvm_installer.install("9.0.1.0") expect(`ls bin`).to match("java") @@ -55,7 +55,7 @@ Dir.chdir(dir) do File.open('system.properties', 'w') { |f| f.write("java.runtime.version=1.8.0_51") } - jvm_installer = LanguagePack::JvmInstaller.new(dir, "cedar-14") + jvm_installer = LanguagePack::Helpers::JvmInstaller.new(dir, "cedar-14") jvm_installer.install("9.0.1.0") expect(`ls bin`).to match("java") @@ -67,7 +67,7 @@ it "downloads default JDK" do Dir.mktmpdir do |dir| Dir.chdir(dir) do - jvm_installer = LanguagePack::JvmInstaller.new(dir, "cedar-14") + jvm_installer = LanguagePack::Helpers::JvmInstaller.new(dir, "cedar-14") jvm_installer.install("9.0.1.0") expect(`ls bin`).to match("java") @@ -83,7 +83,7 @@ Dir.chdir(dir) do File.open('system.properties', 'w') { |f| f.write("java.runtime.version=foobar") } - jvm_installer = LanguagePack::JvmInstaller.new(dir, "cedar-14") + jvm_installer = LanguagePack::Helpers::JvmInstaller.new(dir, "cedar-14") expect{ jvm_installer.install("9.0.1.0") }.to raise_error(BuildpackError) end diff --git a/spec/helpers/node_installer_spec.rb b/spec/helpers/node_installer_spec.rb index d0a794e9f..8475a2df7 100644 --- a/spec/helpers/node_installer_spec.rb +++ b/spec/helpers/node_installer_spec.rb @@ -1,9 +1,9 @@ require 'spec_helper' -describe LanguagePack::NodeInstaller do +describe LanguagePack::Helpers::NodeInstaller do describe "#install" do it "should extract a node binary" do - installer = LanguagePack::NodeInstaller.new + installer = LanguagePack::Helpers::NodeInstaller.new Dir.mktmpdir do |dir| Dir.chdir(dir) do installer.install diff --git a/spec/helpers/yarn_installer_spec.rb b/spec/helpers/yarn_installer_spec.rb index eee2f6a5f..2957f814a 100644 --- a/spec/helpers/yarn_installer_spec.rb +++ b/spec/helpers/yarn_installer_spec.rb @@ -1,10 +1,10 @@ require 'spec_helper' -describe LanguagePack::YarnInstaller do +describe LanguagePack::Helpers::YarnInstaller do describe "#install" do it "should extract the yarn package" do - installer = LanguagePack::YarnInstaller.new + installer = LanguagePack::Helpers::YarnInstaller.new Dir.mktmpdir do |dir| Dir.chdir(dir) do From 83a7abce97162a729b61e46d451b04d0f92474ea Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Mon, 13 Mar 2017 17:16:11 -0500 Subject: [PATCH 0327/1195] add comment about why we mktmpdir in NodeInstaller --- lib/language_pack/helpers/node_installer.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/language_pack/helpers/node_installer.rb b/lib/language_pack/helpers/node_installer.rb index b197119f3..16e7eb9d9 100644 --- a/lib/language_pack/helpers/node_installer.rb +++ b/lib/language_pack/helpers/node_installer.rb @@ -13,6 +13,10 @@ def binary_path end def install + # Untar of this file produces artifacts that the app does not need to run. + # If we ran this command in the app directory, we would have to manually + # clean up un-used files. Instead we untar in a temp directory which + # helps us avoid accidentally deleting code out of the user's slug by mistake. Dir.mktmpdir do |dir| node_bin = "#{binary_path}/bin/node" From 3702b221e500fe0defdb31402f4e3494dc20be43 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Mon, 13 Mar 2017 18:45:10 -0500 Subject: [PATCH 0328/1195] add node path comment --- lib/language_pack/ruby.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 1a50c2d29..e2c4213ed 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -470,7 +470,11 @@ def install_binary(name) Dir.chdir(bin_dir) do |dir| if name.match(/^node\-/) @node_installer.install + # need to set PATH here b/c `node-gyp` can change the CWD, but still depends on executing node. + # the current PATH is relative, but it needs to be absolute for this. + # doing this here also prevents it from being exported during runtime node_bin_path = File.absolute_path(".") + # this needs to be set after so other binaries in bin/ don't take precedence" ENV["PATH"] = "#{ENV["PATH"]}:#{node_bin_path}" elsif name.match(/^yarn\-/) FileUtils.mkdir_p("../vendor") From a62c3d69d87080e2843c44bd47fdc16b668b9980 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 1 Mar 2017 16:23:21 -0800 Subject: [PATCH 0329/1195] bump to v155 --- lib/language_pack/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 06cd58f49..508ece21e 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v154" + BUILDPACK_VERSION = "v155" end end From 543af95ffeb07730daec0b198b4a5ac73e24987b Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 15 Mar 2017 13:17:00 -0500 Subject: [PATCH 0330/1195] Bypass nodebin until security review is done --- lib/language_pack/helpers/nodebin.rb | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/lib/language_pack/helpers/nodebin.rb b/lib/language_pack/helpers/nodebin.rb index 8a8471102..027caf8a1 100644 --- a/lib/language_pack/helpers/nodebin.rb +++ b/lib/language_pack/helpers/nodebin.rb @@ -10,15 +10,29 @@ def self.query(q) end end + def self.hardcoded_node_lts(q) + { + number: "6.10.0", + url: "https://s3.amazonaws.com/heroku-nodejs-bins/node/release/linux-x64/node-v6.10.0-linux-x64.tar.gz" + } + end + + def self.hardcoded_yarn(q) + { + number: "0.22.0", + url: "https://s3.amazonaws.com/heroku-nodejs-bins/yarn/release/yarn-v0.22.0.tar.gz" + } + end + def self.node(q) query("node/linux-x64/#{q}") end def self.node_lts - node("latest?range=6.x") + hardcoded_node_lts # node("latest?range=6.x") end def self.yarn(q) - query("yarn/linux-x64/#{q}") + hardcoded_yarn # query("yarn/linux-x64/#{q}") end end From 3f48e055b235785f0661bf57539c7600fe0b7d68 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 15 Mar 2017 13:41:06 -0500 Subject: [PATCH 0331/1195] Fix arity --- lib/language_pack/helpers/nodebin.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/language_pack/helpers/nodebin.rb b/lib/language_pack/helpers/nodebin.rb index 027caf8a1..817a9c26b 100644 --- a/lib/language_pack/helpers/nodebin.rb +++ b/lib/language_pack/helpers/nodebin.rb @@ -10,14 +10,14 @@ def self.query(q) end end - def self.hardcoded_node_lts(q) + def self.hardcoded_node_lts { number: "6.10.0", url: "https://s3.amazonaws.com/heroku-nodejs-bins/node/release/linux-x64/node-v6.10.0-linux-x64.tar.gz" } end - def self.hardcoded_yarn(q) + def self.hardcoded_yarn { number: "0.22.0", url: "https://s3.amazonaws.com/heroku-nodejs-bins/yarn/release/yarn-v0.22.0.tar.gz" From d4881a56c598141247984d5e58f611bf4b8b609b Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Wed, 15 Mar 2017 13:56:11 -0500 Subject: [PATCH 0332/1195] use urls from heroku-buildpack-nodejs until nodebin passes security review --- lib/language_pack/helpers/nodebin.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/language_pack/helpers/nodebin.rb b/lib/language_pack/helpers/nodebin.rb index 817a9c26b..f3a3b269c 100644 --- a/lib/language_pack/helpers/nodebin.rb +++ b/lib/language_pack/helpers/nodebin.rb @@ -11,16 +11,18 @@ def self.query(q) end def self.hardcoded_node_lts + version = "6.10.0" { - number: "6.10.0", - url: "https://s3.amazonaws.com/heroku-nodejs-bins/node/release/linux-x64/node-v6.10.0-linux-x64.tar.gz" + "number" => version, + "url" => "https://s3pository.heroku.com/node/v#{version}/node-v#{version}-linux-x64.tar.gz" } end def self.hardcoded_yarn + version = "0.22.0" { - number: "0.22.0", - url: "https://s3.amazonaws.com/heroku-nodejs-bins/yarn/release/yarn-v0.22.0.tar.gz" + "number" => version, + "url" => "https://yarnpkg.com/downloads/#{version}/yarn-v#{version}.tar.gz" } end From 6988832f5d34de9e2e338d82caf68d183302c338 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 16 Mar 2017 12:29:16 -0500 Subject: [PATCH 0333/1195] [ci skip] v155 changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c86d9705..6232c5c9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Master +## v155 (03/16/2017) + +* Yarn now installed for apps with `webpacker` gem (#547) + ## v154 (03/01/2017) * Postgres database add-on will only be provisioned if app has a postgres driver in the `Gemfile`. (#535) From f9ad7d57ac22865d4867113a0bc712cf5b23b59f Mon Sep 17 00:00:00 2001 From: Ryan Montgomery Date: Mon, 20 Mar 2017 01:14:35 -0400 Subject: [PATCH 0334/1195] Do not assume lib/tasks exists --- lib/language_pack/test/rails2.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/language_pack/test/rails2.rb b/lib/language_pack/test/rails2.rb index 34df62a72..eee2ddcdd 100644 --- a/lib/language_pack/test/rails2.rb +++ b/lib/language_pack/test/rails2.rb @@ -26,6 +26,7 @@ def prepare_tests # rails test runner + rspec depend on db:test:purge which drops/creates a db which doesn't work on Heroku's DB plans def blank_db_test_purge_task + FileUtils::mkdir_p 'lib/tasks' File.open("lib/tasks/heroku_db_test_purge.rake", "w") do |file| file.puts < Date: Fri, 24 Mar 2017 14:41:30 -0500 Subject: [PATCH 0335/1195] Only add yarn to path if needed We mistakenly added yarn to the path even when it was not on the system. --- lib/language_pack/ruby.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index e2c4213ed..9b6396234 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -330,7 +330,7 @@ def setup_export def setup_profiled instrument 'setup_profiled' do profiled_path = [binstubs_relative_paths.map {|path| "$HOME/#{path}" }.join(":")] - profiled_path << "vendor/#{@yarn_installer.binary_path}" if add_yarn_binary + profiled_path << "vendor/#{@yarn_installer.binary_path}" if has_yarn_binary? profiled_path << "$PATH" set_env_default "LANG", "en_US.UTF-8" @@ -809,6 +809,10 @@ def add_yarn_binary bundler.has_gem?('webpacker') && yarn_not_preinstalled? ? [@yarn_installer.name] : [] end + def has_yarn_binary? + add_yarn_binary.any? + end + # checks if node.js is installed via the official heroku-buildpack-nodejs using multibuildpack # @return String if it's detected and false if it isn't def node_preinstall_bin_path From ae1dd41d5cf10d314e3460e11d5dcedcdfe99f07 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 27 Mar 2017 11:31:57 -0500 Subject: [PATCH 0336/1195] Set GEM_PATH instead of vendoring Gem A "double rainbow" deploy is when someone is using the same buildpack twice. Normally this is by accident. There are failure conditions defined in #511 the app has to have a `json` gem and a version of Ruby that is different from the version of Ruby being used by the buildpacks. When this happens, this exception will occur when the second buildpack tries to execute: ``` remote: -----> Ruby app detected remote: /tmp/tmp.Se0nOtPeri/bin/ruby: symbol lookup error: /tmp/build_c85cc44940028913e25caa54b9ff2142/vendor/bundle/ruby/2.3.0/gems/json-1.8.6/lib/json/ext/generator.so: undefined symbol: rb_data_typed_object_zalloc remote: ! Push rejected, failed to compile Ruby app. ``` If you look at the output, the failure is happening extremely early, this indicated that it was happening before any significant code had been run, otherwise we would have expected to see ``` remote: -----> Compiling Ruby ``` The exception only occurred when using `v155` of the buildpack as the second buildpack (via `heroku buildpacks:add`). Here's what was happening: The first buildpack runs and installs the app's `json` gem. The buildpacks are designed so that they make their contents available for the next buildpack. I.e. if you install `node` via a buildpack, then the next buildpack to execute is expected to have `node` on the `PATH`. The same is true of ruby and any gems installed. So now the second buildpack executes. To do this it's own source code is loaded into memory, when it does this it hits a `require "json"` call that was introduced in `v155` and tries find the `json` library. While this library ships with Ruby it is also a gem, if the gem is present on the system it will prefer the gem. So it loads the `json` gem from a different version of Ruby that is currently executing, it can't because the symbols are different, it errors out. We can avoid this by forcing `GEM_PATH` that the Ruby buildpack is using to the default for the current Ruby version. --- bin/compile | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/compile b/bin/compile index 0be697f94..412856047 100755 --- a/bin/compile +++ b/bin/compile @@ -17,5 +17,6 @@ if [ ! -d "$ROOT_DIR/vendor/ruby/$STACK" ]; then fi export PATH=$ruby_dir/bin/:$PATH +unset GEM_PATH $ruby_dir/bin/ruby $BIN_DIR/ruby_compile $@ From d1355c479abb7d12705062c0bb7dc4b2986fffd8 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 4 Apr 2017 13:48:16 -0500 Subject: [PATCH 0337/1195] Fix Double Ruby for CI & DRY We can DRY up the bash scripts a bit by putting common logic into a function. You get access to this function by sourcing `bin/support/bash_functions.sh`. Currently only one function is offered: ``` heroku_buildpack_ruby_install_ruby "$BIN_DIR" "$ROOT_DIR" ``` This will download a version of Ruby for the buildpack and set the appropriate env vars so that it can be run. Now everywhere we were previously doing this manually we can re-use this bash function: ``` source "$BIN_DIR/support/bash_functions.sh" heroku_buildpack_ruby_install_ruby "$BIN_DIR" "$ROOT_DIR" ``` This left us with a problem since `bin/test-compile` is what set's up an app's `PATH` and `GEM_PATH`, however `bin/test` which is called after, also installs a verison of Ruby for the buildpack and to get this working correctly it mutates the `PATH` and unsets the `GEM_PATH`. To get the application code working correctly we can manually set the two values. ```ruby LanguagePack::ShellHelpers.user_env_hash["PATH"] = "#{build_dir}/bin:#{ENV["PATH"]}" LanguagePack::ShellHelpers.user_env_hash["GEM_PATH"] = LanguagePack::Ruby.slug_vendor_base ``` To get this code to work we have to remove support for Ruby 1.8.7 from the buildpack. This is fine since 1.8.7 is EOL for many years now and not supported on any stacks that Heroku currently maintains. --- CHANGELOG.md | 5 +++ Gemfile.lock | 56 ++++++++++++++++-------- bin/compile | 17 ++----- bin/support/bash_functions.sh | 33 ++++++++++++++ bin/{bootstrap => support/download_ruby} | 5 ++- bin/{ => support}/ruby_compile | 8 +++- bin/{ => support}/ruby_test | 20 ++++++--- bin/{ => support}/ruby_test-compile | 15 +++++-- bin/test | 14 ++---- bin/test-compile | 16 ++----- hatchet.json | 4 ++ lib/language_pack/base.rb | 1 + lib/language_pack/ruby.rb | 17 ++++--- spec/hatchet/ci_spec.rb | 10 +++++ 14 files changed, 142 insertions(+), 79 deletions(-) create mode 100755 bin/support/bash_functions.sh rename bin/{bootstrap => support/download_ruby} (67%) rename bin/{ => support}/ruby_compile (59%) rename bin/{ => support}/ruby_test (52%) rename bin/{ => support}/ruby_test-compile (50%) create mode 100644 spec/hatchet/ci_spec.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index 6232c5c9d..c6f09f90b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ ## Master +* Fix "double ruby rainbow bug" caused by executing two `compile` actions on the same +app (#553 & #555) +* Remove Ruby 1.8.7 compatiability to allow for #555. This version of Ruby has been EOL +for a long time. It is not available on Cedar-14 and Cedar-10 is EOL + ## v155 (03/16/2017) * Yarn now installed for apps with `webpacker` gem (#547) diff --git a/Gemfile.lock b/Gemfile.lock index 3f10d116b..48fa7b29f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -8,44 +8,58 @@ GIT GEM remote: https://rubygems.org/ specs: - activesupport (4.0.13) - i18n (~> 0.6, >= 0.6.9) - minitest (~> 4.2) - multi_json (~> 1.3) - thread_safe (~> 0.1) - tzinfo (~> 0.3.37) + activesupport (4.2.8) + i18n (~> 0.7) + minitest (~> 5.1) + thread_safe (~> 0.3, >= 0.3.4) + tzinfo (~> 1.1) anvil-cli (0.16.2) progress (~> 2.4, >= 2.4.0) rest-client (~> 1.6, >= 1.6.7) thor (~> 0.15, >= 0.15.2) diff-lcs (1.2.5) - excon (0.45.4) - heroku-api (0.4.0) + domain_name (0.5.20170223) + unf (>= 0.0.5, < 1.0.0) + erubis (2.7.0) + excon (0.55.0) + heroics (0.0.21) + erubis (~> 2.0) + excon + multi_json (>= 1.9.2) + heroku-api (0.4.2) excon (~> 0.45) multi_json (~> 1.8) - heroku_hatchet (1.4.1) + heroku_hatchet (2.0.0) activesupport (~> 4) anvil-cli (~> 0) excon (~> 0) heroku-api (~> 0) + platform-api (~> 1) repl_runner (~> 0.0.3) rrrretry (~> 1) thor (~> 0) threaded (~> 0) - i18n (0.7.0) + http-cookie (1.0.3) + domain_name (~> 0.5) + i18n (0.8.1) json (2.0.2) - mime-types (2.4.3) - minitest (4.7.5) - multi_json (1.11.2) - netrc (0.10.2) + mime-types (2.99.3) + minitest (5.10.1) + moneta (0.8.1) + multi_json (1.12.1) + netrc (0.11.0) parallel (1.8.0) parallel_tests (2.5.0) parallel + platform-api (1.0.1) + heroics (~> 0.0.21) + moneta (~> 0.8.1) progress (2.4.0) rake (10.0.4) repl_runner (0.0.3) activesupport - rest-client (1.7.2) + rest-client (1.8.0) + http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 3.0) netrc (~> 0.7) rrrretry (1.0.0) @@ -57,10 +71,14 @@ GEM rspec-retry (0.4.5) rspec-core rspec-support (3.4.1) - thor (0.19.1) - thread_safe (0.3.5) + thor (0.19.4) + thread_safe (0.3.6) threaded (0.0.4) - tzinfo (0.3.52) + tzinfo (1.2.3) + thread_safe (~> 0.1) + unf (0.1.4) + unf_ext + unf_ext (0.0.7.2) PLATFORMS ruby @@ -78,4 +96,4 @@ DEPENDENCIES rspec-retry BUNDLED WITH - 1.13.6 + 1.14.6 diff --git a/bin/compile b/bin/compile index 412856047..86b9c5019 100755 --- a/bin/compile +++ b/bin/compile @@ -5,18 +5,7 @@ BIN_DIR=$(cd $(dirname $0); pwd) ROOT_DIR=$(dirname $BIN_DIR) -ruby_dir="$ROOT_DIR/vendor/ruby/$STACK" -if [ ! -d "$ROOT_DIR/vendor/ruby/$STACK" ]; then - ruby_dir=$(mktemp -d) - # bootstrap ruby - $BIN_DIR/bootstrap $ruby_dir - function atexit { - rm -rf $ruby_dir - } - trap atexit EXIT -fi +source "$BIN_DIR/support/bash_functions.sh" +heroku_buildpack_ruby_install_ruby "$BIN_DIR" "$ROOT_DIR" -export PATH=$ruby_dir/bin/:$PATH -unset GEM_PATH - -$ruby_dir/bin/ruby $BIN_DIR/ruby_compile $@ +$heroku_buildpack_ruby_dir/bin/ruby $BIN_DIR/support/ruby_compile $@ diff --git a/bin/support/bash_functions.sh b/bin/support/bash_functions.sh new file mode 100755 index 000000000..81f05ae1c --- /dev/null +++ b/bin/support/bash_functions.sh @@ -0,0 +1,33 @@ +# This function will install a version of Ruby onto the +# system for the buidlpack to use. It coordinates download +# and setting appropriate env vars for execution +# +# Example: +# +# heroku_buildpack_ruby_install_ruby "$BIN_DIR" "$ROOT_DIR" +# +# Takes two arguments, the first is the location of the buildpack's +# `bin` directory. This is where the `download_ruby` script can be +# found. The second argument is the root directory where Ruby +# can be installed. +# +# Returns the directory where ruby was downloaded +heroku_buildpack_ruby_install_ruby() +{ + local bin_dir=$1 + local root_dir=$2 + heroku_buildpack_ruby_dir="$root_dir/vendor/ruby/$STACK" + + if [ ! -d "$root_dir/vendor/ruby/$STACK" ]; then + heroku_buildpack_ruby_dir=$(mktemp -d) + # bootstrap ruby + $bin_dir/support/download_ruby $heroku_buildpack_ruby_dir + function atexit { + rm -rf $heroku_buildpack_ruby_dir + } + trap atexit EXIT + fi + + export PATH=$heroku_buildpack_ruby_dir/bin/:$PATH + unset GEM_PATH +} diff --git a/bin/bootstrap b/bin/support/download_ruby similarity index 67% rename from bin/bootstrap rename to bin/support/download_ruby index 6a8370068..14a0e80ba 100755 --- a/bin/bootstrap +++ b/bin/support/download_ruby @@ -1,9 +1,10 @@ #!/usr/bin/env ruby -# sync output +# This script will download a version of Ruby for the buildpack to use +# and put it in the `ARGV.first` location. $stdout.sync = true -$:.unshift File.expand_path("../../lib", __FILE__) +$:.unshift File.expand_path("../../../lib", __FILE__) require "language_pack" DEFAULT_STACK = "cedar-14" diff --git a/bin/ruby_compile b/bin/support/ruby_compile similarity index 59% rename from bin/ruby_compile rename to bin/support/ruby_compile index d5eb40a33..949fc1500 100755 --- a/bin/ruby_compile +++ b/bin/support/ruby_compile @@ -1,9 +1,13 @@ #!/usr/bin/env ruby -# sync output +# This script compiles an application so it can run on Heroku. +# It will install the application's specified verison of Ruby, it's dependencies +# and certain framework specific requirements (such as calling `rake assets:precompile` +# for rails apps). You can see all features described in the devcenter +# https://devcenter.heroku.com/articles/ruby-support $stdout.sync = true -$:.unshift File.expand_path("../../lib", __FILE__) +$:.unshift File.expand_path("../../../lib", __FILE__) require "language_pack" require "language_pack/shell_helpers" diff --git a/bin/ruby_test b/bin/support/ruby_test similarity index 52% rename from bin/ruby_test rename to bin/support/ruby_test index 22773c4ee..9c66bb1d7 100755 --- a/bin/ruby_test +++ b/bin/support/ruby_test @@ -1,12 +1,16 @@ #!/usr/bin/env ruby -# sync output +# This script will detect which test script or framework an app is likely to be +# using and run the appropriate command. It is expected that `ruby_test-compile` +# will be run before this file, this installs a version of Ruby and any dependencies +# a customer's app needs. $stdout.sync = true -$:.unshift File.expand_path("../../lib", __FILE__) +$:.unshift File.expand_path("../../../lib", __FILE__) require "language_pack" require "language_pack/shell_helpers" require "language_pack/test" +require "language_pack/ruby" include LanguagePack::ShellHelpers @@ -20,13 +24,19 @@ def execute_command(command) pipe(command, :user_env => true) end -# bin/test BUILD_DIR ENV_DIR ARTIFACT_DIR +# $ bin/test BUILD_DIR ENV_DIR ARTIFACT_DIR build_dir, env_dir, artifact_dir = ARGV LanguagePack::ShellHelpers.initialize_env(env_dir) -# point bundler wrapper to app's bundler gem + +# The `ruby_test-compile` program installs a version of Ruby for the +# user's application. It needs the propper `PATH`, where ever Ruby is installed +# we always add a symlink to the `bin/ruby` file so that is always valid. +# We calculate the gem path the same way we do when compiling. +LanguagePack::ShellHelpers.user_env_hash["PATH"] = "#{build_dir}/bin:#{ENV["PATH"]}" +LanguagePack::ShellHelpers.user_env_hash["GEM_PATH"] = LanguagePack::Ruby.slug_vendor_base + bundler_path = "#{build_dir}/vendor/bundle/ruby/2.3.0/gems/" bundler = LanguagePack::Helpers::BundlerWrapper.new( - bundler_path: bundler_path, gemfile_path: "#{build_dir}/Gemfile" ) # load bundler diff --git a/bin/ruby_test-compile b/bin/support/ruby_test-compile similarity index 50% rename from bin/ruby_test-compile rename to bin/support/ruby_test-compile index c93184dfb..832a2d4e6 100755 --- a/bin/ruby_test-compile +++ b/bin/support/ruby_test-compile @@ -1,9 +1,17 @@ #!/usr/bin/env ruby -# sync output -$stdout.sync = true +# This script installs an app's Ruby version and dependencies. It's +# essentially the same thing as `ruby_compile` (which is called by bin/compile) +# except that some behavior is cusomtized by the inclusion of the +# `language_pack/test` file. One difference is dependencies +# the `bin/compile` installs dependencies via bundler and excludes `development:test` +# gems, however we need `test` gems to run tests, so instead only `development` +# is excluded. +# +# It also sets up the database (if one is present) and populates the database +# with the appropriate schema. -$:.unshift File.expand_path("../../lib", __FILE__) +$:.unshift File.expand_path("../../../lib", __FILE__) require "language_pack" require "language_pack/shell_helpers" require "language_pack/test" @@ -30,4 +38,3 @@ rescue Exception => e raise e end end - diff --git a/bin/test b/bin/test index f1bbde721..c3d930f41 100755 --- a/bin/test +++ b/bin/test @@ -5,15 +5,7 @@ BIN_DIR=$(cd $(dirname $0); pwd) ROOT_DIR=$(dirname $BIN_DIR) -ruby_dir="$ROOT_DIR/vendor/ruby/$STACK" -if [ ! -d "$ROOT_DIR/vendor/ruby/$STACK" ]; then - ruby_dir=$(mktemp -d) - # bootstrap ruby - $BIN_DIR/bootstrap $ruby_dir - function atexit { - rm -rf $ruby_dir - } - trap atexit EXIT -fi +source "$BIN_DIR/support/bash_functions.sh" +heroku_buildpack_ruby_install_ruby "$BIN_DIR" "$ROOT_DIR" -$ruby_dir/bin/ruby $BIN_DIR/ruby_test $@ +$heroku_buildpack_ruby_dir/bin/ruby $BIN_DIR/support/ruby_test $@ diff --git a/bin/test-compile b/bin/test-compile index 18bf623ff..2c36b2bdb 100755 --- a/bin/test-compile +++ b/bin/test-compile @@ -5,17 +5,7 @@ BIN_DIR=$(cd $(dirname $0); pwd) ROOT_DIR=$(dirname $BIN_DIR) -ruby_dir="$ROOT_DIR/vendor/ruby/$STACK" -if [ ! -d "$ROOT_DIR/vendor/ruby/$STACK" ]; then - ruby_dir=$(mktemp -d) - # bootstrap ruby - $BIN_DIR/bootstrap $ruby_dir - function atexit { - rm -rf $ruby_dir - } - trap atexit EXIT -fi +source "$BIN_DIR/support/bash_functions.sh" +heroku_buildpack_ruby_install_ruby "$BIN_DIR" "$ROOT_DIR" -export PATH=$ruby_dir/bin/:$PATH - -$ruby_dir/bin/ruby $BIN_DIR/ruby_test-compile $@ +$heroku_buildpack_ruby_dir/bin/ruby $BIN_DIR/support/ruby_test-compile $@ diff --git a/hatchet.json b/hatchet.json index aad4ed565..e34acd5a8 100644 --- a/hatchet.json +++ b/hatchet.json @@ -78,5 +78,9 @@ ], "multibuildpack": [ "sharpstone/node_multi" + ], + "ci": [ + "sharpstone/rails5_ruby_schema_format", + "sharpstone/heroku-ci-json-example" ] } diff --git a/lib/language_pack/base.rb b/lib/language_pack/base.rb index c41ff735f..cecfefe7b 100644 --- a/lib/language_pack/base.rb +++ b/lib/language_pack/base.rb @@ -14,6 +14,7 @@ # abstract class that all the Ruby based Language Packs inherit from class LanguagePack::Base include LanguagePack::ShellHelpers + extend LanguagePack::ShellHelpers VENDOR_URL = ENV['BUILDPACK_VENDOR_URL'] || "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby" DEFAULT_LEGACY_STACK = "cedar" diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 9b6396234..6e9d0efa5 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -160,19 +160,18 @@ def system_paths "/usr/local/bin:/usr/bin:/bin" end + def self.slug_vendor_base + command = %q(ruby -e "require 'rbconfig';puts \"vendor/bundle/#{RUBY_ENGINE}/#{RbConfig::CONFIG['ruby_version']}\"") + slug_vendor_base = run_no_pipe(command, user_env: true).chomp + error "Problem detecting bundler vendor directory: #{@slug_vendor_base}" unless $?.success? + return slug_vendor_base + end + # the relative path to the bundler directory of gems # @return [String] resulting path def slug_vendor_base instrument 'ruby.slug_vendor_base' do - if @slug_vendor_base - @slug_vendor_base - elsif ruby_version.ruby_version == "1.8.7" - @slug_vendor_base = "vendor/bundle/1.8" - else - @slug_vendor_base = run_no_pipe(%q(ruby -e "require 'rbconfig';puts \"vendor/bundle/#{RUBY_ENGINE}/#{RbConfig::CONFIG['ruby_version']}\"")).chomp - error "Problem detecting bundler vendor directory: #{@slug_vendor_base}" unless $?.success? - @slug_vendor_base - end + @slug_vendor_base ||= self.class.slug_vendor_base end end diff --git a/spec/hatchet/ci_spec.rb b/spec/hatchet/ci_spec.rb new file mode 100644 index 000000000..544c327b2 --- /dev/null +++ b/spec/hatchet/ci_spec.rb @@ -0,0 +1,10 @@ +require 'spec_helper' + +describe "CI" do + it "Does not cause the double ruby rainbow bug" do + Hatchet::Runner.new("heroku-ci-json-example").run_ci do |test_run| + # puts test_run.output + expect(test_run.status).to eq(:succeeded) + end + end +end From e5ed6656d81c209d97b972c8ffb6fd2f5ce6f201 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 5 Apr 2017 21:28:27 -0500 Subject: [PATCH 0338/1195] Update CI tests - Generated a new OAuth token for Travis and Circle. - Updated ruby versions on Travis and Circle - Removed the custom travis setup script from the buildpack and started using the one that ships with Hatchet - Set the HEROKU_API_USER to a valid email address for Travis and Circle --- .travis.yml | 11 ++++++----- Gemfile.lock | 4 ++-- Rakefile | 19 +------------------ circle.yml | 4 ++-- 4 files changed, 11 insertions(+), 27 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0d3d1f78e..c46415228 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: ruby rvm: -- 2.0.0 -before_script: bundle exec rake travis:setup +- 2.4.1 +before_script: bundle exec rake hatchet:setup_travis script: bundle exec parallel_rspec -n 11 spec/ after_script: - heroku keys:remove $USER@`hostname` @@ -11,11 +11,12 @@ env: - IS_RUNNING_ON_CI=true - HATCHET_DEPLOY_STRATEGY=git - HATCHET_APP_LIMIT=80 - - secure: bM8uWN5b9hZzzHk73EN9xHCK65vuopcbwQILcuMt0A1mHB8tSH1xyMYddNrbGdfznLAVXf8UjvKvv6rvvG4O+j3GRuIWVNukoAvZxG0FC9QxYuKbDccEPPdtqGwVEfWEKQYLajsIpF8/ACyALGV+Oe/Z28WRk6Ba3FLptfulc6s= + - secure: xFS5oLPMGyT6N0LKwU7wllaEZEVLzE/D5HuD14q3Vfd4L369XpV6ORYJF/2mkf765m+LH1MaN09rJaKc00ZcQfQECMuzyWagLsr1bVKs+szta3G/nFjjVTwmoPX5kVw5q7e6TYvS/KAzo+n8u5pW+zu8MMTwnv40QI6LfcbZkTc= + - secure: wd/FBYI9I37PJ+eXhO8vesvWELkklNgGRA1xo/tuA31+ACpY/jG5EjrHd+semsfDTxM8fZe3s0foIch+jeMTIOcGs98tDC/L/8b/h6i0Qic0DqkAk6B30fT+5Nl3dufjiXsBJg5xj1zYqW6ka3DKIDjnn+3ao2cme05MtDQBHdc= sudo: false addons: apt: sources: - - heroku + - heroku packages: - - heroku-toolbelt + - heroku-toolbelt diff --git a/Gemfile.lock b/Gemfile.lock index 48fa7b29f..8b41a2b17 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -18,7 +18,7 @@ GEM rest-client (~> 1.6, >= 1.6.7) thor (~> 0.15, >= 0.15.2) diff-lcs (1.2.5) - domain_name (0.5.20170223) + domain_name (0.5.20170404) unf (>= 0.0.5, < 1.0.0) erubis (2.7.0) excon (0.55.0) @@ -29,7 +29,7 @@ GEM heroku-api (0.4.2) excon (~> 0.45) multi_json (~> 1.8) - heroku_hatchet (2.0.0) + heroku_hatchet (2.0.2) activesupport (~> 4) anvil-cli (~> 0) excon (~> 0) diff --git a/Rakefile b/Rakefile index 051ac62ad..35444ee63 100644 --- a/Rakefile +++ b/Rakefile @@ -308,21 +308,4 @@ begin rescue LoadError => e end -namespace :travis do - task :setup do - sh "bundle exec hatchet install" - sh "if [ `git config --get user.email` ]; then echo 'already set'; else `git config --global user.email 'buildpack@example.com'`; fi" - sh "if [ `git config --get user.name` ]; then echo 'already set'; else `git config --global user.name 'BuildpackTester'` ; fi" - sh "echo ' -Host heroku.com - StrictHostKeyChecking no - CheckHostIP no - UserKnownHostsFile=/dev/null - IdentityFile ~/.ssh/id_rsa -Host github.com - StrictHostKeyChecking no -' >> ~/.ssh/config" - sh "ssh-keygen -f ~/.ssh/id_rsa -t rsa -N ''" - sh "yes | heroku keys:add" - end -end + diff --git a/circle.yml b/circle.yml index 69fc52fb6..586da4457 100644 --- a/circle.yml +++ b/circle.yml @@ -1,6 +1,6 @@ machine: ruby: - version: 2.0.0 + version: 2.4.0 environment: HATCHET_RETRIES: 3 IS_RUNNING_ON_CI: true @@ -9,7 +9,7 @@ machine: test: pre: - - bundle exec rake travis:setup + - bundle exec rake hatchet:setup_travis override: - bundle exec parallel_rspec -n 11 spec/ post: From d71b2296dd892be15fc30fbc8ee37fbfa27b9b01 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 6 Apr 2017 15:31:57 -0500 Subject: [PATCH 0339/1195] Don't execute tests against "merge" commits Due to the way travis is built if any new tests for new functionality are added then the "merge" commit test will always fail. This is confusing as it means actually "green" tests have 1 failure. If we always exit on "merge" commits then we can expect green tests before actually merging pull requests --- spec/spec_helper.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 510a7033e..582191be7 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -43,3 +43,8 @@ def create_file_with_size_in(size, dir) config.return_char "\n" # the character that submits the command config.sync_stdout "STDOUT.sync = true" # force REPL to not buffer standard out end + +if ENV['TRAVIS'] + # Don't execute tests against "merge" commits + exit 0 if ENV['TRAVIS_PULL_REQUEST'] != 'false' && ENV['TRAVIS_BRANCH'] == 'master' +end From 125b6e6dd63ac707eff3466a2204532128ce97b5 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 10 Apr 2017 17:14:42 -0500 Subject: [PATCH 0340/1195] Re-add `$stdout.sync = true` to `ruby_test-compile`. --- bin/support/ruby_test-compile | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/support/ruby_test-compile b/bin/support/ruby_test-compile index 832a2d4e6..34e59463e 100755 --- a/bin/support/ruby_test-compile +++ b/bin/support/ruby_test-compile @@ -10,6 +10,7 @@ # # It also sets up the database (if one is present) and populates the database # with the appropriate schema. +$stdout.sync = true $:.unshift File.expand_path("../../../lib", __FILE__) require "language_pack" From d6c52b7939428f78ea5d3bbd20289a3543917082 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 10 Apr 2017 17:15:00 -0500 Subject: [PATCH 0341/1195] Add comments that explain where $STACK comes from --- bin/support/bash_functions.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bin/support/bash_functions.sh b/bin/support/bash_functions.sh index 81f05ae1c..1ac0ae434 100755 --- a/bin/support/bash_functions.sh +++ b/bin/support/bash_functions.sh @@ -11,6 +11,10 @@ # found. The second argument is the root directory where Ruby # can be installed. # +# This function relies on the env var `$STACK` being set. This +# is set in codon outside of the buildpack. An example of a stack +# would be "cedar-14". +# # Returns the directory where ruby was downloaded heroku_buildpack_ruby_install_ruby() { From f772923f9416b8c3ce0c65000cc87c2e894332df Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 10 Apr 2017 17:15:25 -0500 Subject: [PATCH 0342/1195] Use existing variable --- bin/support/bash_functions.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/support/bash_functions.sh b/bin/support/bash_functions.sh index 1ac0ae434..7c3895260 100755 --- a/bin/support/bash_functions.sh +++ b/bin/support/bash_functions.sh @@ -22,7 +22,8 @@ heroku_buildpack_ruby_install_ruby() local root_dir=$2 heroku_buildpack_ruby_dir="$root_dir/vendor/ruby/$STACK" - if [ ! -d "$root_dir/vendor/ruby/$STACK" ]; then + # The -d flag checks to see if a file exists and is a directory + if [ ! -d "$heroku_buildpack_ruby_dir" ]; then heroku_buildpack_ruby_dir=$(mktemp -d) # bootstrap ruby $bin_dir/support/download_ruby $heroku_buildpack_ruby_dir From 4e57a8576c29e8ca4d26c220870a2aadd465d9cd Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 10 Apr 2017 17:15:50 -0500 Subject: [PATCH 0343/1195] Prefer BUILDPACK_DIR to ROOT_DIR --- bin/compile | 4 ++-- bin/support/bash_functions.sh | 6 +++--- bin/test | 4 ++-- bin/test-compile | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/bin/compile b/bin/compile index 86b9c5019..f02fb5129 100755 --- a/bin/compile +++ b/bin/compile @@ -3,9 +3,9 @@ # bootstraps the ruby needed and then executes `bin/ruby_compile` BIN_DIR=$(cd $(dirname $0); pwd) -ROOT_DIR=$(dirname $BIN_DIR) +BUILDPACK_DIR=$(dirname $BIN_DIR) source "$BIN_DIR/support/bash_functions.sh" -heroku_buildpack_ruby_install_ruby "$BIN_DIR" "$ROOT_DIR" +heroku_buildpack_ruby_install_ruby "$BIN_DIR" "$BUILDPACK_DIR" $heroku_buildpack_ruby_dir/bin/ruby $BIN_DIR/support/ruby_compile $@ diff --git a/bin/support/bash_functions.sh b/bin/support/bash_functions.sh index 7c3895260..e27463cb6 100755 --- a/bin/support/bash_functions.sh +++ b/bin/support/bash_functions.sh @@ -4,7 +4,7 @@ # # Example: # -# heroku_buildpack_ruby_install_ruby "$BIN_DIR" "$ROOT_DIR" +# heroku_buildpack_ruby_install_ruby "$BIN_DIR" "$BUILDPACK_DIR" # # Takes two arguments, the first is the location of the buildpack's # `bin` directory. This is where the `download_ruby` script can be @@ -19,8 +19,8 @@ heroku_buildpack_ruby_install_ruby() { local bin_dir=$1 - local root_dir=$2 - heroku_buildpack_ruby_dir="$root_dir/vendor/ruby/$STACK" + local buildpack_dir=$2 + heroku_buildpack_ruby_dir="$buildpack_dir/vendor/ruby/$STACK" # The -d flag checks to see if a file exists and is a directory if [ ! -d "$heroku_buildpack_ruby_dir" ]; then diff --git a/bin/test b/bin/test index c3d930f41..4e821c108 100755 --- a/bin/test +++ b/bin/test @@ -3,9 +3,9 @@ # bootstraps the ruby needed and then executes `bin/ruby_test-compile` BIN_DIR=$(cd $(dirname $0); pwd) -ROOT_DIR=$(dirname $BIN_DIR) +BUILDPACK_DIR=$(dirname $BIN_DIR) source "$BIN_DIR/support/bash_functions.sh" -heroku_buildpack_ruby_install_ruby "$BIN_DIR" "$ROOT_DIR" +heroku_buildpack_ruby_install_ruby "$BIN_DIR" "$BUILDPACK_DIR" $heroku_buildpack_ruby_dir/bin/ruby $BIN_DIR/support/ruby_test $@ diff --git a/bin/test-compile b/bin/test-compile index 2c36b2bdb..5a1529819 100755 --- a/bin/test-compile +++ b/bin/test-compile @@ -3,9 +3,9 @@ # bootstraps the ruby needed and then executes `bin/ruby_test-compile` BIN_DIR=$(cd $(dirname $0); pwd) -ROOT_DIR=$(dirname $BIN_DIR) +BUILDPACK_DIR=$(dirname $BIN_DIR) source "$BIN_DIR/support/bash_functions.sh" -heroku_buildpack_ruby_install_ruby "$BIN_DIR" "$ROOT_DIR" +heroku_buildpack_ruby_install_ruby "$BIN_DIR" "$BUILDPACK_DIR" $heroku_buildpack_ruby_dir/bin/ruby $BIN_DIR/support/ruby_test-compile $@ From 6b7294098b59023d412f8ac96e46f4a310bb4067 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 10 Apr 2017 17:17:44 -0500 Subject: [PATCH 0344/1195] Remove unused variable --- bin/support/ruby_test | 1 - 1 file changed, 1 deletion(-) diff --git a/bin/support/ruby_test b/bin/support/ruby_test index 9c66bb1d7..13daac0bc 100755 --- a/bin/support/ruby_test +++ b/bin/support/ruby_test @@ -35,7 +35,6 @@ LanguagePack::ShellHelpers.initialize_env(env_dir) LanguagePack::ShellHelpers.user_env_hash["PATH"] = "#{build_dir}/bin:#{ENV["PATH"]}" LanguagePack::ShellHelpers.user_env_hash["GEM_PATH"] = LanguagePack::Ruby.slug_vendor_base -bundler_path = "#{build_dir}/vendor/bundle/ruby/2.3.0/gems/" bundler = LanguagePack::Helpers::BundlerWrapper.new( gemfile_path: "#{build_dir}/Gemfile" ) From 6ce4b20df4bd2b79f60646928cee92beef42b999 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 10 Apr 2017 17:18:10 -0500 Subject: [PATCH 0345/1195] Circle use the same Ruby as Travis --- circle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/circle.yml b/circle.yml index 586da4457..232bf722e 100644 --- a/circle.yml +++ b/circle.yml @@ -1,6 +1,6 @@ machine: ruby: - version: 2.4.0 + version: 2.4.1 environment: HATCHET_RETRIES: 3 IS_RUNNING_ON_CI: true From bfbd20514e09eb422af79db11e0f153c49b409aa Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 10 Apr 2017 17:19:10 -0500 Subject: [PATCH 0346/1195] Remvoed coment. --- spec/hatchet/ci_spec.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/spec/hatchet/ci_spec.rb b/spec/hatchet/ci_spec.rb index 544c327b2..6260a1abe 100644 --- a/spec/hatchet/ci_spec.rb +++ b/spec/hatchet/ci_spec.rb @@ -3,7 +3,6 @@ describe "CI" do it "Does not cause the double ruby rainbow bug" do Hatchet::Runner.new("heroku-ci-json-example").run_ci do |test_run| - # puts test_run.output expect(test_run.status).to eq(:succeeded) end end From eb78a9392bf9c7f78e55089a7d40b1cf35190bd9 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 10 Apr 2017 17:19:57 -0500 Subject: [PATCH 0347/1195] Fix comment --- bin/support/bash_functions.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/support/bash_functions.sh b/bin/support/bash_functions.sh index e27463cb6..773606a65 100755 --- a/bin/support/bash_functions.sh +++ b/bin/support/bash_functions.sh @@ -15,7 +15,8 @@ # is set in codon outside of the buildpack. An example of a stack # would be "cedar-14". # -# Returns the directory where ruby was downloaded +# Relies on global scope to set the variable `$heroku_buildpack_ruby_dir` +# that can be used by other scripts heroku_buildpack_ruby_install_ruby() { local bin_dir=$1 From 090e67ded71ac070bd236c06a0386a6ab1eb9ce6 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 10 Apr 2017 17:26:03 -0500 Subject: [PATCH 0348/1195] Only modify path when ruby is installed --- bin/support/bash_functions.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/support/bash_functions.sh b/bin/support/bash_functions.sh index 773606a65..937c80e7b 100755 --- a/bin/support/bash_functions.sh +++ b/bin/support/bash_functions.sh @@ -32,8 +32,8 @@ heroku_buildpack_ruby_install_ruby() rm -rf $heroku_buildpack_ruby_dir } trap atexit EXIT - fi - export PATH=$heroku_buildpack_ruby_dir/bin/:$PATH - unset GEM_PATH + export PATH=$heroku_buildpack_ruby_dir/bin/:$PATH + unset GEM_PATH + fi } From ee8dc783fe8004dfe2716d5db87895086ffafea7 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Mon, 10 Apr 2017 17:08:27 -0500 Subject: [PATCH 0349/1195] bump default ruby to 2.3.4 --- lib/language_pack/ruby_version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/ruby_version.rb b/lib/language_pack/ruby_version.rb index b3a461760..49da9ccb7 100644 --- a/lib/language_pack/ruby_version.rb +++ b/lib/language_pack/ruby_version.rb @@ -12,7 +12,7 @@ def initialize(output = "") end end - DEFAULT_VERSION_NUMBER = "2.2.6" + DEFAULT_VERSION_NUMBER = "2.3.4" DEFAULT_VERSION = "ruby-#{DEFAULT_VERSION_NUMBER}" LEGACY_VERSION_NUMBER = "1.9.2" LEGACY_VERSION = "ruby-#{LEGACY_VERSION_NUMBER}" From ab93adcdbe08727e16c8cdf5b8b512da1f258a5b Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 11 Apr 2017 11:20:55 -0500 Subject: [PATCH 0350/1195] Revert "Merge pull request #555 from heroku/schneems/re-organize-bin" This reverts commit a23dca10fbd8d523cfc7d6847d0d648a4fc0fdec, reversing changes made to 850d4c0b2decc76d6102799a8ffc04601958a223. This is temporary, we need to seperate out code into two deploys. One for default ruby version, then this in another deploy. --- .travis.yml | 11 +++-- CHANGELOG.md | 5 --- Gemfile.lock | 56 ++++++++---------------- Rakefile | 19 +++++++- bin/{support/download_ruby => bootstrap} | 5 +-- bin/compile | 19 ++++++-- bin/{support => }/ruby_compile | 8 +--- bin/{support => }/ruby_test | 21 +++------ bin/{support => }/ruby_test-compile | 14 ++---- bin/support/bash_functions.sh | 39 ----------------- bin/test | 16 +++++-- bin/test-compile | 18 ++++++-- circle.yml | 4 +- hatchet.json | 4 -- lib/language_pack/base.rb | 1 - lib/language_pack/ruby.rb | 17 +++---- spec/hatchet/ci_spec.rb | 9 ---- spec/spec_helper.rb | 5 --- 18 files changed, 107 insertions(+), 164 deletions(-) rename bin/{support/download_ruby => bootstrap} (67%) rename bin/{support => }/ruby_compile (59%) rename bin/{support => }/ruby_test (50%) rename bin/{support => }/ruby_test-compile (51%) delete mode 100755 bin/support/bash_functions.sh delete mode 100644 spec/hatchet/ci_spec.rb diff --git a/.travis.yml b/.travis.yml index c46415228..0d3d1f78e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: ruby rvm: -- 2.4.1 -before_script: bundle exec rake hatchet:setup_travis +- 2.0.0 +before_script: bundle exec rake travis:setup script: bundle exec parallel_rspec -n 11 spec/ after_script: - heroku keys:remove $USER@`hostname` @@ -11,12 +11,11 @@ env: - IS_RUNNING_ON_CI=true - HATCHET_DEPLOY_STRATEGY=git - HATCHET_APP_LIMIT=80 - - secure: xFS5oLPMGyT6N0LKwU7wllaEZEVLzE/D5HuD14q3Vfd4L369XpV6ORYJF/2mkf765m+LH1MaN09rJaKc00ZcQfQECMuzyWagLsr1bVKs+szta3G/nFjjVTwmoPX5kVw5q7e6TYvS/KAzo+n8u5pW+zu8MMTwnv40QI6LfcbZkTc= - - secure: wd/FBYI9I37PJ+eXhO8vesvWELkklNgGRA1xo/tuA31+ACpY/jG5EjrHd+semsfDTxM8fZe3s0foIch+jeMTIOcGs98tDC/L/8b/h6i0Qic0DqkAk6B30fT+5Nl3dufjiXsBJg5xj1zYqW6ka3DKIDjnn+3ao2cme05MtDQBHdc= + - secure: bM8uWN5b9hZzzHk73EN9xHCK65vuopcbwQILcuMt0A1mHB8tSH1xyMYddNrbGdfznLAVXf8UjvKvv6rvvG4O+j3GRuIWVNukoAvZxG0FC9QxYuKbDccEPPdtqGwVEfWEKQYLajsIpF8/ACyALGV+Oe/Z28WRk6Ba3FLptfulc6s= sudo: false addons: apt: sources: - - heroku + - heroku packages: - - heroku-toolbelt + - heroku-toolbelt diff --git a/CHANGELOG.md b/CHANGELOG.md index c6f09f90b..6232c5c9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,5 @@ ## Master -* Fix "double ruby rainbow bug" caused by executing two `compile` actions on the same -app (#553 & #555) -* Remove Ruby 1.8.7 compatiability to allow for #555. This version of Ruby has been EOL -for a long time. It is not available on Cedar-14 and Cedar-10 is EOL - ## v155 (03/16/2017) * Yarn now installed for apps with `webpacker` gem (#547) diff --git a/Gemfile.lock b/Gemfile.lock index 8b41a2b17..3f10d116b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -8,58 +8,44 @@ GIT GEM remote: https://rubygems.org/ specs: - activesupport (4.2.8) - i18n (~> 0.7) - minitest (~> 5.1) - thread_safe (~> 0.3, >= 0.3.4) - tzinfo (~> 1.1) + activesupport (4.0.13) + i18n (~> 0.6, >= 0.6.9) + minitest (~> 4.2) + multi_json (~> 1.3) + thread_safe (~> 0.1) + tzinfo (~> 0.3.37) anvil-cli (0.16.2) progress (~> 2.4, >= 2.4.0) rest-client (~> 1.6, >= 1.6.7) thor (~> 0.15, >= 0.15.2) diff-lcs (1.2.5) - domain_name (0.5.20170404) - unf (>= 0.0.5, < 1.0.0) - erubis (2.7.0) - excon (0.55.0) - heroics (0.0.21) - erubis (~> 2.0) - excon - multi_json (>= 1.9.2) - heroku-api (0.4.2) + excon (0.45.4) + heroku-api (0.4.0) excon (~> 0.45) multi_json (~> 1.8) - heroku_hatchet (2.0.2) + heroku_hatchet (1.4.1) activesupport (~> 4) anvil-cli (~> 0) excon (~> 0) heroku-api (~> 0) - platform-api (~> 1) repl_runner (~> 0.0.3) rrrretry (~> 1) thor (~> 0) threaded (~> 0) - http-cookie (1.0.3) - domain_name (~> 0.5) - i18n (0.8.1) + i18n (0.7.0) json (2.0.2) - mime-types (2.99.3) - minitest (5.10.1) - moneta (0.8.1) - multi_json (1.12.1) - netrc (0.11.0) + mime-types (2.4.3) + minitest (4.7.5) + multi_json (1.11.2) + netrc (0.10.2) parallel (1.8.0) parallel_tests (2.5.0) parallel - platform-api (1.0.1) - heroics (~> 0.0.21) - moneta (~> 0.8.1) progress (2.4.0) rake (10.0.4) repl_runner (0.0.3) activesupport - rest-client (1.8.0) - http-cookie (>= 1.0.2, < 2.0) + rest-client (1.7.2) mime-types (>= 1.16, < 3.0) netrc (~> 0.7) rrrretry (1.0.0) @@ -71,14 +57,10 @@ GEM rspec-retry (0.4.5) rspec-core rspec-support (3.4.1) - thor (0.19.4) - thread_safe (0.3.6) + thor (0.19.1) + thread_safe (0.3.5) threaded (0.0.4) - tzinfo (1.2.3) - thread_safe (~> 0.1) - unf (0.1.4) - unf_ext - unf_ext (0.0.7.2) + tzinfo (0.3.52) PLATFORMS ruby @@ -96,4 +78,4 @@ DEPENDENCIES rspec-retry BUNDLED WITH - 1.14.6 + 1.13.6 diff --git a/Rakefile b/Rakefile index 35444ee63..051ac62ad 100644 --- a/Rakefile +++ b/Rakefile @@ -308,4 +308,21 @@ begin rescue LoadError => e end - +namespace :travis do + task :setup do + sh "bundle exec hatchet install" + sh "if [ `git config --get user.email` ]; then echo 'already set'; else `git config --global user.email 'buildpack@example.com'`; fi" + sh "if [ `git config --get user.name` ]; then echo 'already set'; else `git config --global user.name 'BuildpackTester'` ; fi" + sh "echo ' +Host heroku.com + StrictHostKeyChecking no + CheckHostIP no + UserKnownHostsFile=/dev/null + IdentityFile ~/.ssh/id_rsa +Host github.com + StrictHostKeyChecking no +' >> ~/.ssh/config" + sh "ssh-keygen -f ~/.ssh/id_rsa -t rsa -N ''" + sh "yes | heroku keys:add" + end +end diff --git a/bin/support/download_ruby b/bin/bootstrap similarity index 67% rename from bin/support/download_ruby rename to bin/bootstrap index 14a0e80ba..6a8370068 100755 --- a/bin/support/download_ruby +++ b/bin/bootstrap @@ -1,10 +1,9 @@ #!/usr/bin/env ruby -# This script will download a version of Ruby for the buildpack to use -# and put it in the `ARGV.first` location. +# sync output $stdout.sync = true -$:.unshift File.expand_path("../../../lib", __FILE__) +$:.unshift File.expand_path("../../lib", __FILE__) require "language_pack" DEFAULT_STACK = "cedar-14" diff --git a/bin/compile b/bin/compile index f02fb5129..412856047 100755 --- a/bin/compile +++ b/bin/compile @@ -3,9 +3,20 @@ # bootstraps the ruby needed and then executes `bin/ruby_compile` BIN_DIR=$(cd $(dirname $0); pwd) -BUILDPACK_DIR=$(dirname $BIN_DIR) +ROOT_DIR=$(dirname $BIN_DIR) -source "$BIN_DIR/support/bash_functions.sh" -heroku_buildpack_ruby_install_ruby "$BIN_DIR" "$BUILDPACK_DIR" +ruby_dir="$ROOT_DIR/vendor/ruby/$STACK" +if [ ! -d "$ROOT_DIR/vendor/ruby/$STACK" ]; then + ruby_dir=$(mktemp -d) + # bootstrap ruby + $BIN_DIR/bootstrap $ruby_dir + function atexit { + rm -rf $ruby_dir + } + trap atexit EXIT +fi -$heroku_buildpack_ruby_dir/bin/ruby $BIN_DIR/support/ruby_compile $@ +export PATH=$ruby_dir/bin/:$PATH +unset GEM_PATH + +$ruby_dir/bin/ruby $BIN_DIR/ruby_compile $@ diff --git a/bin/support/ruby_compile b/bin/ruby_compile similarity index 59% rename from bin/support/ruby_compile rename to bin/ruby_compile index 949fc1500..d5eb40a33 100755 --- a/bin/support/ruby_compile +++ b/bin/ruby_compile @@ -1,13 +1,9 @@ #!/usr/bin/env ruby -# This script compiles an application so it can run on Heroku. -# It will install the application's specified verison of Ruby, it's dependencies -# and certain framework specific requirements (such as calling `rake assets:precompile` -# for rails apps). You can see all features described in the devcenter -# https://devcenter.heroku.com/articles/ruby-support +# sync output $stdout.sync = true -$:.unshift File.expand_path("../../../lib", __FILE__) +$:.unshift File.expand_path("../../lib", __FILE__) require "language_pack" require "language_pack/shell_helpers" diff --git a/bin/support/ruby_test b/bin/ruby_test similarity index 50% rename from bin/support/ruby_test rename to bin/ruby_test index 13daac0bc..22773c4ee 100755 --- a/bin/support/ruby_test +++ b/bin/ruby_test @@ -1,16 +1,12 @@ #!/usr/bin/env ruby -# This script will detect which test script or framework an app is likely to be -# using and run the appropriate command. It is expected that `ruby_test-compile` -# will be run before this file, this installs a version of Ruby and any dependencies -# a customer's app needs. +# sync output $stdout.sync = true -$:.unshift File.expand_path("../../../lib", __FILE__) +$:.unshift File.expand_path("../../lib", __FILE__) require "language_pack" require "language_pack/shell_helpers" require "language_pack/test" -require "language_pack/ruby" include LanguagePack::ShellHelpers @@ -24,18 +20,13 @@ def execute_command(command) pipe(command, :user_env => true) end -# $ bin/test BUILD_DIR ENV_DIR ARTIFACT_DIR +# bin/test BUILD_DIR ENV_DIR ARTIFACT_DIR build_dir, env_dir, artifact_dir = ARGV LanguagePack::ShellHelpers.initialize_env(env_dir) - -# The `ruby_test-compile` program installs a version of Ruby for the -# user's application. It needs the propper `PATH`, where ever Ruby is installed -# we always add a symlink to the `bin/ruby` file so that is always valid. -# We calculate the gem path the same way we do when compiling. -LanguagePack::ShellHelpers.user_env_hash["PATH"] = "#{build_dir}/bin:#{ENV["PATH"]}" -LanguagePack::ShellHelpers.user_env_hash["GEM_PATH"] = LanguagePack::Ruby.slug_vendor_base - +# point bundler wrapper to app's bundler gem +bundler_path = "#{build_dir}/vendor/bundle/ruby/2.3.0/gems/" bundler = LanguagePack::Helpers::BundlerWrapper.new( + bundler_path: bundler_path, gemfile_path: "#{build_dir}/Gemfile" ) # load bundler diff --git a/bin/support/ruby_test-compile b/bin/ruby_test-compile similarity index 51% rename from bin/support/ruby_test-compile rename to bin/ruby_test-compile index 34e59463e..c93184dfb 100755 --- a/bin/support/ruby_test-compile +++ b/bin/ruby_test-compile @@ -1,18 +1,9 @@ #!/usr/bin/env ruby -# This script installs an app's Ruby version and dependencies. It's -# essentially the same thing as `ruby_compile` (which is called by bin/compile) -# except that some behavior is cusomtized by the inclusion of the -# `language_pack/test` file. One difference is dependencies -# the `bin/compile` installs dependencies via bundler and excludes `development:test` -# gems, however we need `test` gems to run tests, so instead only `development` -# is excluded. -# -# It also sets up the database (if one is present) and populates the database -# with the appropriate schema. +# sync output $stdout.sync = true -$:.unshift File.expand_path("../../../lib", __FILE__) +$:.unshift File.expand_path("../../lib", __FILE__) require "language_pack" require "language_pack/shell_helpers" require "language_pack/test" @@ -39,3 +30,4 @@ rescue Exception => e raise e end end + diff --git a/bin/support/bash_functions.sh b/bin/support/bash_functions.sh deleted file mode 100755 index 937c80e7b..000000000 --- a/bin/support/bash_functions.sh +++ /dev/null @@ -1,39 +0,0 @@ -# This function will install a version of Ruby onto the -# system for the buidlpack to use. It coordinates download -# and setting appropriate env vars for execution -# -# Example: -# -# heroku_buildpack_ruby_install_ruby "$BIN_DIR" "$BUILDPACK_DIR" -# -# Takes two arguments, the first is the location of the buildpack's -# `bin` directory. This is where the `download_ruby` script can be -# found. The second argument is the root directory where Ruby -# can be installed. -# -# This function relies on the env var `$STACK` being set. This -# is set in codon outside of the buildpack. An example of a stack -# would be "cedar-14". -# -# Relies on global scope to set the variable `$heroku_buildpack_ruby_dir` -# that can be used by other scripts -heroku_buildpack_ruby_install_ruby() -{ - local bin_dir=$1 - local buildpack_dir=$2 - heroku_buildpack_ruby_dir="$buildpack_dir/vendor/ruby/$STACK" - - # The -d flag checks to see if a file exists and is a directory - if [ ! -d "$heroku_buildpack_ruby_dir" ]; then - heroku_buildpack_ruby_dir=$(mktemp -d) - # bootstrap ruby - $bin_dir/support/download_ruby $heroku_buildpack_ruby_dir - function atexit { - rm -rf $heroku_buildpack_ruby_dir - } - trap atexit EXIT - - export PATH=$heroku_buildpack_ruby_dir/bin/:$PATH - unset GEM_PATH - fi -} diff --git a/bin/test b/bin/test index 4e821c108..f1bbde721 100755 --- a/bin/test +++ b/bin/test @@ -3,9 +3,17 @@ # bootstraps the ruby needed and then executes `bin/ruby_test-compile` BIN_DIR=$(cd $(dirname $0); pwd) -BUILDPACK_DIR=$(dirname $BIN_DIR) +ROOT_DIR=$(dirname $BIN_DIR) -source "$BIN_DIR/support/bash_functions.sh" -heroku_buildpack_ruby_install_ruby "$BIN_DIR" "$BUILDPACK_DIR" +ruby_dir="$ROOT_DIR/vendor/ruby/$STACK" +if [ ! -d "$ROOT_DIR/vendor/ruby/$STACK" ]; then + ruby_dir=$(mktemp -d) + # bootstrap ruby + $BIN_DIR/bootstrap $ruby_dir + function atexit { + rm -rf $ruby_dir + } + trap atexit EXIT +fi -$heroku_buildpack_ruby_dir/bin/ruby $BIN_DIR/support/ruby_test $@ +$ruby_dir/bin/ruby $BIN_DIR/ruby_test $@ diff --git a/bin/test-compile b/bin/test-compile index 5a1529819..18bf623ff 100755 --- a/bin/test-compile +++ b/bin/test-compile @@ -3,9 +3,19 @@ # bootstraps the ruby needed and then executes `bin/ruby_test-compile` BIN_DIR=$(cd $(dirname $0); pwd) -BUILDPACK_DIR=$(dirname $BIN_DIR) +ROOT_DIR=$(dirname $BIN_DIR) -source "$BIN_DIR/support/bash_functions.sh" -heroku_buildpack_ruby_install_ruby "$BIN_DIR" "$BUILDPACK_DIR" +ruby_dir="$ROOT_DIR/vendor/ruby/$STACK" +if [ ! -d "$ROOT_DIR/vendor/ruby/$STACK" ]; then + ruby_dir=$(mktemp -d) + # bootstrap ruby + $BIN_DIR/bootstrap $ruby_dir + function atexit { + rm -rf $ruby_dir + } + trap atexit EXIT +fi -$heroku_buildpack_ruby_dir/bin/ruby $BIN_DIR/support/ruby_test-compile $@ +export PATH=$ruby_dir/bin/:$PATH + +$ruby_dir/bin/ruby $BIN_DIR/ruby_test-compile $@ diff --git a/circle.yml b/circle.yml index 232bf722e..69fc52fb6 100644 --- a/circle.yml +++ b/circle.yml @@ -1,6 +1,6 @@ machine: ruby: - version: 2.4.1 + version: 2.0.0 environment: HATCHET_RETRIES: 3 IS_RUNNING_ON_CI: true @@ -9,7 +9,7 @@ machine: test: pre: - - bundle exec rake hatchet:setup_travis + - bundle exec rake travis:setup override: - bundle exec parallel_rspec -n 11 spec/ post: diff --git a/hatchet.json b/hatchet.json index e34acd5a8..aad4ed565 100644 --- a/hatchet.json +++ b/hatchet.json @@ -78,9 +78,5 @@ ], "multibuildpack": [ "sharpstone/node_multi" - ], - "ci": [ - "sharpstone/rails5_ruby_schema_format", - "sharpstone/heroku-ci-json-example" ] } diff --git a/lib/language_pack/base.rb b/lib/language_pack/base.rb index cecfefe7b..c41ff735f 100644 --- a/lib/language_pack/base.rb +++ b/lib/language_pack/base.rb @@ -14,7 +14,6 @@ # abstract class that all the Ruby based Language Packs inherit from class LanguagePack::Base include LanguagePack::ShellHelpers - extend LanguagePack::ShellHelpers VENDOR_URL = ENV['BUILDPACK_VENDOR_URL'] || "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby" DEFAULT_LEGACY_STACK = "cedar" diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 6e9d0efa5..9b6396234 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -160,18 +160,19 @@ def system_paths "/usr/local/bin:/usr/bin:/bin" end - def self.slug_vendor_base - command = %q(ruby -e "require 'rbconfig';puts \"vendor/bundle/#{RUBY_ENGINE}/#{RbConfig::CONFIG['ruby_version']}\"") - slug_vendor_base = run_no_pipe(command, user_env: true).chomp - error "Problem detecting bundler vendor directory: #{@slug_vendor_base}" unless $?.success? - return slug_vendor_base - end - # the relative path to the bundler directory of gems # @return [String] resulting path def slug_vendor_base instrument 'ruby.slug_vendor_base' do - @slug_vendor_base ||= self.class.slug_vendor_base + if @slug_vendor_base + @slug_vendor_base + elsif ruby_version.ruby_version == "1.8.7" + @slug_vendor_base = "vendor/bundle/1.8" + else + @slug_vendor_base = run_no_pipe(%q(ruby -e "require 'rbconfig';puts \"vendor/bundle/#{RUBY_ENGINE}/#{RbConfig::CONFIG['ruby_version']}\"")).chomp + error "Problem detecting bundler vendor directory: #{@slug_vendor_base}" unless $?.success? + @slug_vendor_base + end end end diff --git a/spec/hatchet/ci_spec.rb b/spec/hatchet/ci_spec.rb deleted file mode 100644 index 6260a1abe..000000000 --- a/spec/hatchet/ci_spec.rb +++ /dev/null @@ -1,9 +0,0 @@ -require 'spec_helper' - -describe "CI" do - it "Does not cause the double ruby rainbow bug" do - Hatchet::Runner.new("heroku-ci-json-example").run_ci do |test_run| - expect(test_run.status).to eq(:succeeded) - end - end -end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 582191be7..510a7033e 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -43,8 +43,3 @@ def create_file_with_size_in(size, dir) config.return_char "\n" # the character that submits the command config.sync_stdout "STDOUT.sync = true" # force REPL to not buffer standard out end - -if ENV['TRAVIS'] - # Don't execute tests against "merge" commits - exit 0 if ENV['TRAVIS_PULL_REQUEST'] != 'false' && ENV['TRAVIS_BRANCH'] == 'master' -end From 7a470891a98cc99832feda25ab5dcb34bbedb1f4 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 11 Apr 2017 11:23:26 -0500 Subject: [PATCH 0351/1195] [ci skip] v156 --- CHANGELOG.md | 4 ++++ lib/language_pack/version.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6232c5c9d..137dfb6bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Master +## v156 (04/11/2017) + +* Update default Ruby version to 2.3.4. + ## v155 (03/16/2017) * Yarn now installed for apps with `webpacker` gem (#547) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 508ece21e..e6cae73d4 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v155" + BUILDPACK_VERSION = "v156" end end From 1ff2d31a2b1d9428e69d2add408f720774a9809e Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 11 Apr 2017 13:13:24 -0500 Subject: [PATCH 0352/1195] Revert "Merge pull request #557 from heroku/schneems/revert-and-release" This reverts commit 282278a006ed7ad4a9b9605b9330ea6320d2553e, reversing changes made to 93c83f91f8a059eb7d8f4d147a013b371491b7af. This reintroduces #555 --- .travis.yml | 11 ++--- CHANGELOG.md | 7 +-- Gemfile.lock | 56 ++++++++++++++++-------- Rakefile | 19 +------- bin/compile | 19 ++------ bin/support/bash_functions.sh | 39 +++++++++++++++++ bin/{bootstrap => support/download_ruby} | 5 ++- bin/{ => support}/ruby_compile | 8 +++- bin/{ => support}/ruby_test | 21 ++++++--- bin/{ => support}/ruby_test-compile | 14 ++++-- bin/test | 16 ++----- bin/test-compile | 18 ++------ circle.yml | 4 +- hatchet.json | 4 ++ lib/language_pack/base.rb | 1 + lib/language_pack/ruby.rb | 17 ++++--- lib/language_pack/version.rb | 2 +- spec/hatchet/ci_spec.rb | 9 ++++ spec/spec_helper.rb | 5 +++ 19 files changed, 164 insertions(+), 111 deletions(-) create mode 100755 bin/support/bash_functions.sh rename bin/{bootstrap => support/download_ruby} (67%) rename bin/{ => support}/ruby_compile (59%) rename bin/{ => support}/ruby_test (50%) rename bin/{ => support}/ruby_test-compile (51%) create mode 100644 spec/hatchet/ci_spec.rb diff --git a/.travis.yml b/.travis.yml index 0d3d1f78e..c46415228 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: ruby rvm: -- 2.0.0 -before_script: bundle exec rake travis:setup +- 2.4.1 +before_script: bundle exec rake hatchet:setup_travis script: bundle exec parallel_rspec -n 11 spec/ after_script: - heroku keys:remove $USER@`hostname` @@ -11,11 +11,12 @@ env: - IS_RUNNING_ON_CI=true - HATCHET_DEPLOY_STRATEGY=git - HATCHET_APP_LIMIT=80 - - secure: bM8uWN5b9hZzzHk73EN9xHCK65vuopcbwQILcuMt0A1mHB8tSH1xyMYddNrbGdfznLAVXf8UjvKvv6rvvG4O+j3GRuIWVNukoAvZxG0FC9QxYuKbDccEPPdtqGwVEfWEKQYLajsIpF8/ACyALGV+Oe/Z28WRk6Ba3FLptfulc6s= + - secure: xFS5oLPMGyT6N0LKwU7wllaEZEVLzE/D5HuD14q3Vfd4L369XpV6ORYJF/2mkf765m+LH1MaN09rJaKc00ZcQfQECMuzyWagLsr1bVKs+szta3G/nFjjVTwmoPX5kVw5q7e6TYvS/KAzo+n8u5pW+zu8MMTwnv40QI6LfcbZkTc= + - secure: wd/FBYI9I37PJ+eXhO8vesvWELkklNgGRA1xo/tuA31+ACpY/jG5EjrHd+semsfDTxM8fZe3s0foIch+jeMTIOcGs98tDC/L/8b/h6i0Qic0DqkAk6B30fT+5Nl3dufjiXsBJg5xj1zYqW6ka3DKIDjnn+3ao2cme05MtDQBHdc= sudo: false addons: apt: sources: - - heroku + - heroku packages: - - heroku-toolbelt + - heroku-toolbelt diff --git a/CHANGELOG.md b/CHANGELOG.md index 137dfb6bb..c6f09f90b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,9 @@ ## Master -## v156 (04/11/2017) - -* Update default Ruby version to 2.3.4. +* Fix "double ruby rainbow bug" caused by executing two `compile` actions on the same +app (#553 & #555) +* Remove Ruby 1.8.7 compatiability to allow for #555. This version of Ruby has been EOL +for a long time. It is not available on Cedar-14 and Cedar-10 is EOL ## v155 (03/16/2017) diff --git a/Gemfile.lock b/Gemfile.lock index 3f10d116b..8b41a2b17 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -8,44 +8,58 @@ GIT GEM remote: https://rubygems.org/ specs: - activesupport (4.0.13) - i18n (~> 0.6, >= 0.6.9) - minitest (~> 4.2) - multi_json (~> 1.3) - thread_safe (~> 0.1) - tzinfo (~> 0.3.37) + activesupport (4.2.8) + i18n (~> 0.7) + minitest (~> 5.1) + thread_safe (~> 0.3, >= 0.3.4) + tzinfo (~> 1.1) anvil-cli (0.16.2) progress (~> 2.4, >= 2.4.0) rest-client (~> 1.6, >= 1.6.7) thor (~> 0.15, >= 0.15.2) diff-lcs (1.2.5) - excon (0.45.4) - heroku-api (0.4.0) + domain_name (0.5.20170404) + unf (>= 0.0.5, < 1.0.0) + erubis (2.7.0) + excon (0.55.0) + heroics (0.0.21) + erubis (~> 2.0) + excon + multi_json (>= 1.9.2) + heroku-api (0.4.2) excon (~> 0.45) multi_json (~> 1.8) - heroku_hatchet (1.4.1) + heroku_hatchet (2.0.2) activesupport (~> 4) anvil-cli (~> 0) excon (~> 0) heroku-api (~> 0) + platform-api (~> 1) repl_runner (~> 0.0.3) rrrretry (~> 1) thor (~> 0) threaded (~> 0) - i18n (0.7.0) + http-cookie (1.0.3) + domain_name (~> 0.5) + i18n (0.8.1) json (2.0.2) - mime-types (2.4.3) - minitest (4.7.5) - multi_json (1.11.2) - netrc (0.10.2) + mime-types (2.99.3) + minitest (5.10.1) + moneta (0.8.1) + multi_json (1.12.1) + netrc (0.11.0) parallel (1.8.0) parallel_tests (2.5.0) parallel + platform-api (1.0.1) + heroics (~> 0.0.21) + moneta (~> 0.8.1) progress (2.4.0) rake (10.0.4) repl_runner (0.0.3) activesupport - rest-client (1.7.2) + rest-client (1.8.0) + http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 3.0) netrc (~> 0.7) rrrretry (1.0.0) @@ -57,10 +71,14 @@ GEM rspec-retry (0.4.5) rspec-core rspec-support (3.4.1) - thor (0.19.1) - thread_safe (0.3.5) + thor (0.19.4) + thread_safe (0.3.6) threaded (0.0.4) - tzinfo (0.3.52) + tzinfo (1.2.3) + thread_safe (~> 0.1) + unf (0.1.4) + unf_ext + unf_ext (0.0.7.2) PLATFORMS ruby @@ -78,4 +96,4 @@ DEPENDENCIES rspec-retry BUNDLED WITH - 1.13.6 + 1.14.6 diff --git a/Rakefile b/Rakefile index 051ac62ad..35444ee63 100644 --- a/Rakefile +++ b/Rakefile @@ -308,21 +308,4 @@ begin rescue LoadError => e end -namespace :travis do - task :setup do - sh "bundle exec hatchet install" - sh "if [ `git config --get user.email` ]; then echo 'already set'; else `git config --global user.email 'buildpack@example.com'`; fi" - sh "if [ `git config --get user.name` ]; then echo 'already set'; else `git config --global user.name 'BuildpackTester'` ; fi" - sh "echo ' -Host heroku.com - StrictHostKeyChecking no - CheckHostIP no - UserKnownHostsFile=/dev/null - IdentityFile ~/.ssh/id_rsa -Host github.com - StrictHostKeyChecking no -' >> ~/.ssh/config" - sh "ssh-keygen -f ~/.ssh/id_rsa -t rsa -N ''" - sh "yes | heroku keys:add" - end -end + diff --git a/bin/compile b/bin/compile index 412856047..f02fb5129 100755 --- a/bin/compile +++ b/bin/compile @@ -3,20 +3,9 @@ # bootstraps the ruby needed and then executes `bin/ruby_compile` BIN_DIR=$(cd $(dirname $0); pwd) -ROOT_DIR=$(dirname $BIN_DIR) +BUILDPACK_DIR=$(dirname $BIN_DIR) -ruby_dir="$ROOT_DIR/vendor/ruby/$STACK" -if [ ! -d "$ROOT_DIR/vendor/ruby/$STACK" ]; then - ruby_dir=$(mktemp -d) - # bootstrap ruby - $BIN_DIR/bootstrap $ruby_dir - function atexit { - rm -rf $ruby_dir - } - trap atexit EXIT -fi +source "$BIN_DIR/support/bash_functions.sh" +heroku_buildpack_ruby_install_ruby "$BIN_DIR" "$BUILDPACK_DIR" -export PATH=$ruby_dir/bin/:$PATH -unset GEM_PATH - -$ruby_dir/bin/ruby $BIN_DIR/ruby_compile $@ +$heroku_buildpack_ruby_dir/bin/ruby $BIN_DIR/support/ruby_compile $@ diff --git a/bin/support/bash_functions.sh b/bin/support/bash_functions.sh new file mode 100755 index 000000000..937c80e7b --- /dev/null +++ b/bin/support/bash_functions.sh @@ -0,0 +1,39 @@ +# This function will install a version of Ruby onto the +# system for the buidlpack to use. It coordinates download +# and setting appropriate env vars for execution +# +# Example: +# +# heroku_buildpack_ruby_install_ruby "$BIN_DIR" "$BUILDPACK_DIR" +# +# Takes two arguments, the first is the location of the buildpack's +# `bin` directory. This is where the `download_ruby` script can be +# found. The second argument is the root directory where Ruby +# can be installed. +# +# This function relies on the env var `$STACK` being set. This +# is set in codon outside of the buildpack. An example of a stack +# would be "cedar-14". +# +# Relies on global scope to set the variable `$heroku_buildpack_ruby_dir` +# that can be used by other scripts +heroku_buildpack_ruby_install_ruby() +{ + local bin_dir=$1 + local buildpack_dir=$2 + heroku_buildpack_ruby_dir="$buildpack_dir/vendor/ruby/$STACK" + + # The -d flag checks to see if a file exists and is a directory + if [ ! -d "$heroku_buildpack_ruby_dir" ]; then + heroku_buildpack_ruby_dir=$(mktemp -d) + # bootstrap ruby + $bin_dir/support/download_ruby $heroku_buildpack_ruby_dir + function atexit { + rm -rf $heroku_buildpack_ruby_dir + } + trap atexit EXIT + + export PATH=$heroku_buildpack_ruby_dir/bin/:$PATH + unset GEM_PATH + fi +} diff --git a/bin/bootstrap b/bin/support/download_ruby similarity index 67% rename from bin/bootstrap rename to bin/support/download_ruby index 6a8370068..14a0e80ba 100755 --- a/bin/bootstrap +++ b/bin/support/download_ruby @@ -1,9 +1,10 @@ #!/usr/bin/env ruby -# sync output +# This script will download a version of Ruby for the buildpack to use +# and put it in the `ARGV.first` location. $stdout.sync = true -$:.unshift File.expand_path("../../lib", __FILE__) +$:.unshift File.expand_path("../../../lib", __FILE__) require "language_pack" DEFAULT_STACK = "cedar-14" diff --git a/bin/ruby_compile b/bin/support/ruby_compile similarity index 59% rename from bin/ruby_compile rename to bin/support/ruby_compile index d5eb40a33..949fc1500 100755 --- a/bin/ruby_compile +++ b/bin/support/ruby_compile @@ -1,9 +1,13 @@ #!/usr/bin/env ruby -# sync output +# This script compiles an application so it can run on Heroku. +# It will install the application's specified verison of Ruby, it's dependencies +# and certain framework specific requirements (such as calling `rake assets:precompile` +# for rails apps). You can see all features described in the devcenter +# https://devcenter.heroku.com/articles/ruby-support $stdout.sync = true -$:.unshift File.expand_path("../../lib", __FILE__) +$:.unshift File.expand_path("../../../lib", __FILE__) require "language_pack" require "language_pack/shell_helpers" diff --git a/bin/ruby_test b/bin/support/ruby_test similarity index 50% rename from bin/ruby_test rename to bin/support/ruby_test index 22773c4ee..13daac0bc 100755 --- a/bin/ruby_test +++ b/bin/support/ruby_test @@ -1,12 +1,16 @@ #!/usr/bin/env ruby -# sync output +# This script will detect which test script or framework an app is likely to be +# using and run the appropriate command. It is expected that `ruby_test-compile` +# will be run before this file, this installs a version of Ruby and any dependencies +# a customer's app needs. $stdout.sync = true -$:.unshift File.expand_path("../../lib", __FILE__) +$:.unshift File.expand_path("../../../lib", __FILE__) require "language_pack" require "language_pack/shell_helpers" require "language_pack/test" +require "language_pack/ruby" include LanguagePack::ShellHelpers @@ -20,13 +24,18 @@ def execute_command(command) pipe(command, :user_env => true) end -# bin/test BUILD_DIR ENV_DIR ARTIFACT_DIR +# $ bin/test BUILD_DIR ENV_DIR ARTIFACT_DIR build_dir, env_dir, artifact_dir = ARGV LanguagePack::ShellHelpers.initialize_env(env_dir) -# point bundler wrapper to app's bundler gem -bundler_path = "#{build_dir}/vendor/bundle/ruby/2.3.0/gems/" + +# The `ruby_test-compile` program installs a version of Ruby for the +# user's application. It needs the propper `PATH`, where ever Ruby is installed +# we always add a symlink to the `bin/ruby` file so that is always valid. +# We calculate the gem path the same way we do when compiling. +LanguagePack::ShellHelpers.user_env_hash["PATH"] = "#{build_dir}/bin:#{ENV["PATH"]}" +LanguagePack::ShellHelpers.user_env_hash["GEM_PATH"] = LanguagePack::Ruby.slug_vendor_base + bundler = LanguagePack::Helpers::BundlerWrapper.new( - bundler_path: bundler_path, gemfile_path: "#{build_dir}/Gemfile" ) # load bundler diff --git a/bin/ruby_test-compile b/bin/support/ruby_test-compile similarity index 51% rename from bin/ruby_test-compile rename to bin/support/ruby_test-compile index c93184dfb..34e59463e 100755 --- a/bin/ruby_test-compile +++ b/bin/support/ruby_test-compile @@ -1,9 +1,18 @@ #!/usr/bin/env ruby -# sync output +# This script installs an app's Ruby version and dependencies. It's +# essentially the same thing as `ruby_compile` (which is called by bin/compile) +# except that some behavior is cusomtized by the inclusion of the +# `language_pack/test` file. One difference is dependencies +# the `bin/compile` installs dependencies via bundler and excludes `development:test` +# gems, however we need `test` gems to run tests, so instead only `development` +# is excluded. +# +# It also sets up the database (if one is present) and populates the database +# with the appropriate schema. $stdout.sync = true -$:.unshift File.expand_path("../../lib", __FILE__) +$:.unshift File.expand_path("../../../lib", __FILE__) require "language_pack" require "language_pack/shell_helpers" require "language_pack/test" @@ -30,4 +39,3 @@ rescue Exception => e raise e end end - diff --git a/bin/test b/bin/test index f1bbde721..4e821c108 100755 --- a/bin/test +++ b/bin/test @@ -3,17 +3,9 @@ # bootstraps the ruby needed and then executes `bin/ruby_test-compile` BIN_DIR=$(cd $(dirname $0); pwd) -ROOT_DIR=$(dirname $BIN_DIR) +BUILDPACK_DIR=$(dirname $BIN_DIR) -ruby_dir="$ROOT_DIR/vendor/ruby/$STACK" -if [ ! -d "$ROOT_DIR/vendor/ruby/$STACK" ]; then - ruby_dir=$(mktemp -d) - # bootstrap ruby - $BIN_DIR/bootstrap $ruby_dir - function atexit { - rm -rf $ruby_dir - } - trap atexit EXIT -fi +source "$BIN_DIR/support/bash_functions.sh" +heroku_buildpack_ruby_install_ruby "$BIN_DIR" "$BUILDPACK_DIR" -$ruby_dir/bin/ruby $BIN_DIR/ruby_test $@ +$heroku_buildpack_ruby_dir/bin/ruby $BIN_DIR/support/ruby_test $@ diff --git a/bin/test-compile b/bin/test-compile index 18bf623ff..5a1529819 100755 --- a/bin/test-compile +++ b/bin/test-compile @@ -3,19 +3,9 @@ # bootstraps the ruby needed and then executes `bin/ruby_test-compile` BIN_DIR=$(cd $(dirname $0); pwd) -ROOT_DIR=$(dirname $BIN_DIR) +BUILDPACK_DIR=$(dirname $BIN_DIR) -ruby_dir="$ROOT_DIR/vendor/ruby/$STACK" -if [ ! -d "$ROOT_DIR/vendor/ruby/$STACK" ]; then - ruby_dir=$(mktemp -d) - # bootstrap ruby - $BIN_DIR/bootstrap $ruby_dir - function atexit { - rm -rf $ruby_dir - } - trap atexit EXIT -fi +source "$BIN_DIR/support/bash_functions.sh" +heroku_buildpack_ruby_install_ruby "$BIN_DIR" "$BUILDPACK_DIR" -export PATH=$ruby_dir/bin/:$PATH - -$ruby_dir/bin/ruby $BIN_DIR/ruby_test-compile $@ +$heroku_buildpack_ruby_dir/bin/ruby $BIN_DIR/support/ruby_test-compile $@ diff --git a/circle.yml b/circle.yml index 69fc52fb6..232bf722e 100644 --- a/circle.yml +++ b/circle.yml @@ -1,6 +1,6 @@ machine: ruby: - version: 2.0.0 + version: 2.4.1 environment: HATCHET_RETRIES: 3 IS_RUNNING_ON_CI: true @@ -9,7 +9,7 @@ machine: test: pre: - - bundle exec rake travis:setup + - bundle exec rake hatchet:setup_travis override: - bundle exec parallel_rspec -n 11 spec/ post: diff --git a/hatchet.json b/hatchet.json index aad4ed565..e34acd5a8 100644 --- a/hatchet.json +++ b/hatchet.json @@ -78,5 +78,9 @@ ], "multibuildpack": [ "sharpstone/node_multi" + ], + "ci": [ + "sharpstone/rails5_ruby_schema_format", + "sharpstone/heroku-ci-json-example" ] } diff --git a/lib/language_pack/base.rb b/lib/language_pack/base.rb index c41ff735f..cecfefe7b 100644 --- a/lib/language_pack/base.rb +++ b/lib/language_pack/base.rb @@ -14,6 +14,7 @@ # abstract class that all the Ruby based Language Packs inherit from class LanguagePack::Base include LanguagePack::ShellHelpers + extend LanguagePack::ShellHelpers VENDOR_URL = ENV['BUILDPACK_VENDOR_URL'] || "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby" DEFAULT_LEGACY_STACK = "cedar" diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 9b6396234..6e9d0efa5 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -160,19 +160,18 @@ def system_paths "/usr/local/bin:/usr/bin:/bin" end + def self.slug_vendor_base + command = %q(ruby -e "require 'rbconfig';puts \"vendor/bundle/#{RUBY_ENGINE}/#{RbConfig::CONFIG['ruby_version']}\"") + slug_vendor_base = run_no_pipe(command, user_env: true).chomp + error "Problem detecting bundler vendor directory: #{@slug_vendor_base}" unless $?.success? + return slug_vendor_base + end + # the relative path to the bundler directory of gems # @return [String] resulting path def slug_vendor_base instrument 'ruby.slug_vendor_base' do - if @slug_vendor_base - @slug_vendor_base - elsif ruby_version.ruby_version == "1.8.7" - @slug_vendor_base = "vendor/bundle/1.8" - else - @slug_vendor_base = run_no_pipe(%q(ruby -e "require 'rbconfig';puts \"vendor/bundle/#{RUBY_ENGINE}/#{RbConfig::CONFIG['ruby_version']}\"")).chomp - error "Problem detecting bundler vendor directory: #{@slug_vendor_base}" unless $?.success? - @slug_vendor_base - end + @slug_vendor_base ||= self.class.slug_vendor_base end end diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index e6cae73d4..508ece21e 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v156" + BUILDPACK_VERSION = "v155" end end diff --git a/spec/hatchet/ci_spec.rb b/spec/hatchet/ci_spec.rb new file mode 100644 index 000000000..6260a1abe --- /dev/null +++ b/spec/hatchet/ci_spec.rb @@ -0,0 +1,9 @@ +require 'spec_helper' + +describe "CI" do + it "Does not cause the double ruby rainbow bug" do + Hatchet::Runner.new("heroku-ci-json-example").run_ci do |test_run| + expect(test_run.status).to eq(:succeeded) + end + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 510a7033e..582191be7 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -43,3 +43,8 @@ def create_file_with_size_in(size, dir) config.return_char "\n" # the character that submits the command config.sync_stdout "STDOUT.sync = true" # force REPL to not buffer standard out end + +if ENV['TRAVIS'] + # Don't execute tests against "merge" commits + exit 0 if ENV['TRAVIS_PULL_REQUEST'] != 'false' && ENV['TRAVIS_BRANCH'] == 'master' +end From 5a1ca011c568321077101028a11d24e6e09f1c36 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 11 Apr 2017 13:36:55 -0500 Subject: [PATCH 0353/1195] [ci skip] v157 --- CHANGELOG.md | 6 ++++++ lib/language_pack/version.rb | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c6f09f90b..02d88f48d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,16 @@ ## Master +## v157 (04/11/2017) + * Fix "double ruby rainbow bug" caused by executing two `compile` actions on the same app (#553 & #555) * Remove Ruby 1.8.7 compatiability to allow for #555. This version of Ruby has been EOL for a long time. It is not available on Cedar-14 and Cedar-10 is EOL +## v156 (04/11/2017) + +* Update default Ruby version to 2.3.4. + ## v155 (03/16/2017) * Yarn now installed for apps with `webpacker` gem (#547) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 508ece21e..a7e7ce166 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v155" + BUILDPACK_VERSION = "v157" end end From 6ebca182a35c8f70e975a6d29f1d06c32f41cc8d Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 12 Apr 2017 14:39:40 -0500 Subject: [PATCH 0354/1195] Fix case where CI uses System Ruby Even when a version of Ruby is already installed for the Buildpack to use we must still set the appropriate `PATH` and `GEM_PATH`. --- Gemfile.lock | 4 ++-- bin/support/bash_functions.sh | 15 +++++++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 8b41a2b17..0cf51aa0d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -29,7 +29,7 @@ GEM heroku-api (0.4.2) excon (~> 0.45) multi_json (~> 1.8) - heroku_hatchet (2.0.2) + heroku_hatchet (2.0.3) activesupport (~> 4) anvil-cli (~> 0) excon (~> 0) @@ -78,7 +78,7 @@ GEM thread_safe (~> 0.1) unf (0.1.4) unf_ext - unf_ext (0.0.7.2) + unf_ext (0.0.7.3) PLATFORMS ruby diff --git a/bin/support/bash_functions.sh b/bin/support/bash_functions.sh index 937c80e7b..4bee3e3c5 100755 --- a/bin/support/bash_functions.sh +++ b/bin/support/bash_functions.sh @@ -23,7 +23,12 @@ heroku_buildpack_ruby_install_ruby() local buildpack_dir=$2 heroku_buildpack_ruby_dir="$buildpack_dir/vendor/ruby/$STACK" - # The -d flag checks to see if a file exists and is a directory + # The -d flag checks to see if a file exists and is a directory. + # This directory may be non-empty if a previous compile has + # already placed a Ruby executable here. Also + # when the buildpack is deployed we vendor a ruby executable + # at this location so it doesn't have to be downloaded for + # every app compile if [ ! -d "$heroku_buildpack_ruby_dir" ]; then heroku_buildpack_ruby_dir=$(mktemp -d) # bootstrap ruby @@ -32,8 +37,10 @@ heroku_buildpack_ruby_install_ruby() rm -rf $heroku_buildpack_ruby_dir } trap atexit EXIT - - export PATH=$heroku_buildpack_ruby_dir/bin/:$PATH - unset GEM_PATH fi + + # Even if a Ruby is already downloaded for use by the + # buildpack we still have to set up it's PATH and GEM_PATH + export PATH=$heroku_buildpack_ruby_dir/bin/:$PATH + unset GEM_PATH } From ec7d58d2112b384704b1858f4be1008d7fe15d65 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 12 Apr 2017 15:44:21 -0500 Subject: [PATCH 0355/1195] [ci skip] v158 --- CHANGELOG.md | 4 ++++ lib/language_pack/version.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 02d88f48d..7036b28f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Master +## v158 (04/12/2017) + +* Fix CI issue causing system Ruby to be used (#558) + ## v157 (04/11/2017) * Fix "double ruby rainbow bug" caused by executing two `compile` actions on the same diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index a7e7ce166..4d91cf53b 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v157" + BUILDPACK_VERSION = "v158" end end From 8499e868e716f3ddfb246aee8136a727974ff8d7 Mon Sep 17 00:00:00 2001 From: Joe Kutner Date: Thu, 20 Apr 2017 09:26:37 -0500 Subject: [PATCH 0356/1195] Blacklist JAVA_OPTS and JAVA_TOOL_OPTIONS during build --- lib/language_pack/shell_helpers.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/shell_helpers.rb b/lib/language_pack/shell_helpers.rb index 4e2d560c3..13f376605 100644 --- a/lib/language_pack/shell_helpers.rb +++ b/lib/language_pack/shell_helpers.rb @@ -27,7 +27,7 @@ def env(var) end def self.blacklist?(key) - %w(PATH GEM_PATH GEM_HOME GIT_DIR JRUBY_OPTS).include?(key) + %w(PATH GEM_PATH GEM_HOME GIT_DIR JRUBY_OPTS JAVA_OPTS JAVA_TOOL_OPTIONS).include?(key) end def self.initialize_env(path) From 7fe71959fbc093c34d171fd10b9a8d8d203035f9 Mon Sep 17 00:00:00 2001 From: Joe Kutner Date: Mon, 24 Apr 2017 18:20:25 -0500 Subject: [PATCH 0357/1195] Updated changelog [skip ci] --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7036b28f5..557d62450 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Master +## v159 (04/24/2017) + +* Blacklist JAVA_OPTS and JAVA_TOOL_OPTIONS during build (#559) + ## v158 (04/12/2017) * Fix CI issue causing system Ruby to be used (#558) From a94df2c9c39ae9852c625d7f01a9d696eb561a3f Mon Sep 17 00:00:00 2001 From: Joe Kutner Date: Mon, 24 Apr 2017 18:22:02 -0500 Subject: [PATCH 0358/1195] bump to v159 --- lib/language_pack/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 4d91cf53b..b62b17e37 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v158" + BUILDPACK_VERSION = "v159" end end From aa84b517be53dbf6bcb0d87d033c7b1181b54266 Mon Sep 17 00:00:00 2001 From: schneems Date: Fri, 12 May 2017 17:06:28 -0500 Subject: [PATCH 0359/1195] Get tests working on heroku-16 Heroku-16 stack does not support any ruby versions prior to 2.2. --- hatchet.json | 9 ++---- spec/hatchet/jvm_spec.rb | 2 ++ spec/hatchet/rails3_spec.rb | 17 ++++------ spec/hatchet/rails4_spec.rb | 2 +- spec/hatchet/rubies_spec.rb | 32 ++++++++++--------- spec/hatchet/ruby_spec.rb | 8 +---- spec/hatchet/stack_spec.rb | 8 ++--- spec/hatchet/upgrade_ruby_spec.rb | 11 +++---- .../user_env_compile_edge_case_spec.rb | 19 ----------- spec/spec_helper.rb | 3 +- 10 files changed, 40 insertions(+), 71 deletions(-) delete mode 100644 spec/hatchet/user_env_compile_edge_case_spec.rb diff --git a/hatchet.json b/hatchet.json index e34acd5a8..1509a82ac 100644 --- a/hatchet.json +++ b/hatchet.json @@ -3,14 +3,10 @@ "sharpstone/asset_precompile_fail", "sharpstone/asset_precompile_pass", "sharpstone/asset_precompile_not_found", - "sharpstone/database_url_expected_in_rakefile", "sharpstone/connect_to_database_on_first_push", "sharpstone/no_rakefile", "sharpstone/bad_rakefile", - "sharpstone/mri_187_no_rake", - "sharpstone/mri_187_rake", - "sharpstone/mri_200_no_rake", - "sharpstone/mri_200_rake" + "sharpstone/default_with_rakefile" ], "bundler": [ "sharpstone/bad_gemfile_on_platform", @@ -40,8 +36,7 @@ "sharpstone/mri_187_nokogiri", "sharpstone/mri_192", "sharpstone/mri_193", - "sharpstone/mri_200", - "sharpstone/mri_214" + "sharpstone/mri_200" ], "rails2": [ "sharpstone/rails23_mri_193" diff --git a/spec/hatchet/jvm_spec.rb b/spec/hatchet/jvm_spec.rb index a3e7acd73..08d53defe 100644 --- a/spec/hatchet/jvm_spec.rb +++ b/spec/hatchet/jvm_spec.rb @@ -4,6 +4,8 @@ it "JVM is installed by jvm-common only" do app = Hatchet::Runner.new("ruby_193_jruby_17161") app.setup! + app.heroku.put_stack(app.name, 'cedar-14') + bp = app.heroku.get_config_vars(app.name).body["BUILDPACK_URL"] app.heroku.delete_config_var(app.name, "BUILDPACK_URL") app.heroku.put_buildpacks(app.name, ["https://github.com/heroku/heroku-buildpack-jvm-common", bp]) diff --git a/spec/hatchet/rails3_spec.rb b/spec/hatchet/rails3_spec.rb index 264f0b4be..b1055bdda 100644 --- a/spec/hatchet/rails3_spec.rb +++ b/spec/hatchet/rails3_spec.rb @@ -2,7 +2,10 @@ describe "Rails 3.x" do it "should deploy on ruby 1.9.3" do - Hatchet::Runner.new("rails3_mri_193").deploy do |app, heroku| + app = Hatchet::Runner.new("rails3_mri_193") + app.setup! + app.heroku.put_stack(app.name, "cedar-14") + app.deploy do |app, heroku| expect(app.output).to include("Asset precompilation completed") expect(app.output).to match("WARNING") @@ -11,15 +14,12 @@ ls = app.run("ls vendor/plugins") expect(ls).to match("rails3_serve_static_assets") expect(ls).to match("rails_log_stdout") - - expect(successful_body(app)).to eq("hello") end end it "should not have warnings when using the rails_12factor gem" do Hatchet::Runner.new("rails3_12factor").deploy do |app, heroku| expect(app.output).not_to match("Add 'rails_12factor' gem to your Gemfile to skip plugin injection") - expect(successful_body(app)).to eq("hello") # https://github.com/heroku/heroku-buildpack-ruby/issues/525 env = app.run("env") @@ -32,16 +32,13 @@ expect(app.output).not_to match("rails_log_stdout") expect(app.output).to match("rails3_serve_static_assets") expect(app.output).to match("Add 'rails_12factor' gem to your Gemfile to skip plugin injection") - expect(successful_body(app)).to eq("hello") end end context "when not using the rails gem" do - it "should deploy on ruby 1.9.3" do - Hatchet::Runner.new("railties3_mri_193").deploy do |app, heroku| - expect(app.output).to include("Asset precompilation completed") - expect(app.output).to match("Ruby/Rails") - expect(successful_body(app)).to eq("hello") + it "should detect as a rails app" do + Hatchet::App.new('railties3_mri_193').in_directory do + expect(LanguagePack::Rails3.use?).to eq(true) end end end diff --git a/spec/hatchet/rails4_spec.rb b/spec/hatchet/rails4_spec.rb index 1ba648d83..d09c5f185 100644 --- a/spec/hatchet/rails4_spec.rb +++ b/spec/hatchet/rails4_spec.rb @@ -10,7 +10,7 @@ end end - it "should deploy on ruby 2.0.0" do + it "should skip asset compilation when deployed with manifest file" do Hatchet::Runner.new("rails4-manifest").deploy do |app, heroku| expect(app.output).to include("Detected manifest file, assuming assets were compiled locally") expect(app.output).not_to match("Include 'rails_12factor' gem to enable all platform features") diff --git a/spec/hatchet/rubies_spec.rb b/spec/hatchet/rubies_spec.rb index 321e68e0b..c7ae868c2 100644 --- a/spec/hatchet/rubies_spec.rb +++ b/spec/hatchet/rubies_spec.rb @@ -1,8 +1,11 @@ require_relative '../spec_helper' -describe "Ruby Versions" do +describe "Ruby Versions on cedar-14" do it "should allow patchlevels" do - Hatchet::Runner.new("mri_193_p547").deploy do |app| + app = Hatchet::Runner.new('mri_193_p547') + app.setup! + app.heroku.put_stack(app.name, "cedar-14") + app.deploy do |app| version = '1.9.3p547' expect(app.output).to match("ruby-1.9.3-p547") expect(app.run('ruby -v')).to match(version) @@ -10,15 +13,10 @@ end it "should deploy ruby 1.9.2 properly" do - Hatchet::Runner.new("mri_192").deploy do |app| - version = '1.9.2' - expect(app.output).to match(version) - expect(app.run('ruby -v')).to match(version) - end - end - - it "should deploy ruby 1.9.2 properly (git)" do - Hatchet::GitApp.new("mri_192", buildpack: git_repo).deploy do |app| + app = Hatchet::Runner.new('mri_192') + app.setup! + app.heroku.put_stack(app.name, "cedar-14") + app.deploy do |app| version = '1.9.2' expect(app.output).to match(version) expect(app.run('ruby -v')).to match(version) @@ -26,7 +24,10 @@ end it "should deploy ruby 1.9.3 properly" do - Hatchet::Runner.new("mri_193").deploy do |app| + app = Hatchet::Runner.new('mri_193') + app.setup! + app.heroku.put_stack(app.name, "cedar-14") + app.deploy do |app| version = '1.9.3' expect(app.output).to match(version) expect(app.run('ruby -v')).to match(version) @@ -34,7 +35,10 @@ end it "should deploy ruby 2.0.0 properly" do - Hatchet::Runner.new("mri_200").deploy do |app| + app = Hatchet::Runner.new('mri_200') + app.setup! + app.heroku.put_stack(app.name, "cedar-14") + app.deploy do |app| version = '2.0.0' expect(app.output).to match(version) expect(app.run('ruby -v')).to match(version) @@ -47,7 +51,6 @@ app = Hatchet::Runner.new("ruby_193_jruby_17161") app.setup! app.heroku.put_stack(app.name, 'cedar-14') - app.deploy do |app| expect(app.output).to match("Installing JVM: openjdk-8") expect(app.output).to match("JRUBY_OPTS is: -Xcompile.invokedynamic=false") @@ -66,7 +69,6 @@ app = Hatchet::Runner.new("ruby_193_jruby_17161_jdk7") app.setup! app.heroku.put_stack(app.name, 'cedar-14') - app.deploy do |app| expect(app.output).to match("Installing JVM: openjdk-7") expect(app.output).not_to include("OpenJDK 64-Bit Server VM warning") diff --git a/spec/hatchet/ruby_spec.rb b/spec/hatchet/ruby_spec.rb index 532cb8ac6..4ade6c44b 100644 --- a/spec/hatchet/ruby_spec.rb +++ b/spec/hatchet/ruby_spec.rb @@ -43,14 +43,8 @@ end context "Ruby 1.9+" do - it "runs rake tasks if no rake gem" do - Hatchet::Runner.new('mri_200_no_rake').deploy do |app, heroku| - expect(app.output).to include("foo") - end - end - it "runs a rake task if the gem exists" do - Hatchet::Runner.new('mri_200_rake').deploy do |app, heroku| + Hatchet::Runner.new('default_with_rakefile').deploy do |app, heroku| expect(app.output).to include("foo") end end diff --git a/spec/hatchet/stack_spec.rb b/spec/hatchet/stack_spec.rb index b9ace237f..6fd731a96 100644 --- a/spec/hatchet/stack_spec.rb +++ b/spec/hatchet/stack_spec.rb @@ -2,10 +2,10 @@ describe "Stack Changes" do xit "should reinstall gems on stack change" do - app = Hatchet::Runner.new('mri_200').setup! - app.heroku.put_stack(app.name, "cedar-14") + app = Hatchet::Runner.new('default_ruby').setup! + app.heroku.put_stack(app.name, "heroku-16") app.deploy do |app, heroku| - heroku.put_stack(app.name, "cedar") + heroku.put_stack(app.name, "cedar-14") `git commit --allow-empty -m "cedar-14 migrate"` app.push! @@ -16,7 +16,7 @@ end it "should not reinstall gems if the stack did not change" do - app = Hatchet::Runner.new('mri_200').setup! + app = Hatchet::Runner.new('default_ruby').setup! app.heroku.put_stack(app.name, "cedar-14") app.deploy do |app, heroku| heroku.put_stack(app.name, "cedar-14") diff --git a/spec/hatchet/upgrade_ruby_spec.rb b/spec/hatchet/upgrade_ruby_spec.rb index b30fd842b..c3c117f02 100644 --- a/spec/hatchet/upgrade_ruby_spec.rb +++ b/spec/hatchet/upgrade_ruby_spec.rb @@ -2,20 +2,17 @@ describe "Upgrading ruby apps" do it "upgrades from 2.0.0 to 2.1.0", stack: :cedar do - app = Hatchet::Runner.new("mri_200") + app = Hatchet::Runner.new("default_ruby") app.setup! - app.heroku.put_stack(app.name, "cedar-14") - app.deploy do |app| - expect(app.run("ruby -v")).to match("2.0.0") `echo "" > Gemfile; echo "" > Gemfile.lock` puts `env BUNDLE_GEMFILE=./Gemfile bundle install`.inspect - `echo "ruby '2.1.4'" > Gemfile` + `echo "ruby '2.4.1'" > Gemfile` `git add -A; git commit -m update-ruby` app.push! - expect(app.output).to match("2.1.4") - expect(app.run("ruby -v")).to match("2.1.4") + expect(app.output).to match("2.4.1") + expect(app.run("ruby -v")).to match("2.4.1") expect(app.output).to match("Ruby version change detected") end end diff --git a/spec/hatchet/user_env_compile_edge_case_spec.rb b/spec/hatchet/user_env_compile_edge_case_spec.rb deleted file mode 100644 index fd1e261f7..000000000 --- a/spec/hatchet/user_env_compile_edge_case_spec.rb +++ /dev/null @@ -1,19 +0,0 @@ -require 'spec_helper' - -describe "User env compile" do - it "should not cause problems with warnings" do - app = Hatchet::Runner.new("mri_214") - app.setup! - app.heroku.put_stack(app.name, 'cedar-14') - app.set_config("RUBY_HEAP_MIN_SLOTS" => "1000000") - app.deploy do |app| - expect(app.run("bundle version")).to match(LanguagePack::Ruby::BUNDLER_VERSION) - end - end - - it "DATABASE_URL is present even without user-env-compile" do - Hatchet::Runner.new("database_url_expected_in_rakefile").deploy do |app| - expect(app.output).to match("Asset precompilation completed") - end - end -end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 582191be7..e650dc779 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -27,7 +27,8 @@ def git_repo def successful_body(app, options = {}) retry_limit = options[:retry_limit] || 50 - Excon.get("http://#{app.name}.herokuapp.com", :idempotent => true, :expects => 200, :retry_limit => retry_limit).body + url = "http://#{app.name}.herokuapp.com" + Excon.get(url, :idempotent => true, :expects => 200, :retry_limit => retry_limit).body end def create_file_with_size_in(size, dir) From 69067826a02a44785e25f788a343709240001d22 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 20 Mar 2017 13:59:39 -0500 Subject: [PATCH 0360/1195] Fix preparing database schema when using :sql The schema of a Rails database can be stored in a custom dsl, Rails refers to this as a "schema" where if it is stored as raw SQL, this is called "structure". A Rails app can choose to use either by setting `ActiveRecord::Base.schema_format` to `:ruby` or `:sql`. More recent versions of Rails have rake tasks that will conditionally execute depending on what the app has set `rake db:schema:load_if_ruby` and `rake db:structure:load_if_sql`, for apps that support these rake tasks we can simply execute both tasks and only the one that is set will fire. For older applications that do not have these conditional rake tasks we must be more invasive. We can inspect the value of `ActiveRecord::Base.schema_format` and set the appropriate task. Needs tests. --- lib/language_pack/test/ruby.rb | 41 ++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/lib/language_pack/test/ruby.rb b/lib/language_pack/test/ruby.rb index 2725c659b..ecda8e652 100644 --- a/lib/language_pack/test/ruby.rb +++ b/lib/language_pack/test/ruby.rb @@ -23,21 +23,38 @@ def compile private def prepare_tests - schema_load = rake.task("db:schema:load") - db_migrate = rake.task("db:migrate") - return true unless (schema_load.is_defined? || db_migrate.is_defined?) + schema_load = rake.task("db:schema:load_if_ruby") + structure_load = rake.task("db:structure:load_if_sql") + db_migrate = rake.task("db:migrate") - topic "Preparing test database schema" + if schema_load.not_defined? && structure_load.not_defined? + result = detect_schema_format + case result.lines.last.chomp + when "ruby" + schema_load = rake.task("db:schema:load") + when "sql" + structure_load = rake.task("db:structure:load") + else + puts "Could not determine schema/structure from ActiveRecord::Base.schema_format:\n#{result}" + end + end + + rake_tasks = [schema_load, structure_load, db_migrate].select(&:is_defined?) + return true if rake_tasks.empty? - [schema_load, db_migrate].each do |rake_task| - if rake_task.is_defined? - rake_task.invoke(env: rake_env) - if rake_task.success? - puts "#{rake_task.task} completed (#{"%.2f" % rake_task.time}s)" - else - error "Could not load test database schema" - end + topic "Preparing test database" + rake_tasks.each do |rake_task| + rake_task.invoke(env: rake_env) + if rake_task.success? + puts "#{rake_task.task} completed (#{"%.2f" % rake_task.time}s)" + else + error "Could not prepare database for test" end end end + + + def detect_schema_format + run("rails runner 'puts ActiveRecord::Base.schema_format'") + end end From 0802d50b48cd94d15f01983d3a640495337d1fe4 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 30 Mar 2017 14:40:52 -0500 Subject: [PATCH 0361/1195] Test CI with Hatchet 2.0 --- Gemfile.lock | 28 ++++++++++++------------ hatchet.json | 5 ++++- lib/language_pack/helpers/rake_runner.rb | 4 ++++ spec/hatchet/ci_spec.rb | 24 ++++++++++++++++++++ spec/hatchet/rails23_spec.rb | 2 +- 5 files changed, 47 insertions(+), 16 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 0cf51aa0d..d5ccf27ec 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -17,7 +17,7 @@ GEM progress (~> 2.4, >= 2.4.0) rest-client (~> 1.6, >= 1.6.7) thor (~> 0.15, >= 0.15.2) - diff-lcs (1.2.5) + diff-lcs (1.3) domain_name (0.5.20170404) unf (>= 0.0.5, < 1.0.0) erubis (2.7.0) @@ -42,20 +42,20 @@ GEM http-cookie (1.0.3) domain_name (~> 0.5) i18n (0.8.1) - json (2.0.2) + json (2.0.4) mime-types (2.99.3) - minitest (5.10.1) + minitest (5.10.2) moneta (0.8.1) multi_json (1.12.1) netrc (0.11.0) - parallel (1.8.0) - parallel_tests (2.5.0) + parallel (1.11.2) + parallel_tests (2.14.1) parallel platform-api (1.0.1) heroics (~> 0.0.21) moneta (~> 0.8.1) progress (2.4.0) - rake (10.0.4) + rake (12.0.0) repl_runner (0.0.3) activesupport rest-client (1.8.0) @@ -63,14 +63,14 @@ GEM mime-types (>= 1.16, < 3.0) netrc (~> 0.7) rrrretry (1.0.0) - rspec-core (3.4.4) - rspec-support (~> 3.4.0) - rspec-expectations (3.4.0) + rspec-core (3.6.0) + rspec-support (~> 3.6.0) + rspec-expectations (3.6.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.4.0) - rspec-retry (0.4.5) - rspec-core - rspec-support (3.4.1) + rspec-support (~> 3.6.0) + rspec-retry (0.5.4) + rspec-core (> 3.3, < 3.7) + rspec-support (3.6.0) thor (0.19.4) thread_safe (0.3.6) threaded (0.0.4) @@ -78,7 +78,7 @@ GEM thread_safe (~> 0.1) unf (0.1.4) unf_ext - unf_ext (0.0.7.3) + unf_ext (0.0.7.4) PLATFORMS ruby diff --git a/hatchet.json b/hatchet.json index 1509a82ac..7bc5bc694 100644 --- a/hatchet.json +++ b/hatchet.json @@ -76,6 +76,9 @@ ], "ci": [ "sharpstone/rails5_ruby_schema_format", - "sharpstone/heroku-ci-json-example" + "sharpstone/heroku-ci-json-example", + "sharpstone/rails5_sql_schema_format", + "sharpstone/rails_31_ruby_schema_format", + "sharpstone/rails_31_sql_schema_format" ] } diff --git a/lib/language_pack/helpers/rake_runner.rb b/lib/language_pack/helpers/rake_runner.rb index 4fa54cc28..d2c07e56a 100644 --- a/lib/language_pack/helpers/rake_runner.rb +++ b/lib/language_pack/helpers/rake_runner.rb @@ -21,6 +21,10 @@ def initialize(task, options = {}) @output = "" end + def not_defined? + !is_defined? + end + def success? status == :pass end diff --git a/spec/hatchet/ci_spec.rb b/spec/hatchet/ci_spec.rb index 6260a1abe..7188ed54b 100644 --- a/spec/hatchet/ci_spec.rb +++ b/spec/hatchet/ci_spec.rb @@ -6,4 +6,28 @@ expect(test_run.status).to eq(:succeeded) end end + + it "Works with Rails 5 ruby schema apps" do + Hatchet::Runner.new("rails5_ruby_schema_format").run_ci do |test_run| + expect(test_run.output).to match("db:schema:load_if_ruby completed") + end + end + + it "Works with Rails 5 SQL schema apps" do + Hatchet::Runner.new("rails5_sql_schema_format").run_ci do |test_run| + expect(test_run.output).to match("db:structure:load_if_sql completed") + end + end + + it "Works with Rails 3.1 ruby schema apps" do + Hatchet::Runner.new("rails_31_ruby_schema_format").run_ci do |test_run| + expect(test_run.output).to match("db:schema:load completed") + end + end + + it "Works with Rails 3.1 SQL schema apps" do + Hatchet::Runner.new("rails_31_sql_schema_format").run_ci do |test_run| + expect(test_run.output).to match("db:structure:load completed") + end + end end diff --git a/spec/hatchet/rails23_spec.rb b/spec/hatchet/rails23_spec.rb index 7f7f193a9..483fe46d3 100644 --- a/spec/hatchet/rails23_spec.rb +++ b/spec/hatchet/rails23_spec.rb @@ -5,7 +5,7 @@ app = Hatchet::Runner.new('rails23_mri_193').setup! app.heroku.put_stack(app.name, "cedar-14") app.deploy do |app, heroku| - expect(successful_body(app)).to eq("hello") + # assert deploy is successful end end end From 8f7e99c4c30a0de33c489d85aea9897fae2b9b57 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 17 May 2017 17:13:35 -0500 Subject: [PATCH 0362/1195] We cannot `db:create` a database The `db:schema:load_if_ruby` calls `db:create` before loading the schema, which isn't possible against a Heroku database. Changed to single quote strings due to complaints from rubocop. --- lib/language_pack/test/rails2.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/language_pack/test/rails2.rb b/lib/language_pack/test/rails2.rb index eee2ddcdd..5eed5d864 100644 --- a/lib/language_pack/test/rails2.rb +++ b/lib/language_pack/test/rails2.rb @@ -27,10 +27,14 @@ def prepare_tests # rails test runner + rspec depend on db:test:purge which drops/creates a db which doesn't work on Heroku's DB plans def blank_db_test_purge_task FileUtils::mkdir_p 'lib/tasks' - File.open("lib/tasks/heroku_db_test_purge.rake", "w") do |file| - file.puts < Date: Wed, 17 May 2017 17:37:19 -0500 Subject: [PATCH 0363/1195] Error formatting --- lib/language_pack/test/ruby.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/test/ruby.rb b/lib/language_pack/test/ruby.rb index ecda8e652..247b6348e 100644 --- a/lib/language_pack/test/ruby.rb +++ b/lib/language_pack/test/ruby.rb @@ -35,7 +35,7 @@ def prepare_tests when "sql" structure_load = rake.task("db:structure:load") else - puts "Could not determine schema/structure from ActiveRecord::Base.schema_format:\n#{result}" + puts "Could not determine schema/structure from `ActiveRecord::Base.schema_format`:\n#{result}" end end From 10b4525e387bdf9ec763e2b939184325edc4ffd2 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Wed, 17 May 2017 19:52:22 -0500 Subject: [PATCH 0364/1195] move db test task clearing above any rake invocation generalize rake task clearing method name --- lib/language_pack/test/rails2.rb | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/lib/language_pack/test/rails2.rb b/lib/language_pack/test/rails2.rb index 5eed5d864..5bbb60ba9 100644 --- a/lib/language_pack/test/rails2.rb +++ b/lib/language_pack/test/rails2.rb @@ -19,24 +19,28 @@ def rake_env end def prepare_tests + # need to clear db:create before db:schema:load_if_ruby gets called by super + topic "Clearing #{db_test_tasks_to_clear.join(" ")} rake tasks" + clear_db_test_tasks super - topic "Clearing db:test:purge rake task" - blank_db_test_purge_task + end + + def db_test_tasks_to_clear + ["db:test:purge", "db:create"] end # rails test runner + rspec depend on db:test:purge which drops/creates a db which doesn't work on Heroku's DB plans - def blank_db_test_purge_task + def clear_db_test_tasks FileUtils::mkdir_p 'lib/tasks' File.open("lib/tasks/heroku_clear_tasks.rake", "w") do |file| - file.puts <<-FILE -Rake::Task['db:test:purge'].clear -task 'db:test:purge' do -end - -Rake::Task['db:create'].clear -task 'db:create' do + content = db_test_tasks_to_clear.map do |task_name| + <<-FILE +Rake::Task['#{task_name}'].clear +task '#{task_name}' do end FILE + end.join("\n") + file.print content end end end From b6be7ba23509d88427d9a9ec8a6dbd059cb36f11 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Wed, 17 May 2017 20:16:48 -0500 Subject: [PATCH 0365/1195] need the user's environment to run rails runner. specifically the DATABASE_URL at the very least --- lib/language_pack/test/ruby.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/test/ruby.rb b/lib/language_pack/test/ruby.rb index 247b6348e..5d3cb642f 100644 --- a/lib/language_pack/test/ruby.rb +++ b/lib/language_pack/test/ruby.rb @@ -55,6 +55,6 @@ def prepare_tests def detect_schema_format - run("rails runner 'puts ActiveRecord::Base.schema_format'") + run("rails runner 'puts ActiveRecord::Base.schema_format'", user_env: true) end end From 225b3f41f744812629bfb613d23b06f1626e7e9d Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Wed, 17 May 2017 20:37:17 -0500 Subject: [PATCH 0366/1195] only rails5+ has `bin/rails test` --- bin/support/ruby_test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/support/ruby_test b/bin/support/ruby_test index 13daac0bc..23d958598 100755 --- a/bin/support/ruby_test +++ b/bin/support/ruby_test @@ -50,7 +50,7 @@ execute_test( else "bundle exec rspec" end - elsif File.exist?("bin/rails") + elsif File.exist?("bin/rails") && bundler.has_gem?("railties") && bundler.gem_version("railties") >= Gem::Version.new("5.x") "bin/rails test" elsif File.exist?("bin/rake") "bin/rake test" From 1c3bf87cf7c9f8f05fe6d92f0a0928c17024eddc Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Wed, 17 May 2017 21:47:57 -0500 Subject: [PATCH 0367/1195] stub out `db:structure:dump` since it breaks Rails 3.2's `db:structure:load` We also don't need to dump the structure for tests --- lib/language_pack/test/rails2.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/language_pack/test/rails2.rb b/lib/language_pack/test/rails2.rb index 5bbb60ba9..c46581a19 100644 --- a/lib/language_pack/test/rails2.rb +++ b/lib/language_pack/test/rails2.rb @@ -26,7 +26,10 @@ def prepare_tests end def db_test_tasks_to_clear - ["db:test:purge", "db:create"] + # db:test:purge is called by everything in the db:test namespace + # db:create is called by :db:schema:load_if_ruby + # db:structure:dump is not needed for tests, but breaks Rails 3.2 db:structure:load on Heroku + ["db:test:purge", "db:create", "db:structure:dump"] end # rails test runner + rspec depend on db:test:purge which drops/creates a db which doesn't work on Heroku's DB plans From 82d07c9a05769f968c395e697adb6604bca4e56d Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Wed, 17 May 2017 21:58:48 -0500 Subject: [PATCH 0368/1195] no way to get a rails sql schema case without the rake task available --- lib/language_pack/test/ruby.rb | 1 + spec/hatchet/ci_spec.rb | 6 ------ 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/language_pack/test/ruby.rb b/lib/language_pack/test/ruby.rb index 5d3cb642f..bcb0c66a6 100644 --- a/lib/language_pack/test/ruby.rb +++ b/lib/language_pack/test/ruby.rb @@ -32,6 +32,7 @@ def prepare_tests case result.lines.last.chomp when "ruby" schema_load = rake.task("db:schema:load") + # currently not a possible edge case when "sql" structure_load = rake.task("db:structure:load") else diff --git a/spec/hatchet/ci_spec.rb b/spec/hatchet/ci_spec.rb index 7188ed54b..5fc7c575c 100644 --- a/spec/hatchet/ci_spec.rb +++ b/spec/hatchet/ci_spec.rb @@ -24,10 +24,4 @@ expect(test_run.output).to match("db:schema:load completed") end end - - it "Works with Rails 3.1 SQL schema apps" do - Hatchet::Runner.new("rails_31_sql_schema_format").run_ci do |test_run| - expect(test_run.output).to match("db:structure:load completed") - end - end end From cd639a3dae0033595caa5502f93ad5b7cdf1c614 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Thu, 18 May 2017 10:57:07 -0500 Subject: [PATCH 0369/1195] update changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 557d62450..8f5d0f004 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ ## Master +## v160 (05/18/2017) + +* `bin/rails test` only gets called in CI for Rails 5+ apps +* support `:sql` (structure) Rails schema for CI (#549) + ## v159 (04/24/2017) * Blacklist JAVA_OPTS and JAVA_TOOL_OPTIONS during build (#559) From fa4043721a77a28a9eb9a37fad2bb9e3f94224a8 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Thu, 18 May 2017 10:58:59 -0500 Subject: [PATCH 0370/1195] bump to v160 --- lib/language_pack/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index b62b17e37..c3df0ae41 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v159" + BUILDPACK_VERSION = "v160" end end From eaeb705ce8d4d045676d65290d7c38fe97d47215 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Thu, 18 May 2017 13:05:10 -0500 Subject: [PATCH 0371/1195] move rails db schema checking to only be done for rails apps stick to db:schema:load and db:migrate for general ruby apps if they exist --- lib/language_pack/test/rails2.rb | 27 +++++++++++++++++++++++++++ lib/language_pack/test/ruby.rb | 28 +++++----------------------- 2 files changed, 32 insertions(+), 23 deletions(-) diff --git a/lib/language_pack/test/rails2.rb b/lib/language_pack/test/rails2.rb index c46581a19..cd41f2014 100644 --- a/lib/language_pack/test/rails2.rb +++ b/lib/language_pack/test/rails2.rb @@ -46,4 +46,31 @@ def clear_db_test_tasks file.print content end end + + private + def db_prepare_test_rake_tasks + schema_load = rake.task("db:schema:load_if_ruby") + structure_load = rake.task("db:structure:load_if_sql") + db_migrate = rake.task("db:migrate") + + if schema_load.not_defined? && structure_load.not_defined? + result = detect_schema_format + case result.lines.last.chomp + when "ruby" + schema_load = rake.task("db:schema:load") + # currently not a possible edge case + when "sql" + structure_load = rake.task("db:structure:load") + else + puts "Could not determine schema/structure from `ActiveRecord::Base.schema_format`:\n#{result}" + end + end + + [schema_load, structure_load, db_migrate] + end + + + def detect_schema_format + run("rails runner 'puts ActiveRecord::Base.schema_format'", user_env: true) + end end diff --git a/lib/language_pack/test/ruby.rb b/lib/language_pack/test/ruby.rb index bcb0c66a6..db6b93661 100644 --- a/lib/language_pack/test/ruby.rb +++ b/lib/language_pack/test/ruby.rb @@ -22,25 +22,12 @@ def compile end private - def prepare_tests - schema_load = rake.task("db:schema:load_if_ruby") - structure_load = rake.task("db:structure:load_if_sql") - db_migrate = rake.task("db:migrate") - - if schema_load.not_defined? && structure_load.not_defined? - result = detect_schema_format - case result.lines.last.chomp - when "ruby" - schema_load = rake.task("db:schema:load") - # currently not a possible edge case - when "sql" - structure_load = rake.task("db:structure:load") - else - puts "Could not determine schema/structure from `ActiveRecord::Base.schema_format`:\n#{result}" - end - end + def db_prepare_test_rake_tasks + ["db:schema:load", "db:migrate"].map {|name| rake.task(name) } + end - rake_tasks = [schema_load, structure_load, db_migrate].select(&:is_defined?) + def prepare_tests + rake_tasks = db_prepare_test_rake_tasks.select(&:is_defined?) return true if rake_tasks.empty? topic "Preparing test database" @@ -53,9 +40,4 @@ def prepare_tests end end end - - - def detect_schema_format - run("rails runner 'puts ActiveRecord::Base.schema_format'", user_env: true) - end end From ee0f6fbeb745337dc05b63507238d98aad972d6f Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 18 May 2017 13:50:04 -0500 Subject: [PATCH 0372/1195] Test vanilla Ruby app with CI --- hatchet.json | 3 ++- spec/hatchet/ci_spec.rb | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/hatchet.json b/hatchet.json index 7bc5bc694..6019ad2c3 100644 --- a/hatchet.json +++ b/hatchet.json @@ -79,6 +79,7 @@ "sharpstone/heroku-ci-json-example", "sharpstone/rails5_sql_schema_format", "sharpstone/rails_31_ruby_schema_format", - "sharpstone/rails_31_sql_schema_format" + "sharpstone/rails_31_sql_schema_format", + "sharpstone/ruby_no_rails_test" ] } diff --git a/spec/hatchet/ci_spec.rb b/spec/hatchet/ci_spec.rb index 5fc7c575c..6b32fc212 100644 --- a/spec/hatchet/ci_spec.rb +++ b/spec/hatchet/ci_spec.rb @@ -24,4 +24,10 @@ expect(test_run.output).to match("db:schema:load completed") end end + + it "Works with a vanilla ruby app" do + Hatchet::Runner.new("ruby_no_rails_test").run_ci do |test_run| + # Expect success test run + end + end end From c958543c65518caf64aed8aac84a9dfe8974812e Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 18 May 2017 14:47:23 -0500 Subject: [PATCH 0373/1195] [ci skip] v161 --- CHANGELOG.md | 4 ++++ lib/language_pack/version.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f5d0f004..ae902a1b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Master +## v161 (05/18/2017) + +* Ruby apps being run on CI are no longer expected to have Rails commands (#565) + ## v160 (05/18/2017) * `bin/rails test` only gets called in CI for Rails 5+ apps diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index c3df0ae41..cdcf2e722 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v160" + BUILDPACK_VERSION = "v161" end end From e801f7d57750d2070aa7e5d9880cc0ed358fcb67 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 18 May 2017 16:31:31 -0500 Subject: [PATCH 0374/1195] Disable Roubocop for `heroku_clear_tasks` file --- lib/language_pack/test/rails2.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/language_pack/test/rails2.rb b/lib/language_pack/test/rails2.rb index cd41f2014..e2afb876f 100644 --- a/lib/language_pack/test/rails2.rb +++ b/lib/language_pack/test/rails2.rb @@ -36,6 +36,7 @@ def db_test_tasks_to_clear def clear_db_test_tasks FileUtils::mkdir_p 'lib/tasks' File.open("lib/tasks/heroku_clear_tasks.rake", "w") do |file| + file.puts "# rubocop:disable all" content = db_test_tasks_to_clear.map do |task_name| <<-FILE Rake::Task['#{task_name}'].clear @@ -44,6 +45,7 @@ def clear_db_test_tasks FILE end.join("\n") file.print content + file.puts "# rubocop:enable all" end end From 111151fb23dbf9cf725ddcad3489db31ebe7f569 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 18 May 2017 16:51:21 -0500 Subject: [PATCH 0375/1195] [ci skip] v162 --- CHANGELOG.md | 4 ++++ lib/language_pack/version.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae902a1b9..6d8187b81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Master +## v162 (05/18/2017) + +* Disable roubocop warnings for `heroku_clear_tasks` (#567) + ## v161 (05/18/2017) * Ruby apps being run on CI are no longer expected to have Rails commands (#565) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index cdcf2e722..577cf54d4 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v161" + BUILDPACK_VERSION = "v162" end end From c2daaa6a75a7235c11940331cb8a24f8ab513ea9 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 22 May 2017 12:28:01 -0500 Subject: [PATCH 0376/1195] Fix errors when rake tasks missing There are two modes of errors that were causing failures. 1) `db:test:purge` or other task does not exist it, yet we try to clear it. Solution: check the task exists before trying to clear ``` if Rake::Task.task_defined?('db:test:purge') ``` 2) Rails apps aren't required to have a database or activerecord. When this happens the `db:schema:load_if_ruby` and `db:structure:load_if_sql` will fail which will cause the testpack to look up schema format and fail when it's not set. Solution: Exit early if no `db:migrate` task is present. ``` return [] if db_migrate.not_defined? ``` --- hatchet.json | 3 ++- lib/language_pack/test/rails2.rb | 11 +++++++---- spec/hatchet/ci_spec.rb | 6 ++++++ 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/hatchet.json b/hatchet.json index 6019ad2c3..6bfa0a231 100644 --- a/hatchet.json +++ b/hatchet.json @@ -80,6 +80,7 @@ "sharpstone/rails5_sql_schema_format", "sharpstone/rails_31_ruby_schema_format", "sharpstone/rails_31_sql_schema_format", - "sharpstone/ruby_no_rails_test" + "sharpstone/ruby_no_rails_test", + "sharpstone/activerecord_rake_tasks_does_not_exist" ] } diff --git a/lib/language_pack/test/rails2.rb b/lib/language_pack/test/rails2.rb index e2afb876f..17cacdd8b 100644 --- a/lib/language_pack/test/rails2.rb +++ b/lib/language_pack/test/rails2.rb @@ -39,8 +39,10 @@ def clear_db_test_tasks file.puts "# rubocop:disable all" content = db_test_tasks_to_clear.map do |task_name| <<-FILE -Rake::Task['#{task_name}'].clear -task '#{task_name}' do +if Rake::Task.task_defined?('#{task_name}') + Rake::Task['#{task_name}'].clear + task '#{task_name}' do + end end FILE end.join("\n") @@ -55,13 +57,14 @@ def db_prepare_test_rake_tasks structure_load = rake.task("db:structure:load_if_sql") db_migrate = rake.task("db:migrate") + return [] if db_migrate.not_defined? + if schema_load.not_defined? && structure_load.not_defined? result = detect_schema_format case result.lines.last.chomp when "ruby" schema_load = rake.task("db:schema:load") - # currently not a possible edge case - when "sql" + when "sql" # currently not a possible edge case, we think structure_load = rake.task("db:structure:load") else puts "Could not determine schema/structure from `ActiveRecord::Base.schema_format`:\n#{result}" diff --git a/spec/hatchet/ci_spec.rb b/spec/hatchet/ci_spec.rb index 6b32fc212..68fa7e3ef 100644 --- a/spec/hatchet/ci_spec.rb +++ b/spec/hatchet/ci_spec.rb @@ -30,4 +30,10 @@ # Expect success test run end end + + it "Works with a rails app that does not have activerecord" do + Hatchet::Runner.new("activerecord_rake_tasks_does_not_exist").run_ci do |test_run| + expect(test_run.output).to_not match("db:migrate") + end + end end From 692cfcee054646d5dbb82c96b3c77bc0d1eede6a Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 22 May 2017 13:10:05 -0500 Subject: [PATCH 0377/1195] [ci skip] v163 --- CHANGELOG.md | 4 ++++ lib/language_pack/version.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d8187b81..d906f7115 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Master +## v163 (05/22/2017) + +* Fix CI rake tasks not running (#571) + ## v162 (05/18/2017) * Disable roubocop warnings for `heroku_clear_tasks` (#567) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 577cf54d4..4aebbffe7 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v162" + BUILDPACK_VERSION = "v163" end end From f8448d276990c7424da1647e7d38be932399d4ad Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 30 May 2017 14:06:22 -0500 Subject: [PATCH 0378/1195] Ruby 2.1 is no longer supported. Remove this extra message --- lib/language_pack/ruby.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 6e9d0efa5..a4df0795f 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -388,8 +388,6 @@ def install_ruby if ruby_version.jruby? message << "Note: Only JRuby 1.7.13 and newer are supported on Cedar-14" - elsif ruby_version.ruby_version.start_with?("2.1") - message << "Note: Only the most recent version of Ruby 2.1 is supported on Cedar-14\n" end message << "\nDebug Information" From b0ebf9ee9f28ad8dc608dbf0c05fb0d6f6b2d46a Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 22 May 2017 10:46:28 -0500 Subject: [PATCH 0379/1195] Bundler 1.15.0 Bundler fixed this bug https://github.com/bundler/bundler/pull/5388 which causes this issue https://github.com/ruby/openssl/issues/103. To be able to deploy Ruby 2.4 and the openssl gem on Heroku. --- lib/language_pack/ruby.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 6e9d0efa5..f84ee98c6 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -16,7 +16,7 @@ class LanguagePack::Ruby < LanguagePack::Base NAME = "ruby" LIBYAML_VERSION = "0.1.7" LIBYAML_PATH = "libyaml-#{LIBYAML_VERSION}" - BUNDLER_VERSION = "1.13.7" + BUNDLER_VERSION = "1.15.0" BUNDLER_GEM_PATH = "bundler-#{BUNDLER_VERSION}" RBX_BASE_URL = "http://binaries.rubini.us/heroku" NODE_BP_PATH = "vendor/node/bin" From 274cbf28aa61257662a7fa111353a5e4cb63e339 Mon Sep 17 00:00:00 2001 From: schneems Date: Fri, 2 Jun 2017 11:58:49 -0500 Subject: [PATCH 0380/1195] Revert "Merge pull request #569 from heroku/schneems/bundler-1.15.0" Multiple issues have been reported through support tickets and through GitHub issues. 1.15.0 is not stable enough and 1.15.1 does not appear to have fixes to these issues listed in the Changelog. We will revert until we can triage all issues and report them to bundler and get them fixed. GitHub Issue: #578 This reverts commit 2a7c1c9dc6464e0895bcc9a76607939f105d3952, reversing changes made to 8fed8683c92dc35d1382a0fc9c0532df93c70f3f. --- lib/language_pack/ruby.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 5fd960983..a4df0795f 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -16,7 +16,7 @@ class LanguagePack::Ruby < LanguagePack::Base NAME = "ruby" LIBYAML_VERSION = "0.1.7" LIBYAML_PATH = "libyaml-#{LIBYAML_VERSION}" - BUNDLER_VERSION = "1.15.0" + BUNDLER_VERSION = "1.13.7" BUNDLER_GEM_PATH = "bundler-#{BUNDLER_VERSION}" RBX_BASE_URL = "http://binaries.rubini.us/heroku" NODE_BP_PATH = "vendor/node/bin" From f616ddde5b5861a2c6351e6f5643a43efa75096e Mon Sep 17 00:00:00 2001 From: Caleb Thompson Date: Fri, 2 Jun 2017 11:32:44 -0500 Subject: [PATCH 0381/1195] Update Bundler to 1.15.1 This update includes several bugfixes: - `bundle lock --update GEM` will fail gracefully when the gem is not in the lockfile - `bundle init --gemspec` will fail gracefully when the gemspec is invalid - `bundle install --force` works when the gemfile contains git gems - `bundle env` will print well-formed markdown when there are no settings Full details: https://github.com/bundler/bundler/compare/v1.15.0...v1.15.1 --- lib/language_pack/ruby.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index a4df0795f..114d8a59f 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -16,7 +16,7 @@ class LanguagePack::Ruby < LanguagePack::Base NAME = "ruby" LIBYAML_VERSION = "0.1.7" LIBYAML_PATH = "libyaml-#{LIBYAML_VERSION}" - BUNDLER_VERSION = "1.13.7" + BUNDLER_VERSION = "1.15.1" BUNDLER_GEM_PATH = "bundler-#{BUNDLER_VERSION}" RBX_BASE_URL = "http://binaries.rubini.us/heroku" NODE_BP_PATH = "vendor/node/bin" From 5078e03a208ff74f8b101ddb99f31e2d59439d6c Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 14 Jun 2017 17:38:22 -0500 Subject: [PATCH 0382/1195] Force Ubuntu Trusty to avoid CLI download fail ``` Worker information hostname: i-0e94dd6-precise-production-2-worker-org-docker.travisci.net:dffa36d3-93bd-4340-993c-68617373494e version: v2.5.0 https://github.com/travis-ci/worker/tree/da3a43228dffc0fcca5a46569ca786b22991979f instance: aac9617:travis:ruby startup: 834.026396ms system_info Build system information Build language: ruby Build group: stable Build dist: precise Build id: 242960739 Job id: 242960740 travis-build version: 695186105 Build image provisioning date and time Thu Feb 5 15:09:33 UTC 2015 Operating System Details Distributor ID: Ubuntu Description: Ubuntu 12.04.5 LTS Release: 12.04 Codename: precise Linux Version 3.13.0-29-generic Cookbooks Version a68419e https://github.com/travis-ci/travis-cookbooks/tree/a68419e GCC version gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3 Copyright (C) 2011 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. LLVM version clang version 3.4 (tags/RELEASE_34/final) Target: x86_64-unknown-linux-gnu Thread model: posix Pre-installed Ruby versions ruby-1.9.3-p551 Pre-installed Node.js versions v0.10.36 Pre-installed Go versions 1.4.1 Redis version redis-server 2.8.19 riak version 2.0.2 MongoDB version MongoDB 2.4.12 CouchDB version couchdb 1.6.1 Neo4j version 1.9.4 RabbitMQ Version 3.4.3 ElasticSearch version 1.4.0 Installed Sphinx versions 2.0.10 2.1.9 2.2.6 Default Sphinx version 2.2.6 Installed Firefox version firefox 31.0esr PhantomJS version 1.9.8 ant -version Apache Ant(TM) version 1.8.2 compiled on December 3 2011 mvn -version Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T17:29:23+00:00) Maven home: /usr/local/maven Java version: 1.7.0_76, vendor: Oracle Corporation Java home: /usr/lib/jvm/java-7-oracle/jre Default locale: en_US, platform encoding: ANSI_X3.4-1968 OS name: "linux", version: "3.13.0-29-generic", arch: "amd64", family: "unix" fix.CVE-2015-7547 $ export DEBIAN_FRONTEND=noninteractive Reading package lists... Building dependency tree... Reading state information... The following extra packages will be installed: libc-bin libc-dev-bin libc6-dev Suggested packages: glibc-doc The following packages will be upgraded: libc-bin libc-dev-bin libc6 libc6-dev 4 upgraded, 0 newly installed, 0 to remove and 277 not upgraded. Need to get 8,856 kB of archives. After this operation, 13.3 kB of additional disk space will be used. Get:1 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libc6-dev amd64 2.15-0ubuntu10.18 [2,948 kB] Get:2 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libc-dev-bin amd64 2.15-0ubuntu10.18 [84.5 kB] Get:3 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libc-bin amd64 2.15-0ubuntu10.18 [1,178 kB] Get:4 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libc6 amd64 2.15-0ubuntu10.18 [4,646 kB] Fetched 8,856 kB in 0s (23.4 MB/s) Preconfiguring packages ... (Reading database ... 71420 files and directories currently installed.) Preparing to replace libc6-dev 2.15-0ubuntu10.10 (using .../libc6-dev_2.15-0ubuntu10.18_amd64.deb) ... Unpacking replacement libc6-dev ... Preparing to replace libc-dev-bin 2.15-0ubuntu10.10 (using .../libc-dev-bin_2.15-0ubuntu10.18_amd64.deb) ... Unpacking replacement libc-dev-bin ... Preparing to replace libc-bin 2.15-0ubuntu10.10 (using .../libc-bin_2.15-0ubuntu10.18_amd64.deb) ... Unpacking replacement libc-bin ... Processing triggers for man-db ... Setting up libc-bin (2.15-0ubuntu10.18) ... (Reading database ... 71419 files and directories currently installed.) Preparing to replace libc6 2.15-0ubuntu10.10 (using .../libc6_2.15-0ubuntu10.18_amd64.deb) ... Unpacking replacement libc6 ... Setting up libc6 (2.15-0ubuntu10.18) ... Setting up libc-dev-bin (2.15-0ubuntu10.18) ... Setting up libc6-dev (2.15-0ubuntu10.18) ... Processing triggers for libc-bin ... ldconfig deferred processing now taking place update_libssl1.0.0 $ sudo apt-get install libssl1.0.0 Reading package lists... Done Building dependency tree Reading state information... Done The following extra packages will be installed: libssl-dev The following packages will be upgraded: libssl-dev libssl1.0.0 2 upgraded, 0 newly installed, 0 to remove and 275 not upgraded. Need to get 2,634 kB of archives. After this operation, 29.7 kB of additional disk space will be used. Get:1 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libssl-dev amd64 1.0.1-4ubuntu5.39 [1,580 kB] Get:2 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libssl1.0.0 amd64 1.0.1-4ubuntu5.39 [1,054 kB] Fetched 2,634 kB in 0s (15.7 MB/s) Preconfiguring packages ... (Reading database ... 71419 files and directories currently installed.) Preparing to replace libssl-dev 1.0.1-4ubuntu5.21 (using .../libssl-dev_1.0.1-4ubuntu5.39_amd64.deb) ... Unpacking replacement libssl-dev ... Preparing to replace libssl1.0.0 1.0.1-4ubuntu5.21 (using .../libssl1.0.0_1.0.1-4ubuntu5.39_amd64.deb) ... Unpacking replacement libssl1.0.0 ... Setting up libssl1.0.0 (1.0.1-4ubuntu5.39) ... Setting up libssl-dev (1.0.1-4ubuntu5.39) ... Processing triggers for libc-bin ... ldconfig deferred processing now taking place git.checkout 0.79s$ git clone --depth=50 --branch=1.15.1 https://github.com/heroku/heroku-buildpack-ruby.git heroku/heroku-buildpack-ruby Cloning into 'heroku/heroku-buildpack-ruby'... remote: Counting objects: 835, done. remote: Compressing objects: 100% (473/473), done. remote: Total 835 (delta 423), reused 732 (delta 359), pack-reused 0 Receiving objects: 100% (835/835), 189.93 KiB | 0 bytes/s, done. Resolving deltas: 100% (423/423), done. Checking connectivity... done. $ cd heroku/heroku-buildpack-ruby $ git checkout -qf f616ddde5b5861a2c6351e6f5643a43efa75096e Adding APT Sources (BETA) $ export DEBIAN_FRONTEND=noninteractive 0.13s$ curl -sSL "https://toolbelt.heroku.com/apt/release.key" | sudo -E apt-key add - OK 0.02s$ echo "deb http://toolbelt.heroku.com/ubuntu ./" | sudo tee -a /etc/apt/sources.list > /dev/null Installing APT Packages (BETA) $ export DEBIAN_FRONTEND=noninteractive 5.86s$ sudo -E apt-get -yq update &>> ~/apt-get-update.log 8.72s$ sudo -E apt-get -yq --no-install-suggests --no-install-recommends --force-yes install heroku-toolbelt Reading package lists... Building dependency tree... Reading state information... The following extra packages will be installed: heroku The following NEW packages will be installed: heroku heroku-toolbelt 0 upgraded, 2 newly installed, 0 to remove and 275 not upgraded. Need to get 1,492 B of archives. After this operation, 0 B of additional disk space will be used. Get:1 http://toolbelt.heroku.com/ubuntu/ ./ heroku 3.99.4 [790 B] Get:2 http://toolbelt.heroku.com/ubuntu/ ./ heroku-toolbelt 3.99.4 [702 B] Fetched 1,492 B in 0s (18.4 kB/s) Selecting previously unselected package heroku. (Reading database ... 71419 files and directories currently installed.) Unpacking heroku (from .../archives/heroku_3.99.4_all.deb) ... Selecting previously unselected package heroku-toolbelt. Unpacking heroku-toolbelt (from .../heroku-toolbelt_3.99.4_all.deb) ... Setting up heroku (3.99.4) ... + uname -m + MACHINE_TYPE=x86_64 + [ x86_64 = x86_64 ] + ARCH=x64 + mkdir -p /usr/local + cd /usr/local + + tar xzwget -qO- https://cli-assets.heroku.com/heroku-cli/channels/stable/heroku-cli-linux-x64.tar.gz gzip: stdin: unexpected end of file tar: Child returned status 1 tar: Error is not recoverable: exiting now dpkg: error processing heroku (--configure): subprocess installed post-installation script returned error exit status 2 E: Sub-process /usr/bin/dpkg returned an error code (1) apt-get.diagnostics apt-get install failed $ cat ~/apt-get-update.log Hit http://downloads-distro.mongodb.org dist Release.gpg Hit http://downloads-distro.mongodb.org dist Release Hit http://downloads-distro.mongodb.org dist/10gen amd64 Packages Hit http://apt.postgresql.org precise-pgdg Release.gpg Hit http://downloads-distro.mongodb.org dist/10gen i386 Packages Hit http://security.ubuntu.com precise-security Release.gpg Hit http://us.archive.ubuntu.com precise Release.gpg Hit http://us.archive.ubuntu.com precise-updates Release.gpg Hit http://us.archive.ubuntu.com precise-backports Release.gpg Hit http://apt.postgresql.org precise-pgdg Release Hit http://us.archive.ubuntu.com precise Release Hit http://us.archive.ubuntu.com precise-updates Release Hit http://security.ubuntu.com precise-security Release Hit http://us.archive.ubuntu.com precise-backports Release Hit http://us.archive.ubuntu.com precise/main Sources Hit http://us.archive.ubuntu.com precise/restricted Sources Hit http://security.ubuntu.com precise-security/main Sources Hit http://us.archive.ubuntu.com precise/universe Sources Hit http://us.archive.ubuntu.com precise/multiverse Sources Hit http://us.archive.ubuntu.com precise/main amd64 Packages Hit http://us.archive.ubuntu.com precise/restricted amd64 Packages Hit http://us.archive.ubuntu.com precise/universe amd64 Packages Hit http://us.archive.ubuntu.com precise/multiverse amd64 Packages Hit http://us.archive.ubuntu.com precise/main i386 Packages Hit http://us.archive.ubuntu.com precise/restricted i386 Packages Hit http://security.ubuntu.com precise-security/restricted Sources Hit http://security.ubuntu.com precise-security/universe Sources Hit http://security.ubuntu.com precise-security/multiverse Sources Hit http://security.ubuntu.com precise-security/main amd64 Packages Hit http://security.ubuntu.com precise-security/restricted amd64 Packages Hit http://security.ubuntu.com precise-security/universe amd64 Packages Hit http://security.ubuntu.com precise-security/multiverse amd64 Packages Hit http://security.ubuntu.com precise-security/main i386 Packages Hit http://security.ubuntu.com precise-security/restricted i386 Packages Hit http://security.ubuntu.com precise-security/universe i386 Packages Hit http://us.archive.ubuntu.com precise/universe i386 Packages Hit http://us.archive.ubuntu.com precise/multiverse i386 Packages Hit http://us.archive.ubuntu.com precise-updates/main Sources Hit http://security.ubuntu.com precise-security/multiverse i386 Packages Hit http://us.archive.ubuntu.com precise-updates/restricted Sources Hit http://us.archive.ubuntu.com precise-updates/universe Sources Hit http://us.archive.ubuntu.com precise-updates/multiverse Sources Hit http://us.archive.ubuntu.com precise-updates/main amd64 Packages Hit http://us.archive.ubuntu.com precise-updates/restricted amd64 Packages Hit http://us.archive.ubuntu.com precise-updates/universe amd64 Packages Hit http://us.archive.ubuntu.com precise-updates/multiverse amd64 Packages Hit http://us.archive.ubuntu.com precise-updates/main i386 Packages Hit http://us.archive.ubuntu.com precise-updates/restricted i386 Packages Hit http://us.archive.ubuntu.com precise-updates/universe i386 Packages Hit http://us.archive.ubuntu.com precise-updates/multiverse i386 Packages Hit http://us.archive.ubuntu.com precise-backports/main Sources Hit http://us.archive.ubuntu.com precise-backports/restricted Sources Hit http://us.archive.ubuntu.com precise-backports/universe Sources Hit http://us.archive.ubuntu.com precise-backports/multiverse Sources Hit http://us.archive.ubuntu.com precise-backports/main amd64 Packages Hit http://us.archive.ubuntu.com precise-backports/restricted amd64 Packages Hit http://ppa.launchpad.net precise Release.gpg Hit http://ppa.launchpad.net precise Release.gpg Hit http://ppa.launchpad.net precise Release.gpg Hit http://ppa.launchpad.net precise Release.gpg Hit http://ppa.launchpad.net precise Release.gpg Hit http://ppa.launchpad.net precise Release.gpg Hit http://us.archive.ubuntu.com precise-backports/universe amd64 Packages Hit http://us.archive.ubuntu.com precise-backports/multiverse amd64 Packages Hit http://us.archive.ubuntu.com precise-backports/main i386 Packages Hit http://us.archive.ubuntu.com precise-backports/restricted i386 Packages Hit http://us.archive.ubuntu.com precise-backports/universe i386 Packages Hit http://us.archive.ubuntu.com precise-backports/multiverse i386 Packages Hit http://ppa.launchpad.net precise Release Hit http://ppa.launchpad.net precise Release Hit http://ppa.launchpad.net precise Release Hit http://ppa.launchpad.net precise Release Hit http://ppa.launchpad.net precise Release Hit http://apt.postgresql.org precise-pgdg/main amd64 Packages Hit http://apt.postgresql.org precise-pgdg/main i386 Packages Hit http://ppa.launchpad.net precise Release Hit http://ppa.launchpad.net precise/main amd64 Packages Hit http://ppa.launchpad.net precise/main i386 Packages Hit http://ppa.launchpad.net precise/main amd64 Packages Hit http://ppa.launchpad.net precise/main i386 Packages Hit http://ppa.launchpad.net precise/main amd64 Packages Hit http://ppa.launchpad.net precise/main i386 Packages Hit http://ppa.launchpad.net precise/main amd64 Packages Hit http://ppa.launchpad.net precise/main i386 Packages Hit http://ppa.launchpad.net precise/main amd64 Packages Hit http://ppa.launchpad.net precise/main i386 Packages Hit http://ppa.launchpad.net precise/main amd64 Packages Hit http://ppa.launchpad.net precise/main i386 Packages Reading package lists... Hit http://downloads-distro.mongodb.org dist Release.gpg Hit http://downloads-distro.mongodb.org dist Release Hit http://downloads-distro.mongodb.org dist/10gen amd64 Packages Hit http://us.archive.ubuntu.com precise Release.gpg Hit http://us.archive.ubuntu.com precise-updates Release.gpg Hit http://us.archive.ubuntu.com precise-backports Release.gpg Get:1 http://toolbelt.heroku.com ./ Release.gpg [473 B] Hit http://downloads-distro.mongodb.org dist/10gen i386 Packages Hit http://us.archive.ubuntu.com precise Release Hit http://us.archive.ubuntu.com precise-updates Release Hit http://us.archive.ubuntu.com precise-backports Release Hit http://us.archive.ubuntu.com precise/main Sources Hit http://us.archive.ubuntu.com precise/restricted Sources Hit http://us.archive.ubuntu.com precise/universe Sources Hit http://us.archive.ubuntu.com precise/multiverse Sources Hit http://us.archive.ubuntu.com precise/main amd64 Packages Hit http://us.archive.ubuntu.com precise/restricted amd64 Packages Hit http://us.archive.ubuntu.com precise/universe amd64 Packages Hit http://us.archive.ubuntu.com precise/multiverse amd64 Packages Hit http://us.archive.ubuntu.com precise/main i386 Packages Hit http://us.archive.ubuntu.com precise/restricted i386 Packages Get:2 http://toolbelt.heroku.com ./ Release [1,609 B] Hit http://us.archive.ubuntu.com precise/universe i386 Packages Hit http://us.archive.ubuntu.com precise/multiverse i386 Packages Hit http://us.archive.ubuntu.com precise-updates/main Sources Hit http://us.archive.ubuntu.com precise-updates/restricted Sources Hit http://us.archive.ubuntu.com precise-updates/universe Sources Hit http://us.archive.ubuntu.com precise-updates/multiverse Sources Hit http://us.archive.ubuntu.com precise-updates/main amd64 Packages Hit http://us.archive.ubuntu.com precise-updates/restricted amd64 Packages Hit http://us.archive.ubuntu.com precise-updates/universe amd64 Packages Hit http://us.archive.ubuntu.com precise-updates/multiverse amd64 Packages Hit http://us.archive.ubuntu.com precise-updates/main i386 Packages Hit http://us.archive.ubuntu.com precise-updates/restricted i386 Packages Hit http://us.archive.ubuntu.com precise-updates/universe i386 Packages Hit http://us.archive.ubuntu.com precise-updates/multiverse i386 Packages Hit http://us.archive.ubuntu.com precise-backports/main Sources Hit http://us.archive.ubuntu.com precise-backports/restricted Sources Hit http://us.archive.ubuntu.com precise-backports/universe Sources Hit http://us.archive.ubuntu.com precise-backports/multiverse Sources Hit http://us.archive.ubuntu.com precise-backports/main amd64 Packages Hit http://us.archive.ubuntu.com precise-backports/restricted amd64 Packages Get:3 http://toolbelt.heroku.com ./ Packages [636 B] Hit http://security.ubuntu.com precise-security Release.gpg Hit http://ppa.launchpad.net precise Release.gpg Hit http://ppa.launchpad.net precise Release.gpg Hit http://ppa.launchpad.net precise Release.gpg Hit http://ppa.launchpad.net precise Release.gpg Hit http://ppa.launchpad.net precise Release.gpg Hit http://ppa.launchpad.net precise Release.gpg Hit http://us.archive.ubuntu.com precise-backports/universe amd64 Packages Hit http://us.archive.ubuntu.com precise-backports/multiverse amd64 Packages Hit http://us.archive.ubuntu.com precise-backports/main i386 Packages Hit http://us.archive.ubuntu.com precise-backports/restricted i386 Packages Hit http://us.archive.ubuntu.com precise-backports/universe i386 Packages Hit http://us.archive.ubuntu.com precise-backports/multiverse i386 Packages Hit http://security.ubuntu.com precise-security Release Hit http://ppa.launchpad.net precise Release Hit http://ppa.launchpad.net precise Release Hit http://ppa.launchpad.net precise Release Hit http://apt.postgresql.org precise-pgdg Release.gpg Hit http://ppa.launchpad.net precise Release Hit http://ppa.launchpad.net precise Release Hit http://security.ubuntu.com precise-security/main Sources Hit http://ppa.launchpad.net precise Release Hit http://ppa.launchpad.net precise/main amd64 Packages Hit http://ppa.launchpad.net precise/main i386 Packages Hit http://ppa.launchpad.net precise/main amd64 Packages Hit http://ppa.launchpad.net precise/main i386 Packages Hit http://ppa.launchpad.net precise/main amd64 Packages Hit http://security.ubuntu.com precise-security/restricted Sources Hit http://security.ubuntu.com precise-security/universe Sources Hit http://security.ubuntu.com precise-security/multiverse Sources Hit http://security.ubuntu.com precise-security/main amd64 Packages Hit http://security.ubuntu.com precise-security/restricted amd64 Packages Hit http://security.ubuntu.com precise-security/universe amd64 Packages Hit http://security.ubuntu.com precise-security/multiverse amd64 Packages Hit http://security.ubuntu.com precise-security/main i386 Packages Hit http://security.ubuntu.com precise-security/restricted i386 Packages Hit http://security.ubuntu.com precise-security/universe i386 Packages Hit http://ppa.launchpad.net precise/main i386 Packages Hit http://ppa.launchpad.net precise/main amd64 Packages Hit http://ppa.launchpad.net precise/main i386 Packages Hit http://ppa.launchpad.net precise/main amd64 Packages Hit http://ppa.launchpad.net precise/main i386 Packages Hit http://ppa.launchpad.net precise/main amd64 Packages Hit http://security.ubuntu.com precise-security/multiverse i386 Packages Hit http://ppa.launchpad.net precise/main i386 Packages Hit http://apt.postgresql.org precise-pgdg Release Hit http://apt.postgresql.org precise-pgdg/main amd64 Packages Hit http://apt.postgresql.org precise-pgdg/main i386 Packages Fetched 2,718 B in 3s (830 B/s) Reading package lists... The command "sudo -E apt-get -yq --no-install-suggests --no-install-recommends --force-yes install heroku-toolbelt" failed and exited with 100 during . Your build has been stopped. ``` --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index c46415228..eeb3709d2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,7 @@ env: - secure: xFS5oLPMGyT6N0LKwU7wllaEZEVLzE/D5HuD14q3Vfd4L369XpV6ORYJF/2mkf765m+LH1MaN09rJaKc00ZcQfQECMuzyWagLsr1bVKs+szta3G/nFjjVTwmoPX5kVw5q7e6TYvS/KAzo+n8u5pW+zu8MMTwnv40QI6LfcbZkTc= - secure: wd/FBYI9I37PJ+eXhO8vesvWELkklNgGRA1xo/tuA31+ACpY/jG5EjrHd+semsfDTxM8fZe3s0foIch+jeMTIOcGs98tDC/L/8b/h6i0Qic0DqkAk6B30fT+5Nl3dufjiXsBJg5xj1zYqW6ka3DKIDjnn+3ao2cme05MtDQBHdc= sudo: false +dist: trusty addons: apt: sources: From 93426f96e7c09b1c99fa86709e86ad2a10487338 Mon Sep 17 00:00:00 2001 From: schneems Date: Fri, 16 Jun 2017 16:23:56 -0500 Subject: [PATCH 0383/1195] Update `heroku_hatchet` to use V3 of the API V2 of the Heroku API is being deprecated. Hatchet 3.0.0 uses V3 of the Heroku API. --- Gemfile.lock | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index d5ccf27ec..69b5db238 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -21,27 +21,27 @@ GEM domain_name (0.5.20170404) unf (>= 0.0.5, < 1.0.0) erubis (2.7.0) - excon (0.55.0) - heroics (0.0.21) + excon (0.57.0) + heroics (0.0.22) erubis (~> 2.0) excon multi_json (>= 1.9.2) heroku-api (0.4.2) excon (~> 0.45) multi_json (~> 1.8) - heroku_hatchet (2.0.3) + heroku_hatchet (3.0.0) activesupport (~> 4) anvil-cli (~> 0) excon (~> 0) heroku-api (~> 0) - platform-api (~> 1) + platform-api (~> 2) repl_runner (~> 0.0.3) rrrretry (~> 1) thor (~> 0) threaded (~> 0) http-cookie (1.0.3) domain_name (~> 0.5) - i18n (0.8.1) + i18n (0.8.4) json (2.0.4) mime-types (2.99.3) minitest (5.10.2) @@ -51,8 +51,8 @@ GEM parallel (1.11.2) parallel_tests (2.14.1) parallel - platform-api (1.0.1) - heroics (~> 0.0.21) + platform-api (2.0.0) + heroics (~> 0.0.22) moneta (~> 0.8.1) progress (2.4.0) rake (12.0.0) @@ -96,4 +96,4 @@ DEPENDENCIES rspec-retry BUNDLED WITH - 1.14.6 + 1.15.1 From 75bf917032e883a76c9ff90ff10d19ff18838848 Mon Sep 17 00:00:00 2001 From: schneems Date: Fri, 16 Jun 2017 16:42:07 -0500 Subject: [PATCH 0384/1195] Remove `app.heroku` call from JVM --- Gemfile | 2 +- spec/hatchet/jvm_spec.rb | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/Gemfile b/Gemfile index 270070c44..d2d15447b 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ source "https://rubygems.org" group :development, :test do - gem "heroku_hatchet" + gem "heroku_hatchet", github: "heroku/hatchet", branch: "schneems/enhance" gem "rspec-core" gem "rspec-expectations" gem "excon" diff --git a/spec/hatchet/jvm_spec.rb b/spec/hatchet/jvm_spec.rb index 08d53defe..981d9f56e 100644 --- a/spec/hatchet/jvm_spec.rb +++ b/spec/hatchet/jvm_spec.rb @@ -2,13 +2,10 @@ describe "JvmInstaller" do it "JVM is installed by jvm-common only" do - app = Hatchet::Runner.new("ruby_193_jruby_17161") + buildpacks = ["https://github.com/heroku/heroku-buildpack-jvm-common", + Hatchet::App.default_buildpack] # default is heroku-ruby-buildpack here + app = Hatchet::Runner.new("ruby_193_jruby_17161", stack: 'cedar-14', buildpacks: buildpacks) app.setup! - app.heroku.put_stack(app.name, 'cedar-14') - - bp = app.heroku.get_config_vars(app.name).body["BUILDPACK_URL"] - app.heroku.delete_config_var(app.name, "BUILDPACK_URL") - app.heroku.put_buildpacks(app.name, ["https://github.com/heroku/heroku-buildpack-jvm-common", bp]) app.deploy do |app| expect(app.output).to match("Using pre-installed JDK") From dbe27c7e3b1467b4fd5eaa3e01c182755035731d Mon Sep 17 00:00:00 2001 From: schneems Date: Fri, 16 Jun 2017 16:49:24 -0500 Subject: [PATCH 0385/1195] Remove heroku API calls --- Gemfile.lock | 28 +++++++++++++++++----------- spec/hatchet/rails23_spec.rb | 3 +-- spec/hatchet/rails3_spec.rb | 3 +-- spec/hatchet/rubies_spec.rb | 18 ++++++------------ spec/hatchet/stack_spec.rb | 10 ++++------ 5 files changed, 29 insertions(+), 33 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 69b5db238..eb3c376d8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,3 +1,19 @@ +GIT + remote: git://github.com/heroku/hatchet.git + revision: 6bfbf1e55ab31f6395a073f3ee92a53dae389236 + branch: schneems/enhance + specs: + heroku_hatchet (3.0.0) + activesupport (~> 4) + anvil-cli (~> 0) + excon (~> 0) + heroku-api (~> 0) + platform-api (~> 2) + repl_runner (~> 0.0.3) + rrrretry (~> 1) + thor (~> 0) + threaded (~> 0) + GIT remote: git://github.com/hone/ruby-git.git revision: 264836fcff3c037d8d8fc44bd770b150b46fdc4e @@ -29,16 +45,6 @@ GEM heroku-api (0.4.2) excon (~> 0.45) multi_json (~> 1.8) - heroku_hatchet (3.0.0) - activesupport (~> 4) - anvil-cli (~> 0) - excon (~> 0) - heroku-api (~> 0) - platform-api (~> 2) - repl_runner (~> 0.0.3) - rrrretry (~> 1) - thor (~> 0) - threaded (~> 0) http-cookie (1.0.3) domain_name (~> 0.5) i18n (0.8.4) @@ -86,7 +92,7 @@ PLATFORMS DEPENDENCIES excon git! - heroku_hatchet + heroku_hatchet! json (~> 2.0.2) netrc parallel_tests diff --git a/spec/hatchet/rails23_spec.rb b/spec/hatchet/rails23_spec.rb index 483fe46d3..10fdce199 100644 --- a/spec/hatchet/rails23_spec.rb +++ b/spec/hatchet/rails23_spec.rb @@ -2,8 +2,7 @@ describe "Rails 2.3.x" do it "should deploy on ruby 1.9.3 on cedar-14" do - app = Hatchet::Runner.new('rails23_mri_193').setup! - app.heroku.put_stack(app.name, "cedar-14") + app = Hatchet::Runner.new('rails23_mri_193', stack: "cedar-14").setup! app.deploy do |app, heroku| # assert deploy is successful end diff --git a/spec/hatchet/rails3_spec.rb b/spec/hatchet/rails3_spec.rb index b1055bdda..003dd68e5 100644 --- a/spec/hatchet/rails3_spec.rb +++ b/spec/hatchet/rails3_spec.rb @@ -2,9 +2,8 @@ describe "Rails 3.x" do it "should deploy on ruby 1.9.3" do - app = Hatchet::Runner.new("rails3_mri_193") + app = Hatchet::Runner.new("rails3_mri_193", stack: "cedar-14") app.setup! - app.heroku.put_stack(app.name, "cedar-14") app.deploy do |app, heroku| expect(app.output).to include("Asset precompilation completed") diff --git a/spec/hatchet/rubies_spec.rb b/spec/hatchet/rubies_spec.rb index c7ae868c2..793d4ad4d 100644 --- a/spec/hatchet/rubies_spec.rb +++ b/spec/hatchet/rubies_spec.rb @@ -2,9 +2,8 @@ describe "Ruby Versions on cedar-14" do it "should allow patchlevels" do - app = Hatchet::Runner.new('mri_193_p547') + app = Hatchet::Runner.new('mri_193_p547', stack: "cedar-14") app.setup! - app.heroku.put_stack(app.name, "cedar-14") app.deploy do |app| version = '1.9.3p547' expect(app.output).to match("ruby-1.9.3-p547") @@ -13,9 +12,8 @@ end it "should deploy ruby 1.9.2 properly" do - app = Hatchet::Runner.new('mri_192') + app = Hatchet::Runner.new('mri_192', stack: "cedar-14") app.setup! - app.heroku.put_stack(app.name, "cedar-14") app.deploy do |app| version = '1.9.2' expect(app.output).to match(version) @@ -24,9 +22,8 @@ end it "should deploy ruby 1.9.3 properly" do - app = Hatchet::Runner.new('mri_193') + app = Hatchet::Runner.new('mri_193', stack: "cedar-14") app.setup! - app.heroku.put_stack(app.name, "cedar-14") app.deploy do |app| version = '1.9.3' expect(app.output).to match(version) @@ -35,9 +32,8 @@ end it "should deploy ruby 2.0.0 properly" do - app = Hatchet::Runner.new('mri_200') + app = Hatchet::Runner.new('mri_200', stack: "cedar-14") app.setup! - app.heroku.put_stack(app.name, "cedar-14") app.deploy do |app| version = '2.0.0' expect(app.output).to match(version) @@ -48,9 +44,8 @@ end it "should deploy jdk 8 on cedar-14 by default" do - app = Hatchet::Runner.new("ruby_193_jruby_17161") + app = Hatchet::Runner.new("ruby_193_jruby_17161", stack: "cedar-14") app.setup! - app.heroku.put_stack(app.name, 'cedar-14') app.deploy do |app| expect(app.output).to match("Installing JVM: openjdk-8") expect(app.output).to match("JRUBY_OPTS is: -Xcompile.invokedynamic=false") @@ -66,9 +61,8 @@ end it "should deploy jruby 1.7.16.1 (jdk 7) properly on cedar-14 with sys props file" do - app = Hatchet::Runner.new("ruby_193_jruby_17161_jdk7") + app = Hatchet::Runner.new("ruby_193_jruby_17161_jdk7", stack: "cedar-14") app.setup! - app.heroku.put_stack(app.name, 'cedar-14') app.deploy do |app| expect(app.output).to match("Installing JVM: openjdk-7") expect(app.output).not_to include("OpenJDK 64-Bit Server VM warning") diff --git a/spec/hatchet/stack_spec.rb b/spec/hatchet/stack_spec.rb index 6fd731a96..aca57790d 100644 --- a/spec/hatchet/stack_spec.rb +++ b/spec/hatchet/stack_spec.rb @@ -2,10 +2,9 @@ describe "Stack Changes" do xit "should reinstall gems on stack change" do - app = Hatchet::Runner.new('default_ruby').setup! - app.heroku.put_stack(app.name, "heroku-16") + app = Hatchet::Runner.new('default_ruby', stack: "heroku-16").setup! app.deploy do |app, heroku| - heroku.put_stack(app.name, "cedar-14") + app.update_stack("cedar-14") `git commit --allow-empty -m "cedar-14 migrate"` app.push! @@ -16,10 +15,9 @@ end it "should not reinstall gems if the stack did not change" do - app = Hatchet::Runner.new('default_ruby').setup! - app.heroku.put_stack(app.name, "cedar-14") + app = Hatchet::Runner.new('default_ruby', stack: "cedar-14").setup! app.deploy do |app, heroku| - heroku.put_stack(app.name, "cedar-14") + app.update_stack("cedar-14") `git commit --allow-empty -m "cedar migrate"` app.push! From 74f8beed835b014fd4b9e6e98ea1e3171693cd30 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 19 Jun 2017 10:17:02 -0500 Subject: [PATCH 0386/1195] Use released version of Hatchet 3. --- Gemfile | 2 +- Gemfile.lock | 28 +++++++++++----------------- 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/Gemfile b/Gemfile index d2d15447b..eaec7ed7b 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ source "https://rubygems.org" group :development, :test do - gem "heroku_hatchet", github: "heroku/hatchet", branch: "schneems/enhance" + gem "heroku_hatchet", "~>3.0.1" gem "rspec-core" gem "rspec-expectations" gem "excon" diff --git a/Gemfile.lock b/Gemfile.lock index eb3c376d8..fd2c367e8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,19 +1,3 @@ -GIT - remote: git://github.com/heroku/hatchet.git - revision: 6bfbf1e55ab31f6395a073f3ee92a53dae389236 - branch: schneems/enhance - specs: - heroku_hatchet (3.0.0) - activesupport (~> 4) - anvil-cli (~> 0) - excon (~> 0) - heroku-api (~> 0) - platform-api (~> 2) - repl_runner (~> 0.0.3) - rrrretry (~> 1) - thor (~> 0) - threaded (~> 0) - GIT remote: git://github.com/hone/ruby-git.git revision: 264836fcff3c037d8d8fc44bd770b150b46fdc4e @@ -45,6 +29,16 @@ GEM heroku-api (0.4.2) excon (~> 0.45) multi_json (~> 1.8) + heroku_hatchet (3.0.1) + activesupport (~> 4) + anvil-cli (~> 0) + excon (~> 0) + heroku-api (~> 0) + platform-api (~> 2) + repl_runner (~> 0.0.3) + rrrretry (~> 1) + thor (~> 0) + threaded (~> 0) http-cookie (1.0.3) domain_name (~> 0.5) i18n (0.8.4) @@ -92,7 +86,7 @@ PLATFORMS DEPENDENCIES excon git! - heroku_hatchet! + heroku_hatchet (~> 3.0.1) json (~> 2.0.2) netrc parallel_tests From c343b058d3851090ef3d8443ab074176d382705c Mon Sep 17 00:00:00 2001 From: Caleb Thompson Date: Wed, 21 Jun 2017 10:54:32 -0500 Subject: [PATCH 0387/1195] Add v164 CHANGELOG --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d906f7115..164b04a4f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Master +## v164 (06/21/2017) + +* Update Bundler to 1.15.1 (#579) + ## v163 (05/22/2017) * Fix CI rake tasks not running (#571) From 3ac68e86e803608b0b037518949460388440edd3 Mon Sep 17 00:00:00 2001 From: Caleb Thompson Date: Wed, 21 Jun 2017 10:55:18 -0500 Subject: [PATCH 0388/1195] heroku-buildpack-ruby v164 --- lib/language_pack/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 4aebbffe7..d02ab8853 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v163" + BUILDPACK_VERSION = "v164" end end From b84e73b7801c565d20ccd77aea4826357211e3d3 Mon Sep 17 00:00:00 2001 From: Joe Kutner Date: Tue, 27 Jun 2017 10:45:57 -0500 Subject: [PATCH 0389/1195] Set JAVA_HOME env var for JRuby apps --- lib/language_pack/helpers/jvm_installer.rb | 16 +++++++++++++++- lib/language_pack/ruby.rb | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/language_pack/helpers/jvm_installer.rb b/lib/language_pack/helpers/jvm_installer.rb index 2817d4fbb..fa71c5a1b 100644 --- a/lib/language_pack/helpers/jvm_installer.rb +++ b/lib/language_pack/helpers/jvm_installer.rb @@ -14,6 +14,8 @@ class LanguagePack::Helpers::JvmInstaller PG_CONFIG_JAR = "pgconfig.jar" + PREINSTALLED_JDK_DIR = ".jdk" + def initialize(slug_vendor_jvm, stack) @vendor_dir = slug_vendor_jvm @stack = stack @@ -21,6 +23,18 @@ def initialize(slug_vendor_jvm, stack) @pg_config_jar_fetcher = LanguagePack::Fetcher.new(JVM_BUCKET) end + def java_home + if preinstalled_jdk? + PREINSTALLED_JDK_DIR + else + @vendor_dir + end + end + + def preinstalled_jdk? + Dir.exist?(PREINSTALLED_JDK_DIR) + end + def system_properties props = {} File.read(SYS_PROPS_FILE).split("\n").each do |line| @@ -32,7 +46,7 @@ def system_properties end def install(jruby_version, forced = false) - if Dir.exist?(".jdk") + if preinstalled_jdk? topic "Using pre-installed JDK" return end diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 114d8a59f..4ccb4e9b0 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -290,6 +290,7 @@ def setup_language_pack_environment echo #{default_java_mem} SHELL ENV["JRUBY_OPTS"] = env('JRUBY_BUILD_OPTS') || env('JRUBY_OPTS') + ENV["JAVA_HOME"] = @jvm_installer.java_home end setup_ruby_install_env ENV["PATH"] += ":#{node_preinstall_bin_path}" if node_js_installed? From c4176b81dc6ba4a673ca6e30825cc4ec24d9f49e Mon Sep 17 00:00:00 2001 From: Caleb Thompson Date: Tue, 11 Jul 2017 15:52:25 -0500 Subject: [PATCH 0390/1195] Update Node to 6.11.1 https://nodejs.org/en/blog/vulnerability/july-2017-security-releases/ Fix CVE-2017-1000381 - c-ares NAPTR parser out of bounds access Fix #597 --- lib/language_pack/helpers/nodebin.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/helpers/nodebin.rb b/lib/language_pack/helpers/nodebin.rb index f3a3b269c..c20b725c0 100644 --- a/lib/language_pack/helpers/nodebin.rb +++ b/lib/language_pack/helpers/nodebin.rb @@ -11,7 +11,7 @@ def self.query(q) end def self.hardcoded_node_lts - version = "6.10.0" + version = "6.11.1" { "number" => version, "url" => "https://s3pository.heroku.com/node/v#{version}/node-v#{version}-linux-x64.tar.gz" From 900586d7925468f54dd283a2f06dbe0ca826b159 Mon Sep 17 00:00:00 2001 From: Caleb Thompson Date: Tue, 11 Jul 2017 16:32:31 -0500 Subject: [PATCH 0391/1195] Add CHANGELOG v165 --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 164b04a4f..42e8682da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ ## Master +## v165 (07/11/2017) + +* Set `$JAVA_HOME` for JRuby apps during build (#593) +* Update Node to 6.11.1 (#598) + ## v164 (06/21/2017) * Update Bundler to 1.15.1 (#579) From c0bcd2f36789c7a23e8d0e3a5c30082f48f97ec9 Mon Sep 17 00:00:00 2001 From: Caleb Thompson Date: Tue, 11 Jul 2017 16:26:57 -0500 Subject: [PATCH 0392/1195] [CI Skip] heroku-buildpack-ruby v165 - Increase Node version to 6.11.1 - Set the `JAVA_HOME` environment variable at build time, which enables the use of Rake tasks like `JBundler`. --- lib/language_pack/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index d02ab8853..f16cac1b2 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v164" + BUILDPACK_VERSION = "v165" end end From df81a3d6473372393a1e45040d9ed56b726dc882 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Tue, 11 Jul 2017 16:01:50 -0600 Subject: [PATCH 0393/1195] bump to v166 --- lib/language_pack/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index f16cac1b2..7f89a6c4f 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v165" + BUILDPACK_VERSION = "v166" end end From ff7fa3aba0f943f99849ac761e4c2f9bb12e7c83 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Tue, 11 Jul 2017 16:25:09 -0600 Subject: [PATCH 0394/1195] update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 42e8682da..c5853c1b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Master +## v166 (07/11/2017) + +* no changes from v165 + ## v165 (07/11/2017) * Set `$JAVA_HOME` for JRuby apps during build (#593) From b9d32c51292796e724f9bcc0dd38a6607027cf07 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 17 Jul 2017 14:29:01 -0500 Subject: [PATCH 0395/1195] Bundler 1.15.2 Includes this fix https://github.com/bundler/bundler/pull/5707. --- lib/language_pack/ruby.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 4ccb4e9b0..400f1eaa6 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -16,7 +16,7 @@ class LanguagePack::Ruby < LanguagePack::Base NAME = "ruby" LIBYAML_VERSION = "0.1.7" LIBYAML_PATH = "libyaml-#{LIBYAML_VERSION}" - BUNDLER_VERSION = "1.15.1" + BUNDLER_VERSION = "1.15.2" BUNDLER_GEM_PATH = "bundler-#{BUNDLER_VERSION}" RBX_BASE_URL = "http://binaries.rubini.us/heroku" NODE_BP_PATH = "vendor/node/bin" From e5f5379bdc498eec4fa96b206927212214bbdc47 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 17 Jul 2017 17:09:33 -0500 Subject: [PATCH 0396/1195] Changelog. --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c5853c1b0..b89a7dcf0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Master +* Update Bundler to 1.15.1 (#602) + ## v166 (07/11/2017) * no changes from v165 From 0357bd39f9d788db4c0e0d7bf1966d84c4da4821 Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Wed, 21 Jun 2017 00:53:29 +0100 Subject: [PATCH 0397/1195] Use HTTPS for interactions with GitHub and S3 Fixes #589. --- Rakefile | 6 +++--- support/s3/s3 | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Rakefile b/Rakefile index 35444ee63..05f935185 100644 --- a/Rakefile +++ b/Rakefile @@ -58,9 +58,9 @@ end desc "update plugins" task "plugins:update" do - vendor_plugin "http://github.com/heroku/rails_log_stdout.git", "legacy" - vendor_plugin "http://github.com/pedro/rails3_serve_static_assets.git" - vendor_plugin "http://github.com/hone/rails31_enable_runtime_asset_compilation.git" + vendor_plugin "https://github.com/heroku/rails_log_stdout.git", "legacy" + vendor_plugin "https://github.com/pedro/rails3_serve_static_assets.git" + vendor_plugin "https://github.com/hone/rails31_enable_runtime_asset_compilation.git" end desc "install vendored gem" diff --git a/support/s3/s3 b/support/s3/s3 index d5cf94d2a..2b2583e3a 100755 --- a/support/s3/s3 +++ b/support/s3/s3 @@ -151,7 +151,7 @@ s3_curl() { headers[${#headers[@]}]="Date: ${date}" [[ ${md5} ]] && headers[${#headers[@]}]="Content-MD5: ${md5}" curl ${arg} "${inout}" ${stdopts} -o - -K <(curl_headers "${headers[@]}") \ - "http://s3.amazonaws.com${bucket}${remote}" + "https://s3.amazonaws.com${bucket}${remote}" return $? } From 8b802ab38fe418815b7cf028ef56bdf40a54fafd Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 20 Jul 2017 14:18:43 -0500 Subject: [PATCH 0398/1195] Skip Bundler version check There is an issue in Bundler 1.15.1 that was exposed when Bundler 1.15.2 was released. Bundler now checks rubygems.org on all `bundle` commands and checks to see if a newer version of `bundler` has been released and if it is newer than the one currently in use it will emit a warning. Ruby parses the output of `bundle platform --ruby` from bundler and in some cases this causes failures because it gets extra output. This is an issue for Heroku ruby users who are using 2 ruby buildpacks by mistakes. - heroku/ruby - https://github.com/heroku/heroku-buildpack-ruby The bundler version check adds a tiny bit of performance overhead. We can avoid the performance overhead and any build failures by skipping this check on installs. More info in https://github.com/bundler/bundler/pull/5884 --- lib/language_pack/helpers/bundler_wrapper.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index ab0baaee9..218230b26 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -90,7 +90,8 @@ def ruby_version instrument 'detect_ruby_version' do env = { "PATH" => "#{bundler_path}/bin:#{ENV['PATH']}", "RUBYLIB" => File.join(bundler_path, "gems", BUNDLER_DIR_NAME, "lib"), - "GEM_PATH" => "#{bundler_path}:#{ENV["GEM_PATH"]}" + "GEM_PATH" => "#{bundler_path}:#{ENV["GEM_PATH"]}", + "BUNDLE_DISABLE_VERSION_CHECK" => "true" } command = "bundle platform --ruby" From 74dd4782dbcb2396aa254bd7fb9973ed9071f772 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 25 Jul 2017 11:12:46 -0500 Subject: [PATCH 0399/1195] v167 --- CHANGELOG.md | 4 +++- lib/language_pack/version.rb | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b89a7dcf0..447991802 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ ## Master -* Update Bundler to 1.15.1 (#602) +## v167 (07/25/2016) + +* Update Bundler to 1.15.2 (#602) ## v166 (07/11/2017) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 7f89a6c4f..9465b6a2e 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v166" + BUILDPACK_VERSION = "v167" end end From 68e9d32d55d0c0001169a183d95b1d55909a2b92 Mon Sep 17 00:00:00 2001 From: Caleb Thompson Date: Tue, 20 Jun 2017 13:40:20 -0500 Subject: [PATCH 0400/1195] Retry failed downloads for untar On occasion, S3 drops connections or cURL fails for other reasons. It can happen that cURL's inbuilt retry behavior also fails for these dropped connections. If downloads fail, retry three times and notify in log for each retry. This is different than the retry behavior in the `curl` command (5 retries, 1s delay, 3s connect timeout, 30s total timeout) also implements, which are used for what cURL considers "temporary" problems. These [problems] include the operation timing out, failure to resolve host/proxy, or FTP timeouts. We'd like to get additional behavior for other failure reasons so we retry the full command. [problems]: --- lib/language_pack/fetcher.rb | 4 ++- lib/language_pack/shell_helpers.rb | 23 ++++++++++---- spec/helpers/shell_spec.rb | 49 +++++++++++++++++++++--------- 3 files changed, 55 insertions(+), 21 deletions(-) diff --git a/lib/language_pack/fetcher.rb b/lib/language_pack/fetcher.rb index 56daf5951..c4415dacb 100644 --- a/lib/language_pack/fetcher.rb +++ b/lib/language_pack/fetcher.rb @@ -21,7 +21,9 @@ def fetch(path) def fetch_untar(path, files_to_extract = nil) curl = curl_command("#{@host_url.join(path)} -s -o") - run!("#{curl} - | tar zxf - #{files_to_extract}", error_class: FetchError) + run! "#{curl} - | tar zxf - #{files_to_extract}", + error_class: FetchError, + max_attempts: 3 end def fetch_bunzip2(path, files_to_extract = nil) diff --git a/lib/language_pack/shell_helpers.rb b/lib/language_pack/shell_helpers.rb index 13f376605..313081891 100644 --- a/lib/language_pack/shell_helpers.rb +++ b/lib/language_pack/shell_helpers.rb @@ -41,14 +41,25 @@ def self.initialize_env(path) end end + # run a shell command (deferring to #run), and raise an error if it fails + # @param [String] command to be run + # @return [String] result of #run + # @option options [Error] :error_class Class of error to raise, defaults to Standard Error + # @option options [Integer] :max_attempts Number of times to attempt command before raising def run!(command, options = {}) - result = run(command, options) - error_class = options.delete(:error_class) || StandardError - unless $?.success? - message = "Command: '#{command}' failed unexpectedly:\n#{result}" - raise error_class, message + max_attempts = options[:max_attempts] || 1 + error_class = options[:error_class] || StandardError + max_attempts.times do |attempt_number| + result = run(command, options) + if $?.success? + return result + end + if attempt_number == max_attempts - 1 + raise error_class, "Command: '#{command}' failed unexpectedly:\n#{result}" + else + puts "Command: '#{command}' failed on attempt #{attempt_number + 1} of #{max_attempts}." + end end - return result end # doesn't do any special piping. stderr won't be redirected. diff --git a/spec/helpers/shell_spec.rb b/spec/helpers/shell_spec.rb index 3f1591d97..812ce0e51 100644 --- a/spec/helpers/shell_spec.rb +++ b/spec/helpers/shell_spec.rb @@ -1,23 +1,44 @@ require 'spec_helper' +describe "ShellHelpers" do + module RecordPuts + attr_reader :puts_calls + def puts(*args) + @puts_calls ||= [] + @puts_calls << args + end + end -class FakeShell - include LanguagePack::ShellHelpers -end + class FakeShell + include RecordPuts + include LanguagePack::ShellHelpers + end + describe "#command_options_to_string" do + it "formats ugly keys correctly" do + env = {%Q{ un"matched } => "bad key"} + result = FakeShell.new.command_options_to_string("bundle install", env: env) + expected = %r{env \\ un\\\"matched\\ =bad\\ key bash -c bundle\\ install 2>&1} + expect(result.strip).to match(expected) + end -describe "ShellHelpers" do - it "format ugly keys correctly" do - env = {%Q{ un"matched } => "bad key"} - result = FakeShell.new.command_options_to_string("bundle install", env: env) - expected = %r{env \\ un\\\"matched\\ =bad\\ key bash -c bundle\\ install 2>&1} - expect(result.strip).to match(expected) + it "formats ugly values correctly" do + env = {"BAD VALUE" => %Q{ )(*&^%$#'$'\n''@!~\'\ }} + result = FakeShell.new.command_options_to_string("bundle install", env: env) + expected = %r{env BAD\\ VALUE=\\ \\\)\\\(\\\*\\&\\\^\\%\\\$\\#\\'\\\$\\''\n'\\'\\'@\\!\\~\\'\\ bash -c bundle\\ install 2>&1} + expect(result.strip).to match(expected) + end end - it "formats ugly values correctly" do - env = {"BAD VALUE" => %Q{ )(*&^%$#'$'\n''@!~\'\ }} - result = FakeShell.new.command_options_to_string("bundle install", env: env) - expected = %r{env BAD\\ VALUE=\\ \\\)\\\(\\\*\\&\\\^\\%\\\$\\#\\'\\\$\\''\n'\\'\\'@\\!\\~\\'\\ bash -c bundle\\ install 2>&1} - expect(result.strip).to match(expected) + describe "#run!" do + it "retries failed commands when passed max_attempts: > 1" do + sh = FakeShell.new + expect { sh.run!("false", max_attempts: 3) }.to raise_error(StandardError) + + expect(sh.puts_calls).to eq([ + [" Command: 'false' failed on attempt 1 of 3."], + [" Command: 'false' failed on attempt 2 of 3."], + ]) + end end end From 17f6aac18d3bdeb6b721c74e1b080107f8f7e351 Mon Sep 17 00:00:00 2001 From: Paul Kuruvilla Date: Fri, 28 Jul 2017 19:05:52 +0530 Subject: [PATCH 0401/1195] Update comment in bin/compile The file `bin/ruby_compile` was moved to `bin/support/ruby_compile` --- bin/compile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/compile b/bin/compile index f02fb5129..0dcf523ae 100755 --- a/bin/compile +++ b/bin/compile @@ -1,6 +1,6 @@ #!/bin/bash -# The actual `bin/compile` code lives in `bin/ruby_compile`. This file instead -# bootstraps the ruby needed and then executes `bin/ruby_compile` +# The actual `bin/compile` code lives in `bin/support/ruby_compile`. This file +# instead bootstraps the ruby needed and then executes `bin/support/ruby_compile` BIN_DIR=$(cd $(dirname $0); pwd) BUILDPACK_DIR=$(dirname $BIN_DIR) From 1063d3c22c87d9a7059600501fc3e1ee0dc981f7 Mon Sep 17 00:00:00 2001 From: Titus Ramczykowski Date: Mon, 31 Jul 2017 11:36:46 +0200 Subject: [PATCH 0402/1195] fix typo in bin/support/ruby_compile verison -> version --- bin/support/ruby_compile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/support/ruby_compile b/bin/support/ruby_compile index 949fc1500..2ab37427d 100755 --- a/bin/support/ruby_compile +++ b/bin/support/ruby_compile @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # This script compiles an application so it can run on Heroku. -# It will install the application's specified verison of Ruby, it's dependencies +# It will install the application's specified version of Ruby, it's dependencies # and certain framework specific requirements (such as calling `rake assets:precompile` # for rails apps). You can see all features described in the devcenter # https://devcenter.heroku.com/articles/ruby-support From a6e69990c19226c0b613ccd04cc2bc00a7aa7c3f Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Mon, 31 Jul 2017 18:41:24 -0500 Subject: [PATCH 0403/1195] install node when using execjs OR webpacker --- hatchet.json | 3 +++ lib/language_pack/ruby.rb | 6 +++++- spec/hatchet/node_spec.rb | 8 +++++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/hatchet.json b/hatchet.json index 6bfa0a231..349a05794 100644 --- a/hatchet.json +++ b/hatchet.json @@ -74,6 +74,9 @@ "multibuildpack": [ "sharpstone/node_multi" ], + "node": [ + "sharpstone/webpacker_no_execjs" + ], "ci": [ "sharpstone/rails5_ruby_schema_format", "sharpstone/heroku-ci-json-example", diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 400f1eaa6..7837ed032 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -800,7 +800,11 @@ def pg_adapters # @note execjs will blow up if no JS RUNTIME is detected and is loaded. # @return [Array] the node.js binary path if we need it or an empty Array def add_node_js_binary - bundler.has_gem?('execjs') && node_not_preinstalled? ? [@node_installer.binary_path] : [] + if (bundler.has_gem?('execjs') || bundler.has_gem?('webpacker')) && node_not_preinstalled? + [@node_installer.binary_path] + else + [] + end end def add_yarn_binary diff --git a/spec/hatchet/node_spec.rb b/spec/hatchet/node_spec.rb index 8766538d1..937eec1b2 100644 --- a/spec/hatchet/node_spec.rb +++ b/spec/hatchet/node_spec.rb @@ -16,10 +16,16 @@ end end - it "doesn't install node without exec JS" do + it "doesn't install node without execjs or webpacker" do Hatchet::Runner.new("default_ruby").deploy do |app| expect(app.run("node -v")).to match("node: command not found") end end + + it "installs node when webpacker is detected but no execjs" do + Hatchet::Runner.new("webpacker_no_execjs").deploy do |app| + expect(app.output).to match("Installing node-v") + end + end end From 70ed87d93bee8148901856c989a89e0071ca707f Mon Sep 17 00:00:00 2001 From: Caleb Thompson Date: Mon, 14 Aug 2017 10:18:02 -0500 Subject: [PATCH 0404/1195] v168 --- .travis.yml | 2 -- CHANGELOG.md | 6 +++++- Gemfile | 2 +- Gemfile.lock | 32 ++++++++++++++++---------------- circle.yml | 2 -- lib/language_pack/version.rb | 2 +- 6 files changed, 23 insertions(+), 23 deletions(-) diff --git a/.travis.yml b/.travis.yml index eeb3709d2..645402868 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,8 +3,6 @@ rvm: - 2.4.1 before_script: bundle exec rake hatchet:setup_travis script: bundle exec parallel_rspec -n 11 spec/ -after_script: -- heroku keys:remove $USER@`hostname` env: global: - HATCHET_RETRIES=3 diff --git a/CHANGELOG.md b/CHANGELOG.md index 447991802..fc4dc6add 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ -## Master +## v168 (08/14/2017) + +* Install Node when using either ExecJS _or_ Webpacker (#608) +* Make installs more robust against temporary network issues by retrying failed + downloads in `LanguagePack::Fetcher#fetch_untar`, which installs Rubies (#585) ## v167 (07/25/2016) diff --git a/Gemfile b/Gemfile index eaec7ed7b..270070c44 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ source "https://rubygems.org" group :development, :test do - gem "heroku_hatchet", "~>3.0.1" + gem "heroku_hatchet" gem "rspec-core" gem "rspec-expectations" gem "excon" diff --git a/Gemfile.lock b/Gemfile.lock index fd2c367e8..f8693a0ff 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -8,32 +8,30 @@ GIT GEM remote: https://rubygems.org/ specs: - activesupport (4.2.8) + activesupport (5.1.3) + concurrent-ruby (~> 1.0, >= 1.0.2) i18n (~> 0.7) minitest (~> 5.1) - thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) anvil-cli (0.16.2) progress (~> 2.4, >= 2.4.0) rest-client (~> 1.6, >= 1.6.7) thor (~> 0.15, >= 0.15.2) + concurrent-ruby (1.0.5) diff-lcs (1.3) domain_name (0.5.20170404) unf (>= 0.0.5, < 1.0.0) erubis (2.7.0) - excon (0.57.0) - heroics (0.0.22) + excon (0.58.0) + heroics (0.0.23) erubis (~> 2.0) excon multi_json (>= 1.9.2) - heroku-api (0.4.2) - excon (~> 0.45) - multi_json (~> 1.8) - heroku_hatchet (3.0.1) - activesupport (~> 4) + heroku_hatchet (3.0.3) + activesupport (~> 5) anvil-cli (~> 0) excon (~> 0) - heroku-api (~> 0) + minitest-retry (~> 0.1.9) platform-api (~> 2) repl_runner (~> 0.0.3) rrrretry (~> 1) @@ -41,18 +39,20 @@ GEM threaded (~> 0) http-cookie (1.0.3) domain_name (~> 0.5) - i18n (0.8.4) + i18n (0.8.6) json (2.0.4) mime-types (2.99.3) - minitest (5.10.2) + minitest (5.10.3) + minitest-retry (0.1.9) + minitest (>= 5.0) moneta (0.8.1) multi_json (1.12.1) netrc (0.11.0) parallel (1.11.2) parallel_tests (2.14.1) parallel - platform-api (2.0.0) - heroics (~> 0.0.22) + platform-api (2.1.0) + heroics (~> 0.0.23) moneta (~> 0.8.1) progress (2.4.0) rake (12.0.0) @@ -86,7 +86,7 @@ PLATFORMS DEPENDENCIES excon git! - heroku_hatchet (~> 3.0.1) + heroku_hatchet json (~> 2.0.2) netrc parallel_tests @@ -96,4 +96,4 @@ DEPENDENCIES rspec-retry BUNDLED WITH - 1.15.1 + 1.15.3 diff --git a/circle.yml b/circle.yml index 232bf722e..3119ab852 100644 --- a/circle.yml +++ b/circle.yml @@ -12,5 +12,3 @@ test: - bundle exec rake hatchet:setup_travis override: - bundle exec parallel_rspec -n 11 spec/ - post: - - heroku keys:remove $USER@`hostname` diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 9465b6a2e..fb9e6ae1a 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v167" + BUILDPACK_VERSION = "v168" end end From aa9a6c619a04b6fb657942cb3de499f1a85104af Mon Sep 17 00:00:00 2001 From: Joe Kutner Date: Mon, 14 Aug 2017 19:41:19 -0500 Subject: [PATCH 0405/1195] Added explicit case for JVM version 8 or 1.8 in system.properties --- lib/language_pack/helpers/jvm_installer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/helpers/jvm_installer.rb b/lib/language_pack/helpers/jvm_installer.rb index fa71c5a1b..f4d1ac71c 100644 --- a/lib/language_pack/helpers/jvm_installer.rb +++ b/lib/language_pack/helpers/jvm_installer.rb @@ -59,7 +59,7 @@ def install(jruby_version, forced = false) fetch_env_untar('JDK_URL_1_7') || fetch_untar(JVM_1_7_PATH, "openjdk-7") when "1.6", "6" fetch_env_untar('JDK_URL_1_6') || fetch_untar(JVM_1_6_PATH, "openjdk-6") - when nil + when "1.8", "8", nil if @stack == "cedar" if forced || Gem::Version.new(jruby_version) >= Gem::Version.new("1.7.4") fetch_untar(JVM_1_7_PATH, "openjdk-7") From 59131f90d9d8461be9edf2427c78bc7ed195e45c Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Tue, 15 Aug 2017 10:18:43 -0500 Subject: [PATCH 0406/1195] [close rails/webpacker#739] Upgrade Yarn to 1.0.2 --- CHANGELOG.md | 2 ++ lib/language_pack/helpers/nodebin.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fc4dc6add..b9fc50a5f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ * Make installs more robust against temporary network issues by retrying failed downloads in `LanguagePack::Fetcher#fetch_untar`, which installs Rubies (#585) +* Yarn version upgraded to v1.0.2 + ## v167 (07/25/2016) * Update Bundler to 1.15.2 (#602) diff --git a/lib/language_pack/helpers/nodebin.rb b/lib/language_pack/helpers/nodebin.rb index c20b725c0..199f53a47 100644 --- a/lib/language_pack/helpers/nodebin.rb +++ b/lib/language_pack/helpers/nodebin.rb @@ -19,7 +19,7 @@ def self.hardcoded_node_lts end def self.hardcoded_yarn - version = "0.22.0" + version = "1.0.2" { "number" => version, "url" => "https://yarnpkg.com/downloads/#{version}/yarn-v#{version}.tar.gz" From bdcd0cf62662c17305f6214dcf643989649ea4d5 Mon Sep 17 00:00:00 2001 From: Caleb Thompson Date: Tue, 20 Jun 2017 17:30:14 -0500 Subject: [PATCH 0407/1195] Warn if ruby/rails/bundle binstub shebangs are bad Binstubs, which RubyGems and Bundler generate to prepare the environment before dispatching calls to original executables, can sometimes include shebangs that worked on developer machines, but won't work on Heroku. Often, this is caused by ruby binaries being named other than `ruby` (or `ruby.exe` on Windows). While it can happen for any binstub, we're mostly concerned about `rake`, `rails`, and `bundler` stubs. Check each of these to see if they are `!#/usr/bin/env ruby` or `!#/usr/bin/env ruby.exe` and issue a warning if this is not the case. --- .../installers/heroku_ruby_installer.rb | 15 ++++++++ spec/installers/heroku_ruby_installer_spec.rb | 37 +++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/lib/language_pack/installers/heroku_ruby_installer.rb b/lib/language_pack/installers/heroku_ruby_installer.rb index c752be37e..aff7c230e 100644 --- a/lib/language_pack/installers/heroku_ruby_installer.rb +++ b/lib/language_pack/installers/heroku_ruby_installer.rb @@ -22,5 +22,20 @@ def fetch_unpack(ruby_version, install_dir, build = false) @fetcher.fetch_untar(file) end end + + def setup_binstubs(*) + super + Dir["#{DEFAULT_BIN_DIR}/{rake,bundle,rails}"].select do |binstub| + begin + if File.file?(binstub) + shebang = File.open(binstub, &:readline) + if !shebang.match %r{\A#!/usr/bin/env ruby(.exe)?\z} + warn("Binstub #{binstub} contains shebang #{shebang}. This may cause issues if the program specified is unavailable.", inline: true) + end + end + rescue EOFError + end + end + end end diff --git a/spec/installers/heroku_ruby_installer_spec.rb b/spec/installers/heroku_ruby_installer_spec.rb index 6648a870a..57cba2d33 100644 --- a/spec/installers/heroku_ruby_installer_spec.rb +++ b/spec/installers/heroku_ruby_installer_spec.rb @@ -48,4 +48,41 @@ end end + + describe "#setup_binstubs" do + it "warns about malformed shebangs" do + Dir.mktmpdir do |dir| + Dir.chdir(dir) do + Dir.mkdir("bin") + File.open("bin/rake", 'w') { |f| f.write("#!/usr/bin/env ruby") } + File.open("bin/rails", 'w') { |f| f.write("#!/usr/bin/env ruby.exe") } + File.open("bin/bundle", 'w') { |f| f.write("#!/usr/bin/env ruby1.7") } + + output = capture(:stdout) { installer.setup_binstubs("#{dir}/vendor/ruby") } + + expect(output).to include(<<-WARNING) +###### WARNING: + Binstub bin/bundle contains shebang #!/usr/bin/env ruby1.7. This may cause issues if the program specified is unavailable. + WARNING + end + end + end + + def capture(stream) + stream = stream.to_s + captured_stream = Tempfile.new(stream) + stream_io = eval("$#{stream}") + origin_stream = stream_io.dup + stream_io.reopen(captured_stream) + + yield + + stream_io.rewind + return captured_stream.read + ensure + captured_stream.close + captured_stream.unlink + stream_io.reopen(origin_stream) + end + end end From ad7d7648658348c9fae7683266782c4350ae9dde Mon Sep 17 00:00:00 2001 From: Caleb Thompson Date: Wed, 13 Sep 2017 11:59:37 -0500 Subject: [PATCH 0408/1195] Move binstub detection to main compile flow --- .../installers/heroku_ruby_installer.rb | 15 ----- lib/language_pack/ruby.rb | 15 +++++ spec/installers/heroku_ruby_installer_spec.rb | 36 ----------- spec/ruby_spec.rb | 60 +++++++++++++++---- 4 files changed, 65 insertions(+), 61 deletions(-) diff --git a/lib/language_pack/installers/heroku_ruby_installer.rb b/lib/language_pack/installers/heroku_ruby_installer.rb index aff7c230e..c752be37e 100644 --- a/lib/language_pack/installers/heroku_ruby_installer.rb +++ b/lib/language_pack/installers/heroku_ruby_installer.rb @@ -22,20 +22,5 @@ def fetch_unpack(ruby_version, install_dir, build = false) @fetcher.fetch_untar(file) end end - - def setup_binstubs(*) - super - Dir["#{DEFAULT_BIN_DIR}/{rake,bundle,rails}"].select do |binstub| - begin - if File.file?(binstub) - shebang = File.open(binstub, &:readline) - if !shebang.match %r{\A#!/usr/bin/env ruby(.exe)?\z} - warn("Binstub #{binstub} contains shebang #{shebang}. This may cause issues if the program specified is unavailable.", inline: true) - end - end - rescue EOFError - end - end - end end diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 7837ed032..e079293ff 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -88,6 +88,20 @@ def best_practice_warnings end end + def warn_bad_binstubs + Dir["bin/{rake,bundle,rails}"].select do |binstub| + begin + if File.file?(binstub) + shebang = File.open(binstub, &:readline) + if !shebang.match %r{\A#!/usr/bin/env ruby(.exe)?\z} + warn("Binstub #{binstub} contains shebang #{shebang}. This may cause issues if the program specified is unavailable.", inline: true) + end + end + rescue EOFError + end + end + end + def compile instrument 'ruby.compile' do # check for new app at the beginning of the compile @@ -95,6 +109,7 @@ def compile Dir.chdir(build_path) remove_vendor_bundle warn_bundler_upgrade + warn_bad_binstubs install_ruby install_jvm setup_language_pack_environment diff --git a/spec/installers/heroku_ruby_installer_spec.rb b/spec/installers/heroku_ruby_installer_spec.rb index 57cba2d33..925e3a6c6 100644 --- a/spec/installers/heroku_ruby_installer_spec.rb +++ b/spec/installers/heroku_ruby_installer_spec.rb @@ -49,40 +49,4 @@ end - describe "#setup_binstubs" do - it "warns about malformed shebangs" do - Dir.mktmpdir do |dir| - Dir.chdir(dir) do - Dir.mkdir("bin") - File.open("bin/rake", 'w') { |f| f.write("#!/usr/bin/env ruby") } - File.open("bin/rails", 'w') { |f| f.write("#!/usr/bin/env ruby.exe") } - File.open("bin/bundle", 'w') { |f| f.write("#!/usr/bin/env ruby1.7") } - - output = capture(:stdout) { installer.setup_binstubs("#{dir}/vendor/ruby") } - - expect(output).to include(<<-WARNING) -###### WARNING: - Binstub bin/bundle contains shebang #!/usr/bin/env ruby1.7. This may cause issues if the program specified is unavailable. - WARNING - end - end - end - - def capture(stream) - stream = stream.to_s - captured_stream = Tempfile.new(stream) - stream_io = eval("$#{stream}") - origin_stream = stream_io.dup - stream_io.reopen(captured_stream) - - yield - - stream_io.rewind - return captured_stream.read - ensure - captured_stream.close - captured_stream.unlink - stream_io.reopen(origin_stream) - end - end end diff --git a/spec/ruby_spec.rb b/spec/ruby_spec.rb index 02d9c97fc..bc88d44c5 100644 --- a/spec/ruby_spec.rb +++ b/spec/ruby_spec.rb @@ -2,18 +2,18 @@ describe LanguagePack::Ruby do describe "#install_binary" do - context "installing yarn" do - before do - @old_path = ENV['PATH'] - @old_stack = ENV['STACK'] - ENV['STACK'] = 'cedar-14' - end + before do + @old_path = ENV['PATH'] + @old_stack = ENV['STACK'] + ENV['STACK'] = 'cedar-14' + end - after do - ENV['PATH'] = @old_path - ENV['STACK'] = @old_stack - end + after do + ENV['PATH'] = @old_path + ENV['STACK'] = @old_stack + end + context "installing yarn" do it "sets up PATH" do Dir.mktmpdir do |build_path| Dir.mktmpdir do |cache_path| @@ -27,5 +27,45 @@ end end + describe "#warn_bad_binstubs" do + it "warns about malformed shebangs" do + Dir.mktmpdir do |build_path| + Dir.mktmpdir do |cache_path| + Dir.chdir(build_path) do + Dir.mkdir("bin") + File.open("bin/rake", 'w') { |f| f.write("#!/usr/bin/env ruby") } + File.open("bin/rails", 'w') { |f| f.write("#!/usr/bin/env ruby.exe") } + File.open("bin/bundle", 'w') { |f| f.write("#!/usr/bin/env ruby1.7") } + + ruby = LanguagePack::Ruby.new(build_path, cache_path) + output = capture(:stdout) { ruby.send(:warn_bad_binstubs) } + + expect(output).to include(<<-WARNING) +###### WARNING: + Binstub bin/bundle contains shebang #!/usr/bin/env ruby1.7. This may cause issues if the program specified is unavailable. + WARNING + end + end + end + end + + def capture(stream) + stream = stream.to_s + captured_stream = Tempfile.new(stream) + stream_io = eval("$#{stream}") + origin_stream = stream_io.dup + stream_io.reopen(captured_stream) + + yield + + stream_io.rewind + return captured_stream.read + ensure + captured_stream.close + captured_stream.unlink + stream_io.reopen(origin_stream) + end end + end + end From 5eef134fa9eab2310a76f89b00f19694b76c341b Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 13 Sep 2017 17:39:38 -0500 Subject: [PATCH 0409/1195] Yarn no longer uses `dist` directory. --- lib/language_pack/helpers/yarn_installer.rb | 6 +++--- spec/helpers/yarn_installer_spec.rb | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/language_pack/helpers/yarn_installer.rb b/lib/language_pack/helpers/yarn_installer.rb index 6514bffbf..a57c07884 100644 --- a/lib/language_pack/helpers/yarn_installer.rb +++ b/lib/language_pack/helpers/yarn_installer.rb @@ -11,7 +11,7 @@ def initialize end def name - "yarn-#{@version}" + "yarn-v#{@version}" end def binary_path @@ -21,10 +21,10 @@ def binary_path def install Dir.mktmpdir do |dir| Dir.chdir(dir) do - @fetcher.fetch_untar(@url, "dist") + @fetcher.fetch_untar(@url) end - FileUtils.mv("#{dir}/dist", name) + FileUtils.mv(File.join(dir, name), name) end end end diff --git a/spec/helpers/yarn_installer_spec.rb b/spec/helpers/yarn_installer_spec.rb index 2957f814a..86ada6bb6 100644 --- a/spec/helpers/yarn_installer_spec.rb +++ b/spec/helpers/yarn_installer_spec.rb @@ -12,7 +12,7 @@ # webpacker gem checks for yarnpkg # https://github.com/rails/webpacker/blob/master/lib/install/bin/yarn.tt#L5 - expect(File.exist?("yarn-#{installer.version}/bin/yarnpkg")).to be(true) + expect(File.exist?("yarn-v#{installer.version}/bin/yarnpkg")).to be(true) end end end From 6914b1e700d96258033013f8dfce87b72b8a7d00 Mon Sep 17 00:00:00 2001 From: schneems Date: Fri, 15 Sep 2017 14:11:50 -0500 Subject: [PATCH 0410/1195] Revert "Merge pull request #586 from heroku/check-binstubs" This reverts commit c2ba079766dde7920b05738fc3e108d9b28116c3, reversing changes made to c42a5781a2f6ca2efba7dad4fe7d49d8a800e336. --- lib/language_pack/ruby.rb | 15 ----- spec/installers/heroku_ruby_installer_spec.rb | 1 - spec/ruby_spec.rb | 60 ++++--------------- 3 files changed, 10 insertions(+), 66 deletions(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index e079293ff..7837ed032 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -88,20 +88,6 @@ def best_practice_warnings end end - def warn_bad_binstubs - Dir["bin/{rake,bundle,rails}"].select do |binstub| - begin - if File.file?(binstub) - shebang = File.open(binstub, &:readline) - if !shebang.match %r{\A#!/usr/bin/env ruby(.exe)?\z} - warn("Binstub #{binstub} contains shebang #{shebang}. This may cause issues if the program specified is unavailable.", inline: true) - end - end - rescue EOFError - end - end - end - def compile instrument 'ruby.compile' do # check for new app at the beginning of the compile @@ -109,7 +95,6 @@ def compile Dir.chdir(build_path) remove_vendor_bundle warn_bundler_upgrade - warn_bad_binstubs install_ruby install_jvm setup_language_pack_environment diff --git a/spec/installers/heroku_ruby_installer_spec.rb b/spec/installers/heroku_ruby_installer_spec.rb index 925e3a6c6..6648a870a 100644 --- a/spec/installers/heroku_ruby_installer_spec.rb +++ b/spec/installers/heroku_ruby_installer_spec.rb @@ -48,5 +48,4 @@ end end - end diff --git a/spec/ruby_spec.rb b/spec/ruby_spec.rb index bc88d44c5..02d9c97fc 100644 --- a/spec/ruby_spec.rb +++ b/spec/ruby_spec.rb @@ -2,18 +2,18 @@ describe LanguagePack::Ruby do describe "#install_binary" do - before do - @old_path = ENV['PATH'] - @old_stack = ENV['STACK'] - ENV['STACK'] = 'cedar-14' - end + context "installing yarn" do + before do + @old_path = ENV['PATH'] + @old_stack = ENV['STACK'] + ENV['STACK'] = 'cedar-14' + end - after do - ENV['PATH'] = @old_path - ENV['STACK'] = @old_stack - end + after do + ENV['PATH'] = @old_path + ENV['STACK'] = @old_stack + end - context "installing yarn" do it "sets up PATH" do Dir.mktmpdir do |build_path| Dir.mktmpdir do |cache_path| @@ -27,45 +27,5 @@ end end - describe "#warn_bad_binstubs" do - it "warns about malformed shebangs" do - Dir.mktmpdir do |build_path| - Dir.mktmpdir do |cache_path| - Dir.chdir(build_path) do - Dir.mkdir("bin") - File.open("bin/rake", 'w') { |f| f.write("#!/usr/bin/env ruby") } - File.open("bin/rails", 'w') { |f| f.write("#!/usr/bin/env ruby.exe") } - File.open("bin/bundle", 'w') { |f| f.write("#!/usr/bin/env ruby1.7") } - - ruby = LanguagePack::Ruby.new(build_path, cache_path) - output = capture(:stdout) { ruby.send(:warn_bad_binstubs) } - - expect(output).to include(<<-WARNING) -###### WARNING: - Binstub bin/bundle contains shebang #!/usr/bin/env ruby1.7. This may cause issues if the program specified is unavailable. - WARNING - end - end - end - end - - def capture(stream) - stream = stream.to_s - captured_stream = Tempfile.new(stream) - stream_io = eval("$#{stream}") - origin_stream = stream_io.dup - stream_io.reopen(captured_stream) - - yield - - stream_io.rewind - return captured_stream.read - ensure - captured_stream.close - captured_stream.unlink - stream_io.reopen(origin_stream) - end end - end - end From 75977fc4bcb00a882dd6288a6e4871bb7569ae06 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 28 Sep 2017 13:50:55 -0500 Subject: [PATCH 0411/1195] v169 --- CHANGELOG.md | 6 ++++-- lib/language_pack/version.rb | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b9fc50a5f..45a2194f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,13 @@ +## v169 (09/28/2017) + +* Yarn version upgraded to v1.0.2 + ## v168 (08/14/2017) * Install Node when using either ExecJS _or_ Webpacker (#608) * Make installs more robust against temporary network issues by retrying failed downloads in `LanguagePack::Fetcher#fetch_untar`, which installs Rubies (#585) -* Yarn version upgraded to v1.0.2 - ## v167 (07/25/2016) * Update Bundler to 1.15.2 (#602) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index fb9e6ae1a..06029e752 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v168" + BUILDPACK_VERSION = "v169" end end From 26d0eddf7dcfc079e5604f0cfc07466e88a8fa49 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Wed, 11 Oct 2017 14:25:51 -0500 Subject: [PATCH 0412/1195] Make the Ruby buildpack work with Ruby vendored Bundler. With Bundler being vendored in Ruby, we have no choice but to use the Ruby vendored Bundler if it's >= than the one we package in the Ruby buildpack since Ruby comes first in the `GEM_PATH` and `require 'bundler'` will always pull the latest. This still allows us the ability to update Bundler when we need to. Forcing the version of Bundler with `bundle _1.15.2_` won't be propagated during runtime. Having a different version used during build and runtime is not a good idea. This patch works also works around the [binstub `Kernel#load` issue](https://bugs.ruby-lang.org/issues/13997) in preview1. --- lib/language_pack/ruby.rb | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 7837ed032..65a7965b3 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -540,6 +540,10 @@ def bundler_binstubs_path "vendor/bundle/bin" end + def bundler_path + @bundler_path ||= "#{slug_vendor_base}/gems/#{BUNDLER_GEM_PATH}" + end + # runs bundler to install the dependencies def build_bundler(default_bundle_without) instrument 'ruby.build_bundler' do @@ -576,7 +580,15 @@ def build_bundler(default_bundle_without) bundle_command += " --deployment" end - topic("Installing dependencies using bundler #{bundler.version}") + # If Ruby's bundler is >= buildpack version, it will win. Get the + # version of bundler actually being used + bundler_version = + if ruby_version.ruby_version >= "2.5.0" + `#{bundler_path}/exe/#{bundle_bin} -v`.downcase.chomp + else + "bundler #{bundler.version}" + end + topic("Installing dependencies using #{bundler_version}") load_bundler_cache bundler_output = "" @@ -589,7 +601,6 @@ def build_bundler(default_bundle_without) yaml_include = File.expand_path("#{libyaml_dir}/include").shellescape yaml_lib = File.expand_path("#{libyaml_dir}/lib").shellescape pwd = Dir.pwd - bundler_path = "#{pwd}/#{slug_vendor_base}/gems/#{BUNDLER_GEM_PATH}/lib" # we need to set BUNDLE_CONFIG and BUNDLE_GEMFILE for # codon since it uses bundler. env_vars = { @@ -601,8 +612,14 @@ def build_bundler(default_bundle_without) "RUBYOPT" => syck_hack, "NOKOGIRI_USE_SYSTEM_LIBRARIES" => "true" } - env_vars["BUNDLER_LIB_PATH"] = "#{bundler_path}" if ruby_version.ruby_version == "1.8.7" + env_vars["BUNDLER_LIB_PATH"] = "#{pwd}/#{bundler_path}/lib" if ruby_version.ruby_version == "1.8.7" puts "Running: #{bundle_command}" + # bundler binstub bug in Ruby 2.5.0-preview1 + # https://bugs.ruby-lang.org/issues/13997 + if ruby_version.ruby_version == "2.5.0" + bundle_command.prepend("#{bundler_path}/exe/") + end + instrument "ruby.bundle_install" do bundle_time = Benchmark.realtime do bundler_output << pipe("#{bundle_command} --no-clean", out: "2>&1", env: env_vars, user_env: true) From d929c9b8b5439ca347bcddce902b45c74faa6ed3 Mon Sep 17 00:00:00 2001 From: schneems Date: Fri, 13 Oct 2017 09:13:47 -0500 Subject: [PATCH 0413/1195] Test Ruby 2.5.0 --- hatchet.json | 1 + spec/hatchet/ruby_spec.rb | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/hatchet.json b/hatchet.json index 349a05794..edc1bcc54 100644 --- a/hatchet.json +++ b/hatchet.json @@ -26,6 +26,7 @@ "sharpstone/ruby_193_jruby_17161_jdk7", "sharpstone/ruby_193_jruby_17161_jdk8", "sharpstone/ruby_193_bad_patch_cedar_14", + "sharpstone/ruby_25", "sharpstone/jruby-minimal", "sharpstone/empty-procfile", "sharpstone/bad_ruby_version", diff --git a/spec/hatchet/ruby_spec.rb b/spec/hatchet/ruby_spec.rb index 4ade6c44b..6a8f6132e 100644 --- a/spec/hatchet/ruby_spec.rb +++ b/spec/hatchet/ruby_spec.rb @@ -16,6 +16,14 @@ end end + describe "2.5.0" do + it "works" do + Hatchet::Runner.new("ruby_25").deploy do + # works + end + end + end + # describe "default WEB_CONCURRENCY" do # it "auto scales WEB_CONCURRENCY" do # pending("https://github.com/heroku/api/issues/4426") From 71253720abf2397f5674da44e507551c6253de96 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 17 Oct 2017 15:22:32 -0500 Subject: [PATCH 0414/1195] Check script runs without error --- lib/language_pack/ruby.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 65a7965b3..ab6c5166b 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -584,7 +584,7 @@ def build_bundler(default_bundle_without) # version of bundler actually being used bundler_version = if ruby_version.ruby_version >= "2.5.0" - `#{bundler_path}/exe/#{bundle_bin} -v`.downcase.chomp + run!("#{bundler_path}/exe/#{bundle_bin} -v").downcase.chomp else "bundler #{bundler.version}" end From c3f48b702ddf952b34614b59ea8e40b4af2c7657 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 19 Oct 2017 13:00:09 -0500 Subject: [PATCH 0415/1195] v170 --- CHANGELOG.md | 4 ++++ lib/language_pack/version.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 45a2194f2..cf710fb49 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## v170 (10/19/2017) + +* Compatiability for Ruby 2.5.0 preview 1 (#628) + ## v169 (09/28/2017) * Yarn version upgraded to v1.0.2 diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 06029e752..f07328276 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v169" + BUILDPACK_VERSION = "v170" end end From b35cd4f1048964932f077c8ec18f79a21107a208 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 19 Oct 2017 14:30:24 -0500 Subject: [PATCH 0416/1195] Update Hatchet to 3.0.4 --- Gemfile.lock | 37 ++++++++++--------------------------- 1 file changed, 10 insertions(+), 27 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index f8693a0ff..437945cfa 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -8,28 +8,21 @@ GIT GEM remote: https://rubygems.org/ specs: - activesupport (5.1.3) + activesupport (5.1.4) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (~> 0.7) minitest (~> 5.1) tzinfo (~> 1.1) - anvil-cli (0.16.2) - progress (~> 2.4, >= 2.4.0) - rest-client (~> 1.6, >= 1.6.7) - thor (~> 0.15, >= 0.15.2) concurrent-ruby (1.0.5) diff-lcs (1.3) - domain_name (0.5.20170404) - unf (>= 0.0.5, < 1.0.0) erubis (2.7.0) - excon (0.58.0) - heroics (0.0.23) + excon (0.59.0) + heroics (0.0.24) erubis (~> 2.0) excon + moneta multi_json (>= 1.9.2) - heroku_hatchet (3.0.3) - activesupport (~> 5) - anvil-cli (~> 0) + heroku_hatchet (3.0.4) excon (~> 0) minitest-retry (~> 0.1.9) platform-api (~> 2) @@ -37,16 +30,14 @@ GEM rrrretry (~> 1) thor (~> 0) threaded (~> 0) - http-cookie (1.0.3) - domain_name (~> 0.5) - i18n (0.8.6) + i18n (0.9.0) + concurrent-ruby (~> 1.0) json (2.0.4) - mime-types (2.99.3) minitest (5.10.3) minitest-retry (0.1.9) minitest (>= 5.0) moneta (0.8.1) - multi_json (1.12.1) + multi_json (1.12.2) netrc (0.11.0) parallel (1.11.2) parallel_tests (2.14.1) @@ -54,14 +45,9 @@ GEM platform-api (2.1.0) heroics (~> 0.0.23) moneta (~> 0.8.1) - progress (2.4.0) rake (12.0.0) repl_runner (0.0.3) activesupport - rest-client (1.8.0) - http-cookie (>= 1.0.2, < 2.0) - mime-types (>= 1.16, < 3.0) - netrc (~> 0.7) rrrretry (1.0.0) rspec-core (3.6.0) rspec-support (~> 3.6.0) @@ -71,14 +57,11 @@ GEM rspec-retry (0.5.4) rspec-core (> 3.3, < 3.7) rspec-support (3.6.0) - thor (0.19.4) + thor (0.20.0) thread_safe (0.3.6) threaded (0.0.4) tzinfo (1.2.3) thread_safe (~> 0.1) - unf (0.1.4) - unf_ext - unf_ext (0.0.7.4) PLATFORMS ruby @@ -96,4 +79,4 @@ DEPENDENCIES rspec-retry BUNDLED WITH - 1.15.3 + 1.15.4 From 782019c54f1753e7b74958437e02ca4892bf8c13 Mon Sep 17 00:00:00 2001 From: BuildpackTester Date: Mon, 30 Oct 2017 09:07:03 -0500 Subject: [PATCH 0417/1195] Use full path when setting JAVA_HOME during bundle install Using a relative path causes problems with some Gems that try to run the java command, such as the naether Gem. See ticket 523738 Added a spec for jruby with the naether Gem. This confirms the use of a full path for the jvm vendor directory --- hatchet.json | 3 +++ lib/language_pack/ruby.rb | 3 ++- spec/hatchet/rubies_spec.rb | 9 +++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/hatchet.json b/hatchet.json index edc1bcc54..efd8f62fc 100644 --- a/hatchet.json +++ b/hatchet.json @@ -32,6 +32,9 @@ "sharpstone/bad_ruby_version", "sharpstone/activerecord41_scaffold" ], + "jruby": [ + "sharpstone/jruby_naether" + ], "rack": [ "sharpstone/default_ruby", "sharpstone/mri_187_nokogiri", diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index ab6c5166b..5fa9e8621 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -610,7 +610,8 @@ def build_bundler(default_bundle_without) "CPPATH" => noshellescape("#{yaml_include}:$CPPATH"), "LIBRARY_PATH" => noshellescape("#{yaml_lib}:$LIBRARY_PATH"), "RUBYOPT" => syck_hack, - "NOKOGIRI_USE_SYSTEM_LIBRARIES" => "true" + "NOKOGIRI_USE_SYSTEM_LIBRARIES" => "true", + "JAVA_HOME" => noshellescape("#{pwd}/$JAVA_HOME") } env_vars["BUNDLER_LIB_PATH"] = "#{pwd}/#{bundler_path}/lib" if ruby_version.ruby_version == "1.8.7" puts "Running: #{bundle_command}" diff --git a/spec/hatchet/rubies_spec.rb b/spec/hatchet/rubies_spec.rb index 793d4ad4d..8cffa26ef 100644 --- a/spec/hatchet/rubies_spec.rb +++ b/spec/hatchet/rubies_spec.rb @@ -68,4 +68,13 @@ expect(app.output).not_to include("OpenJDK 64-Bit Server VM warning") end end + + it "should deploy jruby with the naether gem" do + app = Hatchet::Runner.new("jruby_naether") + app.setup! + app.deploy do |app| + expect(app.output).to match("Installing naether") + expect(app.output).not_to include("An error occurred while installing naether") + end + end end From 8a2c44745a47f68e7fbf14b38e91b638e1685369 Mon Sep 17 00:00:00 2001 From: BuildpackTester Date: Mon, 30 Oct 2017 11:06:55 -0500 Subject: [PATCH 0418/1195] Fix a test that was failing due to a JDK 9 update --- spec/helpers/jvm_installer_spec.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/spec/helpers/jvm_installer_spec.rb b/spec/helpers/jvm_installer_spec.rb index e6fbb72c0..7a4d806b3 100644 --- a/spec/helpers/jvm_installer_spec.rb +++ b/spec/helpers/jvm_installer_spec.rb @@ -8,7 +8,7 @@ begin ENV['JDK_URL_1_8'] = "http://lang-jvm.s3.amazonaws.com/jdk/openjdk1.8.0_51-cedar14.tar.gz" - jvm_installer = LanguagePack::Helpers::JvmInstaller.new(dir, "cedar-14") + jvm_installer = LanguagePack::Helpers::JvmInstaller.new(dir, "heroku-16") jvm_installer.install("9.0.1.0") expect(`ls bin`).to match("java") @@ -25,7 +25,7 @@ Dir.chdir(dir) do File.open('system.properties', 'w') { |f| f.write("java.runtime.version=1.7") } - jvm_installer = LanguagePack::Helpers::JvmInstaller.new(dir, "cedar-14") + jvm_installer = LanguagePack::Helpers::JvmInstaller.new(dir, "heroku-16") jvm_installer.install("9.0.1.0") expect(`ls bin`).to match("java") @@ -40,12 +40,12 @@ Dir.chdir(dir) do File.open('system.properties', 'w') { |f| f.write("java.runtime.version=1.9") } - jvm_installer = LanguagePack::Helpers::JvmInstaller.new(dir, "cedar-14") + jvm_installer = LanguagePack::Helpers::JvmInstaller.new(dir, "heroku-16") jvm_installer.install("9.0.1.0") expect(`ls bin`).to match("java") expect(`cat release 2>&1`).not_to match("1.8.0") - expect(`cat release 2>&1`).to match("9-internal") + expect(`cat release 2>&1`).to match("9") end end end @@ -67,7 +67,7 @@ it "downloads default JDK" do Dir.mktmpdir do |dir| Dir.chdir(dir) do - jvm_installer = LanguagePack::Helpers::JvmInstaller.new(dir, "cedar-14") + jvm_installer = LanguagePack::Helpers::JvmInstaller.new(dir, "heroku-16") jvm_installer.install("9.0.1.0") expect(`ls bin`).to match("java") @@ -83,7 +83,7 @@ Dir.chdir(dir) do File.open('system.properties', 'w') { |f| f.write("java.runtime.version=foobar") } - jvm_installer = LanguagePack::Helpers::JvmInstaller.new(dir, "cedar-14") + jvm_installer = LanguagePack::Helpers::JvmInstaller.new(dir, "heroku-16") expect{ jvm_installer.install("9.0.1.0") }.to raise_error(BuildpackError) end From d10664bb248b52c009c25adbb3b461580f89f25a Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 2 Nov 2017 09:51:01 -0500 Subject: [PATCH 0419/1195] =?UTF-8?q?Speed=20up=20deploys,=20don=E2=80=99t?= =?UTF-8?q?=20check=20latest=20bundler=20version.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit http://bundler.io/man/bundle-config.1.html ``` disable_version_check (BUNDLE_DISABLE_VERSION_CHECK): Stop Bundler from checking if a newer Bundler version is available on rubygems.org. ``` --- CHANGELOG.md | 4 ++++ lib/language_pack/ruby.rb | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cf710fb49..8ba282302 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## Master + +* Disable bundler version check (#632) + ## v170 (10/19/2017) * Compatiability for Ruby 2.5.0 preview 1 (#628) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 5fa9e8621..1223537bb 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -611,7 +611,8 @@ def build_bundler(default_bundle_without) "LIBRARY_PATH" => noshellescape("#{yaml_lib}:$LIBRARY_PATH"), "RUBYOPT" => syck_hack, "NOKOGIRI_USE_SYSTEM_LIBRARIES" => "true", - "JAVA_HOME" => noshellescape("#{pwd}/$JAVA_HOME") + "JAVA_HOME" => noshellescape("#{pwd}/$JAVA_HOME"), + "BUNDLE_DISABLE_VERSION_CHECK" => "true" } env_vars["BUNDLER_LIB_PATH"] = "#{pwd}/#{bundler_path}/lib" if ruby_version.ruby_version == "1.8.7" puts "Running: #{bundle_command}" From 32c63e85ff8439be1144962641a08129c74eea2c Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Thu, 14 Dec 2017 13:55:55 -0600 Subject: [PATCH 0420/1195] Revert "Make the Ruby buildpack work with Ruby vendored Bundler." This reverts commit 26d0eddf7dcfc079e5604f0cfc07466e88a8fa49. This isn't needed anymore for Ruby 2.5.0-rc1 since https://bugs.ruby-lang.org/issues/13997 is now fixed --- lib/language_pack/ruby.rb | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 1223537bb..734640a70 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -540,10 +540,6 @@ def bundler_binstubs_path "vendor/bundle/bin" end - def bundler_path - @bundler_path ||= "#{slug_vendor_base}/gems/#{BUNDLER_GEM_PATH}" - end - # runs bundler to install the dependencies def build_bundler(default_bundle_without) instrument 'ruby.build_bundler' do @@ -580,15 +576,7 @@ def build_bundler(default_bundle_without) bundle_command += " --deployment" end - # If Ruby's bundler is >= buildpack version, it will win. Get the - # version of bundler actually being used - bundler_version = - if ruby_version.ruby_version >= "2.5.0" - run!("#{bundler_path}/exe/#{bundle_bin} -v").downcase.chomp - else - "bundler #{bundler.version}" - end - topic("Installing dependencies using #{bundler_version}") + topic("Installing dependencies using bundler #{bundler.version}") load_bundler_cache bundler_output = "" @@ -601,6 +589,7 @@ def build_bundler(default_bundle_without) yaml_include = File.expand_path("#{libyaml_dir}/include").shellescape yaml_lib = File.expand_path("#{libyaml_dir}/lib").shellescape pwd = Dir.pwd + bundler_path = "#{pwd}/#{slug_vendor_base}/gems/#{BUNDLER_GEM_PATH}/lib" # we need to set BUNDLE_CONFIG and BUNDLE_GEMFILE for # codon since it uses bundler. env_vars = { @@ -614,14 +603,8 @@ def build_bundler(default_bundle_without) "JAVA_HOME" => noshellescape("#{pwd}/$JAVA_HOME"), "BUNDLE_DISABLE_VERSION_CHECK" => "true" } - env_vars["BUNDLER_LIB_PATH"] = "#{pwd}/#{bundler_path}/lib" if ruby_version.ruby_version == "1.8.7" + env_vars["BUNDLER_LIB_PATH"] = "#{bundler_path}" if ruby_version.ruby_version == "1.8.7" puts "Running: #{bundle_command}" - # bundler binstub bug in Ruby 2.5.0-preview1 - # https://bugs.ruby-lang.org/issues/13997 - if ruby_version.ruby_version == "2.5.0" - bundle_command.prepend("#{bundler_path}/exe/") - end - instrument "ruby.bundle_install" do bundle_time = Benchmark.realtime do bundler_output << pipe("#{bundle_command} --no-clean", out: "2>&1", env: env_vars, user_env: true) From 2bbaeb7c0d8b9c7e9b06229aff69381dd7f1fcb7 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Fri, 22 Dec 2017 02:23:00 -0600 Subject: [PATCH 0421/1195] write bundler shim to activate our version of bundler instead of Ruby's when vendored --- .../installers/ruby_installer.rb | 2 + lib/language_pack/ruby.rb | 38 +++++++++++++++++++ lib/language_pack/ruby_version.rb | 5 +++ 3 files changed, 45 insertions(+) diff --git a/lib/language_pack/installers/ruby_installer.rb b/lib/language_pack/installers/ruby_installer.rb index fc884ae18..f80a05a31 100644 --- a/lib/language_pack/installers/ruby_installer.rb +++ b/lib/language_pack/installers/ruby_installer.rb @@ -24,6 +24,8 @@ def setup_binstubs(install_dir) run("ln -s ruby #{install_dir}/bin/ruby.exe") Dir["#{install_dir}/bin/*"].each do |vendor_bin| + # for Ruby 2.5.0+ don't symlink the Bundler bin so our shim works + next if vendor_bin.include?("bundle") run("ln -s ../#{vendor_bin} #{DEFAULT_BIN_DIR}") end end diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 734640a70..9d1a8a09b 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -441,6 +441,10 @@ def install_bundler_in_app Dir.chdir(slug_vendor_base) do |dir| `cp -R #{bundler.bundler_path}/. .` end + + # write bundler shim, so we can control the version bundler used + # Ruby 2.5.0 started vendoring bundler + write_bundler_shim("vendor/bundle/bin") if ruby_version.vendored_bundler? end end @@ -540,6 +544,40 @@ def bundler_binstubs_path "vendor/bundle/bin" end + def bundler_path + @bundler_path ||= "#{slug_vendor_base}/gems/#{BUNDLER_GEM_PATH}" + end + + def write_bundler_shim(path) + FileUtils.mkdir_p(path) + shim_path = "#{path}/bundle" + File.open(shim_path, "w") do |file| + file.print <<-BUNDLE +#!/usr/bin/env ruby +require 'rubygems' + +version = "#{BUNDLER_VERSION}" + +if ARGV.first + str = ARGV.first + str = str.dup.force_encoding("BINARY") if str.respond_to? :force_encoding + if str =~ /\A_(.*)_\z/ and Gem::Version.correct?($1) then + version = $1 + ARGV.shift + end +end + +if Gem.respond_to?(:activate_bin_path) +load Gem.activate_bin_path('bundler', 'bundle', version) +else +gem "bundler", version +load Gem.bin_path("bundler", "bundle", version) +end +BUNDLE + end + FileUtils.chmod(0755, shim_path) + end + # runs bundler to install the dependencies def build_bundler(default_bundle_without) instrument 'ruby.build_bundler' do diff --git a/lib/language_pack/ruby_version.rb b/lib/language_pack/ruby_version.rb index 49da9ccb7..d7391ed95 100644 --- a/lib/language_pack/ruby_version.rb +++ b/lib/language_pack/ruby_version.rb @@ -91,6 +91,11 @@ def to_gemfile end end + # does this vendor bundler + def vendored_bundler? + Gem::Version.new(self.ruby_version) >= Gem::Version.new("2.5.0dev") + end + private def none From e20e7990dc3434d381c9997d66b15eb0591f21e4 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Fri, 22 Dec 2017 14:59:42 -0600 Subject: [PATCH 0422/1195] bump to v172 --- lib/language_pack/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index f07328276..60b91561f 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v170" + BUILDPACK_VERSION = "v172" end end From 0267c5169cfd98f57aa741e0a57f9dbd95b37447 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Fri, 22 Dec 2017 15:01:07 -0600 Subject: [PATCH 0423/1195] update CHANGELOG --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ba282302..bd2defb8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ ## Master +## v172 (12/22/2017) + +* updated Ruby 2.5.0 support + Bundler shim (#640) * Disable bundler version check (#632) +* set JAVA_HOME to absolute path during `bundle install` (#631) ## v170 (10/19/2017) From 5dbc8401d038d3b54d531693f01136223177f650 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Fri, 22 Dec 2017 16:21:40 -0600 Subject: [PATCH 0424/1195] Ruby 2.5.0 will not vendor Bundler in the final release This removes the shim work to work around that. --- lib/language_pack/installers/ruby_installer.rb | 2 +- lib/language_pack/ruby.rb | 2 +- lib/language_pack/ruby_version.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/language_pack/installers/ruby_installer.rb b/lib/language_pack/installers/ruby_installer.rb index f80a05a31..96657133c 100644 --- a/lib/language_pack/installers/ruby_installer.rb +++ b/lib/language_pack/installers/ruby_installer.rb @@ -24,7 +24,7 @@ def setup_binstubs(install_dir) run("ln -s ruby #{install_dir}/bin/ruby.exe") Dir["#{install_dir}/bin/*"].each do |vendor_bin| - # for Ruby 2.5.0+ don't symlink the Bundler bin so our shim works + # for Ruby 2.6.0+ don't symlink the Bundler bin so our shim works next if vendor_bin.include?("bundle") run("ln -s ../#{vendor_bin} #{DEFAULT_BIN_DIR}") end diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 9d1a8a09b..28d6316df 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -443,7 +443,7 @@ def install_bundler_in_app end # write bundler shim, so we can control the version bundler used - # Ruby 2.5.0 started vendoring bundler + # Ruby 2.6.0 started vendoring bundler write_bundler_shim("vendor/bundle/bin") if ruby_version.vendored_bundler? end end diff --git a/lib/language_pack/ruby_version.rb b/lib/language_pack/ruby_version.rb index d7391ed95..03326245f 100644 --- a/lib/language_pack/ruby_version.rb +++ b/lib/language_pack/ruby_version.rb @@ -93,7 +93,7 @@ def to_gemfile # does this vendor bundler def vendored_bundler? - Gem::Version.new(self.ruby_version) >= Gem::Version.new("2.5.0dev") + false end private From 9bc8c9df4a16fcc0082b387cb7bb4c26e0d91fde Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Fri, 22 Dec 2017 16:35:40 -0600 Subject: [PATCH 0425/1195] bump to v173 --- lib/language_pack/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 60b91561f..6eafc680e 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v172" + BUILDPACK_VERSION = "v173" end end From 84a755c1d345b63670af1bd7a445b0adeb65a42c Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Fri, 22 Dec 2017 16:35:51 -0600 Subject: [PATCH 0426/1195] update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bd2defb8d..463fa24ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Master +## v173 (12/22/2017) + +* Remove Bundler shim since Bundler 2.5.0 will not vendor Bundler (#645) + ## v172 (12/22/2017) * updated Ruby 2.5.0 support + Bundler shim (#640) From 9d1bcf38cb349bc6b8b1ab3bd58521a788117d44 Mon Sep 17 00:00:00 2001 From: Joe Kutner Date: Wed, 3 Jan 2018 10:39:03 -0600 Subject: [PATCH 0427/1195] Only set JAVA_HOME for Bundler when using JRuby --- lib/language_pack/ruby.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 28d6316df..d9ec17d4d 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -638,9 +638,9 @@ def build_bundler(default_bundle_without) "LIBRARY_PATH" => noshellescape("#{yaml_lib}:$LIBRARY_PATH"), "RUBYOPT" => syck_hack, "NOKOGIRI_USE_SYSTEM_LIBRARIES" => "true", - "JAVA_HOME" => noshellescape("#{pwd}/$JAVA_HOME"), "BUNDLE_DISABLE_VERSION_CHECK" => "true" } + env_vars["JAVA_HOME"] = noshellescape("#{pwd}/$JAVA_HOME") if ruby_version.jruby? env_vars["BUNDLER_LIB_PATH"] = "#{bundler_path}" if ruby_version.ruby_version == "1.8.7" puts "Running: #{bundle_command}" instrument "ruby.bundle_install" do From 3fd2030d05d128a62ea4bb3dd77ed64a69d5d18d Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Mon, 15 Jan 2018 19:21:21 -0600 Subject: [PATCH 0428/1195] update heroku cli for CircleCI --- circle.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/circle.yml b/circle.yml index 3119ab852..a5fe0e42a 100644 --- a/circle.yml +++ b/circle.yml @@ -9,6 +9,8 @@ machine: test: pre: + - wget -qO- https://cli-assets.heroku.com/install-ubuntu.sh | sh + - heroku --version - bundle exec rake hatchet:setup_travis override: - bundle exec parallel_rspec -n 11 spec/ From 3322805e03b1f093a9ea37eed160794688caa34b Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Tue, 13 Feb 2018 13:53:47 -0600 Subject: [PATCH 0429/1195] v174 changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 463fa24ac..f80f4d788 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Master +## v174 (02/13/2018) + +* Only set JAVA_HOME for Bundler when using JRuby (#649, @jkutner) + ## v173 (12/22/2017) * Remove Bundler shim since Bundler 2.5.0 will not vendor Bundler (#645) From 7c29b260d830daac9278433f2e8811bc56d84799 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Tue, 13 Feb 2018 13:54:07 -0600 Subject: [PATCH 0430/1195] bump to v174 --- lib/language_pack/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 6eafc680e..b49464b46 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v173" + BUILDPACK_VERSION = "v174" end end From 55dd3f24e41271add363393a9ce5c8a7e70fb0bf Mon Sep 17 00:00:00 2001 From: schneems Date: Fri, 16 Mar 2018 10:26:00 -0500 Subject: [PATCH 0431/1195] Add ability to log from the Ruby Buildpack --- .gitignore | 1 + .travis.yml | 2 +- Rakefile | 2 ++ lib/language_pack/base.rb | 1 + lib/language_pack/shell_helpers.rb | 21 +++++++++++++++++++++ spec/helpers/shell_spec.rb | 15 +++++++++++++++ tmp/.gitkeep | 0 7 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 tmp/.gitkeep diff --git a/.gitignore b/.gitignore index d3c5516c2..3421c3253 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ vendor/bundle/* .ruby-version buildpacks/* .anvil/ +tmp/*.log diff --git a/.travis.yml b/.travis.yml index 645402868..7eba9404f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: ruby rvm: -- 2.4.1 +- 2.4.3 before_script: bundle exec rake hatchet:setup_travis script: bundle exec parallel_rspec -n 11 spec/ env: diff --git a/Rakefile b/Rakefile index 05f935185..804a741c7 100644 --- a/Rakefile +++ b/Rakefile @@ -2,6 +2,8 @@ require "fileutils" require "tmpdir" require 'hatchet/tasks' +ENV["BUILDPACK_LOG_FILE"] ||= "tmp/buildpack.log" + S3_BUCKET_NAME = "heroku-buildpack-ruby" VENDOR_URL = "https://s3.amazonaws.com/#{S3_BUCKET_NAME}" diff --git a/lib/language_pack/base.rb b/lib/language_pack/base.rb index cecfefe7b..608e9710d 100644 --- a/lib/language_pack/base.rb +++ b/lib/language_pack/base.rb @@ -93,6 +93,7 @@ def compile puts @deprecations.join("\n") end end + mcount "success.ruby" end def write_release_yaml diff --git a/lib/language_pack/shell_helpers.rb b/lib/language_pack/shell_helpers.rb index 313081891..fe8fe891e 100644 --- a/lib/language_pack/shell_helpers.rb +++ b/lib/language_pack/shell_helpers.rb @@ -14,6 +14,18 @@ module LanguagePack module ShellHelpers @@user_env_hash = {} + def mcount(key, value = 1) + private_log("count", key => value) + end + + def mmeasure(key, value) + private_log("measure", key => value) + end + + def munique(key, value) + private_log("unique", key => value) + end + def self.user_env_hash @@user_env_hash end @@ -149,5 +161,14 @@ def deprecate(message) def noshellescape(string) NoShellEscape.new(string) end + + private + def private_log(name, key_value_hash) + File.open(ENV["BUILDPACK_LOG_FILE"], "a+") do |f| + key_value_hash.each do |key, value| + f.puts "#{name}##{ENV["BPLOG_PREFIX"]}#{key}=#{value}" + end + end + end end end diff --git a/spec/helpers/shell_spec.rb b/spec/helpers/shell_spec.rb index 812ce0e51..199755037 100644 --- a/spec/helpers/shell_spec.rb +++ b/spec/helpers/shell_spec.rb @@ -14,6 +14,21 @@ class FakeShell include LanguagePack::ShellHelpers end + describe "mcount" do + it "logs to a file" do + begin + original = ENV["BUILDPACK_LOG_FILE"] + Tempfile.open("logfile.log") do |f| + ENV["BUILDPACK_LOG_FILE"] = f.path + FakeShell.new.mcount "foo" + expect(File.read(f.path)).to match("count#foo=1") + end + ensure + ENV["BUILDPACK_LOG_FILE"] = original + end + end + end + describe "#command_options_to_string" do it "formats ugly keys correctly" do env = {%Q{ un"matched } => "bad key"} diff --git a/tmp/.gitkeep b/tmp/.gitkeep new file mode 100644 index 000000000..e69de29bb From 2c95a78ff2e08c41693c00534d3eac925eb64e05 Mon Sep 17 00:00:00 2001 From: schneems Date: Fri, 16 Mar 2018 11:49:17 -0500 Subject: [PATCH 0432/1195] Instrument build failures with mcount --- lib/language_pack/base.rb | 2 +- lib/language_pack/ruby.rb | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/language_pack/base.rb b/lib/language_pack/base.rb index 608e9710d..414b7a682 100644 --- a/lib/language_pack/base.rb +++ b/lib/language_pack/base.rb @@ -93,7 +93,7 @@ def compile puts @deprecations.join("\n") end end - mcount "success.ruby" + mcount "ruby.success" end def write_release_yaml diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index d9ec17d4d..6913a565b 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -376,6 +376,8 @@ def install_ruby true rescue LanguagePack::Fetcher::FetchError => error + mcount "ruby.fail.bad_version_fetch" + mcount "ruby.fail.bad_version_fetch.#{ruby_version.version_for_download}" message = < "failure" error_message = "Failed to install gems via Bundler." puts "Bundler Output: #{bundler_output}" if bundler_output.match(/An error occurred while installing sqlite3/) + mcount "ruby.fail.sqlite3" error_message += <<-ERROR Detected sqlite3 gem which is not supported on Heroku: @@ -679,6 +683,7 @@ def build_bundler(default_bundle_without) end if bundler_output.match(/but your Gemfile specified/) + mcount "ruby.fail.ruby_version_mismatch" error_message += <<-ERROR Detected a mismatch between your Ruby version installed and @@ -908,6 +913,7 @@ def run_assets_precompile_rake_task end def precompile_fail(output) + mcount "ruby.fail.assets_precompile" log "assets_precompile", :status => "failure" msg = "Precompiling assets failed.\n" if output.match(/(127\.0\.0\.1)|(org\.postgresql\.util)/) From 1778dbf9b3bd1b51ccbb450790781a5a6d5e421e Mon Sep 17 00:00:00 2001 From: schneems Date: Fri, 16 Mar 2018 12:50:33 -0500 Subject: [PATCH 0433/1195] Fix travis tests --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 7eba9404f..fd08cfd65 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,7 @@ env: - IS_RUNNING_ON_CI=true - HATCHET_DEPLOY_STRATEGY=git - HATCHET_APP_LIMIT=80 + - BUILDPACK_LOG_FILE=tmp/buildpack.log - secure: xFS5oLPMGyT6N0LKwU7wllaEZEVLzE/D5HuD14q3Vfd4L369XpV6ORYJF/2mkf765m+LH1MaN09rJaKc00ZcQfQECMuzyWagLsr1bVKs+szta3G/nFjjVTwmoPX5kVw5q7e6TYvS/KAzo+n8u5pW+zu8MMTwnv40QI6LfcbZkTc= - secure: wd/FBYI9I37PJ+eXhO8vesvWELkklNgGRA1xo/tuA31+ACpY/jG5EjrHd+semsfDTxM8fZe3s0foIch+jeMTIOcGs98tDC/L/8b/h6i0Qic0DqkAk6B30fT+5Nl3dufjiXsBJg5xj1zYqW6ka3DKIDjnn+3ao2cme05MtDQBHdc= sudo: false From 28880b41d61f138d455d173ffbe322e00dee07a5 Mon Sep 17 00:00:00 2001 From: schneems Date: Fri, 16 Mar 2018 14:18:54 -0500 Subject: [PATCH 0434/1195] Default to dev/null if no log file is passed in --- lib/language_pack/shell_helpers.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/shell_helpers.rb b/lib/language_pack/shell_helpers.rb index fe8fe891e..3b33848ad 100644 --- a/lib/language_pack/shell_helpers.rb +++ b/lib/language_pack/shell_helpers.rb @@ -164,7 +164,7 @@ def noshellescape(string) private def private_log(name, key_value_hash) - File.open(ENV["BUILDPACK_LOG_FILE"], "a+") do |f| + File.open(ENV["BUILDPACK_LOG_FILE"] || "/dev/null", "a+") do |f| key_value_hash.each do |key, value| f.puts "#{name}##{ENV["BPLOG_PREFIX"]}#{key}=#{value}" end From 2364cf8e706b553a05bfa17d84c027abc64b8b49 Mon Sep 17 00:00:00 2001 From: schneems Date: Fri, 16 Mar 2018 14:24:43 -0500 Subject: [PATCH 0435/1195] =?UTF-8?q?=E2=9C=82=EF=B8=8F=20trailing=20white?= =?UTF-8?q?space?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/compile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/compile b/bin/compile index 0dcf523ae..35e550801 100755 --- a/bin/compile +++ b/bin/compile @@ -1,5 +1,5 @@ #!/bin/bash -# The actual `bin/compile` code lives in `bin/support/ruby_compile`. This file +# The actual `bin/compile` code lives in `bin/support/ruby_compile`. This file # instead bootstraps the ruby needed and then executes `bin/support/ruby_compile` BIN_DIR=$(cd $(dirname $0); pwd) From 37a9cf131b7e9dff38f2e0c40a7842f303b6ada5 Mon Sep 17 00:00:00 2001 From: schneems Date: Fri, 16 Mar 2018 16:29:08 -0500 Subject: [PATCH 0436/1195] Delete out commented test --- spec/hatchet/rails4_spec.rb | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/spec/hatchet/rails4_spec.rb b/spec/hatchet/rails4_spec.rb index d09c5f185..f5644cf1a 100644 --- a/spec/hatchet/rails4_spec.rb +++ b/spec/hatchet/rails4_spec.rb @@ -35,23 +35,6 @@ end end - # it "works with windows" do - # pending("failing due to free dynos not being able to have more than 1 process type") - # Hatchet::Runner.new("rails4_windows_mri193").deploy do |app, heroku| - # result = app.run("rails -v") - # expect(result).to match("4.0.0") - # result = app.run("rake -T") - # expect(result).to match("assets:precompile") - - # result = app.run("bundle show rails") - # expect(result).to match("rails-4.0.0") - # expect(app.output).to match("Removing `Gemfile.lock`") - - # before_final_warnings = app.output.split("Bundle completed").first - # expect(before_final_warnings).to match("Removing `Gemfile.lock`") - # end - # end - it "fails compile if assets:precompile fails" do Hatchet::Runner.new("rails4-fail-assets-compile", allow_failure: true).deploy do |app, heroku| expect(app.output).to include("raising on assets:precompile on purpose") From 082beeca99fbae17059570e6675cb0252ef5effa Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 19 Mar 2018 14:27:55 -0500 Subject: [PATCH 0437/1195] Make note of common error and fix. --- lib/language_pack/ruby.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 6913a565b..9d63402c4 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -920,6 +920,14 @@ def precompile_fail(output) msg << "Attempted to access a nonexistent database:\n" msg << "https://devcenter.heroku.com/articles/pre-provision-database\n" end + + sprockets_version = bundler.gem_version('sprockets') + if output.match(/Sprockets::FileNotFound/) && (sprockets_version < Gem::Version.new('4.0.0.beta7') && sprockets_version > Gem::Version.new('4.0.0.beta4')) + msg << "If you have this file in your project\n" + msg << "try upgrading to Sprockets 4.0.0.beta7 or later:\n" + msg << "https://github.com/rails/sprockets/pull/547\n" + end + error msg end From e5e828338b9a748d856ef2183ceabbb3d4c5026a Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 19 Mar 2018 14:46:49 -0500 Subject: [PATCH 0438/1195] mcount the number of times this error gets shown --- lib/language_pack/ruby.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 9d63402c4..533400b48 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -923,6 +923,7 @@ def precompile_fail(output) sprockets_version = bundler.gem_version('sprockets') if output.match(/Sprockets::FileNotFound/) && (sprockets_version < Gem::Version.new('4.0.0.beta7') && sprockets_version > Gem::Version.new('4.0.0.beta4')) + mcount "fail.assets_precompile.file_not_found_beta" msg << "If you have this file in your project\n" msg << "try upgrading to Sprockets 4.0.0.beta7 or later:\n" msg << "https://github.com/rails/sprockets/pull/547\n" From c1f3f93029e032641bdce0926b8d4c4f900cc8d9 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 19 Mar 2018 14:47:30 -0500 Subject: [PATCH 0439/1195] Standardize mcount names MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The “ruby” keyword is already added by the prefix, it is not needed again. --- lib/language_pack/base.rb | 2 +- lib/language_pack/ruby.rb | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/language_pack/base.rb b/lib/language_pack/base.rb index 414b7a682..338188846 100644 --- a/lib/language_pack/base.rb +++ b/lib/language_pack/base.rb @@ -93,7 +93,7 @@ def compile puts @deprecations.join("\n") end end - mcount "ruby.success" + mcount "success" end def write_release_yaml diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 533400b48..27a7a1ba0 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -376,8 +376,8 @@ def install_ruby true rescue LanguagePack::Fetcher::FetchError => error - mcount "ruby.fail.bad_version_fetch" - mcount "ruby.fail.bad_version_fetch.#{ruby_version.version_for_download}" + mcount "fail.bad_version_fetch" + mcount "fail.bad_version_fetch.#{ruby_version.version_for_download}" message = < "failure" error_message = "Failed to install gems via Bundler." puts "Bundler Output: #{bundler_output}" if bundler_output.match(/An error occurred while installing sqlite3/) - mcount "ruby.fail.sqlite3" + mcount "fail.sqlite3" error_message += <<-ERROR Detected sqlite3 gem which is not supported on Heroku: @@ -683,7 +683,7 @@ def build_bundler(default_bundle_without) end if bundler_output.match(/but your Gemfile specified/) - mcount "ruby.fail.ruby_version_mismatch" + mcount "fail.ruby_version_mismatch" error_message += <<-ERROR Detected a mismatch between your Ruby version installed and @@ -913,7 +913,7 @@ def run_assets_precompile_rake_task end def precompile_fail(output) - mcount "ruby.fail.assets_precompile" + mcount "fail.assets_precompile" log "assets_precompile", :status => "failure" msg = "Precompiling assets failed.\n" if output.match(/(127\.0\.0\.1)|(org\.postgresql\.util)/) From 966388f82968fc5bf4d1a64c3b6bd1b912bf3dd0 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 19 Mar 2018 13:56:45 -0500 Subject: [PATCH 0440/1195] Fix buildpack logging with prefix - Add prefix for Ruby buildpack - Ensure log prefix ends with a dot. --- lib/language_pack/base.rb | 1 + lib/language_pack/shell_helpers.rb | 7 +++++-- spec/helpers/shell_spec.rb | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/language_pack/base.rb b/lib/language_pack/base.rb index 414b7a682..63f32fa31 100644 --- a/lib/language_pack/base.rb +++ b/lib/language_pack/base.rb @@ -10,6 +10,7 @@ require "language_pack/instrument" Encoding.default_external = Encoding::UTF_8 if defined?(Encoding) +ENV["BPLOG_PREFIX"] = "buildpack.ruby" # abstract class that all the Ruby based Language Packs inherit from class LanguagePack::Base diff --git a/lib/language_pack/shell_helpers.rb b/lib/language_pack/shell_helpers.rb index 3b33848ad..35d2ea17b 100644 --- a/lib/language_pack/shell_helpers.rb +++ b/lib/language_pack/shell_helpers.rb @@ -1,6 +1,5 @@ require "shellwords" - class BuildpackError < StandardError end @@ -166,7 +165,11 @@ def noshellescape(string) def private_log(name, key_value_hash) File.open(ENV["BUILDPACK_LOG_FILE"] || "/dev/null", "a+") do |f| key_value_hash.each do |key, value| - f.puts "#{name}##{ENV["BPLOG_PREFIX"]}#{key}=#{value}" + metric = String.new("#{name}#") + metric << "#{ENV["BPLOG_PREFIX"]}" + metric << "." unless metric.end_with?('.') + metric << "#{key}=#{value}" + f.puts metric end end end diff --git a/spec/helpers/shell_spec.rb b/spec/helpers/shell_spec.rb index 199755037..ed9132c25 100644 --- a/spec/helpers/shell_spec.rb +++ b/spec/helpers/shell_spec.rb @@ -21,7 +21,7 @@ class FakeShell Tempfile.open("logfile.log") do |f| ENV["BUILDPACK_LOG_FILE"] = f.path FakeShell.new.mcount "foo" - expect(File.read(f.path)).to match("count#foo=1") + expect(File.read(f.path)).to match("count#buildpack.ruby.foo=1") end ensure ENV["BUILDPACK_LOG_FILE"] = original From 414c151c28e1991c452611c735cee53e19b709b0 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 19 Mar 2018 15:42:13 -0500 Subject: [PATCH 0441/1195] Update Heroku Hatchet to 3.0.6 Fixes a double delete bug https://github.com/heroku/hatchet/pull/41 --- Gemfile.lock | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 437945cfa..7910517c4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -8,7 +8,7 @@ GIT GEM remote: https://rubygems.org/ specs: - activesupport (5.1.4) + activesupport (5.1.5) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (~> 0.7) minitest (~> 5.1) @@ -16,13 +16,13 @@ GEM concurrent-ruby (1.0.5) diff-lcs (1.3) erubis (2.7.0) - excon (0.59.0) + excon (0.61.0) heroics (0.0.24) erubis (~> 2.0) excon moneta multi_json (>= 1.9.2) - heroku_hatchet (3.0.4) + heroku_hatchet (3.0.6) excon (~> 0) minitest-retry (~> 0.1.9) platform-api (~> 2) @@ -30,14 +30,14 @@ GEM rrrretry (~> 1) thor (~> 0) threaded (~> 0) - i18n (0.9.0) + i18n (0.9.5) concurrent-ruby (~> 1.0) json (2.0.4) - minitest (5.10.3) + minitest (5.11.3) minitest-retry (0.1.9) minitest (>= 5.0) moneta (0.8.1) - multi_json (1.12.2) + multi_json (1.13.1) netrc (0.11.0) parallel (1.11.2) parallel_tests (2.14.1) @@ -60,7 +60,7 @@ GEM thor (0.20.0) thread_safe (0.3.6) threaded (0.0.4) - tzinfo (1.2.3) + tzinfo (1.2.5) thread_safe (~> 0.1) PLATFORMS @@ -79,4 +79,4 @@ DEPENDENCIES rspec-retry BUNDLED WITH - 1.15.4 + 1.16.1 From c7f650ecb4478780b58c00c2586b16f6e91b38a0 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 21 Mar 2018 13:45:28 -0500 Subject: [PATCH 0442/1195] v175 --- CHANGELOG.md | 5 +++++ lib/language_pack/version.rb | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f80f4d788..3cb753501 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ ## Master +## v175 (03/21/2018) + +* Suggest users encountering a specific sprockets error in specific beta versions to upgrade (#718) +* Log metrics for common failures (#716) + ## v174 (02/13/2018) * Only set JAVA_HOME for Bundler when using JRuby (#649, @jkutner) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index b49464b46..9f33885f6 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v174" + BUILDPACK_VERSION = "v175" end end From 4f2d944b4d69d3d5986fdb48643f6c0108c1aa18 Mon Sep 17 00:00:00 2001 From: Joseph Page Date: Wed, 28 Feb 2018 11:01:30 +0100 Subject: [PATCH 0443/1195] Upgrade node to 8.10.0 LTS --- CHANGELOG.md | 3 +++ lib/language_pack/helpers/nodebin.rb | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3cb753501..c3ed0057c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ ## Master +* Node version upgraded to v8.9.4 (#714) +* Yarn version upgraded to v1.5.1 (#714) + ## v175 (03/21/2018) * Suggest users encountering a specific sprockets error in specific beta versions to upgrade (#718) diff --git a/lib/language_pack/helpers/nodebin.rb b/lib/language_pack/helpers/nodebin.rb index 199f53a47..6efae32e7 100644 --- a/lib/language_pack/helpers/nodebin.rb +++ b/lib/language_pack/helpers/nodebin.rb @@ -11,7 +11,7 @@ def self.query(q) end def self.hardcoded_node_lts - version = "6.11.1" + version = "8.10.0" { "number" => version, "url" => "https://s3pository.heroku.com/node/v#{version}/node-v#{version}-linux-x64.tar.gz" @@ -19,7 +19,7 @@ def self.hardcoded_node_lts end def self.hardcoded_yarn - version = "1.0.2" + version = "1.5.1" { "number" => version, "url" => "https://yarnpkg.com/downloads/#{version}/yarn-v#{version}.tar.gz" From 7f74c6e8115b446802df33898fe391d803280734 Mon Sep 17 00:00:00 2001 From: JOSE HERIBERTO Date: Thu, 22 Mar 2018 19:36:49 -0600 Subject: [PATCH 0444/1195] Prevents exception when logging invalid utf8 encoding messages At this moment Heroku review apps and manual deployments are failing and there are several tickets reported to Heroku about the same issue, in order to fix the issue a new rescue clause is added to the ShellHelper#puts method, and the right Rspec tests were added to show the error about encoding. closes https://github.com/heroku/heroku-buildpack-ruby/issues/722 --- Gemfile | 1 + Gemfile.lock | 4 ++++ lib/language_pack/shell_helpers.rb | 9 ++++++++ spec/fixtures/invalid_encoding.log | 1 + spec/helpers/shell_spec.rb | 33 ++++++++++++++++++++++++++++++ spec/spec_helper.rb | 2 +- 6 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 spec/fixtures/invalid_encoding.log diff --git a/Gemfile b/Gemfile index 270070c44..3919ac903 100644 --- a/Gemfile +++ b/Gemfile @@ -4,6 +4,7 @@ group :development, :test do gem "heroku_hatchet" gem "rspec-core" gem "rspec-expectations" + gem "rspec-mocks" gem "excon" gem "rake" gem "parallel_tests" diff --git a/Gemfile.lock b/Gemfile.lock index 7910517c4..90eb076a5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -54,6 +54,9 @@ GEM rspec-expectations (3.6.0) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.6.0) + rspec-mocks (3.6.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.6.0) rspec-retry (0.5.4) rspec-core (> 3.3, < 3.7) rspec-support (3.6.0) @@ -76,6 +79,7 @@ DEPENDENCIES rake rspec-core rspec-expectations + rspec-mocks rspec-retry BUNDLED WITH diff --git a/lib/language_pack/shell_helpers.rb b/lib/language_pack/shell_helpers.rb index 35d2ea17b..4694d1932 100644 --- a/lib/language_pack/shell_helpers.rb +++ b/lib/language_pack/shell_helpers.rb @@ -132,9 +132,18 @@ def topic(message) # (indented by 6 spaces) # @param [String] message to be displayed def puts(message) + begin + message.to_s.split("\n").each do |line| super " #{line.strip}" end + + # Sometimes it fails because encoding problems + # look at the spec for a reference + rescue Exception + Kernel.puts " #{message.to_s}" + end + $stdout.flush end diff --git a/spec/fixtures/invalid_encoding.log b/spec/fixtures/invalid_encoding.log new file mode 100644 index 000000000..16047e6e6 --- /dev/null +++ b/spec/fixtures/invalid_encoding.log @@ -0,0 +1 @@ +ACENOCUMAROL,AZECAR,1 MG 30 COMPRIMIDOS, n diff --git a/spec/helpers/shell_spec.rb b/spec/helpers/shell_spec.rb index ed9132c25..6d5cd1a9a 100644 --- a/spec/helpers/shell_spec.rb +++ b/spec/helpers/shell_spec.rb @@ -56,4 +56,37 @@ class FakeShell ]) end end + + def read_file_lines + lines = [] + File.open("spec/fixtures/invalid_encoding.log") do |f| + f.each_line do |line| + lines << line + end + end + lines + end + + describe "#puts" do + + context 'when the message has valid encoding' do + it 'does not raise an exception' do + sh = FakeShell.new + expect(Kernel).to_not receive(:puts) + message = "npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents)" + result = sh.puts message + expect(result).to eq $stdout.flush + end + end + + context 'when the message does not have a valid utf-8 character' do + it 'rescues the error and show the message as string' do + sh = FakeShell.new + lines = read_file_lines + expect(Kernel).to receive(:puts) + result = sh.puts lines[0] + expect(result).to eq $stdout.flush + end + end + end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index e650dc779..238262cb0 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -18,7 +18,7 @@ config.expect_with :rspec do |c| c.syntax = :expect end - config.mock_with :nothing + config.mock_with :rspec end def git_repo From bab03dbd9098cf1280fd71021f740723847c10d2 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 22 Mar 2018 22:02:01 -0500 Subject: [PATCH 0445/1195] Modify #723 to not raise an exception on a UTF8 string MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of catching the exception and ignoring it, we can re-write this method to not call any methods on the original string that would cause it to raise an “invalid byte sequence”. This is done by using `each_line` instead of splitting the string. We can also avoid the `strip` by switching the `puts` to a `print` and ensuring that the printed string ends in a newline. Just in case the original error is still caught and a better error message raised. I also added a counter to determine if the issue is actually fixed. --- Gemfile | 1 - Gemfile.lock | 4 --- lib/language_pack/shell_helpers.rb | 23 +++++++------ spec/helpers/shell_spec.rb | 52 ++++++++++++++---------------- spec/spec_helper.rb | 2 +- 5 files changed, 38 insertions(+), 44 deletions(-) diff --git a/Gemfile b/Gemfile index 3919ac903..270070c44 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,6 @@ group :development, :test do gem "heroku_hatchet" gem "rspec-core" gem "rspec-expectations" - gem "rspec-mocks" gem "excon" gem "rake" gem "parallel_tests" diff --git a/Gemfile.lock b/Gemfile.lock index 90eb076a5..7910517c4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -54,9 +54,6 @@ GEM rspec-expectations (3.6.0) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.6.0) - rspec-mocks (3.6.0) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.6.0) rspec-retry (0.5.4) rspec-core (> 3.3, < 3.7) rspec-support (3.6.0) @@ -79,7 +76,6 @@ DEPENDENCIES rake rspec-core rspec-expectations - rspec-mocks rspec-retry BUNDLED WITH diff --git a/lib/language_pack/shell_helpers.rb b/lib/language_pack/shell_helpers.rb index 4694d1932..8a5ae763e 100644 --- a/lib/language_pack/shell_helpers.rb +++ b/lib/language_pack/shell_helpers.rb @@ -132,19 +132,22 @@ def topic(message) # (indented by 6 spaces) # @param [String] message to be displayed def puts(message) - begin - - message.to_s.split("\n").each do |line| - super " #{line.strip}" - end - - # Sometimes it fails because encoding problems - # look at the spec for a reference - rescue Exception - Kernel.puts " #{message.to_s}" + message.each_line do |line| + if line.end_with?('\n'.freeze) + print " #{line}" + else + print " #{line}\n" + end end $stdout.flush + rescue ArgumentError => e + error_message = e.message + raise e if error_message !~ /invalid byte sequence/ + + mcount "fail.invalid_utf8" + error_message << "\n Invalid string: #{message}" + raise e, error_message end def warn(message, options = {}) diff --git a/spec/helpers/shell_spec.rb b/spec/helpers/shell_spec.rb index 6d5cd1a9a..7e6e64484 100644 --- a/spec/helpers/shell_spec.rb +++ b/spec/helpers/shell_spec.rb @@ -2,11 +2,16 @@ describe "ShellHelpers" do module RecordPuts - attr_reader :puts_calls + attr_reader :puts_calls, :print_calls def puts(*args) @puts_calls ||= [] @puts_calls << args end + + def print(*args) + @print_calls ||= [] + @print_calls << args + end end class FakeShell @@ -50,42 +55,33 @@ class FakeShell sh = FakeShell.new expect { sh.run!("false", max_attempts: 3) }.to raise_error(StandardError) - expect(sh.puts_calls).to eq([ - [" Command: 'false' failed on attempt 1 of 3."], - [" Command: 'false' failed on attempt 2 of 3."], + expect(sh.print_calls).to eq([ + [" Command: 'false' failed on attempt 1 of 3.\n"], + [" Command: 'false' failed on attempt 2 of 3.\n"], ]) end end - def read_file_lines - lines = [] - File.open("spec/fixtures/invalid_encoding.log") do |f| - f.each_line do |line| - lines << line - end - end - lines - end - describe "#puts" do - - context 'when the message has valid encoding' do - it 'does not raise an exception' do + context 'when the message has an invalid utf-8 character' do + it 'no error is raised' do sh = FakeShell.new - expect(Kernel).to_not receive(:puts) - message = "npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents)" - result = sh.puts message - expect(result).to eq $stdout.flush + + bad_lines = File.read("spec/fixtures/invalid_encoding.log") + sh.puts(bad_lines) end - end - context 'when the message does not have a valid utf-8 character' do - it 'rescues the error and show the message as string' do + it 'catches it just in case' do sh = FakeShell.new - lines = read_file_lines - expect(Kernel).to receive(:puts) - result = sh.puts lines[0] - expect(result).to eq $stdout.flush + + def sh.print(string); string.strip; end + def sh.mcount(*args); @error_caught = true; end + + bad_lines = File.read("spec/fixtures/invalid_encoding.log") + expect { sh.puts(bad_lines) }.to raise_error(ArgumentError) + + error_caught = sh.instance_variable_get(:"@error_caught") + expect(error_caught).to eq(true) end end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 238262cb0..e650dc779 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -18,7 +18,7 @@ config.expect_with :rspec do |c| c.syntax = :expect end - config.mock_with :rspec + config.mock_with :nothing end def git_repo From b485cddfa1b68cdb84bbce311623b085b986bbba Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 27 Mar 2018 11:05:06 -0500 Subject: [PATCH 0446/1195] v176 --- CHANGELOG.md | 3 +++ lib/language_pack/version.rb | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c3ed0057c..459141d2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,10 @@ ## Master +## v176 (3j/27/2018) + * Node version upgraded to v8.9.4 (#714) * Yarn version upgraded to v1.5.1 (#714) +* Fix issue with malformed UTF-8 string parsing (#724) ## v175 (03/21/2018) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 9f33885f6..9cfca6e16 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v175" + BUILDPACK_VERSION = "v176" end end From e37a4930227b82e818b22acde0c6a609d5114530 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 27 Mar 2018 13:29:41 -0500 Subject: [PATCH 0447/1195] Typo --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 459141d2e..0f0b3b3aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ## Master -## v176 (3j/27/2018) +## v176 (3/27/2018) * Node version upgraded to v8.9.4 (#714) * Yarn version upgraded to v1.5.1 (#714) From 596dc3a42c23b18d8c21c601528628bdf2a2aab3 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 3 Apr 2018 12:05:02 -0700 Subject: [PATCH 0448/1195] Lock buildpack to specific hatchet SHAs --- Gemfile.lock | 10 ++--- hatchet.lock | 121 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 126 insertions(+), 5 deletions(-) create mode 100644 hatchet.lock diff --git a/Gemfile.lock b/Gemfile.lock index 7910517c4..936830ed8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -8,21 +8,21 @@ GIT GEM remote: https://rubygems.org/ specs: - activesupport (5.1.5) + activesupport (5.1.6) concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (~> 0.7) + i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) concurrent-ruby (1.0.5) diff-lcs (1.3) erubis (2.7.0) - excon (0.61.0) + excon (0.62.0) heroics (0.0.24) erubis (~> 2.0) excon moneta multi_json (>= 1.9.2) - heroku_hatchet (3.0.6) + heroku_hatchet (3.1.0) excon (~> 0) minitest-retry (~> 0.1.9) platform-api (~> 2) @@ -30,7 +30,7 @@ GEM rrrretry (~> 1) thor (~> 0) threaded (~> 0) - i18n (0.9.5) + i18n (1.0.0) concurrent-ruby (~> 1.0) json (2.0.4) minitest (5.11.3) diff --git a/hatchet.lock b/hatchet.lock new file mode 100644 index 000000000..9300c6995 --- /dev/null +++ b/hatchet.lock @@ -0,0 +1,121 @@ +--- +- - "./repos/bundler/bad_gemfile_on_platform" + - 5dd45c83631f58d121afb48b513016cc9e2d3432 +- - "./repos/bundler/bundle-ruby-version-not-in-lockfile" + - 892a75783913df4bd64ffb2fdb3c5517f65fdb46 +- - "./repos/bundler/git_gemspec" + - 19fc9a51a5c36c81c926bf8e16d07399e0e514aa +- - "./repos/bundler/no_lockfile" + - 1947ce9a9c276d5df1c323b2ad78d1d85c7ab4c0 +- - "./repos/bundler/nokogiri_160" + - d9a761776be43e1c685f98ef13c6ef1ee0292267 +- - "./repos/bundler/problem_gemfile_version" + - c6266a7d121522b6219a52c69a1d104b00c03359 +- - "./repos/bundler/sqlite3_gemfile" + - 116db685f54dae18f703b3beb90e64fdbddb048d +- - "./repos/ci/activerecord_rake_tasks_does_not_exist" + - 71bb06014dcb95a56570198d60c4b61a33e21b21 +- - "./repos/ci/heroku-ci-json-example" + - b728496ec372793e867eb522e4a95ee9cf4c65be +- - "./repos/ci/rails5_ruby_schema_format" + - 3e63c3e13f435cf4ab11265e9abd161cc28cc552 +- - "./repos/ci/rails5_sql_schema_format" + - f77612224dcb43d3af7297ddf1d2866b2058dc3c +- - "./repos/ci/rails_31_ruby_schema_format" + - cce38934f6a8c014735f35ee90f1224c01c937bb +- - "./repos/ci/rails_31_sql_schema_format" + - e89a575baf7fcf168240f3674884124568086dd1 +- - "./repos/ci/ruby_no_rails_test" + - 25099328d78ee767e6378baf2abd77256e82caf3 +- - "./repos/jruby/jruby_naether" + - c5081c07de64dcd4b480923e4b7e2a98a9b4a431 +- - "./repos/multibuildpack/node_multi" + - f51a81f64667309d951ac67e6d4f3b1f6157798d +- - "./repos/node/webpacker_no_execjs" + - f4d42a9dc399b3153176e1aa2b3d5ba28fa4127e +- - "./repos/rack/default_ruby" + - da748a59340be8b950e7bbbfb32077eb67d70c3c +- - "./repos/rack/mri_187_nokogiri" + - 3fcce9c85bf560dba285cc385ae9845729195826 +- - "./repos/rack/mri_192" + - ef6b5ccf8aa2a8f5e3745934e3580dc0bd2d6d4b +- - "./repos/rack/mri_193" + - 2e9ed455517c57b0dc953f54fbf9fef641c7aadb +- - "./repos/rack/mri_200" + - f9922cbd9c6f44fdded54912f66038db37cb4b8f +- - "./repos/rails2/rails23_mri_193" + - 557f7ba7a9347ebe0dd2038dda7e7a97b2582525 +- - "./repos/rails3/rails3-fail-assets-compile" + - 733df1b022e181aeabc28ba85883f246d4d685cc +- - "./repos/rails3/rails3-fail-rakefile" + - 439110ea49008db0ab6dbe695125b44b2373748c +- - "./repos/rails3/rails3_12factor" + - 010a0d34d9f87c0ee5e8d8ad00b2001df2aab30d +- - "./repos/rails3/rails3_mri_193" + - 88c5d0d067cfd11e4452633994a85b04627ae8c7 +- - "./repos/rails3/rails3_one_plugin" + - 3a55abe16ebe152593c5e64dea8ba18b334b99a2 +- - "./repos/rails3/rails3_runtime_assets" + - 2bd534614490c1264fe02fe3a1039b0e586e8034 +- - "./repos/rails3/railties3_mri_193" + - 8cc041cffb9f5635017aa118d16688491f794e91 +- - "./repos/rails4/rails3-to-4-no-bin" + - 15a993614bde9c683476e56d60daad220f0bebdb +- - "./repos/rails4/rails4-env-assets-compile" + - ba8c352856685c3e46ae227ffbc175d6aa8e868b +- - "./repos/rails4/rails4-fail-assets-compile" + - 6dcded27ee27e557d4561e26c1e79aa89e109c24 +- - "./repos/rails4/rails4-manifest" + - a4942b578d5ecd6c2603612e6453eac2f4660d8b +- - "./repos/rails4/rails4_windows_mri193" + - f4c7b6209835050468bbb87827acf652b8f4d8ce +- - "./repos/rails41/rails41_scaffold" + - 488c116bda742a348ae320c73318990e19d4d78d +- - "./repos/rails42/rails42_scaffold" + - 0e56e663ce4de29dbe7ca42c9725068f8556b634 +- - "./repos/rails42/rails42_sprockets3_manifest" + - 8ba93cea22a99d64dd1fbf87b8f7892c0d5204d1 +- - "./repos/rails5/rails5" + - fc537b7091260d8cc6fdf2bc0fac7032d910a261 +- - "./repos/rails51/rails51_webpacker" + - d8460fc9eeb93108b6037a3ea755ec7a111ad03c +- - "./repos/rake/asset_precompile_fail" + - 16f7834331d6bb3fc5c284130b14eb1ff74d99d5 +- - "./repos/rake/asset_precompile_not_found" + - 57fc7f239bf9319e2f77fe580ba68445f6635191 +- - "./repos/rake/asset_precompile_pass" + - ce976c727d9f477957c499f39f4cf9603c378103 +- - "./repos/rake/bad_rakefile" + - 3cb9c7bf6494c59bd25fa74c2aa4531119e12a46 +- - "./repos/rake/connect_to_database_on_first_push" + - 635e002cb5a0400092dd5e80b88c6ffb740fda02 +- - "./repos/rake/default_with_rakefile" + - c6e0c4db8dcccb47e11d496e17adbc2dafc80dd8 +- - "./repos/rake/no_rakefile" + - d2ec2084b825218418dac54bd6276ac896b31cdd +- - "./repos/ruby/activerecord41_scaffold" + - 136e3e2627ed5e64e1491f9aff2b402462ce3d25 +- - "./repos/ruby/bad_ruby_version" + - 7bf3470265a87ea6361640aa4bfce6ce3b743520 +- - "./repos/ruby/empty-procfile" + - 7cae0aae424c2028b81b5d37ee24d42db8e545b9 +- - "./repos/ruby/jruby-minimal" + - f79860bc2866449fe065484f1542aaadd3f7cfd2 +- - "./repos/ruby/mri_187" + - 43cecfacbedda64f09310a4408ce73c5dc3a9c44 +- - "./repos/ruby/mri_193_p547" + - 39f4753b620f9ff427c547fd19f04c89f8441f6f +- - "./repos/ruby/ruby_193_bad_patch_cedar_14" + - 6948c1460c596f08c4642d616ae73a45dc0ae51a +- - "./repos/ruby/ruby_193_jruby_17161" + - 130cbe4bc2d8325ecb6d450fb7f5f2248390f0f8 +- - "./repos/ruby/ruby_193_jruby_17161_jdk7" + - c1b632f8a96cf9b902f5cdcd7a190d46544a8144 +- - "./repos/ruby/ruby_193_jruby_17161_jdk8" + - 01d90df2547488151f3add3b237f15e47e62a4e9 +- - "./repos/ruby/ruby_193_jruby_173" + - a08e8b2cc61d08bd611accaa455dbcbfff80f831 +- - "./repos/ruby/ruby_193_jruby_176" + - 9fcbc184cb386abc8784e9935d52d403e35c532c +- - "./repos/ruby/ruby_25" + - 0cb3df80d55b61e9417f2ac00adb06e15ae37982 From 697b2d5ceb46dd468d1725c1cc7b952bd146455f Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 4 Apr 2018 15:28:42 -0700 Subject: [PATCH 0449/1195] Update Default Ruby to not be an insecure version --- lib/language_pack/ruby_version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/ruby_version.rb b/lib/language_pack/ruby_version.rb index 03326245f..2db558a59 100644 --- a/lib/language_pack/ruby_version.rb +++ b/lib/language_pack/ruby_version.rb @@ -12,7 +12,7 @@ def initialize(output = "") end end - DEFAULT_VERSION_NUMBER = "2.3.4" + DEFAULT_VERSION_NUMBER = "2.3.7" DEFAULT_VERSION = "ruby-#{DEFAULT_VERSION_NUMBER}" LEGACY_VERSION_NUMBER = "1.9.2" LEGACY_VERSION = "ruby-#{LEGACY_VERSION_NUMBER}" From 7d8fb0c33a58f0fc161222d5d84c28b0d1921ab2 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 4 Apr 2018 15:50:54 -0700 Subject: [PATCH 0450/1195] [close #634] Allow Running Ruby outside of default directory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently you cannot run `ruby` outside of your default directory because all paths to the user’s version of ruby are relative paths. This forces the relative path to be an absolute path so that Ruby commands are available from anywhere on the system. --- hatchet.json | 1 + hatchet.lock | 2 ++ lib/language_pack/ruby.rb | 2 +- spec/hatchet/ruby_spec.rb | 9 +++++++++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/hatchet.json b/hatchet.json index efd8f62fc..56d3ca085 100644 --- a/hatchet.json +++ b/hatchet.json @@ -18,6 +18,7 @@ "sharpstone/bundle-ruby-version-not-in-lockfile" ], "ruby": [ + "sharpstone/cd_ruby", "sharpstone/mri_187", "sharpstone/mri_193_p547", "sharpstone/ruby_193_jruby_173", diff --git a/hatchet.lock b/hatchet.lock index 9300c6995..085c3af4c 100644 --- a/hatchet.lock +++ b/hatchet.lock @@ -97,6 +97,8 @@ - 136e3e2627ed5e64e1491f9aff2b402462ce3d25 - - "./repos/ruby/bad_ruby_version" - 7bf3470265a87ea6361640aa4bfce6ce3b743520 +- - "./repos/ruby/cd_ruby" + - 5d4139af87bbb941008ef945408eb8b6a5276369 - - "./repos/ruby/empty-procfile" - 7cae0aae424c2028b81b5d37ee24d42db8e545b9 - - "./repos/ruby/jruby-minimal" diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 27a7a1ba0..42e796130 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -428,7 +428,7 @@ def ruby_install_binstub_path # setup the environment so we can use the vendored ruby def setup_ruby_install_env instrument 'ruby.setup_ruby_install_env' do - ENV["PATH"] = "#{ruby_install_binstub_path}:#{ENV["PATH"]}" + ENV["PATH"] = "#{File.expand_path(ruby_install_binstub_path)}:#{ENV["PATH"]}" if ruby_version.jruby? ENV['JAVA_OPTS'] = default_java_opts diff --git a/spec/hatchet/ruby_spec.rb b/spec/hatchet/ruby_spec.rb index 6a8f6132e..23fac7fd4 100644 --- a/spec/hatchet/ruby_spec.rb +++ b/spec/hatchet/ruby_spec.rb @@ -1,6 +1,15 @@ require_relative '../spec_helper' describe "Ruby apps" do + + describe "running Ruby from outside the default dir" do + it "works" do + Hatchet::Runner.new('cd_ruby').deploy do |app| + expect(app.output).to match("2.3.5") + end + end + end + describe "bundler ruby version matcher" do it "installs a version even when not present in the Gemfile.lock" do Hatchet::Runner.new('bundle-ruby-version-not-in-lockfile').deploy do |app| From 5c369a098ac578525a4586c670f71760fb843061 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 5 Apr 2018 16:39:30 -0700 Subject: [PATCH 0451/1195] Fix double newline printing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Introduced in #724 the `puts` method now uses `print` but appends a newline if it’s not already present. Unfortunately the string in the `end_with?` call is using single quotes instead of double quotes, so it is checking for a string that literally ends with a slash and an n rather than the newline character. Switching to double quotes fixes the issue. --- lib/language_pack/shell_helpers.rb | 2 +- spec/helpers/shell_spec.rb | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/language_pack/shell_helpers.rb b/lib/language_pack/shell_helpers.rb index 8a5ae763e..1f8937586 100644 --- a/lib/language_pack/shell_helpers.rb +++ b/lib/language_pack/shell_helpers.rb @@ -133,7 +133,7 @@ def topic(message) # @param [String] message to be displayed def puts(message) message.each_line do |line| - if line.end_with?('\n'.freeze) + if line.end_with?("\n".freeze) print " #{line}" else print " #{line}\n" diff --git a/spec/helpers/shell_spec.rb b/spec/helpers/shell_spec.rb index 7e6e64484..0d4eab188 100644 --- a/spec/helpers/shell_spec.rb +++ b/spec/helpers/shell_spec.rb @@ -19,6 +19,15 @@ class FakeShell include LanguagePack::ShellHelpers end + describe "pipe" do + it "does not double append newlines" do + sh = FakeShell.new + sh.pipe('bundle install') + first_line = sh.print_calls.first.first + expect(first_line.end_with?("\n\n")).to be(false) + end + end + describe "mcount" do it "logs to a file" do begin From 277232f6a010ac56fa23e7e5e9060e8c70529c6f Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 10 Apr 2018 09:45:58 -0500 Subject: [PATCH 0452/1195] v177 --- CHANGELOG.md | 6 ++++++ lib/language_pack/version.rb | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f0b3b3aa..7309c2801 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ ## Master +## v177 (4/10/2018) + +* New apps that do not specify a Ruby version now get 2.3.7 (#732) +* Bugfix: `bundle install` output no longer has an extra newline (#735) +* Bugfix: when deploying an application the `ruby` version specified in the Gemfile is available outide of the home directory (#733) + ## v176 (3/27/2018) * Node version upgraded to v8.9.4 (#714) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 9cfca6e16..f2e737bbc 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v176" + BUILDPACK_VERSION = "v177" end end From f2c0843e76f8b0e678757fcec2b5ae738fab7099 Mon Sep 17 00:00:00 2001 From: Jeremy Morrell Date: Mon, 16 Apr 2018 15:11:34 -0700 Subject: [PATCH 0453/1195] Use nodebin s3 bucket to download Node --- lib/language_pack/helpers/nodebin.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/helpers/nodebin.rb b/lib/language_pack/helpers/nodebin.rb index 6efae32e7..eff71669e 100644 --- a/lib/language_pack/helpers/nodebin.rb +++ b/lib/language_pack/helpers/nodebin.rb @@ -14,7 +14,7 @@ def self.hardcoded_node_lts version = "8.10.0" { "number" => version, - "url" => "https://s3pository.heroku.com/node/v#{version}/node-v#{version}-linux-x64.tar.gz" + "url" => "https://s3.amazonaws.com/heroku-nodejs-bins/node/release/linux-x64/node-v#{version}-linux-x64.tar.gz" } end From 7e41e650c4a642bfb725bd4049dc415e783321bf Mon Sep 17 00:00:00 2001 From: Jeremy Morrell Date: Mon, 16 Apr 2018 16:06:33 -0700 Subject: [PATCH 0454/1195] Also hardcode yarn mirror --- lib/language_pack/helpers/nodebin.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/helpers/nodebin.rb b/lib/language_pack/helpers/nodebin.rb index eff71669e..5f9dbb4f0 100644 --- a/lib/language_pack/helpers/nodebin.rb +++ b/lib/language_pack/helpers/nodebin.rb @@ -22,7 +22,7 @@ def self.hardcoded_yarn version = "1.5.1" { "number" => version, - "url" => "https://yarnpkg.com/downloads/#{version}/yarn-v#{version}.tar.gz" + "url" => "https://s3.amazonaws.com/heroku-nodejs-bins/yarn/release/yarn-v#{version}.tar.gz" } end From 4b340d48583c4d05559ea32600423aa26c1f3fa4 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 16 Apr 2018 13:25:16 -0500 Subject: [PATCH 0455/1195] Active Storage Preview Warnings - When using active storage set to `:local` emit a warning letting people know that the storage might not work as they expect. - When no `ffmpeg` is available warn that they need to add a special buildpack. --- hatchet.json | 4 +++ hatchet.lock | 4 +++ lib/language_pack/rails5.rb | 52 +++++++++++++++++++++++++++++++++++++ spec/hatchet/rails5_spec.rb | 25 ++++++++++++++++-- 4 files changed, 83 insertions(+), 2 deletions(-) diff --git a/hatchet.json b/hatchet.json index 56d3ca085..7b16ffb4b 100644 --- a/hatchet.json +++ b/hatchet.json @@ -76,6 +76,10 @@ "rails51": [ "schneems/rails51_webpacker" ], + "rails52": [ + "sharpstone/active_storage_non_local", + "sharpstone/active_storage_local" + ], "multibuildpack": [ "sharpstone/node_multi" ], diff --git a/hatchet.lock b/hatchet.lock index 085c3af4c..191830086 100644 --- a/hatchet.lock +++ b/hatchet.lock @@ -79,6 +79,10 @@ - fc537b7091260d8cc6fdf2bc0fac7032d910a261 - - "./repos/rails51/rails51_webpacker" - d8460fc9eeb93108b6037a3ea755ec7a111ad03c +- - "./repos/rails52/active_storage_local" + - a1b6b18e081001b407898532fb9cb061a29ceee1 +- - "./repos/rails52/active_storage_non_local" + - cba59b7559f1f806684b65654228d44fcda91a82 - - "./repos/rake/asset_precompile_fail" - 16f7834331d6bb3fc5c284130b14eb1ff74d99d5 - - "./repos/rake/asset_precompile_not_found" diff --git a/lib/language_pack/rails5.rb b/lib/language_pack/rails5.rb index 81bed4d8d..79d97639b 100644 --- a/lib/language_pack/rails5.rb +++ b/lib/language_pack/rails5.rb @@ -30,4 +30,56 @@ def default_config_vars def install_plugins # do not install plugins, do not call super, do not warn end + + def best_practice_warnings + return unless bundler.has_gem?("activestorage") + return unless File.exist?("config/storage.yml") + + warn_local_storage if local_storage? + warn_no_ffmpeg if needs_ffmpeg? + end + + private + def has_ffmpeg? + run("which ffmpeg") + return $?.success? + end + + def needs_ffmpeg? + !has_ffmpeg? + end + + def local_storage? + out = run!('bin/rails runner "puts %Q{heroku_detecting_active_storage_config=#{Rails.application.config.active_storage.service}}"') + out =~ /heroku_detecting_active_storage_config=local/ + end + + def warn_local_storage + mcount("warn.activestorage.local_storage") + warn(<<-WARNING) +You set your `config.active_storage.service` to :local in production. +If you are uploading files to this app, they will not persist after the app +is restarted, on one-off dynos, or if the app has multiple dynos. +Heroku applications have an ephemeral files system. To +persist uploaded files, please use a service such as S3 and update your Rails +configuration. More information can be found in this article: + https://devcenter.heroku.com/articles/active-storage-on-heroku + +WARNING + end + + def warn_no_ffmpeg + mcount("warn.activestorage.no_binaries") + warn(<<-WARNING) +We detected that some binary dependencies required to +use all the preview features of Active Storage are not +present on this system. You can add them by running this command: + + $ heroku buildpacks:add -i 1 https://github.com/heroku/heroku-buildpack-activestorage-preview + +For more information please see: + https://devcenter.heroku.com/articles/active-storage-on-heroku + +WARNING + end end diff --git a/spec/hatchet/rails5_spec.rb b/spec/hatchet/rails5_spec.rb index da7f89dc8..2a3215cb5 100644 --- a/spec/hatchet/rails5_spec.rb +++ b/spec/hatchet/rails5_spec.rb @@ -1,10 +1,31 @@ require_relative '../spec_helper' -describe "Rails 5.x" do - +describe "Rails 5" do it "works" do Hatchet::Runner.new("rails5").deploy do |app, heroku| expect(app.run("rails -v")).to match("") end end + + describe "active storage" do + it "non-local storage warnings" do + Hatchet::Runner.new("active_storage_non_local").deploy do |app, heroku| + expect(app.output).to match('heroku-buildpack-activestorage-preview') + expect(app.output).to_not match('config.active_storage.service') + end + end + + it "local storage warnings" do + Hatchet::Runner.new( + "active_storage_local", + buildpacks: [ + "https://github.com/heroku/heroku-buildpack-activestorage-preview", + Hatchet::App.default_buildpack + ] + ).deploy do |app, heroku| + expect(app.output).to_not match('heroku-buildpack-activestorage-preview') + expect(app.output).to match('config.active_storage.service') + end + end + end end From 41462eab9f8a14205ef1d5b607e184a4895c1b82 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 17 Apr 2018 11:40:24 -0400 Subject: [PATCH 0456/1195] v178 --- CHANGELOG.md | 4 ++++ lib/language_pack/version.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7309c2801..c43809397 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Master +## v178 (4/17/2018) + +* Use S3 directly instead of s3pository for Node downloads (#740) + ## v177 (4/10/2018) * New apps that do not specify a Ruby version now get 2.3.7 (#732) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index f2e737bbc..089cb11d0 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v177" + BUILDPACK_VERSION = "v178" end end From ac66f54b235cb3522e8af22e5c6e100ed4b734fc Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 19 Apr 2018 12:40:46 -0400 Subject: [PATCH 0457/1195] Omit buildpack information in error messages --- lib/language_pack/rails5.rb | 6 +++--- spec/hatchet/rails5_spec.rb | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/language_pack/rails5.rb b/lib/language_pack/rails5.rb index 79d97639b..48f74357b 100644 --- a/lib/language_pack/rails5.rb +++ b/lib/language_pack/rails5.rb @@ -62,7 +62,9 @@ def warn_local_storage is restarted, on one-off dynos, or if the app has multiple dynos. Heroku applications have an ephemeral files system. To persist uploaded files, please use a service such as S3 and update your Rails -configuration. More information can be found in this article: +configuration. + +For more information can be found in this article: https://devcenter.heroku.com/articles/active-storage-on-heroku WARNING @@ -75,8 +77,6 @@ def warn_no_ffmpeg use all the preview features of Active Storage are not present on this system. You can add them by running this command: - $ heroku buildpacks:add -i 1 https://github.com/heroku/heroku-buildpack-activestorage-preview - For more information please see: https://devcenter.heroku.com/articles/active-storage-on-heroku diff --git a/spec/hatchet/rails5_spec.rb b/spec/hatchet/rails5_spec.rb index 2a3215cb5..0215ff38d 100644 --- a/spec/hatchet/rails5_spec.rb +++ b/spec/hatchet/rails5_spec.rb @@ -10,7 +10,7 @@ describe "active storage" do it "non-local storage warnings" do Hatchet::Runner.new("active_storage_non_local").deploy do |app, heroku| - expect(app.output).to match('heroku-buildpack-activestorage-preview') + expect(app.output).to match('binary dependencies required') expect(app.output).to_not match('config.active_storage.service') end end @@ -19,12 +19,12 @@ Hatchet::Runner.new( "active_storage_local", buildpacks: [ - "https://github.com/heroku/heroku-buildpack-activestorage-preview", + # "https://github.com/heroku/heroku-buildpack-activestorage-preview", Hatchet::App.default_buildpack ] ).deploy do |app, heroku| - expect(app.output).to_not match('heroku-buildpack-activestorage-preview') - expect(app.output).to match('config.active_storage.service') + expect(app.output).to match('binary dependencies required') + expect(app.output).to match('config.active_storage.service') end end end From 231db516fe623e3cd08ec3b1c2d6a1d041fb4398 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 23 Apr 2018 10:38:43 -0500 Subject: [PATCH 0458/1195] Remove extra instructions --- lib/language_pack/rails5.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/rails5.rb b/lib/language_pack/rails5.rb index 48f74357b..ee7536de9 100644 --- a/lib/language_pack/rails5.rb +++ b/lib/language_pack/rails5.rb @@ -75,7 +75,7 @@ def warn_no_ffmpeg warn(<<-WARNING) We detected that some binary dependencies required to use all the preview features of Active Storage are not -present on this system. You can add them by running this command: +present on this system. For more information please see: https://devcenter.heroku.com/articles/active-storage-on-heroku From b96ecc79671ad76af467ff02c295cf1581092d59 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 23 Apr 2018 10:38:58 -0500 Subject: [PATCH 0459/1195] Log this issue in terms of stack occurrences --- lib/language_pack/base.rb | 2 +- lib/language_pack/rails5.rb | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/language_pack/base.rb b/lib/language_pack/base.rb index e29d00388..74f2cee39 100644 --- a/lib/language_pack/base.rb +++ b/lib/language_pack/base.rb @@ -21,7 +21,7 @@ class LanguagePack::Base DEFAULT_LEGACY_STACK = "cedar" ROOT_DIR = File.expand_path("../../..", __FILE__) - attr_reader :build_path, :cache + attr_reader :build_path, :cache, :stack # changes directory to the build_path # @param [String] the path of the build dir diff --git a/lib/language_pack/rails5.rb b/lib/language_pack/rails5.rb index ee7536de9..27e3ce447 100644 --- a/lib/language_pack/rails5.rb +++ b/lib/language_pack/rails5.rb @@ -71,7 +71,8 @@ def warn_local_storage end def warn_no_ffmpeg - mcount("warn.activestorage.no_binaries") + mcount("warn.activestorage.no_binaries.stack-#{stack}") + mcount("warn.activestorage.no_binaries.all") warn(<<-WARNING) We detected that some binary dependencies required to use all the preview features of Active Storage are not From 70de4825990eca4a92d46993d89c1003efd80808 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 23 Apr 2018 12:06:00 -0500 Subject: [PATCH 0460/1195] v179 --- CHANGELOG.md | 4 ++++ lib/language_pack/version.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c43809397..d5701c46c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Master +## v179 (4/23/2018) + +* Emit warnings for Active Storage (#739) + ## v178 (4/17/2018) * Use S3 directly instead of s3pository for Node downloads (#740) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 089cb11d0..4d8ef838f 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v178" + BUILDPACK_VERSION = "v179" end end From 56ab9b4d5e0df90dff0e685196052a298b617492 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 23 Apr 2018 15:40:38 -0500 Subject: [PATCH 0461/1195] [Close #744] Run check in current env. --- lib/language_pack/rails5.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/language_pack/rails5.rb b/lib/language_pack/rails5.rb index 27e3ce447..44263edf0 100644 --- a/lib/language_pack/rails5.rb +++ b/lib/language_pack/rails5.rb @@ -50,7 +50,8 @@ def needs_ffmpeg? end def local_storage? - out = run!('bin/rails runner "puts %Q{heroku_detecting_active_storage_config=#{Rails.application.config.active_storage.service}}"') + command = 'bin/rails runner "puts %Q{heroku_detecting_active_storage_config=#{Rails.application.config.active_storage.service}}"' + out = run!(command, user_env: true) out =~ /heroku_detecting_active_storage_config=local/ end From e11caf4f9caf54b868e0799f1b9dd03f94c9336e Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 23 Apr 2018 16:04:40 -0500 Subject: [PATCH 0462/1195] v180 --- CHANGELOG.md | 4 ++++ lib/language_pack/version.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d5701c46c..003b75a6e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Master +## v180 (4/23/2018) + +* Fix case where user environment variables were not being used (#745) + ## v179 (4/23/2018) * Emit warnings for Active Storage (#739) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 4d8ef838f..86d95adab 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v179" + BUILDPACK_VERSION = "v180" end end From 3270bf046118f2a35e3e04765a5f1e103fb53079 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 23 Apr 2018 17:05:37 -0500 Subject: [PATCH 0463/1195] Do not call `service` if active_storage does not exist. --- CHANGELOG.md | 4 ++++ lib/language_pack/rails5.rb | 2 +- lib/language_pack/version.rb | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 003b75a6e..7e9cc3e75 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Master +## v181 (4/23/2018) + +* The `active_storage` is not guranteed to be present (#748) + ## v180 (4/23/2018) * Fix case where user environment variables were not being used (#745) diff --git a/lib/language_pack/rails5.rb b/lib/language_pack/rails5.rb index 44263edf0..278b509f8 100644 --- a/lib/language_pack/rails5.rb +++ b/lib/language_pack/rails5.rb @@ -50,7 +50,7 @@ def needs_ffmpeg? end def local_storage? - command = 'bin/rails runner "puts %Q{heroku_detecting_active_storage_config=#{Rails.application.config.active_storage.service}}"' + command = 'bin/rails runner "puts %Q{heroku_detecting_active_storage_config=#{Rails.application.config.try(:active_storage).try(:service)}}"' out = run!(command, user_env: true) out =~ /heroku_detecting_active_storage_config=local/ end diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 86d95adab..97b31dbfa 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v180" + BUILDPACK_VERSION = "v181" end end From 29068fb45e4a41e93f346339583c138b24a786fd Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 24 Apr 2018 11:05:38 -0500 Subject: [PATCH 0464/1195] Do not expect `rails runner` to be error free MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When people have exceptions in their Rails apps that only show on boot, previously the app would deploy and then they would have to debug in production. This call to `rails runner` preemptively calls code that might not be called until after build and so people are getting exceptions here. It’s confusing, so this warning and check are now optional. We will attempt to run them and give an appropriate warning when possible, otherwise we will not warn. --- CHANGELOG.md | 4 ++++ lib/language_pack/rails5.rb | 3 ++- lib/language_pack/version.rb | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e9cc3e75..c12b3dd89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Master +## v182 (4/24/2018) + +* Do not warn when `rails runner` cannot be executed (#749) + ## v181 (4/23/2018) * The `active_storage` is not guranteed to be present (#748) diff --git a/lib/language_pack/rails5.rb b/lib/language_pack/rails5.rb index 278b509f8..b2114d0c0 100644 --- a/lib/language_pack/rails5.rb +++ b/lib/language_pack/rails5.rb @@ -51,7 +51,8 @@ def needs_ffmpeg? def local_storage? command = 'bin/rails runner "puts %Q{heroku_detecting_active_storage_config=#{Rails.application.config.try(:active_storage).try(:service)}}"' - out = run!(command, user_env: true) + out = run(command, user_env: true) + return false unless $?.success? out =~ /heroku_detecting_active_storage_config=local/ end diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 97b31dbfa..37edfcea4 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v181" + BUILDPACK_VERSION = "v182" end end From ab2a37d15bbe4e66bc98fed659c6bb32617bf636 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 24 Apr 2018 13:08:30 -0500 Subject: [PATCH 0465/1195] Use Ruby 2.4.4 on Heroku 18 --- lib/language_pack/ruby_version.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/language_pack/ruby_version.rb b/lib/language_pack/ruby_version.rb index 2db558a59..25e3e47cf 100644 --- a/lib/language_pack/ruby_version.rb +++ b/lib/language_pack/ruby_version.rb @@ -12,7 +12,12 @@ def initialize(output = "") end end - DEFAULT_VERSION_NUMBER = "2.3.7" + if ENV["STACK"] == "heroku-18" + DEFAULT_VERSION_NUMBER = "2.4.4" + else + DEFAULT_VERSION_NUMBER = "2.3.7" + end + DEFAULT_VERSION = "ruby-#{DEFAULT_VERSION_NUMBER}" LEGACY_VERSION_NUMBER = "1.9.2" LEGACY_VERSION = "ruby-#{LEGACY_VERSION_NUMBER}" From 359a984aa341e44f37c4366cff937e7d736f1be6 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 24 Apr 2018 13:24:39 -0500 Subject: [PATCH 0466/1195] Libyaml is on the stack --- lib/language_pack/ruby.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 42e796130..43d5c9799 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -518,6 +518,12 @@ def load_default_cache # install libyaml into the LP to be referenced for psych compilation # @param [String] tmpdir to store the libyaml files def install_libyaml(dir) + case stack + when "cedar-14", "heroku-16" + else + return + end + instrument 'ruby.install_libyaml' do FileUtils.mkdir_p dir Dir.chdir(dir) do From e657d92d92bcc2ef78bf4bdc7331c27795858d10 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 26 Apr 2018 07:47:36 -0500 Subject: [PATCH 0467/1195] v183 --- CHANGELOG.md | 4 ++++ lib/language_pack/version.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c12b3dd89..45e50eb7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Master +## v183 (4/26/2018) + +* Support for not yet released heroku-18 stack (#750) + ## v182 (4/24/2018) * Do not warn when `rails runner` cannot be executed (#749) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 37edfcea4..17d91cacb 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v182" + BUILDPACK_VERSION = "v183" end end From 2c8b6ed4ef902fc03031b6436974cae45955f9ed Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 5 Apr 2018 14:56:35 -0700 Subject: [PATCH 0468/1195] Default Ruby version to 2.4.4 --- hatchet.lock | 46 ++++++++++++++-------------- lib/language_pack/ruby_version.rb | 7 +---- spec/hatchet/rails41_spec.rb | 50 ------------------------------- spec/hatchet/rails42_spec.rb | 38 +++++++++++++++++++++++ spec/hatchet/rails4_spec.rb | 12 ++++---- 5 files changed, 68 insertions(+), 85 deletions(-) delete mode 100644 spec/hatchet/rails41_spec.rb diff --git a/hatchet.lock b/hatchet.lock index 191830086..d2c20cd22 100644 --- a/hatchet.lock +++ b/hatchet.lock @@ -14,25 +14,25 @@ - - "./repos/bundler/sqlite3_gemfile" - 116db685f54dae18f703b3beb90e64fdbddb048d - - "./repos/ci/activerecord_rake_tasks_does_not_exist" - - 71bb06014dcb95a56570198d60c4b61a33e21b21 + - a6b711be6921cf7a0aa4e31269c37965799ea110 - - "./repos/ci/heroku-ci-json-example" - - b728496ec372793e867eb522e4a95ee9cf4c65be + - 4e5410a7381f486ba3df7739e02e52f32fdd4dda - - "./repos/ci/rails5_ruby_schema_format" - - 3e63c3e13f435cf4ab11265e9abd161cc28cc552 + - d76be86c66ae8f45ec611fb2c4d8eb3adac0ad4b - - "./repos/ci/rails5_sql_schema_format" - - f77612224dcb43d3af7297ddf1d2866b2058dc3c + - df48237c57f89bb3629937ae6b1d6af070100ed3 - - "./repos/ci/rails_31_ruby_schema_format" - - cce38934f6a8c014735f35ee90f1224c01c937bb + - 4dfec62253a2a09e004e396a8849c3bf11c3f68a - - "./repos/ci/rails_31_sql_schema_format" - - e89a575baf7fcf168240f3674884124568086dd1 + - 540ec776eff3111ad9bb01af204c62725c94a11d - - "./repos/ci/ruby_no_rails_test" - - 25099328d78ee767e6378baf2abd77256e82caf3 + - 3916137106d59b008b67d738abe6a1438f8fbde6 - - "./repos/jruby/jruby_naether" - c5081c07de64dcd4b480923e4b7e2a98a9b4a431 - - "./repos/multibuildpack/node_multi" - - f51a81f64667309d951ac67e6d4f3b1f6157798d + - c8f822a0cdd3b7ed92f19bd1112bd9e301bc4a5e - - "./repos/node/webpacker_no_execjs" - - f4d42a9dc399b3153176e1aa2b3d5ba28fa4127e + - 26792540c924699c69e4c79019b65bc9192586ea - - "./repos/rack/default_ruby" - da748a59340be8b950e7bbbfb32077eb67d70c3c - - "./repos/rack/mri_187_nokogiri" @@ -46,39 +46,39 @@ - - "./repos/rails2/rails23_mri_193" - 557f7ba7a9347ebe0dd2038dda7e7a97b2582525 - - "./repos/rails3/rails3-fail-assets-compile" - - 733df1b022e181aeabc28ba85883f246d4d685cc + - 0a2496b162fee373cbd484466abfcac1792510a1 - - "./repos/rails3/rails3-fail-rakefile" - - 439110ea49008db0ab6dbe695125b44b2373748c + - 85ee71f73a50067ca99163aa3bb23865a1df4c8f - - "./repos/rails3/rails3_12factor" - - 010a0d34d9f87c0ee5e8d8ad00b2001df2aab30d + - 9aebcf9adccd007e178f71aa49f85ee1a203fc4d - - "./repos/rails3/rails3_mri_193" - 88c5d0d067cfd11e4452633994a85b04627ae8c7 - - "./repos/rails3/rails3_one_plugin" - - 3a55abe16ebe152593c5e64dea8ba18b334b99a2 + - 4f6ee83f2b977d4c939890ede9f11319ab8fd67c - - "./repos/rails3/rails3_runtime_assets" - - 2bd534614490c1264fe02fe3a1039b0e586e8034 + - 6f71613db2ba4e25c82d5986f43e419ed9b2e4b0 - - "./repos/rails3/railties3_mri_193" - 8cc041cffb9f5635017aa118d16688491f794e91 - - "./repos/rails4/rails3-to-4-no-bin" - - 15a993614bde9c683476e56d60daad220f0bebdb + - 95c14c6381edadd55eed294cd21149eae8e784ab - - "./repos/rails4/rails4-env-assets-compile" - ba8c352856685c3e46ae227ffbc175d6aa8e868b - - "./repos/rails4/rails4-fail-assets-compile" - - 6dcded27ee27e557d4561e26c1e79aa89e109c24 + - 7f65fbb04ca49be526906a1b0d9155cd24941b8e - - "./repos/rails4/rails4-manifest" - - a4942b578d5ecd6c2603612e6453eac2f4660d8b + - b700f4683f601f102ab4b65a7e5052e40f2b4def - - "./repos/rails4/rails4_windows_mri193" - f4c7b6209835050468bbb87827acf652b8f4d8ce - - "./repos/rails41/rails41_scaffold" - - 488c116bda742a348ae320c73318990e19d4d78d + - a16a04c3a36bfaf6178e92619bd24b21b9d440e7 - - "./repos/rails42/rails42_scaffold" - - 0e56e663ce4de29dbe7ca42c9725068f8556b634 + - 932f6c48481eae5b23f27bf3bdf369ad711d61f8 - - "./repos/rails42/rails42_sprockets3_manifest" - - 8ba93cea22a99d64dd1fbf87b8f7892c0d5204d1 + - 4ea4b080599b4394bdf6753a7b392d9ed6b844a7 - - "./repos/rails5/rails5" - - fc537b7091260d8cc6fdf2bc0fac7032d910a261 + - 1680c5da829e03ffb9345187971a13e5109d86a6 - - "./repos/rails51/rails51_webpacker" - - d8460fc9eeb93108b6037a3ea755ec7a111ad03c + - 002ea4e0fce7b2b827ef7937c600743cc32fc901 - - "./repos/rails52/active_storage_local" - a1b6b18e081001b407898532fb9cb061a29ceee1 - - "./repos/rails52/active_storage_non_local" @@ -98,7 +98,7 @@ - - "./repos/rake/no_rakefile" - d2ec2084b825218418dac54bd6276ac896b31cdd - - "./repos/ruby/activerecord41_scaffold" - - 136e3e2627ed5e64e1491f9aff2b402462ce3d25 + - 6e4662c44b49e2c3c9429f00e7e7f4708142b03f - - "./repos/ruby/bad_ruby_version" - 7bf3470265a87ea6361640aa4bfce6ce3b743520 - - "./repos/ruby/cd_ruby" diff --git a/lib/language_pack/ruby_version.rb b/lib/language_pack/ruby_version.rb index 25e3e47cf..e5c102017 100644 --- a/lib/language_pack/ruby_version.rb +++ b/lib/language_pack/ruby_version.rb @@ -12,12 +12,7 @@ def initialize(output = "") end end - if ENV["STACK"] == "heroku-18" - DEFAULT_VERSION_NUMBER = "2.4.4" - else - DEFAULT_VERSION_NUMBER = "2.3.7" - end - + DEFAULT_VERSION_NUMBER = "2.4.4" DEFAULT_VERSION = "ruby-#{DEFAULT_VERSION_NUMBER}" LEGACY_VERSION_NUMBER = "1.9.2" LEGACY_VERSION = "ruby-#{LEGACY_VERSION_NUMBER}" diff --git a/spec/hatchet/rails41_spec.rb b/spec/hatchet/rails41_spec.rb deleted file mode 100644 index edd00f027..000000000 --- a/spec/hatchet/rails41_spec.rb +++ /dev/null @@ -1,50 +0,0 @@ -require_relative '../spec_helper' - -describe "Rails 4.1.x" do - it "should detect rails successfully" do - Hatchet::App.new('rails41_scaffold').in_directory do - expect(LanguagePack::Rails41.use?).to eq(true) - end - Hatchet::App.new('rails41_scaffold').in_directory do - expect(LanguagePack::Rails4.use?).to eq(false) - end - end - - it "should be able to run a migration without heroku specific database.yml" do - Hatchet::Runner.new("rails41_scaffold").deploy do |app, heroku| - expect(app.output).not_to include("Writing config/database.yml to read from DATABASE_URL") - expect(app.run("rake db:migrate")).to include("20140218165801 CreatePeople") - end - end - - it "should handle secrets.yml properly" do - Hatchet::Runner.new("rails41_scaffold").deploy do |app, heroku| - ReplRunner.new(:rails_console, "heroku run bin/rails console -a #{app.name}").run do |console| - console.run("ENV['SECRET_KEY_BASE'] == Rails.application.config.secrets.secret_key_base") {|result| expect(result).not_to eq("true") } - end - end - end - - it "should not overwrite existing files with cached files" do - string = SecureRandom.hex(13) - new_string = SecureRandom.hex(13) - - Hatchet::Runner.new("rails41_scaffold").deploy do |app, heroku| - # First Deploy - `mkdir public/assets` - `echo #{string} > public/assets/file.txt` - `git add -A; git commit -m 'adding file.txt'` - app.push! - - # Second Deploy - `echo #{new_string} > public/assets/file.txt` - `git add -A; git commit -m 'updating file.txt'` - app.push! - - # Asserts - result = app.run('cat public/assets/file.txt') - expect(result).not_to match(string) - expect(result).to match(new_string) - end - end -end diff --git a/spec/hatchet/rails42_spec.rb b/spec/hatchet/rails42_spec.rb index 5581bcb09..926591627 100644 --- a/spec/hatchet/rails42_spec.rb +++ b/spec/hatchet/rails42_spec.rb @@ -8,4 +8,42 @@ expect(output).to match(/true/) end end + + it "should be able to run a migration without heroku specific database.yml" do + Hatchet::Runner.new("rails41_scaffold").deploy do |app, heroku| + expect(app.output).not_to include("Writing config/database.yml to read from DATABASE_URL") + expect(app.run("rake db:migrate")).to include("20140218165801 CreatePeople") + end + end + + it "should handle secrets.yml properly" do + Hatchet::Runner.new("rails41_scaffold").deploy do |app, heroku| + ReplRunner.new(:rails_console, "heroku run bin/rails console -a #{app.name}").run do |console| + console.run("ENV['SECRET_KEY_BASE'] == Rails.application.config.secrets.secret_key_base") {|result| expect(result).not_to eq("true") } + end + end + end + + it "should not overwrite existing files with cached files" do + string = SecureRandom.hex(13) + new_string = SecureRandom.hex(13) + + Hatchet::Runner.new("rails41_scaffold").deploy do |app, heroku| + # First Deploy + `mkdir public/assets` + `echo #{string} > public/assets/file.txt` + `git add -A; git commit -m 'adding file.txt'` + app.push! + + # Second Deploy + `echo #{new_string} > public/assets/file.txt` + `git add -A; git commit -m 'updating file.txt'` + app.push! + + # Asserts + result = app.run('cat public/assets/file.txt') + expect(result).not_to match(string) + expect(result).to match(new_string) + end + end end diff --git a/spec/hatchet/rails4_spec.rb b/spec/hatchet/rails4_spec.rb index f5644cf1a..85e2ab422 100644 --- a/spec/hatchet/rails4_spec.rb +++ b/spec/hatchet/rails4_spec.rb @@ -1,9 +1,9 @@ require_relative '../spec_helper' -describe "Rails 4.0.x" do +describe "Rails 4.x" do it "should detect rails successfully" do Hatchet::App.new('rails4-manifest').in_directory do - expect(LanguagePack::Rails4.use?).to eq(true) + expect(LanguagePack::Rails42.use?).to eq(true) end Hatchet::App.new('rails4-manifest').in_directory do expect(LanguagePack::Rails3.use?).to eq(false) @@ -17,13 +17,13 @@ end end - it "detects new manifest file (sprockets 3.x: .sprockets-manifest-.json)" do + it "detects new manifest file (sprockets 3.x: .sprockets-manifest-.json) Rails 4.2" do Hatchet::Runner.new("rails42_sprockets3_manifest").deploy do |app, heroku| expect(app.output).to include("Detected manifest file, assuming assets were compiled locally") end end - it "upgraded from 3 to 4 missing ./bin still works" do + it "upgraded from 3 to 4.2 missing ./bin still works" do Hatchet::Runner.new("rails3-to-4-no-bin").deploy do |app, heroku| expect(app.output).to include("Asset precompilation completed") @@ -35,14 +35,14 @@ end end - it "fails compile if assets:precompile fails" do + it "fails compile if assets:precompile fails rails 4.2" do Hatchet::Runner.new("rails4-fail-assets-compile", allow_failure: true).deploy do |app, heroku| expect(app.output).to include("raising on assets:precompile on purpose") expect(app).not_to be_deployed end end - it "should not override user settings" do + it "should not override user settings rails 4.2" do app = Hatchet::Runner.new("rails4-env-assets-compile") app.setup! app.set_config("RAILS_ENV" => "staging") From 96fb1a2e1d9af4648f485d2fe41e06975cfb38f0 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 2 May 2018 13:47:17 -0500 Subject: [PATCH 0469/1195] rails42_scaffold --- hatchet.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hatchet.lock b/hatchet.lock index d2c20cd22..ac2c68be5 100644 --- a/hatchet.lock +++ b/hatchet.lock @@ -72,7 +72,7 @@ - - "./repos/rails41/rails41_scaffold" - a16a04c3a36bfaf6178e92619bd24b21b9d440e7 - - "./repos/rails42/rails42_scaffold" - - 932f6c48481eae5b23f27bf3bdf369ad711d61f8 + - e103fc313febe3aa94bd891b88181807bb5f4316 - - "./repos/rails42/rails42_sprockets3_manifest" - 4ea4b080599b4394bdf6753a7b392d9ed6b844a7 - - "./repos/rails5/rails5" From 759638816e884080d3e3e10ed584ab61510bfb25 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 2 May 2018 14:38:55 -0500 Subject: [PATCH 0470/1195] Parallel tests --- .travis.yml | 16 +++++- spec/default_cache_spec.rb | 11 ----- spec/hatchet/gem_detect_errors_spec.rb | 12 ----- spec/hatchet/no_lockfile_spec.rb | 10 ---- spec/hatchet/node_spec.rb | 4 +- spec/hatchet/rack_spec.rb | 15 ------ spec/hatchet/rails42_spec.rb | 49 ------------------- spec/hatchet/rails4_spec.rb | 45 +++++++++++++++++ spec/hatchet/rails51_spec.rb | 11 ----- spec/hatchet/rails5_spec.rb | 10 ++++ spec/hatchet/rubies_spec.rb | 19 +++++++ spec/hatchet/ruby_spec.rb | 36 +++++++++++++- spec/hatchet/upgrade_ruby_spec.rb | 19 ------- .../yarn_installer_spec.rb} | 0 14 files changed, 126 insertions(+), 131 deletions(-) delete mode 100644 spec/default_cache_spec.rb delete mode 100644 spec/hatchet/gem_detect_errors_spec.rb delete mode 100644 spec/hatchet/no_lockfile_spec.rb delete mode 100644 spec/hatchet/rack_spec.rb delete mode 100644 spec/hatchet/rails42_spec.rb delete mode 100644 spec/hatchet/rails51_spec.rb delete mode 100644 spec/hatchet/upgrade_ruby_spec.rb rename spec/{ruby_spec.rb => installers/yarn_installer_spec.rb} (100%) diff --git a/.travis.yml b/.travis.yml index fd08cfd65..75e9b9dd9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ language: ruby rvm: - 2.4.3 before_script: bundle exec rake hatchet:setup_travis -script: bundle exec parallel_rspec -n 11 spec/ +script: bundle exec parallel_rspec -n 11 spec/$TEST_SUITE env: global: - HATCHET_RETRIES=3 @@ -12,6 +12,20 @@ env: - BUILDPACK_LOG_FILE=tmp/buildpack.log - secure: xFS5oLPMGyT6N0LKwU7wllaEZEVLzE/D5HuD14q3Vfd4L369XpV6ORYJF/2mkf765m+LH1MaN09rJaKc00ZcQfQECMuzyWagLsr1bVKs+szta3G/nFjjVTwmoPX5kVw5q7e6TYvS/KAzo+n8u5pW+zu8MMTwnv40QI6LfcbZkTc= - secure: wd/FBYI9I37PJ+eXhO8vesvWELkklNgGRA1xo/tuA31+ACpY/jG5EjrHd+semsfDTxM8fZe3s0foIch+jeMTIOcGs98tDC/L/8b/h6i0Qic0DqkAk6B30fT+5Nl3dufjiXsBJg5xj1zYqW6ka3DKIDjnn+3ao2cme05MtDQBHdc= + matrix: + - TEST_SUITE=hatchet/helpers/ + - TEST_SUITE=hatchet/installers/ + - TEST_SUITE=hatchet/bugs_spec.rb + - TEST_SUITE=hatchet/ci_spec.rb + - TEST_SUITE=hatchet/jvm_spec.rb + - TEST_SUITE=hatchet/node_spec.rb + - TEST_SUITE=hatchet/rails23_spec.rb + - TEST_SUITE=hatchet/rails3_spec.rb + - TEST_SUITE=hatchet/rails4_spec.rb + - TEST_SUITE=hatchet/rubies_spec.rb + - TEST_SUITE=hatchet/ruby_spec.rb + - TEST_SUITE=hatchet/stack_spec.rb + sudo: false dist: trusty addons: diff --git a/spec/default_cache_spec.rb b/spec/default_cache_spec.rb deleted file mode 100644 index 736f7395f..000000000 --- a/spec/default_cache_spec.rb +++ /dev/null @@ -1,11 +0,0 @@ -require 'spec_helper' - -# describe "Default Cache" do -# it "gets loaded successfully" do -# pending("needs dep-tracker work") -# Hatchet::Runner.new("default_ruby").deploy do |app| -# expect(app.output).to match("loading default bundler cache") -# end -# end -# end - diff --git a/spec/hatchet/gem_detect_errors_spec.rb b/spec/hatchet/gem_detect_errors_spec.rb deleted file mode 100644 index 5e311c92f..000000000 --- a/spec/hatchet/gem_detect_errors_spec.rb +++ /dev/null @@ -1,12 +0,0 @@ -require 'spec_helper' - -describe "Raise errors on specific gems" do - it "should should raise on sqlite3" do - Hatchet::Runner.new("sqlite3_gemfile", allow_failure: true).deploy do |app| - expect(app).not_to be_deployed - expect(app.output).to include("Detected sqlite3 gem which is not supported") - expect(app.output).to include("devcenter.heroku.com/articles/sqlite3") - end - end -end - diff --git a/spec/hatchet/no_lockfile_spec.rb b/spec/hatchet/no_lockfile_spec.rb deleted file mode 100644 index e3d121f54..000000000 --- a/spec/hatchet/no_lockfile_spec.rb +++ /dev/null @@ -1,10 +0,0 @@ -require 'spec_helper' - -describe "No Lockfile" do - it "should not deploy" do - Hatchet::Runner.new("no_lockfile", allow_failure: true).deploy do |app| - expect(app).not_to be_deployed - expect(app.output).to include("Gemfile.lock required") - end - end -end diff --git a/spec/hatchet/node_spec.rb b/spec/hatchet/node_spec.rb index 937eec1b2..dbd651844 100644 --- a/spec/hatchet/node_spec.rb +++ b/spec/hatchet/node_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' -describe "Multibuildpack" do - it "works with node" do +describe "Node" do + it "works with node buildpack" do Hatchet::Runner.new("node_multi", buildpack_url: "https://github.com/heroku/heroku-buildpack-multi.git").deploy do |app| expect(app.output).to match("Node Version in Ruby buildpack is: v4.1.2") expect(app.run("node -v")).to match("v4.1.2") diff --git a/spec/hatchet/rack_spec.rb b/spec/hatchet/rack_spec.rb deleted file mode 100644 index 60b79bf6e..000000000 --- a/spec/hatchet/rack_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -require_relative '../spec_helper' - -describe "Rack" do - it "should not overwrite already set environment variables" do - custom_env = "FFFUUUUUUU" - app = Hatchet::Runner.new("default_ruby") - app.setup! - app.set_config("RACK_ENV" => custom_env) - expect(app.run("env")).to match(custom_env) - - app.deploy do |app| - expect(app.run("env")).to match(custom_env) - end - end -end diff --git a/spec/hatchet/rails42_spec.rb b/spec/hatchet/rails42_spec.rb deleted file mode 100644 index 926591627..000000000 --- a/spec/hatchet/rails42_spec.rb +++ /dev/null @@ -1,49 +0,0 @@ -require_relative '../spec_helper' - -describe "Rails 4.2.x" do - - it "set RAILS_SERVE_STATIC_FILES" do - Hatchet::Runner.new("rails42_scaffold").deploy do |app, heroku| - output = app.run("rails runner 'puts ENV[%Q{RAILS_SERVE_STATIC_FILES}].present?'") - expect(output).to match(/true/) - end - end - - it "should be able to run a migration without heroku specific database.yml" do - Hatchet::Runner.new("rails41_scaffold").deploy do |app, heroku| - expect(app.output).not_to include("Writing config/database.yml to read from DATABASE_URL") - expect(app.run("rake db:migrate")).to include("20140218165801 CreatePeople") - end - end - - it "should handle secrets.yml properly" do - Hatchet::Runner.new("rails41_scaffold").deploy do |app, heroku| - ReplRunner.new(:rails_console, "heroku run bin/rails console -a #{app.name}").run do |console| - console.run("ENV['SECRET_KEY_BASE'] == Rails.application.config.secrets.secret_key_base") {|result| expect(result).not_to eq("true") } - end - end - end - - it "should not overwrite existing files with cached files" do - string = SecureRandom.hex(13) - new_string = SecureRandom.hex(13) - - Hatchet::Runner.new("rails41_scaffold").deploy do |app, heroku| - # First Deploy - `mkdir public/assets` - `echo #{string} > public/assets/file.txt` - `git add -A; git commit -m 'adding file.txt'` - app.push! - - # Second Deploy - `echo #{new_string} > public/assets/file.txt` - `git add -A; git commit -m 'updating file.txt'` - app.push! - - # Asserts - result = app.run('cat public/assets/file.txt') - expect(result).not_to match(string) - expect(result).to match(new_string) - end - end -end diff --git a/spec/hatchet/rails4_spec.rb b/spec/hatchet/rails4_spec.rb index 85e2ab422..c7cd84f33 100644 --- a/spec/hatchet/rails4_spec.rb +++ b/spec/hatchet/rails4_spec.rb @@ -1,6 +1,51 @@ require_relative '../spec_helper' describe "Rails 4.x" do + it "set RAILS_SERVE_STATIC_FILES" do + Hatchet::Runner.new("rails42_scaffold").deploy do |app, heroku| + output = app.run("rails runner 'puts ENV[%Q{RAILS_SERVE_STATIC_FILES}].present?'") + expect(output).to match(/true/) + end + end + + it "should be able to run a migration without heroku specific database.yml" do + Hatchet::Runner.new("rails41_scaffold").deploy do |app, heroku| + expect(app.output).not_to include("Writing config/database.yml to read from DATABASE_URL") + expect(app.run("rake db:migrate")).to include("20140218165801 CreatePeople") + end + end + + it "should handle secrets.yml properly" do + Hatchet::Runner.new("rails41_scaffold").deploy do |app, heroku| + ReplRunner.new(:rails_console, "heroku run bin/rails console -a #{app.name}").run do |console| + console.run("ENV['SECRET_KEY_BASE'] == Rails.application.config.secrets.secret_key_base") {|result| expect(result).not_to eq("true") } + end + end + end + + it "should not overwrite existing files with cached files" do + string = SecureRandom.hex(13) + new_string = SecureRandom.hex(13) + + Hatchet::Runner.new("rails41_scaffold").deploy do |app, heroku| + # First Deploy + `mkdir public/assets` + `echo #{string} > public/assets/file.txt` + `git add -A; git commit -m 'adding file.txt'` + app.push! + + # Second Deploy + `echo #{new_string} > public/assets/file.txt` + `git add -A; git commit -m 'updating file.txt'` + app.push! + + # Asserts + result = app.run('cat public/assets/file.txt') + expect(result).not_to match(string) + expect(result).to match(new_string) + end + end + it "should detect rails successfully" do Hatchet::App.new('rails4-manifest').in_directory do expect(LanguagePack::Rails42.use?).to eq(true) diff --git a/spec/hatchet/rails51_spec.rb b/spec/hatchet/rails51_spec.rb deleted file mode 100644 index 12e0b2332..000000000 --- a/spec/hatchet/rails51_spec.rb +++ /dev/null @@ -1,11 +0,0 @@ -require "spec_helper" - -describe "Rails 5.1" do - it "works with webpacker + yarn (js friends)" do - Hatchet::Runner.new("rails51_webpacker").deploy do |app, heroku| - expect(app.output).to include("Installing yarn") - expect(app.output).to include("yarn install") - expect(app.run("rails -v")).to match("") - end - end -end diff --git a/spec/hatchet/rails5_spec.rb b/spec/hatchet/rails5_spec.rb index 0215ff38d..54fe7bc0c 100644 --- a/spec/hatchet/rails5_spec.rb +++ b/spec/hatchet/rails5_spec.rb @@ -29,3 +29,13 @@ end end end + +describe "Rails 5.1" do + it "works with webpacker + yarn (js friends)" do + Hatchet::Runner.new("rails51_webpacker").deploy do |app, heroku| + expect(app.output).to include("Installing yarn") + expect(app.output).to include("yarn install") + expect(app.run("rails -v")).to match("") + end + end +end diff --git a/spec/hatchet/rubies_spec.rb b/spec/hatchet/rubies_spec.rb index 8cffa26ef..c5bf47763 100644 --- a/spec/hatchet/rubies_spec.rb +++ b/spec/hatchet/rubies_spec.rb @@ -78,3 +78,22 @@ end end end + + +describe "Upgrading ruby apps" do + it "upgrades from 2.0.0 to 2.1.0", stack: :cedar do + app = Hatchet::Runner.new("default_ruby") + app.setup! + app.deploy do |app| + + `echo "" > Gemfile; echo "" > Gemfile.lock` + puts `env BUNDLE_GEMFILE=./Gemfile bundle install`.inspect + `echo "ruby '2.4.1'" > Gemfile` + `git add -A; git commit -m update-ruby` + app.push! + expect(app.output).to match("2.4.1") + expect(app.run("ruby -v")).to match("2.4.1") + expect(app.output).to match("Ruby version change detected") + end + end +end \ No newline at end of file diff --git a/spec/hatchet/ruby_spec.rb b/spec/hatchet/ruby_spec.rb index 23fac7fd4..da126efef 100644 --- a/spec/hatchet/ruby_spec.rb +++ b/spec/hatchet/ruby_spec.rb @@ -1,7 +1,6 @@ require_relative '../spec_helper' describe "Ruby apps" do - describe "running Ruby from outside the default dir" do it "works" do Hatchet::Runner.new('cd_ruby').deploy do |app| @@ -87,3 +86,38 @@ end end end + +describe "Raise errors on specific gems" do + it "should should raise on sqlite3" do + Hatchet::Runner.new("sqlite3_gemfile", allow_failure: true).deploy do |app| + expect(app).not_to be_deployed + expect(app.output).to include("Detected sqlite3 gem which is not supported") + expect(app.output).to include("devcenter.heroku.com/articles/sqlite3") + end + end +end + + + +describe "No Lockfile" do + it "should not deploy" do + Hatchet::Runner.new("no_lockfile", allow_failure: true).deploy do |app| + expect(app).not_to be_deployed + expect(app.output).to include("Gemfile.lock required") + end + end +end + +describe "Rack" do + it "should not overwrite already set environment variables" do + custom_env = "FFFUUUUUUU" + app = Hatchet::Runner.new("default_ruby") + app.setup! + app.set_config("RACK_ENV" => custom_env) + expect(app.run("env")).to match(custom_env) + + app.deploy do |app| + expect(app.run("env")).to match(custom_env) + end + end +end diff --git a/spec/hatchet/upgrade_ruby_spec.rb b/spec/hatchet/upgrade_ruby_spec.rb deleted file mode 100644 index c3c117f02..000000000 --- a/spec/hatchet/upgrade_ruby_spec.rb +++ /dev/null @@ -1,19 +0,0 @@ -require 'spec_helper' - -describe "Upgrading ruby apps" do - it "upgrades from 2.0.0 to 2.1.0", stack: :cedar do - app = Hatchet::Runner.new("default_ruby") - app.setup! - app.deploy do |app| - - `echo "" > Gemfile; echo "" > Gemfile.lock` - puts `env BUNDLE_GEMFILE=./Gemfile bundle install`.inspect - `echo "ruby '2.4.1'" > Gemfile` - `git add -A; git commit -m update-ruby` - app.push! - expect(app.output).to match("2.4.1") - expect(app.run("ruby -v")).to match("2.4.1") - expect(app.output).to match("Ruby version change detected") - end - end -end diff --git a/spec/ruby_spec.rb b/spec/installers/yarn_installer_spec.rb similarity index 100% rename from spec/ruby_spec.rb rename to spec/installers/yarn_installer_spec.rb From edc3ffbd7451b78d0f3d7d1934c2c2a7aea9f3fe Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 2 May 2018 14:40:24 -0500 Subject: [PATCH 0471/1195] Might want to test Rails 5 --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 75e9b9dd9..db964c445 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,6 +22,7 @@ env: - TEST_SUITE=hatchet/rails23_spec.rb - TEST_SUITE=hatchet/rails3_spec.rb - TEST_SUITE=hatchet/rails4_spec.rb + - TEST_SUITE=hatchet/rails5_spec.rb - TEST_SUITE=hatchet/rubies_spec.rb - TEST_SUITE=hatchet/ruby_spec.rb - TEST_SUITE=hatchet/stack_spec.rb From 6572b027f2a9dc923312c0b50adc35001e0c5ae4 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 2 May 2018 15:30:03 -0500 Subject: [PATCH 0472/1195] Fix paths to test dirs --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index db964c445..7d83066a9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: ruby rvm: -- 2.4.3 +- 2.4.4 before_script: bundle exec rake hatchet:setup_travis script: bundle exec parallel_rspec -n 11 spec/$TEST_SUITE env: @@ -13,8 +13,8 @@ env: - secure: xFS5oLPMGyT6N0LKwU7wllaEZEVLzE/D5HuD14q3Vfd4L369XpV6ORYJF/2mkf765m+LH1MaN09rJaKc00ZcQfQECMuzyWagLsr1bVKs+szta3G/nFjjVTwmoPX5kVw5q7e6TYvS/KAzo+n8u5pW+zu8MMTwnv40QI6LfcbZkTc= - secure: wd/FBYI9I37PJ+eXhO8vesvWELkklNgGRA1xo/tuA31+ACpY/jG5EjrHd+semsfDTxM8fZe3s0foIch+jeMTIOcGs98tDC/L/8b/h6i0Qic0DqkAk6B30fT+5Nl3dufjiXsBJg5xj1zYqW6ka3DKIDjnn+3ao2cme05MtDQBHdc= matrix: - - TEST_SUITE=hatchet/helpers/ - - TEST_SUITE=hatchet/installers/ + - TEST_SUITE=helpers/ + - TEST_SUITE=installers/ - TEST_SUITE=hatchet/bugs_spec.rb - TEST_SUITE=hatchet/ci_spec.rb - TEST_SUITE=hatchet/jvm_spec.rb From ed657bb0894c56f983a05417371eab0aefa5bf35 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 2 May 2018 15:30:16 -0500 Subject: [PATCH 0473/1195] Fix Rails 4 specs --- hatchet.lock | 6 +++--- spec/hatchet/rails4_spec.rb | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hatchet.lock b/hatchet.lock index ac2c68be5..c6565e2a8 100644 --- a/hatchet.lock +++ b/hatchet.lock @@ -60,7 +60,7 @@ - - "./repos/rails3/railties3_mri_193" - 8cc041cffb9f5635017aa118d16688491f794e91 - - "./repos/rails4/rails3-to-4-no-bin" - - 95c14c6381edadd55eed294cd21149eae8e784ab + - 3fd6e84f5d8eaaadb6d95aeb1f367f62da28cc62 - - "./repos/rails4/rails4-env-assets-compile" - ba8c352856685c3e46ae227ffbc175d6aa8e868b - - "./repos/rails4/rails4-fail-assets-compile" @@ -70,9 +70,9 @@ - - "./repos/rails4/rails4_windows_mri193" - f4c7b6209835050468bbb87827acf652b8f4d8ce - - "./repos/rails41/rails41_scaffold" - - a16a04c3a36bfaf6178e92619bd24b21b9d440e7 + - d98e9ccee771b3745f1ab1936a697a05229392df - - "./repos/rails42/rails42_scaffold" - - e103fc313febe3aa94bd891b88181807bb5f4316 + - 5da1259651bf29b80af2bb27789422def02be5a8 - - "./repos/rails42/rails42_sprockets3_manifest" - 4ea4b080599b4394bdf6753a7b392d9ed6b844a7 - - "./repos/rails5/rails5" diff --git a/spec/hatchet/rails4_spec.rb b/spec/hatchet/rails4_spec.rb index c7cd84f33..9a26d2978 100644 --- a/spec/hatchet/rails4_spec.rb +++ b/spec/hatchet/rails4_spec.rb @@ -48,7 +48,7 @@ it "should detect rails successfully" do Hatchet::App.new('rails4-manifest').in_directory do - expect(LanguagePack::Rails42.use?).to eq(true) + expect(LanguagePack::Rails4.use?).to eq(true) end Hatchet::App.new('rails4-manifest').in_directory do expect(LanguagePack::Rails3.use?).to eq(false) From 82174aa5a550e8980493d88c6be0a59afd5a666c Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 2 May 2018 15:44:39 -0500 Subject: [PATCH 0474/1195] https://github.com/travis-ci/travis-ci/issues/9383 --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 7d83066a9..0c74496d0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,9 @@ language: ruby rvm: - 2.4.4 -before_script: bundle exec rake hatchet:setup_travis +before_script: + - gem install bundler -v 1.15.4 + - bundle exec rake hatchet:setup_travis script: bundle exec parallel_rspec -n 11 spec/$TEST_SUITE env: global: From 803314028bb092e605c9b4d7544e3d4d41044a39 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 2 May 2018 16:11:07 -0500 Subject: [PATCH 0475/1195] Rails 51 --- hatchet.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hatchet.lock b/hatchet.lock index c6565e2a8..2dd74adf0 100644 --- a/hatchet.lock +++ b/hatchet.lock @@ -78,7 +78,7 @@ - - "./repos/rails5/rails5" - 1680c5da829e03ffb9345187971a13e5109d86a6 - - "./repos/rails51/rails51_webpacker" - - 002ea4e0fce7b2b827ef7937c600743cc32fc901 + - 61ade71748b50effae7fd4aef2832ed0d89660e2 - - "./repos/rails52/active_storage_local" - a1b6b18e081001b407898532fb9cb061a29ceee1 - - "./repos/rails52/active_storage_non_local" From 9d32404b19801e057f6208a811d0a7f376dbc86a Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 2 May 2018 16:13:20 -0500 Subject: [PATCH 0476/1195] Travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0c74496d0..01e5fb105 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ language: ruby rvm: - 2.4.4 before_script: - - gem install bundler -v 1.15.4 + - gem install bundler -v 1.16.1 - bundle exec rake hatchet:setup_travis script: bundle exec parallel_rspec -n 11 spec/$TEST_SUITE env: From 48f25883e2002a3d6ba4da119b5832396a364248 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 8 May 2018 21:27:44 -0400 Subject: [PATCH 0477/1195] Disable listing check for disabling cops For a backstory see https://github.com/bbatsov/rubocop/issues/4459 You can configure rubocop to error out when anyone disables rubocop errors. Which is fine, except the Ruby buildpack needs to do that. We needed a way to disable that check, so this feature was added https://github.com/bbatsov/rubocop/pull/4938. This PR is using that feature to hopefully allow anyone to deploy and not get errors from rubocop. --- lib/language_pack/test/rails2.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/language_pack/test/rails2.rb b/lib/language_pack/test/rails2.rb index 17cacdd8b..11481b23a 100644 --- a/lib/language_pack/test/rails2.rb +++ b/lib/language_pack/test/rails2.rb @@ -36,6 +36,7 @@ def db_test_tasks_to_clear def clear_db_test_tasks FileUtils::mkdir_p 'lib/tasks' File.open("lib/tasks/heroku_clear_tasks.rake", "w") do |file| + file.puts "# rubocop:disable Lint/UnneededDisable" file.puts "# rubocop:disable all" content = db_test_tasks_to_clear.map do |task_name| <<-FILE @@ -47,6 +48,7 @@ def clear_db_test_tasks FILE end.join("\n") file.print content + file.puts "# rubocop:enable Lint/UnneededDisable" file.puts "# rubocop:enable all" end end From bd47adc0021f9dbf927a0ad8955ec53861ebe3ec Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 16 May 2018 12:10:46 -0500 Subject: [PATCH 0478/1195] Use correct disable enable directive name https://github.com/bbatsov/rubocop/pull/4938#issuecomment-388754900 --- lib/language_pack/test/rails2.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/language_pack/test/rails2.rb b/lib/language_pack/test/rails2.rb index 11481b23a..6eb6b8eba 100644 --- a/lib/language_pack/test/rails2.rb +++ b/lib/language_pack/test/rails2.rb @@ -36,7 +36,7 @@ def db_test_tasks_to_clear def clear_db_test_tasks FileUtils::mkdir_p 'lib/tasks' File.open("lib/tasks/heroku_clear_tasks.rake", "w") do |file| - file.puts "# rubocop:disable Lint/UnneededDisable" + file.puts "# rubocop:disable Lint/UnneededCopDisableDirective" file.puts "# rubocop:disable all" content = db_test_tasks_to_clear.map do |task_name| <<-FILE @@ -48,8 +48,8 @@ def clear_db_test_tasks FILE end.join("\n") file.print content - file.puts "# rubocop:enable Lint/UnneededDisable" file.puts "# rubocop:enable all" + file.puts "# rubocop:enable Lint/UnneededCopDisableDirective" end end From e27bc72db9113cb04ebf257ade03e3c2a363098b Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 16 May 2018 17:28:50 -0500 Subject: [PATCH 0479/1195] Introduce RailsRunner helper object Allows us to detect multiple rails configurations while only having to pay the penalty of booting Rails once. The time spent booting rails via `rails runner` should also be drastically reduced in more recent versions of Rails with the use of spring and boot snap. This PR also introduces a second configuration based warning for Rails users who are using compile set to true due to runtime performance implications and odd behavior resulting in support tickets. --- hatchet.lock | 2 +- lib/language_pack.rb | 1 + lib/language_pack/helpers/rails_runner.rb | 93 +++++++++++++++++++++++ lib/language_pack/rails2.rb | 5 ++ lib/language_pack/rails3.rb | 25 ++++++ lib/language_pack/rails5.rb | 12 ++- lib/language_pack/ruby.rb | 4 + spec/hatchet/rails5_spec.rb | 7 +- spec/helpers/rails_runner_spec.rb | 17 +++++ 9 files changed, 158 insertions(+), 8 deletions(-) create mode 100644 lib/language_pack/helpers/rails_runner.rb create mode 100644 spec/helpers/rails_runner_spec.rb diff --git a/hatchet.lock b/hatchet.lock index 2dd74adf0..3443a9fec 100644 --- a/hatchet.lock +++ b/hatchet.lock @@ -80,7 +80,7 @@ - - "./repos/rails51/rails51_webpacker" - 61ade71748b50effae7fd4aef2832ed0d89660e2 - - "./repos/rails52/active_storage_local" - - a1b6b18e081001b407898532fb9cb061a29ceee1 + - 98c6675cf97059278709cf75030e28063e0228d2 - - "./repos/rails52/active_storage_non_local" - cba59b7559f1f806684b65654228d44fcda91a82 - - "./repos/rake/asset_precompile_fail" diff --git a/lib/language_pack.rb b/lib/language_pack.rb index 4bbe201a7..c096774bf 100644 --- a/lib/language_pack.rb +++ b/lib/language_pack.rb @@ -32,6 +32,7 @@ def self.detect(*args) require "language_pack/helpers/plugin_installer" require "language_pack/helpers/stale_file_cleaner" require "language_pack/helpers/rake_runner" +require "language_pack/helpers/rails_runner" require "language_pack/helpers/bundler_wrapper" require "language_pack/installers/ruby_installer" require "language_pack/installers/heroku_ruby_installer" diff --git a/lib/language_pack/helpers/rails_runner.rb b/lib/language_pack/helpers/rails_runner.rb new file mode 100644 index 000000000..39f5b664f --- /dev/null +++ b/lib/language_pack/helpers/rails_runner.rb @@ -0,0 +1,93 @@ +# This class is used for running `rails runner` against +# apps, primarially for the intention of detecting configuration. +# +# The main benefit of this class is that multiple config +# queries can be grouped together so the application only +# has to be booted once. Calling `did_match` on a +# RailsConfig object will trigger the `rails runner` command +# to be executed. +# +# Example usage: +# +# rails_config = RailsRunner.new +# local_storage = rails_config.detect("active_storage.service") +# assets_compile = rails_config.detect("assets.compile") +# +# local_storage.success? # => true +# local_storage.did_match?("local") # => false +# +# assets_compile.success? # => true +# assets_compile.did_match?("false") # => true +# +class LanguagePack::Helpers::RailsRunner + # This class is used to help pull configuration values + # from a rails application. It takes in a configuration key + # and a reference to the parent RailsRunner object which + # allows it obtain the `rails runner` output and success + # status of the operation. + # + # For example: + # + # config = RailsConfig.new("active_storage.service", rails_runner) + # config.to_command # => "puts %Q{heroku.detecting.config.for.active_storage.service=Rails.application.config.try(:active_storage).try(:service)}; " + # + class RailsConfig + def initialize(config, rails_runner) + @rails_runner = rails_runner + @config = config + @heroku_key = "heroku.detecting.config.for.#{config}" + @rails_config = String.new('#{Rails.application.config') + config.split('.').each do |part| + @rails_config << ".try(:#{part})" + end + @rails_config << '}' + end + + def success? + rails_runner.success? && rails_runner.output =~ %r(#{heroku_key}) + end + + def did_match?(val) + rails_runner.output =~ %r(#{heroku_key}=#{val}) + end + + def to_command + "begin; puts %Q{#{@heroku_key}=#{@rails_config}}; rescue; end;" + end + end + + include LanguagePack::ShellHelpers + + def initialize + @command_array = [] + @output = "" + @success = false + end + + def detect(config_string) + config = RailsConfig.new(config_string, self) + @command_array << config.to_command + config + end + + def output + @output ||= call + end + + def success? + output && @success + end + + def command + %Q{rails runner "#{@command_array.join(' ')}"} + end + + private + + def call + out = run(command, user_env: true) + @success = $?.success? + out + end +end + diff --git a/lib/language_pack/rails2.rb b/lib/language_pack/rails2.rb index 656e65eef..e4209af8e 100644 --- a/lib/language_pack/rails2.rb +++ b/lib/language_pack/rails2.rb @@ -16,6 +16,11 @@ def self.use? end end + def initialize + super + @rails_runner = LanguagePack::Helpers::RailsRunner.new + end + def name "Ruby/Rails" end diff --git a/lib/language_pack/rails3.rb b/lib/language_pack/rails3.rb index 4ec822645..7f7761b6a 100644 --- a/lib/language_pack/rails3.rb +++ b/lib/language_pack/rails3.rb @@ -45,6 +45,31 @@ def compile private + def config_detect + super + @assets_compile_config = @rails_runner.detect("assets.compile") + end + + def best_practice_warnings + super + if assets_compile_enabled? + mcount("warn.assets.compile.true") + warn(<<-WARNING) +You set your `config.assets.compile = true` in production. +This can negatively impact the performance of your application. + +For more information can be found in this article: + https://devcenter.heroku.com/articles/rails-asset-pipeline#compile-set-to-true-in-production + +WARNING + end + end + + def assets_compile_enabled? + return false unless @assets_compile_config.success? + @assets_compile_config.has_match?("true") + end + def install_plugins instrument "rails3.install_plugins" do return false if bundler.has_gem?('rails_12factor') diff --git a/lib/language_pack/rails5.rb b/lib/language_pack/rails5.rb index b2114d0c0..b849ac7c4 100644 --- a/lib/language_pack/rails5.rb +++ b/lib/language_pack/rails5.rb @@ -40,6 +40,12 @@ def best_practice_warnings end private + + def config_detect + super + @local_storage_config = @rails_runner.detect("active_storage.service") + end + def has_ffmpeg? run("which ffmpeg") return $?.success? @@ -50,10 +56,8 @@ def needs_ffmpeg? end def local_storage? - command = 'bin/rails runner "puts %Q{heroku_detecting_active_storage_config=#{Rails.application.config.try(:active_storage).try(:service)}}"' - out = run(command, user_env: true) - return false unless $?.success? - out =~ /heroku_detecting_active_storage_config=local/ + return false unless @local_storage_config.success? + @local_storage_config.has_match?("local") end def warn_local_storage diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 43d5c9799..43bc300e1 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -108,11 +108,15 @@ def compile install_binaries run_assets_precompile_rake_task end + config_detect best_practice_warnings super end end + def config_detect + end + private def warn_bundler_upgrade diff --git a/spec/hatchet/rails5_spec.rb b/spec/hatchet/rails5_spec.rb index 54fe7bc0c..caa4ca982 100644 --- a/spec/hatchet/rails5_spec.rb +++ b/spec/hatchet/rails5_spec.rb @@ -19,12 +19,13 @@ Hatchet::Runner.new( "active_storage_local", buildpacks: [ - # "https://github.com/heroku/heroku-buildpack-activestorage-preview", + "https://github.com/heroku/heroku-buildpack-activestorage-preview", Hatchet::App.default_buildpack ] ).deploy do |app, heroku| - expect(app.output).to match('binary dependencies required') - expect(app.output).to match('config.active_storage.service') + expect(app.output).to_not match('binary dependencies required') + expect(app.output).to match('config.active_storage.service') + expect(app.output).to match('config.assets.compile = true') end end end diff --git a/spec/helpers/rails_runner_spec.rb b/spec/helpers/rails_runner_spec.rb new file mode 100644 index 000000000..70a7d6317 --- /dev/null +++ b/spec/helpers/rails_runner_spec.rb @@ -0,0 +1,17 @@ +require 'spec_helper' + +describe "Rails Runner" do + it "config objects build propperly formatted commands" do + rails_runner = LanguagePack::Helpers::RailsRunner.new + local_storage = rails_runner.detect("active_storage.service") + + expected = 'rails runner "begin; puts %Q{heroku.detecting.config.for.active_storage.service=#{Rails.application.config.try(:active_storage).try(:service)}}; rescue; end;"' + expect(rails_runner.command).to eq(expected) + + rails_runner.detect("assets.compile") + + + expected = 'rails runner "begin; puts %Q{heroku.detecting.config.for.active_storage.service=#{Rails.application.config.try(:active_storage).try(:service)}}; rescue; end; begin; puts %Q{heroku.detecting.config.for.assets.compile=#{Rails.application.config.try(:assets).try(:compile)}}; rescue; end;"' + expect(rails_runner.command).to eq(expected) + end +end From 4e43bf5d9da5c5a453432adbf3293e09a6058650 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 17 May 2018 09:05:39 -0500 Subject: [PATCH 0480/1195] =?UTF-8?q?Bundler=201.16.2=20because=20?= =?UTF-8?q?=F0=9F=A4=B7=E2=80=8D=E2=99=82=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 01e5fb105..5e527b62f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ language: ruby rvm: - 2.4.4 before_script: - - gem install bundler -v 1.16.1 + - gem install bundler -v 1.16.2 - bundle exec rake hatchet:setup_travis script: bundle exec parallel_rspec -n 11 spec/$TEST_SUITE env: From b899b3726dad7ec5c39339e85c2875356ba9736c Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 17 May 2018 09:48:08 -0500 Subject: [PATCH 0481/1195] Use correct method signature --- lib/language_pack/rails2.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/language_pack/rails2.rb b/lib/language_pack/rails2.rb index e4209af8e..7c18ec672 100644 --- a/lib/language_pack/rails2.rb +++ b/lib/language_pack/rails2.rb @@ -16,8 +16,8 @@ def self.use? end end - def initialize - super + def initialize(build_path, cache_path=nil) + super(build_path, cache_path) @rails_runner = LanguagePack::Helpers::RailsRunner.new end From 375436efacca59130d4a331ac4c2872e99de54dd Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 17 May 2018 10:32:02 -0500 Subject: [PATCH 0482/1195] Freeze string literals --- lib/language_pack/helpers/rails_runner.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/language_pack/helpers/rails_runner.rb b/lib/language_pack/helpers/rails_runner.rb index 39f5b664f..0394a1b78 100644 --- a/lib/language_pack/helpers/rails_runner.rb +++ b/lib/language_pack/helpers/rails_runner.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # This class is used for running `rails runner` against # apps, primarially for the intention of detecting configuration. # From 973607801dbb0e8dcaab7aacf111c124a0044d7c Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 17 May 2018 10:33:38 -0500 Subject: [PATCH 0483/1195] Make rails config more obvious --- lib/language_pack/helpers/rails_runner.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/language_pack/helpers/rails_runner.rb b/lib/language_pack/helpers/rails_runner.rb index 0394a1b78..301428b63 100644 --- a/lib/language_pack/helpers/rails_runner.rb +++ b/lib/language_pack/helpers/rails_runner.rb @@ -38,7 +38,8 @@ def initialize(config, rails_runner) @rails_runner = rails_runner @config = config @heroku_key = "heroku.detecting.config.for.#{config}" - @rails_config = String.new('#{Rails.application.config') + @rails_config = String.new('#{') + @rails_config << 'Rails.application.config' config.split('.').each do |part| @rails_config << ".try(:#{part})" end From 09f203436a36b05f0bc9d972cebe8964e2441b43 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 17 May 2018 10:33:52 -0500 Subject: [PATCH 0484/1195] Use correct instance variable --- lib/language_pack/helpers/rails_runner.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/language_pack/helpers/rails_runner.rb b/lib/language_pack/helpers/rails_runner.rb index 301428b63..771457915 100644 --- a/lib/language_pack/helpers/rails_runner.rb +++ b/lib/language_pack/helpers/rails_runner.rb @@ -47,11 +47,11 @@ def initialize(config, rails_runner) end def success? - rails_runner.success? && rails_runner.output =~ %r(#{heroku_key}) + @rails_runner.success? && @rails_runner.output =~ %r(#{heroku_key}) end def did_match?(val) - rails_runner.output =~ %r(#{heroku_key}=#{val}) + @rails_runner.output =~ %r(#{heroku_key}=#{val}) end def to_command From f28965e38bd87c933905ef4708db8b19c7f96033 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 17 May 2018 10:34:21 -0500 Subject: [PATCH 0485/1195] Make RailsConfig `to_command` more composable --- lib/language_pack/helpers/rails_runner.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/language_pack/helpers/rails_runner.rb b/lib/language_pack/helpers/rails_runner.rb index 771457915..796550439 100644 --- a/lib/language_pack/helpers/rails_runner.rb +++ b/lib/language_pack/helpers/rails_runner.rb @@ -55,7 +55,12 @@ def did_match?(val) end def to_command - "begin; puts %Q{#{@heroku_key}=#{@rails_config}}; rescue; end;" + cmd = String.new('begin; ') + cmd << 'puts %Q{' + cmd << "#{@heroku_key}=#{@rails_config}" + cmd << '}; ' + cmd << 'rescue; end;' + cmd end end @@ -88,6 +93,7 @@ def command private def call + topic("Detecting rails configuration") out = run(command, user_env: true) @success = $?.success? out From 1f136c31a5dfcdd4dfa5bf5fb1b47266facb92ee Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 17 May 2018 11:25:09 -0500 Subject: [PATCH 0486/1195] Allow debugging RailsRunner tasks --- lib/language_pack/helpers/rails_runner.rb | 15 ++++++++++++--- spec/hatchet/rails5_spec.rb | 7 +++++-- spec/helpers/rails_runner_spec.rb | 5 ++--- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/lib/language_pack/helpers/rails_runner.rb b/lib/language_pack/helpers/rails_runner.rb index 796550439..ebe0f4b6d 100644 --- a/lib/language_pack/helpers/rails_runner.rb +++ b/lib/language_pack/helpers/rails_runner.rb @@ -34,7 +34,9 @@ class LanguagePack::Helpers::RailsRunner # config.to_command # => "puts %Q{heroku.detecting.config.for.active_storage.service=Rails.application.config.try(:active_storage).try(:service)}; " # class RailsConfig - def initialize(config, rails_runner) + + def initialize(config, rails_runner, options={}) + @debug = options[:debug] @rails_runner = rails_runner @config = config @heroku_key = "heroku.detecting.config.for.#{config}" @@ -59,7 +61,9 @@ def to_command cmd << 'puts %Q{' cmd << "#{@heroku_key}=#{@rails_config}" cmd << '}; ' - cmd << 'rescue; end;' + cmd << 'rescue => e; ' + cmd << 'puts e; puts e.backtrace; ' if @debug + cmd << 'end;' cmd end end @@ -70,10 +74,11 @@ def initialize @command_array = [] @output = "" @success = false + @debug = env('HEROKU_DEBUG_RAILS_RUNNER') end def detect(config_string) - config = RailsConfig.new(config_string, self) + config = RailsConfig.new(config_string, self, debug: @debug) @command_array << config.to_command config end @@ -96,6 +101,10 @@ def call topic("Detecting rails configuration") out = run(command, user_env: true) @success = $?.success? + if @debug + puts "$ #{command}" + puts out + end out end end diff --git a/spec/hatchet/rails5_spec.rb b/spec/hatchet/rails5_spec.rb index caa4ca982..c60834bdb 100644 --- a/spec/hatchet/rails5_spec.rb +++ b/spec/hatchet/rails5_spec.rb @@ -16,13 +16,16 @@ end it "local storage warnings" do - Hatchet::Runner.new( + app = Hatchet::Runner.new( "active_storage_local", buildpacks: [ "https://github.com/heroku/heroku-buildpack-activestorage-preview", Hatchet::App.default_buildpack ] - ).deploy do |app, heroku| + ) + app.setup! + app.set_config('HEROKU_DEBUG_RAILS_RUNNER' => 'true') + app.deploy do |app, heroku| expect(app.output).to_not match('binary dependencies required') expect(app.output).to match('config.active_storage.service') expect(app.output).to match('config.assets.compile = true') diff --git a/spec/helpers/rails_runner_spec.rb b/spec/helpers/rails_runner_spec.rb index 70a7d6317..ddce6f271 100644 --- a/spec/helpers/rails_runner_spec.rb +++ b/spec/helpers/rails_runner_spec.rb @@ -5,13 +5,12 @@ rails_runner = LanguagePack::Helpers::RailsRunner.new local_storage = rails_runner.detect("active_storage.service") - expected = 'rails runner "begin; puts %Q{heroku.detecting.config.for.active_storage.service=#{Rails.application.config.try(:active_storage).try(:service)}}; rescue; end;"' + expected = 'rails runner "begin; puts %Q{heroku.detecting.config.for.active_storage.service=#{Rails.application.config.try(:active_storage).try(:service)}}; rescue => e; end;"' expect(rails_runner.command).to eq(expected) rails_runner.detect("assets.compile") - - expected = 'rails runner "begin; puts %Q{heroku.detecting.config.for.active_storage.service=#{Rails.application.config.try(:active_storage).try(:service)}}; rescue; end; begin; puts %Q{heroku.detecting.config.for.assets.compile=#{Rails.application.config.try(:assets).try(:compile)}}; rescue; end;"' + expected = 'rails runner "begin; puts %Q{heroku.detecting.config.for.active_storage.service=#{Rails.application.config.try(:active_storage).try(:service)}}; rescue => e; end; begin; puts %Q{heroku.detecting.config.for.assets.compile=#{Rails.application.config.try(:assets).try(:compile)}}; rescue => e; end;"' expect(rails_runner.command).to eq(expected) end end From 355db567fdf735718814696042e413435ffc4bb3 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 17 May 2018 11:59:40 -0500 Subject: [PATCH 0487/1195] Debugging --- lib/language_pack/helpers/rails_runner.rb | 4 ++++ lib/language_pack/rails3.rb | 5 +++-- lib/language_pack/rails5.rb | 13 +++++++------ 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/lib/language_pack/helpers/rails_runner.rb b/lib/language_pack/helpers/rails_runner.rb index ebe0f4b6d..55f80f675 100644 --- a/lib/language_pack/helpers/rails_runner.rb +++ b/lib/language_pack/helpers/rails_runner.rb @@ -75,15 +75,18 @@ def initialize @output = "" @success = false @debug = env('HEROKU_DEBUG_RAILS_RUNNER') + puts "DELETEME: debug is #{@debug}" end def detect(config_string) + puts "DELETEME: Detecting #{config_string}" config = RailsConfig.new(config_string, self, debug: @debug) @command_array << config.to_command config end def output + puts "DELETEME: getting output" @output ||= call end @@ -98,6 +101,7 @@ def command private def call + puts "DELETEME: calling call" topic("Detecting rails configuration") out = run(command, user_env: true) @success = $?.success? diff --git a/lib/language_pack/rails3.rb b/lib/language_pack/rails3.rb index 7f7761b6a..f87ca6c7e 100644 --- a/lib/language_pack/rails3.rb +++ b/lib/language_pack/rails3.rb @@ -43,10 +43,9 @@ def compile end end -private - def config_detect super + puts "DELETEME: about to detect assets compile" @assets_compile_config = @rails_runner.detect("assets.compile") end @@ -65,6 +64,8 @@ def best_practice_warnings end end +private + def assets_compile_enabled? return false unless @assets_compile_config.success? @assets_compile_config.has_match?("true") diff --git a/lib/language_pack/rails5.rb b/lib/language_pack/rails5.rb index b849ac7c4..98ed8ac58 100644 --- a/lib/language_pack/rails5.rb +++ b/lib/language_pack/rails5.rb @@ -31,6 +31,12 @@ def install_plugins # do not install plugins, do not call super, do not warn end + def config_detect + super + puts "DELETEME: about to detect local storage" + @local_storage_config = @rails_runner.detect("active_storage.service") + end + def best_practice_warnings return unless bundler.has_gem?("activestorage") return unless File.exist?("config/storage.yml") @@ -40,12 +46,6 @@ def best_practice_warnings end private - - def config_detect - super - @local_storage_config = @rails_runner.detect("active_storage.service") - end - def has_ffmpeg? run("which ffmpeg") return $?.success? @@ -56,6 +56,7 @@ def needs_ffmpeg? end def local_storage? + puts "DELETEME: checking for success" return false unless @local_storage_config.success? @local_storage_config.has_match?("local") end From c9d9b9963f7a873133544cc86700cf27d7f86632 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 17 May 2018 12:33:20 -0500 Subject: [PATCH 0488/1195] Fix output memoization --- lib/language_pack/helpers/rails_runner.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/language_pack/helpers/rails_runner.rb b/lib/language_pack/helpers/rails_runner.rb index 55f80f675..338d899f3 100644 --- a/lib/language_pack/helpers/rails_runner.rb +++ b/lib/language_pack/helpers/rails_runner.rb @@ -72,9 +72,9 @@ def to_command def initialize @command_array = [] - @output = "" - @success = false - @debug = env('HEROKU_DEBUG_RAILS_RUNNER') + @output = nil + @success = false + @debug = env('HEROKU_DEBUG_RAILS_RUNNER') puts "DELETEME: debug is #{@debug}" end From 6ac6f79cb59ca20d6a53f3eb71dff9f3229e509d Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 17 May 2018 12:36:08 -0500 Subject: [PATCH 0489/1195] Use instance variable --- lib/language_pack/helpers/rails_runner.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/language_pack/helpers/rails_runner.rb b/lib/language_pack/helpers/rails_runner.rb index 338d899f3..a0eb3f947 100644 --- a/lib/language_pack/helpers/rails_runner.rb +++ b/lib/language_pack/helpers/rails_runner.rb @@ -49,11 +49,11 @@ def initialize(config, rails_runner, options={}) end def success? - @rails_runner.success? && @rails_runner.output =~ %r(#{heroku_key}) + @rails_runner.success? && @rails_runner.output =~ %r(#{@heroku_key}) end def did_match?(val) - @rails_runner.output =~ %r(#{heroku_key}=#{val}) + @rails_runner.output =~ %r(#{@heroku_key}=#{val}) end def to_command From 9c526ec1fcbb2a316ce884999bc44591dcb39300 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 17 May 2018 12:36:14 -0500 Subject: [PATCH 0490/1195] Remove debugging --- lib/language_pack/helpers/rails_runner.rb | 4 ---- lib/language_pack/rails3.rb | 1 - lib/language_pack/rails5.rb | 2 -- 3 files changed, 7 deletions(-) diff --git a/lib/language_pack/helpers/rails_runner.rb b/lib/language_pack/helpers/rails_runner.rb index a0eb3f947..65a578234 100644 --- a/lib/language_pack/helpers/rails_runner.rb +++ b/lib/language_pack/helpers/rails_runner.rb @@ -75,18 +75,15 @@ def initialize @output = nil @success = false @debug = env('HEROKU_DEBUG_RAILS_RUNNER') - puts "DELETEME: debug is #{@debug}" end def detect(config_string) - puts "DELETEME: Detecting #{config_string}" config = RailsConfig.new(config_string, self, debug: @debug) @command_array << config.to_command config end def output - puts "DELETEME: getting output" @output ||= call end @@ -101,7 +98,6 @@ def command private def call - puts "DELETEME: calling call" topic("Detecting rails configuration") out = run(command, user_env: true) @success = $?.success? diff --git a/lib/language_pack/rails3.rb b/lib/language_pack/rails3.rb index f87ca6c7e..3ca19a879 100644 --- a/lib/language_pack/rails3.rb +++ b/lib/language_pack/rails3.rb @@ -45,7 +45,6 @@ def compile def config_detect super - puts "DELETEME: about to detect assets compile" @assets_compile_config = @rails_runner.detect("assets.compile") end diff --git a/lib/language_pack/rails5.rb b/lib/language_pack/rails5.rb index 98ed8ac58..623444bf1 100644 --- a/lib/language_pack/rails5.rb +++ b/lib/language_pack/rails5.rb @@ -33,7 +33,6 @@ def install_plugins def config_detect super - puts "DELETEME: about to detect local storage" @local_storage_config = @rails_runner.detect("active_storage.service") end @@ -56,7 +55,6 @@ def needs_ffmpeg? end def local_storage? - puts "DELETEME: checking for success" return false unless @local_storage_config.success? @local_storage_config.has_match?("local") end From fe5af753965db9e6b33939dc047a5070b43df344 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 17 May 2018 12:38:17 -0500 Subject: [PATCH 0491/1195] Use correct method --- lib/language_pack/rails3.rb | 2 +- lib/language_pack/rails5.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/language_pack/rails3.rb b/lib/language_pack/rails3.rb index 3ca19a879..6c520fee3 100644 --- a/lib/language_pack/rails3.rb +++ b/lib/language_pack/rails3.rb @@ -67,7 +67,7 @@ def best_practice_warnings def assets_compile_enabled? return false unless @assets_compile_config.success? - @assets_compile_config.has_match?("true") + @assets_compile_config.did_match?("true") end def install_plugins diff --git a/lib/language_pack/rails5.rb b/lib/language_pack/rails5.rb index 623444bf1..4d2b51346 100644 --- a/lib/language_pack/rails5.rb +++ b/lib/language_pack/rails5.rb @@ -56,7 +56,7 @@ def needs_ffmpeg? def local_storage? return false unless @local_storage_config.success? - @local_storage_config.has_match?("local") + @local_storage_config.did_match?("local") end def warn_local_storage From 45d631d20912e9f486fe3bf3e641c9706a473194 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 17 May 2018 13:11:18 -0500 Subject: [PATCH 0492/1195] Debugging --- lib/language_pack/rails3.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/language_pack/rails3.rb b/lib/language_pack/rails3.rb index 6c520fee3..0feea47a0 100644 --- a/lib/language_pack/rails3.rb +++ b/lib/language_pack/rails3.rb @@ -66,6 +66,10 @@ def best_practice_warnings private def assets_compile_enabled? + puts "DELETEME Assets compile enabled" + puts "DELETEME @assets_compile_config.success? #{@assets_compile_config.success?}" + puts "DELETEME @assets_compile_config.did_match?('true'): #{@assets_compile_config.did_match?("true")}" + return false unless @assets_compile_config.success? @assets_compile_config.did_match?("true") end From 491f08d14af1fa53aecf462443464a79fb352660 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 17 May 2018 13:14:39 -0500 Subject: [PATCH 0493/1195] Call super --- lib/language_pack/rails5.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/language_pack/rails5.rb b/lib/language_pack/rails5.rb index 4d2b51346..f3d24f526 100644 --- a/lib/language_pack/rails5.rb +++ b/lib/language_pack/rails5.rb @@ -37,6 +37,7 @@ def config_detect end def best_practice_warnings + super return unless bundler.has_gem?("activestorage") return unless File.exist?("config/storage.yml") From 23219acbb00e41cc239338d9b502e013c8a8dfc4 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 17 May 2018 13:47:09 -0500 Subject: [PATCH 0494/1195] Remove debugging --- lib/language_pack/rails3.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/language_pack/rails3.rb b/lib/language_pack/rails3.rb index 0feea47a0..6c520fee3 100644 --- a/lib/language_pack/rails3.rb +++ b/lib/language_pack/rails3.rb @@ -66,10 +66,6 @@ def best_practice_warnings private def assets_compile_enabled? - puts "DELETEME Assets compile enabled" - puts "DELETEME @assets_compile_config.success? #{@assets_compile_config.success?}" - puts "DELETEME @assets_compile_config.did_match?('true'): #{@assets_compile_config.did_match?("true")}" - return false unless @assets_compile_config.success? @assets_compile_config.did_match?("true") end From cecedcff64ea02c2139799ede0c55c45ff2a3ca7 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 17 May 2018 13:47:26 -0500 Subject: [PATCH 0495/1195] Initialize all instance variables up front --- lib/language_pack/helpers/rails_runner.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/helpers/rails_runner.rb b/lib/language_pack/helpers/rails_runner.rb index 65a578234..bf9a96f36 100644 --- a/lib/language_pack/helpers/rails_runner.rb +++ b/lib/language_pack/helpers/rails_runner.rb @@ -34,11 +34,11 @@ class LanguagePack::Helpers::RailsRunner # config.to_command # => "puts %Q{heroku.detecting.config.for.active_storage.service=Rails.application.config.try(:active_storage).try(:service)}; " # class RailsConfig - def initialize(config, rails_runner, options={}) @debug = options[:debug] @rails_runner = rails_runner @config = config + @success = nil @heroku_key = "heroku.detecting.config.for.#{config}" @rails_config = String.new('#{') @rails_config << 'Rails.application.config' From 53c96e3c7b2bce1a9e4520730c4404fbefd22613 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 17 May 2018 13:47:37 -0500 Subject: [PATCH 0496/1195] Additional RailsRunner unit test --- spec/helpers/rails_runner_spec.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/spec/helpers/rails_runner_spec.rb b/spec/helpers/rails_runner_spec.rb index ddce6f271..1b662c56e 100644 --- a/spec/helpers/rails_runner_spec.rb +++ b/spec/helpers/rails_runner_spec.rb @@ -13,4 +13,19 @@ expected = 'rails runner "begin; puts %Q{heroku.detecting.config.for.active_storage.service=#{Rails.application.config.try(:active_storage).try(:service)}}; rescue => e; end; begin; puts %Q{heroku.detecting.config.for.assets.compile=#{Rails.application.config.try(:assets).try(:compile)}}; rescue => e; end;"' expect(rails_runner.command).to eq(expected) end + + it "calls run through child object" do + rails_runner = LanguagePack::Helpers::RailsRunner.new + def rails_runner.call; @called ||= 0 ; @called += 1; end + def rails_runner.called; @called; end + + local_storage = rails_runner.detect("active_storage.service") + local_storage.success? + expect(rails_runner.called).to eq(1) + + local_storage.success? + local_storage.did_match?("foo") + expect(rails_runner.called).to eq(1) + end end + From d42350ae6d7eada59471aabf89a0fcbbdd39c627 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 17 May 2018 13:50:26 -0500 Subject: [PATCH 0497/1195] Re-order variables --- lib/language_pack/helpers/rails_runner.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/language_pack/helpers/rails_runner.rb b/lib/language_pack/helpers/rails_runner.rb index bf9a96f36..15a3eb1a9 100644 --- a/lib/language_pack/helpers/rails_runner.rb +++ b/lib/language_pack/helpers/rails_runner.rb @@ -35,11 +35,13 @@ class LanguagePack::Helpers::RailsRunner # class RailsConfig def initialize(config, rails_runner, options={}) - @debug = options[:debug] - @rails_runner = rails_runner @config = config + @rails_runner = rails_runner + @debug = options[:debug] + @success = nil @heroku_key = "heroku.detecting.config.for.#{config}" + @rails_config = String.new('#{') @rails_config << 'Rails.application.config' config.split('.').each do |part| From bff2be17d64c9f635caf94a273c0edecbe014ee0 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 17 May 2018 13:50:56 -0500 Subject: [PATCH 0498/1195] Test HEROKU_DEBUG_RAILS_RUNNER functionality --- spec/hatchet/rails5_spec.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spec/hatchet/rails5_spec.rb b/spec/hatchet/rails5_spec.rb index c60834bdb..36adf4b91 100644 --- a/spec/hatchet/rails5_spec.rb +++ b/spec/hatchet/rails5_spec.rb @@ -12,6 +12,7 @@ Hatchet::Runner.new("active_storage_non_local").deploy do |app, heroku| expect(app.output).to match('binary dependencies required') expect(app.output).to_not match('config.active_storage.service') + expect(app.output).to_not match(/\$ rails runner/) end end @@ -29,6 +30,7 @@ expect(app.output).to_not match('binary dependencies required') expect(app.output).to match('config.active_storage.service') expect(app.output).to match('config.assets.compile = true') + expect(app.output).to match(/\$ rails runner/) end end end From 39085a27e25441cd14f570400ebf1e845c207d2e Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Fri, 27 Jan 2017 14:10:47 -0600 Subject: [PATCH 0499/1195] configure buildpack processor --- buildpack.toml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 buildpack.toml diff --git a/buildpack.toml b/buildpack.toml new file mode 100644 index 000000000..0cd32aa51 --- /dev/null +++ b/buildpack.toml @@ -0,0 +1,11 @@ +[[Vendor]] +# get tokens for logging build tokens +url = "https://codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/ruby.tgz" +dir = "." +files = [".env"] +[[Vendor]] +url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/cedar-14/ruby-2.2.6.tgz" +dir = "vendor/ruby/cedar-14" +[[Vendor]] +url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-16/ruby-2.2.6.tgz" +dir = "vendor/ruby/heroku-16" From f8140769b8621c890c37bfbdf435878d1ac23857 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Fri, 27 Jan 2017 17:57:53 -0600 Subject: [PATCH 0500/1195] update to new buildpack.toml format --- buildpack.toml | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/buildpack.toml b/buildpack.toml index 0cd32aa51..385fbecf5 100644 --- a/buildpack.toml +++ b/buildpack.toml @@ -1,11 +1,21 @@ -[[Vendor]] -# get tokens for logging build tokens -url = "https://codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/ruby.tgz" -dir = "." -files = [".env"] -[[Vendor]] -url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/cedar-14/ruby-2.2.6.tgz" -dir = "vendor/ruby/cedar-14" -[[Vendor]] -url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-16/ruby-2.2.6.tgz" -dir = "vendor/ruby/heroku-16" +[buildpack] +name = "Ruby" + + [post.Ignore] + files = [ + "spec/" + ] + + [[post.Vendor]] + # get tokens for logging build tokens + url = "https://codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/ruby.tgz" + dir = "." + files = [".env"] + [[post.Vendor]] + # vendor ruby for the buildpack, cedar-14 + url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/cedar-14/ruby-2.2.6.tgz" + dir = "vendor/ruby/cedar-14" + [[post.Vendor]] + # vendor ruby for the buildpack, cedar-14 + url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-16/ruby-2.2.6.tgz" + dir = "vendor/ruby/heroku-16" From 38f69586538f9630f0ccee4fafeebe5638c09297 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Mon, 30 Jan 2017 11:34:49 -0600 Subject: [PATCH 0501/1195] change post processing namespace to publish --- buildpack.toml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/buildpack.toml b/buildpack.toml index 385fbecf5..dd8d02bf2 100644 --- a/buildpack.toml +++ b/buildpack.toml @@ -1,21 +1,21 @@ [buildpack] name = "Ruby" - [post.Ignore] + [publish.Ignore] files = [ "spec/" ] - [[post.Vendor]] + [[publish.Vendor]] # get tokens for logging build tokens url = "https://codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/ruby.tgz" dir = "." files = [".env"] - [[post.Vendor]] + [[publish.Vendor]] # vendor ruby for the buildpack, cedar-14 url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/cedar-14/ruby-2.2.6.tgz" dir = "vendor/ruby/cedar-14" - [[post.Vendor]] + [[publish.Vendor]] # vendor ruby for the buildpack, cedar-14 url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-16/ruby-2.2.6.tgz" dir = "vendor/ruby/heroku-16" From f5d2339b335805058f7d4f27b70d496d1027c4d7 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 30 May 2018 11:28:33 -0500 Subject: [PATCH 0502/1195] Skip circle builds --- circle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/circle.yml b/circle.yml index a5fe0e42a..7deddc457 100644 --- a/circle.yml +++ b/circle.yml @@ -13,4 +13,4 @@ test: - heroku --version - bundle exec rake hatchet:setup_travis override: - - bundle exec parallel_rspec -n 11 spec/ + - exit 0 # bundle exec parallel_rspec -n 11 spec/ From 2f65b6670229e7fdabc9dcc3a14cacfe663308f6 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 30 May 2018 12:46:33 -0500 Subject: [PATCH 0503/1195] v184 --- CHANGELOG.md | 4 ++++ lib/language_pack/version.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 45e50eb7c..079cba2b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Master +## v184 (5/30/2018) + +* Default Ruby version is now 2.4.4 (#734) + ## v183 (4/26/2018) * Support for not yet released heroku-18 stack (#750) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 17d91cacb..7165649d3 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v183" + BUILDPACK_VERSION = "v184" end end From c82b421a9726f8a51d79187ef3cfa9d221f6cef7 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 30 May 2018 20:44:11 -0500 Subject: [PATCH 0504/1195] Update buildpack.toml - Add heroku-18 stack - Use latest Ruby version --- buildpack.toml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/buildpack.toml b/buildpack.toml index dd8d02bf2..cfb1aa8a3 100644 --- a/buildpack.toml +++ b/buildpack.toml @@ -12,10 +12,11 @@ name = "Ruby" dir = "." files = [".env"] [[publish.Vendor]] - # vendor ruby for the buildpack, cedar-14 - url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/cedar-14/ruby-2.2.6.tgz" + url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/cedar-14/ruby-2.5.1.tgz" dir = "vendor/ruby/cedar-14" [[publish.Vendor]] - # vendor ruby for the buildpack, cedar-14 - url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-16/ruby-2.2.6.tgz" + url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-16/ruby-2.5.1.tgz" dir = "vendor/ruby/heroku-16" + [[publish.Vendor]] + url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-18/ruby-2.5.1.tgz" + dir = "vendor/ruby/heroku-18" From c901b1a92fd0ae49fa9a410c7e309e738962ef17 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 31 May 2018 10:45:41 -0500 Subject: [PATCH 0505/1195] v185 --- CHANGELOG.md | 4 ++++ lib/language_pack/version.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 079cba2b7..b40144945 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Master +## v185 (5/31/2018) + +* The Ruby buildpack bootstrap Ruby version is now 2.5.1. This is not a customer facing feature (#765) + ## v184 (5/30/2018) * Default Ruby version is now 2.4.4 (#734) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 7165649d3..bbd534e4b 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v184" + BUILDPACK_VERSION = "v185" end end From 4b2f8f1a36f67b788d57a62de4114ccf3a162fd0 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 31 May 2018 12:44:44 -0500 Subject: [PATCH 0506/1195] Provide explicit directory for file location The `.env` file is inside of the `./` directory. --- buildpack.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildpack.toml b/buildpack.toml index cfb1aa8a3..48e130b06 100644 --- a/buildpack.toml +++ b/buildpack.toml @@ -10,7 +10,7 @@ name = "Ruby" # get tokens for logging build tokens url = "https://codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/ruby.tgz" dir = "." - files = [".env"] + files = ["./.env"] [[publish.Vendor]] url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/cedar-14/ruby-2.5.1.tgz" dir = "vendor/ruby/cedar-14" From d00495b7b130da2f0b24df21296307db43eb9eb1 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 4 Jun 2018 14:12:01 -0500 Subject: [PATCH 0507/1195] Allow for Rails Runner timeout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It is assumed that all Rails apps can boot within 60 seconds since this is the timeout for binding to a processes. While testing this feature to a subset of Heroku users (on master branch) an issue came up where it appeared that this call would “hang” and prevent the build from succeeding. This should never happen. To prevent an indefinite hang, a timeout is added to the `rails runner call`. If it exceeds 65 seconds the task will fail. When this happens a warning will be emitted along with steps on how to debug (by adding `HEROKU_DEBUG_RAILS_RUNNER=1`) to config. Tests are added to this feature to simulate actually calling a `rails` executable. --- lib/language_pack/helpers/rails_runner.rb | 29 +++++++-- lib/language_pack/shell_helpers.rb | 5 +- spec/helpers/rails_runner_spec.rb | 78 +++++++++++++++++++++++ 3 files changed, 105 insertions(+), 7 deletions(-) diff --git a/lib/language_pack/helpers/rails_runner.rb b/lib/language_pack/helpers/rails_runner.rb index 15a3eb1a9..4db687323 100644 --- a/lib/language_pack/helpers/rails_runner.rb +++ b/lib/language_pack/helpers/rails_runner.rb @@ -72,11 +72,12 @@ def to_command include LanguagePack::ShellHelpers - def initialize + def initialize(debug = env('HEROKU_DEBUG_RAILS_RUNNER'), timeout = 65) @command_array = [] @output = nil @success = false - @debug = env('HEROKU_DEBUG_RAILS_RUNNER') + @debug = debug + @timeout = timeout # seconds end def detect(config_string) @@ -98,16 +99,34 @@ def command end private - def call topic("Detecting rails configuration") - out = run(command, user_env: true) - @success = $?.success? + out = execute_command! + if @debug puts "$ #{command}" puts out end out end + + def execute_command! + out = String.new + Timeout.timeout(@timeout) do + pipe(command, user_env: true, silent: true, buffer: out) + end + @success = $?.success? + + unless @success + warn("Detecting rails configuration failed\nset HEROKU_DEBUG_RAILS_RUNNER=1 to debug") + mcount("warn.rails.runner.fail") + end + return out + rescue Timeout::Error + @success = false + warn("Detecting rails configuration timeout\nset HEROKU_DEBUG_RAILS_RUNNER=1 to debug") + mcount("warn.rails.runner.timeout") + return out + end end diff --git a/lib/language_pack/shell_helpers.rb b/lib/language_pack/shell_helpers.rb index 1f8937586..89f8e3473 100644 --- a/lib/language_pack/shell_helpers.rb +++ b/lib/language_pack/shell_helpers.rb @@ -108,12 +108,13 @@ def command_options_to_string(command, options) # run a shell command and stream the output # @param [String] command to be run def pipe(command, options = {}) - output = "" + output = options[:buffer] || "" + silent = options[:silent] IO.popen(command_options_to_string(command, options)) do |io| until io.eof? buffer = io.gets output << buffer - puts buffer + puts buffer unless silent end end diff --git a/spec/helpers/rails_runner_spec.rb b/spec/helpers/rails_runner_spec.rb index 1b662c56e..2b71ad509 100644 --- a/spec/helpers/rails_runner_spec.rb +++ b/spec/helpers/rails_runner_spec.rb @@ -27,5 +27,83 @@ def rails_runner.called; @called; end local_storage.did_match?("foo") expect(rails_runner.called).to eq(1) end + + it "calls a mock interface" do + Dir.mktmpdir do |tmpdir| + Dir.chdir(tmpdir) do + mock_rails_runner + expect(File.executable?("bin/rails")).to eq(true) + + rails_runner = LanguagePack::Helpers::RailsRunner.new + local_storage = rails_runner.detect("active_storage.service") + + expect(rails_runner.output).to match("heroku.detecting.config.for.active_storage.service=active_storage.service") + expect(rails_runner.success?).to be(true) + end + end + end + + it "timeout works as expected" do + Dir.mktmpdir do |tmpdir| + Dir.chdir(tmpdir) do + mock_rails_runner("sleep(0.05)") + + rails_runner = LanguagePack::Helpers::RailsRunner.new(false, 0.01) + local_storage = rails_runner.detect("active_storage.service") + + expect(rails_runner.success?).to eq(false) + end + end + end + + it "failure in one task does not cause another to fail" do + Dir.mktmpdir do |tmpdir| + Dir.chdir(tmpdir) do + mock_rails_runner('raise "bad" if value == :bad') + + rails_runner = LanguagePack::Helpers::RailsRunner.new(false, 1) + bad_value = rails_runner.detect("bad.value") + local_storage = rails_runner.detect("active_storage.service") + + expect(!!bad_value.success?).to eq(false) + expect(!!local_storage.success?).to eq(true) + end + end + end + + def mock_rails_runner(try_code = "") + executable_contents = <<-FILE +#!/usr/bin/env ruby + +require 'ostruct' + +class Object + def try(value) + $tried ||= [] + $tried << value + #{try_code} + $tried.join(".") + end +end + +module Rails; end + +def Rails.application + OpenStruct.new(config: Object.new) +end + +ARGV.shift # remove "runner" + +eval(ARGV.join(" ")) +FILE + FileUtils.mkdir("bin") + File.open("bin/rails", "w") { |f| f << executable_contents } + File.chmod(0777, "bin/rails") + ENV["PATH"] = "./bin/:#{ENV['PATH']}" unless ENV["PATH"].include?("./bin:") + + # BUILDPACK_LOG_FILE support for logging + FileUtils.mkdir("tmp") + FileUtils.touch("buildpack.log") + end end From 1ca448f0b3119e4d7296c1e4a0a24950d7de032c Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 5 Jun 2018 06:36:12 -0700 Subject: [PATCH 0508/1195] Only output debug instructions when not debugging --- lib/language_pack/helpers/rails_runner.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/language_pack/helpers/rails_runner.rb b/lib/language_pack/helpers/rails_runner.rb index 4db687323..fed13db3a 100644 --- a/lib/language_pack/helpers/rails_runner.rb +++ b/lib/language_pack/helpers/rails_runner.rb @@ -118,13 +118,17 @@ def execute_command! @success = $?.success? unless @success - warn("Detecting rails configuration failed\nset HEROKU_DEBUG_RAILS_RUNNER=1 to debug") + message = String.new("Detecting rails configuration failed\n") + message << "set HEROKU_DEBUG_RAILS_RUNNER=1 to debug" unless @debug + warn(message) mcount("warn.rails.runner.fail") end return out rescue Timeout::Error @success = false - warn("Detecting rails configuration timeout\nset HEROKU_DEBUG_RAILS_RUNNER=1 to debug") + message = String.new("Detecting rails configuration timeout\n") + message << "set HEROKU_DEBUG_RAILS_RUNNER=1 to debug" unless @debug + warn(message) mcount("warn.rails.runner.timeout") return out end From 1392ab697597c2ffb978c99d9e06620093249d26 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 5 Jun 2018 07:08:53 -0700 Subject: [PATCH 0509/1195] Better mock code with fewer monkey patches --- spec/helpers/rails_runner_spec.rb | 39 ++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/spec/helpers/rails_runner_spec.rb b/spec/helpers/rails_runner_spec.rb index 2b71ad509..f6964555e 100644 --- a/spec/helpers/rails_runner_spec.rb +++ b/spec/helpers/rails_runner_spec.rb @@ -36,8 +36,10 @@ def rails_runner.called; @called; end rails_runner = LanguagePack::Helpers::RailsRunner.new local_storage = rails_runner.detect("active_storage.service") + local_storage = rails_runner.detect("foo.bar") expect(rails_runner.output).to match("heroku.detecting.config.for.active_storage.service=active_storage.service") + expect(rails_runner.output).to match("heroku.detecting.config.for.foo.bar=foo.bar") expect(rails_runner.success?).to be(true) end end @@ -74,27 +76,38 @@ def rails_runner.called; @called; end def mock_rails_runner(try_code = "") executable_contents = <<-FILE #!/usr/bin/env ruby - require 'ostruct' -class Object +module Rails; end +def Rails.application + OpenStruct.new(config: TryMock.new) # Rails.application.config #=> TryMock instance +end + +# Mock object used to record calls +# for example: +# +# obj = Try.new +# obj.try(:active_storage).try(:service) +# puts obj.to_s # => "active_storage.service" +# +class TryMock + def initialize(array = []) + @try_array = array + end + def try(value) - $tried ||= [] - $tried << value + @try_array << value #{try_code} - $tried.join(".") + return TryMock.new(@try_array) end -end - -module Rails; end -def Rails.application - OpenStruct.new(config: Object.new) + def to_s + @try_array.join(".") + end end -ARGV.shift # remove "runner" - -eval(ARGV.join(" ")) +ARGV.shift # remove "runner" +eval(ARGV.join(" ")) # Execute command passed in FILE FileUtils.mkdir("bin") File.open("bin/rails", "w") { |f| f << executable_contents } From 54d2d9ad3780cdcaed28f1d4974d48323b20c189 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 12 Jun 2018 09:24:52 -0500 Subject: [PATCH 0510/1195] v186 --- CHANGELOG.md | 4 ++++ lib/language_pack/version.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b40144945..b1bbda981 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Master +## v186 (6/12/2018) + +* The Ruby buildpack can now detect Rails configuration in a project (#758 #770) + ## v185 (5/31/2018) * The Ruby buildpack bootstrap Ruby version is now 2.5.1. This is not a customer facing feature (#765) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index bbd534e4b..8607b948b 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v185" + BUILDPACK_VERSION = "v186" end end From 01494222ea27b71af1f34bd707c3234caa9672d8 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 13 Jun 2018 09:49:32 -0500 Subject: [PATCH 0511/1195] Fix spelling --- lib/language_pack/rails5.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/rails5.rb b/lib/language_pack/rails5.rb index f3d24f526..171407dd5 100644 --- a/lib/language_pack/rails5.rb +++ b/lib/language_pack/rails5.rb @@ -66,7 +66,7 @@ def warn_local_storage You set your `config.active_storage.service` to :local in production. If you are uploading files to this app, they will not persist after the app is restarted, on one-off dynos, or if the app has multiple dynos. -Heroku applications have an ephemeral files system. To +Heroku applications have an ephemeral file system. To persist uploaded files, please use a service such as S3 and update your Rails configuration. From f917f407e50afa405679c971a43f8055bbfe49e3 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 18 Jun 2018 12:24:52 -0500 Subject: [PATCH 0512/1195] Fail builds with known directory traversal config Fail builds for an application that is using a known vulnerable version of Sprockets and has enabled a setting that will allow for a directory traversal: ``` config.assets.compile = true # Enables security vulnerability ``` Applications can deploy again by either upgrading their version of sprockets or by disabling dynamic asset compilation via setting: ``` config.assets.compile = false # Disables security vulnerability ``` If an app really needs to deploy but cannot upgrade their sprockets version, then they should know they are at extreme risk. It should be assumed that all their credentials and source code is in the hands of an attacker. They can do this manually via replacing `heroku/ruby` with `https://github.com/heroku/heroku-buildpack-ruby#v186`, though note that this is should be temporary while a fix can be put in place, pinning to a specific buildpack version like this is not supported in the long term. --- lib/language_pack/rails3.rb | 39 +++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/lib/language_pack/rails3.rb b/lib/language_pack/rails3.rb index 6c520fee3..58a9c35d0 100644 --- a/lib/language_pack/rails3.rb +++ b/lib/language_pack/rails3.rb @@ -52,6 +52,29 @@ def best_practice_warnings super if assets_compile_enabled? mcount("warn.assets.compile.true") + + safe_sprockets_version_needed = sprocket_version_upgrade_needed + if safe_sprockets_version_needed + message = < Gem::Version.new("3") && + sprockets_version < Gem::Version.new("3.7.2") + return "3.7.2" + elsif sprockets_version > Gem::Version.new("4") && + sprockets_version < Gem::Version.new("4.0.0.beta8") + return "4.0.0.beta8" + else + return false + end + end + def assets_compile_enabled? return false unless @assets_compile_config.success? @assets_compile_config.did_match?("true") From 7cf6b6daef465968da5a627f1d2176dbc3b539d9 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 19 Jun 2018 10:53:10 -0500 Subject: [PATCH 0513/1195] Test vulnerability error logic. --- hatchet.json | 3 ++- hatchet.lock | 4 +++- spec/hatchet/rails5_spec.rb | 7 +++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/hatchet.json b/hatchet.json index 7b16ffb4b..a0af351ac 100644 --- a/hatchet.json +++ b/hatchet.json @@ -78,7 +78,8 @@ ], "rails52": [ "sharpstone/active_storage_non_local", - "sharpstone/active_storage_local" + "sharpstone/active_storage_local", + "sharpstone/sprockets_asset_compile_true" ], "multibuildpack": [ "sharpstone/node_multi" diff --git a/hatchet.lock b/hatchet.lock index 3443a9fec..7544bacb9 100644 --- a/hatchet.lock +++ b/hatchet.lock @@ -80,9 +80,11 @@ - - "./repos/rails51/rails51_webpacker" - 61ade71748b50effae7fd4aef2832ed0d89660e2 - - "./repos/rails52/active_storage_local" - - 98c6675cf97059278709cf75030e28063e0228d2 + - e2119af6ddd4bc21fda9bc7da6401e7aa256e38d - - "./repos/rails52/active_storage_non_local" - cba59b7559f1f806684b65654228d44fcda91a82 +- - "./repos/rails52/sprockets_asset_compile_true" + - 98c6675cf97059278709cf75030e28063e0228d2 - - "./repos/rake/asset_precompile_fail" - 16f7834331d6bb3fc5c284130b14eb1ff74d99d5 - - "./repos/rake/asset_precompile_not_found" diff --git a/spec/hatchet/rails5_spec.rb b/spec/hatchet/rails5_spec.rb index 36adf4b91..2f66a48ae 100644 --- a/spec/hatchet/rails5_spec.rb +++ b/spec/hatchet/rails5_spec.rb @@ -34,6 +34,13 @@ end end end + + it "blocks bads sprockets config with bad version" do + Hatchet::Runner.new("sprockets_asset_compile_true", allow_failure: true).deploy do |app, heroku| + expect(app.output).to match('A security vulnerability has been detected') + expect(app.output).to match('version "3.7.2"') + end + end end describe "Rails 5.1" do From a85bfb39e57493da0c00b28681eee68c9012bf72 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 19 Jun 2018 11:12:43 -0500 Subject: [PATCH 0514/1195] v187 --- CHANGELOG.md | 4 ++++ lib/language_pack/version.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b1bbda981..b1d25d4d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Master +## v187 (6/19/2018) + +* Prevent apps from deploying with known security vulnerability activated via config (#776) + ## v186 (6/12/2018) * The Ruby buildpack can now detect Rails configuration in a project (#758 #770) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 8607b948b..d22feb3a5 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v186" + BUILDPACK_VERSION = "v187" end end From fd0becc9bb1f3466831b30599362deddddeddc86 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 20 Jun 2018 13:40:54 -0500 Subject: [PATCH 0515/1195] Allow warnings to work with multiple classes As written warnings are expected to be directly on a buildpack class. This is not always the case, for example the `RailsRunner` object can warn. To fix this we need shared mutable state between everything that inherits from shell helpers. Since both instances and classes use these methods they should be shared between the two via a class variable. --- lib/language_pack/base.rb | 8 +++----- lib/language_pack/shell_helpers.rb | 16 ++++++++++++---- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/lib/language_pack/base.rb b/lib/language_pack/base.rb index 74f2cee39..2007a3aaf 100644 --- a/lib/language_pack/base.rb +++ b/lib/language_pack/base.rb @@ -34,8 +34,6 @@ def initialize(build_path, cache_path=nil) @metadata = LanguagePack::Metadata.new(@cache) @bundler_cache = LanguagePack::BundlerCache.new(@cache, @stack) @id = Digest::SHA1.hexdigest("#{Time.now.to_f}-#{rand(1000000)}")[0..10] - @warnings = [] - @deprecations = [] @fetchers = {:buildpack => LanguagePack::Fetcher.new(VENDOR_URL) } Dir.chdir build_path @@ -84,12 +82,12 @@ def compile write_release_yaml instrument 'base.compile' do Kernel.puts "" - @warnings.each do |warning| - Kernel.puts "###### WARNING:" + warnings.each do |warning| + Kernel.puts "###### WARNING:\n" puts warning Kernel.puts "" end - if @deprecations.any? + if deprecations.any? topic "DEPRECATIONS:" puts @deprecations.join("\n") end diff --git a/lib/language_pack/shell_helpers.rb b/lib/language_pack/shell_helpers.rb index 89f8e3473..a3cc5519e 100644 --- a/lib/language_pack/shell_helpers.rb +++ b/lib/language_pack/shell_helpers.rb @@ -12,6 +12,16 @@ def shellescape module LanguagePack module ShellHelpers @@user_env_hash = {} + @@warnings = [] + @@deprecations = [] + + def warnings + @@warnings + end + + def deprecations + @@deprecations + end def mcount(key, value = 1) private_log("count", key => value) @@ -157,8 +167,7 @@ def warn(message, options = {}) puts message Kernel.puts "" end - @warnings ||= [] - @warnings << message + warnings << message end def error(message) @@ -166,8 +175,7 @@ def error(message) end def deprecate(message) - @deprecations ||= [] - @deprecations << message + deprecations << message end def noshellescape(string) From ba71990e7f2cdf9f815e322faecfd097d8033293 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 19 Jun 2018 21:25:42 -0500 Subject: [PATCH 0516/1195] Fix Rails Runner timeout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit IO.popen cannot be timed out reliably: https://stackoverflow.com/questions/17237743/timeout-within-a-popen-works-but-popen-inside-a-timeout-doesnt We could instead use exec (i.e. backticks) and we can time it out. However, there’s a problem because this code: ``` require 'timeout' begin Timeout.timeout(1) do `ruby -e 'pid = Process.spawn("sleep 1000"); Process.wait(pid)'` end rescue Timeout::Error end ``` This code leaves a process lying around even though the parent process exits. The Heroku build system interprets a running process as a thing that we need to wait for and so the build never ends. To meet our needs we need: - To be able to reliably time out this command. - To provide debugging output for when the command fails or times out. - Not leave hanging processes around when the buildpack ends. One way that we can time out and not leave processes hanging is via `Process.spawn` ``` require 'timeout' begin Timeout.timeout(1) do @pid = Process.spawn(%Q{`ruby -e 'pid = Process.spawn("sleep 1000"); Process.wait(pid)'`}) Process.wait(@pid) end rescue Timeout::Error Process.kill("SIGTERM", @pid) end ``` When the timeout fires, the child process is killed. Now that we can stop a process, we need to be able to also log the output for debugging. The solution that I came up with is to tell the command to write to a file while it is running. If the command is killed via a timeout then the contents of the file are preserved and can be used for debugging. The updated timeout test fails on master, and passes on this branch. --- lib/language_pack/helpers/rails_runner.rb | 57 +++++++++++++++-------- lib/language_pack/shell_helpers.rb | 35 ++++++++++++++ spec/helpers/rails_runner_spec.rb | 18 +++++-- 3 files changed, 86 insertions(+), 24 deletions(-) diff --git a/lib/language_pack/helpers/rails_runner.rb b/lib/language_pack/helpers/rails_runner.rb index fed13db3a..5a8f04ccf 100644 --- a/lib/language_pack/helpers/rails_runner.rb +++ b/lib/language_pack/helpers/rails_runner.rb @@ -40,6 +40,7 @@ def initialize(config, rails_runner, options={}) @debug = options[:debug] @success = nil + @did_time_out = false @heroku_key = "heroku.detecting.config.for.#{config}" @rails_config = String.new('#{') @@ -77,7 +78,7 @@ def initialize(debug = env('HEROKU_DEBUG_RAILS_RUNNER'), timeout = 65) @output = nil @success = false @debug = debug - @timeout = timeout # seconds + @timeout_val = timeout # seconds end def detect(config_string) @@ -98,38 +99,54 @@ def command %Q{rails runner "#{@command_array.join(' ')}"} end + def timeout? + @did_time_out + end + private def call topic("Detecting rails configuration") + puts "$ #{command}" if @debug out = execute_command! - - if @debug - puts "$ #{command}" - puts out - end + puts out if @debug out end - def execute_command! - out = String.new - Timeout.timeout(@timeout) do - pipe(command, user_env: true, silent: true, buffer: out) - end - @success = $?.success? + def silent + return false if @debug + true + end - unless @success + def execute_command! + # Output is written to a file so if + # the process gets timed out, the contents of the file + # containing the partial output can be used for debugging + config_detect_file = Pathname.new("./.heroku/ruby/config_detect/rails.txt") + config_detect_file.dirname.mkpath + process = ProcessSpawn.new(command, + user_env: true, + timeout: @timeout_val, + out: ">> #{config_detect_file} 2>&1" + ) + process.call + process.wait_with_timeout + + out = config_detect_file.read + @success = process.success? + @did_time_out = process.timeout? + + if timeout? + message = String.new("Detecting rails configuration timeout\n") + message << "set HEROKU_DEBUG_RAILS_RUNNER=1 to debug" unless @debug + warn(message) + mcount("warn.rails.runner.timeout") + elsif !@success message = String.new("Detecting rails configuration failed\n") message << "set HEROKU_DEBUG_RAILS_RUNNER=1 to debug" unless @debug warn(message) mcount("warn.rails.runner.fail") end - return out - rescue Timeout::Error - @success = false - message = String.new("Detecting rails configuration timeout\n") - message << "set HEROKU_DEBUG_RAILS_RUNNER=1 to debug" unless @debug - warn(message) - mcount("warn.rails.runner.timeout") + return out end end diff --git a/lib/language_pack/shell_helpers.rb b/lib/language_pack/shell_helpers.rb index 89f8e3473..fe79aa753 100644 --- a/lib/language_pack/shell_helpers.rb +++ b/lib/language_pack/shell_helpers.rb @@ -105,6 +105,41 @@ def command_options_to_string(command, options) "/usr/bin/env #{env} bash -c #{command.shellescape} #{options[:out]} " end + class ProcessSpawn + include ShellHelpers + + def initialize(command, options = {}) + @timeout_value = options.delete(:timeout) + @command = command_options_to_string(command, options) + @did_time_out = false + @success = false + end + + def call + @pid ||= Process.spawn(@command) + end + + def timeout? + @did_time_out + end + + def success? + @success + end + + def wait_with_timeout + call + Timeout.timeout(@timeout_value) do + Process.wait(@pid) + @success = $?.success? + end + rescue Timeout::Error + Process.kill("SIGKILL", @pid) + @did_time_out = true + @success = false + end + end + # run a shell command and stream the output # @param [String] command to be run def pipe(command, options = {}) diff --git a/spec/helpers/rails_runner_spec.rb b/spec/helpers/rails_runner_spec.rb index f6964555e..797b7f6c2 100644 --- a/spec/helpers/rails_runner_spec.rb +++ b/spec/helpers/rails_runner_spec.rb @@ -48,12 +48,16 @@ def rails_runner.called; @called; end it "timeout works as expected" do Dir.mktmpdir do |tmpdir| Dir.chdir(tmpdir) do - mock_rails_runner("sleep(0.05)") + mock_rails_runner("pid = Process.spawn('sleep 5'); Process.wait(pid)") - rails_runner = LanguagePack::Helpers::RailsRunner.new(false, 0.01) - local_storage = rails_runner.detect("active_storage.service") + diff = time_it do + rails_runner = LanguagePack::Helpers::RailsRunner.new(false, 0.01) + local_storage = rails_runner.detect("active_storage.service") + expect(rails_runner.success?).to eq(false) + expect(rails_runner.timeout?).to eq(true) + end - expect(rails_runner.success?).to eq(false) + expect(diff < 1).to eq(true), "expected time difference #{diff} to be less than 1 second, but was longer" end end end @@ -73,6 +77,12 @@ def rails_runner.called; @called; end end end + def time_it + start = Time.now + yield + return Time.now - start + end + def mock_rails_runner(try_code = "") executable_contents = <<-FILE #!/usr/bin/env ruby From fd935762921cf9ec8af315a15a23b9e772c8ca3a Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 21 Jun 2018 11:02:40 -0500 Subject: [PATCH 0517/1195] Escape error messages before trying to use in shell. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When an exception gets raised that uses back-ticks it’s currently being passed directly to a shell unescaped. This means that the string gets executed. This commit fixes the issue by shell escaping the value. Here’s an example of the output a user sees in the wild: ``` remote: sh: 2: config.assets.compile: not found remote: ! A security vulnerability has been detected in your application. remote: ! To protect your application you must take action. Your application remote: ! is currently exposing its credentials via an easy to exploit directory remote: ! traversal. remote: ! remote: ! To protect your application you must either upgrade to Sprockets version "2.12.5" remote: ! or disable dynamic compilation at runtime by setting: remote: ! remote: ! ``` remote: ! config.assets.compile = false # Disables security vulnerability remote: ! ``` ``` --- lib/language_pack/base.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/language_pack/base.rb b/lib/language_pack/base.rb index 74f2cee39..bc7d75d97 100644 --- a/lib/language_pack/base.rb +++ b/lib/language_pack/base.rb @@ -136,8 +136,9 @@ def log(*args) log_internal args, :status => "complete", :finish => finish, :elapsed => (finish - start) return ret rescue StandardError => ex - finish = Time.now.to_f - log_internal args, :status => "error", :finish => finish, :elapsed => (finish - start), :message => ex.message + finish = Time.now.to_f + message = Shellwords.escape(ex.message) + log_internal args, :status => "error", :finish => finish, :elapsed => (finish - start), :message => message raise ex end end From b9fe1b3887af67136501ef3bb3e1ff984731e6c2 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 21 Jun 2018 11:16:26 -0500 Subject: [PATCH 0518/1195] Remove unused method --- lib/language_pack/helpers/rails_runner.rb | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lib/language_pack/helpers/rails_runner.rb b/lib/language_pack/helpers/rails_runner.rb index 5a8f04ccf..e9e6f4bd1 100644 --- a/lib/language_pack/helpers/rails_runner.rb +++ b/lib/language_pack/helpers/rails_runner.rb @@ -112,11 +112,6 @@ def call out end - def silent - return false if @debug - true - end - def execute_command! # Output is written to a file so if # the process gets timed out, the contents of the file From fa0b16f985f05b5f3c75814a59183570f0c899eb Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 21 Jun 2018 11:38:19 -0500 Subject: [PATCH 0519/1195] Polish up ProcessSpawn - Add docs with examples - Keep file logic inside of class - All inspection methods also trigger process to be spawned --- lib/language_pack/helpers/rails_runner.rb | 11 +---- lib/language_pack/shell_helpers.rb | 57 ++++++++++++++++++++--- 2 files changed, 53 insertions(+), 15 deletions(-) diff --git a/lib/language_pack/helpers/rails_runner.rb b/lib/language_pack/helpers/rails_runner.rb index e9e6f4bd1..facc21c7d 100644 --- a/lib/language_pack/helpers/rails_runner.rb +++ b/lib/language_pack/helpers/rails_runner.rb @@ -113,22 +113,15 @@ def call end def execute_command! - # Output is written to a file so if - # the process gets timed out, the contents of the file - # containing the partial output can be used for debugging - config_detect_file = Pathname.new("./.heroku/ruby/config_detect/rails.txt") - config_detect_file.dirname.mkpath process = ProcessSpawn.new(command, user_env: true, timeout: @timeout_val, - out: ">> #{config_detect_file} 2>&1" + file: "./.heroku/ruby/config_detect/rails.txt" ) - process.call - process.wait_with_timeout - out = config_detect_file.read @success = process.success? @did_time_out = process.timeout? + out = process.output if timeout? message = String.new("Detecting rails configuration timeout\n") diff --git a/lib/language_pack/shell_helpers.rb b/lib/language_pack/shell_helpers.rb index fe79aa753..df13afed6 100644 --- a/lib/language_pack/shell_helpers.rb +++ b/lib/language_pack/shell_helpers.rb @@ -105,38 +105,83 @@ def command_options_to_string(command, options) "/usr/bin/env #{env} bash -c #{command.shellescape} #{options[:out]} " end + # Class for running process spawn with a timeout + # + # Example: + # + # spawn = ProcessSpawn.new("echo 'hello'") + # spawn.success? # => true + # spawn.timeout? # => false + # + # If you want to get the output of the process, you will need to pass + # in a file: + # + # spawn = ProcessSpawn.new("echo 'hello'", file: "hello.txt") + # spawn.success? # => true + # spawn.output # => "hello" + # + # The main benefit of using a file is that even if the command fails + # or times out, there will still be partial results in the output file. + # + # To add a timeout, instantiate pass in a hash with a `timeout` key + # in seconds: + # + # spawn = ProcessSpawn.new("sleep 10", timeout: 4) + # spawn.success? # => false + # spawn.timeout? # => true + # class ProcessSpawn include ShellHelpers def initialize(command, options = {}) @timeout_value = options.delete(:timeout) + @file = options.delete(:file) + if @file + raise "Cannot specify :file, and :out" if options[:out] + @file = Pathname.new(@file) + @file.dirname.mkpath + options[:out] = ">> #{@file} 2>&1" + end + @command = command_options_to_string(command, options) @did_time_out = false @success = false end - def call - @pid ||= Process.spawn(@command) + def output + raise "no file name given" if @file.nil? + exec_once + @file.read end def timeout? + exec_once @did_time_out end def success? + exec_once @success end + private + def exec_once + return if @exec_once + @exec_once = true + wait_with_timeout + true + end + def wait_with_timeout - call + pid = Process.spawn(@command) Timeout.timeout(@timeout_value) do - Process.wait(@pid) + Process.wait(pid) @success = $?.success? end rescue Timeout::Error - Process.kill("SIGKILL", @pid) + Process.kill("SIGKILL", pid) @did_time_out = true - @success = false + @success = false end end From 2c77fdc9fa6c3abea5b392ef9368ffc41787348d Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 26 Jun 2018 10:02:40 -0500 Subject: [PATCH 0520/1195] v188 --- CHANGELOG.md | 4 ++++ lib/language_pack/version.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b1d25d4d0..2e62d072f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Master +## v188 (6/26/2018) + +* Fix rails config detect timeout. Addreses the process deadlock when detecting rails config that contains an infinite task. This was originally addressed in #770 but the implementation did not handle all cases. (#781) + ## v187 (6/19/2018) * Prevent apps from deploying with known security vulnerability activated via config (#776) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index d22feb3a5..c37604788 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v187" + BUILDPACK_VERSION = "v188" end end From 3e608ca7802fbefec1858064209b29f83c711715 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 2 Jul 2018 20:35:14 -0500 Subject: [PATCH 0521/1195] Colorize buildpack failures --- bin/support/ruby_compile | 11 +---------- bin/support/ruby_test-compile | 12 ++---------- lib/language_pack/shell_helpers.rb | 16 ++++++++++++++++ 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/bin/support/ruby_compile b/bin/support/ruby_compile index 2ab37427d..fe82b57b0 100755 --- a/bin/support/ruby_compile +++ b/bin/support/ruby_compile @@ -22,14 +22,5 @@ begin end end rescue Exception => e - Kernel.puts " !" - e.message.split("\n").each do |line| - Kernel.puts " ! #{line.strip}" - end - Kernel.puts " !" - if e.is_a?(BuildpackError) - exit 1 - else - raise e - end + LanguagePack::ShellHelpers.display_error_and_exit(e) end diff --git a/bin/support/ruby_test-compile b/bin/support/ruby_test-compile index 34e59463e..81b007c01 100755 --- a/bin/support/ruby_test-compile +++ b/bin/support/ruby_test-compile @@ -16,6 +16,7 @@ $:.unshift File.expand_path("../../../lib", __FILE__) require "language_pack" require "language_pack/shell_helpers" require "language_pack/test" +include LanguagePack::ShellHelpers begin LanguagePack::Instrument.trace 'test_compile', 'app.test_compile' do @@ -28,14 +29,5 @@ begin end end rescue Exception => e - Kernel.puts " !" - e.message.split("\n").each do |line| - Kernel.puts " ! #{line.strip}" - end - Kernel.puts " !" - if e.is_a?(BuildpackError) - exit 1 - else - raise e - end + LanguagePack::ShellHelpers.display_error_and_exit(e) end diff --git a/lib/language_pack/shell_helpers.rb b/lib/language_pack/shell_helpers.rb index f9992bb9d..9c9d36539 100644 --- a/lib/language_pack/shell_helpers.rb +++ b/lib/language_pack/shell_helpers.rb @@ -62,6 +62,22 @@ def self.initialize_env(path) end end + # Should only be used once in the top level script + # for example $ bin/support/ruby_compile + def self.display_error_and_exit(e) + Kernel.puts "\e[1m\e[31m" + Kernel.puts " !" + e.message.split("\n").each do |line| + Kernel.puts " ! #{line.strip}" + end + Kernel.puts " !\e[0m" + if e.is_a?(BuildpackError) + exit 1 + else + raise e + end + end + # run a shell command (deferring to #run), and raise an error if it fails # @param [String] command to be run # @return [String] result of #run From 451f9d53f7852c50ec0fcf2062afef622c412640 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 2 Jul 2018 20:49:57 -0500 Subject: [PATCH 0522/1195] Warn yellow --- lib/language_pack/base.rb | 3 ++- lib/language_pack/shell_helpers.rb | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/language_pack/base.rb b/lib/language_pack/base.rb index 82e38e316..3b758bd99 100644 --- a/lib/language_pack/base.rb +++ b/lib/language_pack/base.rb @@ -81,7 +81,7 @@ def default_process_types def compile write_release_yaml instrument 'base.compile' do - Kernel.puts "" + Kernel.puts "\e[1m\e[33m" # Bold yellow warnings.each do |warning| Kernel.puts "###### WARNING:\n" puts warning @@ -91,6 +91,7 @@ def compile topic "DEPRECATIONS:" puts @deprecations.join("\n") end + Kernel.puts "\e[0m" end mcount "success" end diff --git a/lib/language_pack/shell_helpers.rb b/lib/language_pack/shell_helpers.rb index 9c9d36539..4d9e8e2a1 100644 --- a/lib/language_pack/shell_helpers.rb +++ b/lib/language_pack/shell_helpers.rb @@ -65,7 +65,7 @@ def self.initialize_env(path) # Should only be used once in the top level script # for example $ bin/support/ruby_compile def self.display_error_and_exit(e) - Kernel.puts "\e[1m\e[31m" + Kernel.puts "\e[1m\e[31m" # Bold Red Kernel.puts " !" e.message.split("\n").each do |line| Kernel.puts " ! #{line.strip}" From 65cf344b74c1b9a891b068db9155b64c68d344a2 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 3 Jul 2018 12:53:43 -0500 Subject: [PATCH 0523/1195] Make inline warnings yellow too. --- lib/language_pack/shell_helpers.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/language_pack/shell_helpers.rb b/lib/language_pack/shell_helpers.rb index 4d9e8e2a1..d4d6ee39e 100644 --- a/lib/language_pack/shell_helpers.rb +++ b/lib/language_pack/shell_helpers.rb @@ -259,9 +259,10 @@ def puts(message) def warn(message, options = {}) if options.key?(:inline) ? options[:inline] : false - Kernel.puts "###### WARNING:" + Kernel.puts "\e[1m\e[33m" # Bold yellow + Kernel.puts "###### WARNING:\n" puts message - Kernel.puts "" + Kernel.puts "\e[0m" end warnings << message end From c81a2422c0548ee435c1180ced4d233929b7d94a Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 3 Jul 2018 14:13:10 -0500 Subject: [PATCH 0524/1195] Only highlight warning header --- lib/language_pack/base.rb | 7 ++++--- lib/language_pack/shell_helpers.rb | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/language_pack/base.rb b/lib/language_pack/base.rb index 3b758bd99..f95287388 100644 --- a/lib/language_pack/base.rb +++ b/lib/language_pack/base.rb @@ -81,9 +81,10 @@ def default_process_types def compile write_release_yaml instrument 'base.compile' do - Kernel.puts "\e[1m\e[33m" # Bold yellow + Kernel.puts "" warnings.each do |warning| - Kernel.puts "###### WARNING:\n" + Kernel.puts "\e[1m\e[33m###### WARNING:\e[0m"# Bold yellow + Kernel.puts "" puts warning Kernel.puts "" end @@ -91,7 +92,7 @@ def compile topic "DEPRECATIONS:" puts @deprecations.join("\n") end - Kernel.puts "\e[0m" + Kernel.puts "" end mcount "success" end diff --git a/lib/language_pack/shell_helpers.rb b/lib/language_pack/shell_helpers.rb index d4d6ee39e..52ab522d4 100644 --- a/lib/language_pack/shell_helpers.rb +++ b/lib/language_pack/shell_helpers.rb @@ -259,10 +259,11 @@ def puts(message) def warn(message, options = {}) if options.key?(:inline) ? options[:inline] : false - Kernel.puts "\e[1m\e[33m" # Bold yellow - Kernel.puts "###### WARNING:\n" + Kernel.puts "" + Kernel.puts "\e[1m\e[33m###### WARNING:\e[0m" # Bold yellow + Kernel.puts "" puts message - Kernel.puts "\e[0m" + Kernel.puts "" end warnings << message end From 6f0ca29565e2f3dd3f7efc14d2a7c499b7fda285 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 9 Jul 2018 14:36:57 -0500 Subject: [PATCH 0525/1195] v189 --- CHANGELOG.md | 4 ++++ lib/language_pack/version.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e62d072f..81a6545f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Master +## v189 (7/10/2018) + +* Colorize build failures and warnings. (https://github.com/heroku/heroku-buildpack-ruby/pull/788) + ## v188 (6/26/2018) * Fix rails config detect timeout. Addreses the process deadlock when detecting rails config that contains an infinite task. This was originally addressed in #770 but the implementation did not handle all cases. (#781) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index c37604788..af1f3c4fc 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v188" + BUILDPACK_VERSION = "v189" end end From 3791cef66f7631981715c8ce0cb2d08ffcf5bf7a Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 9 Jul 2018 11:22:56 -0500 Subject: [PATCH 0526/1195] Support TAP output for CI The TAP specification says that there should be no whitespace in front of output. The `pipe` command auto indents output so that it looks correct with the build output. This PR adds the ability to specify the object that is used for puts. We can pass in the `Kernel` object to force it to not indent output. Related support ticket: 605130 --- bin/support/ruby_test | 7 ++++++- lib/language_pack/shell_helpers.rb | 4 +++- spec/hatchet/ci_spec.rb | 4 +++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/bin/support/ruby_test b/bin/support/ruby_test index 23d958598..b138cf319 100755 --- a/bin/support/ruby_test +++ b/bin/support/ruby_test @@ -21,7 +21,12 @@ def execute_test(command) end def execute_command(command) - pipe(command, :user_env => true) + # Normally the `pipe` command will indent output so that it + # matches the build output, however in a test TAP depends on + # having no whitespace before output. To avoid adding whitespace + # for the original Kernel.puts to be used by passing in the + # Kernel object. + pipe(command, :user_env => true, :output_object => Kernel) end # $ bin/test BUILD_DIR ENV_DIR ARTIFACT_DIR diff --git a/lib/language_pack/shell_helpers.rb b/lib/language_pack/shell_helpers.rb index 52ab522d4..5de58edfb 100644 --- a/lib/language_pack/shell_helpers.rb +++ b/lib/language_pack/shell_helpers.rb @@ -216,11 +216,13 @@ def wait_with_timeout def pipe(command, options = {}) output = options[:buffer] || "" silent = options[:silent] + # self.puts uses the method defined in this file + output_object = options[:output_object] || self IO.popen(command_options_to_string(command, options)) do |io| until io.eof? buffer = io.gets output << buffer - puts buffer unless silent + output_object.puts(buffer) unless silent end end diff --git a/spec/hatchet/ci_spec.rb b/spec/hatchet/ci_spec.rb index 68fa7e3ef..3b1d2e230 100644 --- a/spec/hatchet/ci_spec.rb +++ b/spec/hatchet/ci_spec.rb @@ -27,7 +27,9 @@ it "Works with a vanilla ruby app" do Hatchet::Runner.new("ruby_no_rails_test").run_ci do |test_run| - # Expect success test run + # Test no whitespace in front of output + expect(test_run.output).to_not match(/^ +Finished in/) + expect(test_run.output).to match(/^Finished in/) end end From c290668f0b2ecd9833ef01c4685afe5946703289 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 24 Jul 2018 11:40:05 -0500 Subject: [PATCH 0527/1195] v190 --- CHANGELOG.md | 4 ++++ lib/language_pack/version.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 81a6545f8..31d796eaf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Master +## v190 (7/24/2018) + +* Support TAP output for Heroku CI (https://github.com/heroku/heroku-buildpack-ruby/pull/790). + ## v189 (7/10/2018) * Colorize build failures and warnings. (https://github.com/heroku/heroku-buildpack-ruby/pull/788) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index af1f3c4fc..617ffd73b 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -3,6 +3,6 @@ # This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v189" + BUILDPACK_VERSION = "v190" end end From 678caa0a5cd1e19e9518da9ad81fdcdf963c23c7 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 25 Jun 2018 11:04:40 -0500 Subject: [PATCH 0528/1195] Run tests on Heroku CI --- Gemfile | 1 + Gemfile.lock | 11 +++++++---- app.json | 27 +++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 4 deletions(-) create mode 100644 app.json diff --git a/Gemfile b/Gemfile index 270070c44..57db654ae 100644 --- a/Gemfile +++ b/Gemfile @@ -2,6 +2,7 @@ source "https://rubygems.org" group :development, :test do gem "heroku_hatchet" + gem "rspec-parts" # another alternative is http://docs.knapsackpro.com/ruby/knapsack gem "rspec-core" gem "rspec-expectations" gem "excon" diff --git a/Gemfile.lock b/Gemfile.lock index 936830ed8..6d97d6170 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -8,7 +8,7 @@ GIT GEM remote: https://rubygems.org/ specs: - activesupport (5.1.6) + activesupport (5.2.0) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) @@ -22,7 +22,7 @@ GEM excon moneta multi_json (>= 1.9.2) - heroku_hatchet (3.1.0) + heroku_hatchet (4.0.0) excon (~> 0) minitest-retry (~> 0.1.9) platform-api (~> 2) @@ -30,7 +30,7 @@ GEM rrrretry (~> 1) thor (~> 0) threaded (~> 0) - i18n (1.0.0) + i18n (1.0.1) concurrent-ruby (~> 1.0) json (2.0.4) minitest (5.11.3) @@ -54,6 +54,8 @@ GEM rspec-expectations (3.6.0) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.6.0) + rspec-parts (0.2.1) + rake rspec-retry (0.5.4) rspec-core (> 3.3, < 3.7) rspec-support (3.6.0) @@ -76,7 +78,8 @@ DEPENDENCIES rake rspec-core rspec-expectations + rspec-parts rspec-retry BUNDLED WITH - 1.16.1 + 1.16.2 diff --git a/app.json b/app.json new file mode 100644 index 000000000..177ec4839 --- /dev/null +++ b/app.json @@ -0,0 +1,27 @@ +{ + "name":"Heroku Buildpack Ruby", + "description":"The buildpack for Ruby", + "environments": { + "test": { + "env": { + "HATCHET_RETRIES": 3, + "IS_RUNNING_ON_CI": true, + "HATCHET_APP_LIMIT": 80, + "BUILDPACK_LOG_FILE": "tmp/buildpack.log" + }, + "formation": { + "test": { + "size": "performance-s", + "quantity": 16 + } + }, + "scripts": { + "test-setup": "bundle exec rake hatchet:setup_ci", + "test": "bundle exec rake spec:part[($CI_NODE_INDEX + 1),$CI_NODE_TOTAL]" + }, + "buildpacks": [ + { "url": "heroku/ruby" } + ] + } + } +} From 72072d0b4af3ee86518bdf95c022766e2cd735b4 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 25 Jun 2018 11:23:52 -0500 Subject: [PATCH 0529/1195] Env values must be strings --- app.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app.json b/app.json index 177ec4839..e60d76e31 100644 --- a/app.json +++ b/app.json @@ -4,14 +4,14 @@ "environments": { "test": { "env": { - "HATCHET_RETRIES": 3, - "IS_RUNNING_ON_CI": true, - "HATCHET_APP_LIMIT": 80, + "HATCHET_RETRIES": "3", + "IS_RUNNING_ON_CI": "true", + "HATCHET_APP_LIMIT": "80", "BUILDPACK_LOG_FILE": "tmp/buildpack.log" }, "formation": { "test": { - "size": "performance-s", + "size": "performance-s", "quantity": 16 } }, From 3a7e49ed65bf8c9ee1ecd92b93df97a615ed6ce4 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 25 Jun 2018 11:29:38 -0500 Subject: [PATCH 0530/1195] pef-m --- app.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.json b/app.json index e60d76e31..8e3035745 100644 --- a/app.json +++ b/app.json @@ -11,7 +11,7 @@ }, "formation": { "test": { - "size": "performance-s", + "size": "performance-m", "quantity": 16 } }, From e05668cc22c343c2a536f324429c16cd6e614b41 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 25 Jun 2018 11:57:09 -0500 Subject: [PATCH 0531/1195] Use knapsack MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rspec-parts doesn’t seem to work currently: https://github.com/hjhart/rspec-parts/issues/4 --- Gemfile | 2 +- Gemfile.lock | 6 +++--- Rakefile | 4 ++-- app.json | 2 +- knapsack_rspec_report.json | 4 ++++ spec/spec_helper.rb | 4 ++++ 6 files changed, 15 insertions(+), 7 deletions(-) create mode 100644 knapsack_rspec_report.json diff --git a/Gemfile b/Gemfile index 57db654ae..1a6921ff4 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source "https://rubygems.org" group :development, :test do gem "heroku_hatchet" - gem "rspec-parts" # another alternative is http://docs.knapsackpro.com/ruby/knapsack + gem "knapsack" gem "rspec-core" gem "rspec-expectations" gem "excon" diff --git a/Gemfile.lock b/Gemfile.lock index 6d97d6170..f2c2a4e62 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -33,6 +33,8 @@ GEM i18n (1.0.1) concurrent-ruby (~> 1.0) json (2.0.4) + knapsack (1.16.0) + rake minitest (5.11.3) minitest-retry (0.1.9) minitest (>= 5.0) @@ -54,8 +56,6 @@ GEM rspec-expectations (3.6.0) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.6.0) - rspec-parts (0.2.1) - rake rspec-retry (0.5.4) rspec-core (> 3.3, < 3.7) rspec-support (3.6.0) @@ -73,12 +73,12 @@ DEPENDENCIES git! heroku_hatchet json (~> 2.0.2) + knapsack netrc parallel_tests rake rspec-core rspec-expectations - rspec-parts rspec-retry BUNDLED WITH diff --git a/Rakefile b/Rakefile index 804a741c7..41c9a0011 100644 --- a/Rakefile +++ b/Rakefile @@ -1,7 +1,7 @@ require "fileutils" require "tmpdir" require 'hatchet/tasks' - +require 'knapsack' ENV["BUILDPACK_LOG_FILE"] ||= "tmp/buildpack.log" S3_BUCKET_NAME = "heroku-buildpack-ruby" @@ -310,4 +310,4 @@ begin rescue LoadError => e end - +Knapsack.load_tasks if defined?(Knapsack) diff --git a/app.json b/app.json index 8e3035745..210762cfe 100644 --- a/app.json +++ b/app.json @@ -17,7 +17,7 @@ }, "scripts": { "test-setup": "bundle exec rake hatchet:setup_ci", - "test": "bundle exec rake spec:part[($CI_NODE_INDEX + 1),$CI_NODE_TOTAL]" + "test": "bundle exec rake knapsack:rspec" }, "buildpacks": [ { "url": "heroku/ruby" } diff --git a/knapsack_rspec_report.json b/knapsack_rspec_report.json new file mode 100644 index 000000000..f6bceb284 --- /dev/null +++ b/knapsack_rspec_report.json @@ -0,0 +1,4 @@ +{ + "spec/hatchet/bugs_spec.rb": 83.60694026947021, + "spec/hatchet/ci_spec.rb": 184.3626697063446 +} \ No newline at end of file diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index e650dc779..b73e8ddaf 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -5,6 +5,10 @@ require 'rspec/retry' require 'language_pack' +require 'knapsack' + +Knapsack::Adapters::RSpecAdapter.bind + ENV['RACK_ENV'] = 'test' RSpec.configure do |config| From 282750ed8f337289c5a83f270f1b5e1420d2e572 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 25 Jun 2018 12:04:44 -0500 Subject: [PATCH 0532/1195] Export current branch name --- app.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.json b/app.json index 210762cfe..9773d6a49 100644 --- a/app.json +++ b/app.json @@ -17,7 +17,7 @@ }, "scripts": { "test-setup": "bundle exec rake hatchet:setup_ci", - "test": "bundle exec rake knapsack:rspec" + "test": "HATCHET_BUILDPACK_BRANCH=$HEROKU_TEST_RUN_BRANCH bundle exec rake knapsack:rspec" }, "buildpacks": [ { "url": "heroku/ruby" } From 31bc61791b4e14ca388aff414ee4a359e3341db7 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 25 Jun 2018 12:09:49 -0500 Subject: [PATCH 0533/1195] Install Git and heroku cli --- app.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app.json b/app.json index 9773d6a49..3f0ff1061 100644 --- a/app.json +++ b/app.json @@ -20,6 +20,8 @@ "test": "HATCHET_BUILDPACK_BRANCH=$HEROKU_TEST_RUN_BRANCH bundle exec rake knapsack:rspec" }, "buildpacks": [ + { "url": "https://github.com/schneems/heroku-buildpack-git" }, + { "url": "https://github.com/heroku/heroku-buildpack-cli.git" }, { "url": "heroku/ruby" } ] } From 22fb66ef8e21936fad2360866630db95ead97fe9 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 25 Jun 2018 12:27:36 -0500 Subject: [PATCH 0534/1195] Install git --- Aptfile | 1 + app.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 Aptfile diff --git a/Aptfile b/Aptfile new file mode 100644 index 000000000..5664e303b --- /dev/null +++ b/Aptfile @@ -0,0 +1 @@ +git diff --git a/app.json b/app.json index 3f0ff1061..17e896853 100644 --- a/app.json +++ b/app.json @@ -20,7 +20,7 @@ "test": "HATCHET_BUILDPACK_BRANCH=$HEROKU_TEST_RUN_BRANCH bundle exec rake knapsack:rspec" }, "buildpacks": [ - { "url": "https://github.com/schneems/heroku-buildpack-git" }, + { "url": "https://github.com/heroku/heroku-buildpack-apt" }, { "url": "https://github.com/heroku/heroku-buildpack-cli.git" }, { "url": "heroku/ruby" } ] From f94cbf81c54f8e277dae8c5bc780dff2c04798b8 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 25 Jun 2018 12:54:32 -0500 Subject: [PATCH 0535/1195] Fix upgrading ruby spec When trying to bundle with no Gemfile.lock you get this error: ``` our bundle only supports platforms [] but your local platforms are ["ruby", "x86_64-linux"], and there's no compatible match between those two lists. (Bundler::ProductionError) ``` This pr also replaces shell commands with ShelHelper commands that will fail if they get a bad status. --- spec/hatchet/rails4_spec.rb | 10 +++++----- spec/hatchet/rubies_spec.rb | 11 +++++------ spec/hatchet/stack_spec.rb | 4 ++-- spec/spec_helper.rb | 3 +++ 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/spec/hatchet/rails4_spec.rb b/spec/hatchet/rails4_spec.rb index 9a26d2978..d517a3c50 100644 --- a/spec/hatchet/rails4_spec.rb +++ b/spec/hatchet/rails4_spec.rb @@ -29,14 +29,14 @@ Hatchet::Runner.new("rails41_scaffold").deploy do |app, heroku| # First Deploy - `mkdir public/assets` - `echo #{string} > public/assets/file.txt` - `git add -A; git commit -m 'adding file.txt'` + run!(%Q{mkdir public/assets}) + run!(%Q{echo #{string} > public/assets/file.txt}) + run!(%Q{git add -A; git commit -m 'adding file.txt'}) app.push! # Second Deploy - `echo #{new_string} > public/assets/file.txt` - `git add -A; git commit -m 'updating file.txt'` + run!(%Q{echo #{new_string} > public/assets/file.txt}) + run!(%Q{git add -A; git commit -m 'updating file.txt'}) app.push! # Asserts diff --git a/spec/hatchet/rubies_spec.rb b/spec/hatchet/rubies_spec.rb index c5bf47763..50baf5cd2 100644 --- a/spec/hatchet/rubies_spec.rb +++ b/spec/hatchet/rubies_spec.rb @@ -51,7 +51,7 @@ expect(app.output).to match("JRUBY_OPTS is: -Xcompile.invokedynamic=false") expect(app.output).not_to include("OpenJDK 64-Bit Server VM warning") - `git commit -am "redeploy" --allow-empty` + run!('git commit -am "redeploy" --allow-empty') app.set_config("JRUBY_BUILD_OPTS" => "--dev") app.push! expect(app.output).to match("JRUBY_OPTS is: --dev") @@ -81,15 +81,14 @@ describe "Upgrading ruby apps" do - it "upgrades from 2.0.0 to 2.1.0", stack: :cedar do + it "works when changing from default version", stack: :cedar do app = Hatchet::Runner.new("default_ruby") app.setup! app.deploy do |app| - `echo "" > Gemfile; echo "" > Gemfile.lock` - puts `env BUNDLE_GEMFILE=./Gemfile bundle install`.inspect - `echo "ruby '2.4.1'" > Gemfile` - `git add -A; git commit -m update-ruby` + puts run!("env BUNDLE_GEMFILE=./Gemfile bundle install") + run!(%Q{echo "ruby '2.4.1'" >> Gemfile}) + run!("git add -A; git commit -m update-ruby") app.push! expect(app.output).to match("2.4.1") expect(app.run("ruby -v")).to match("2.4.1") diff --git a/spec/hatchet/stack_spec.rb b/spec/hatchet/stack_spec.rb index aca57790d..c0e4a8526 100644 --- a/spec/hatchet/stack_spec.rb +++ b/spec/hatchet/stack_spec.rb @@ -5,7 +5,7 @@ app = Hatchet::Runner.new('default_ruby', stack: "heroku-16").setup! app.deploy do |app, heroku| app.update_stack("cedar-14") - `git commit --allow-empty -m "cedar-14 migrate"` + run!('git commit --allow-empty -m "cedar-14 migrate"') app.push! puts app.output @@ -18,7 +18,7 @@ app = Hatchet::Runner.new('default_ruby', stack: "cedar-14").setup! app.deploy do |app, heroku| app.update_stack("cedar-14") - `git commit --allow-empty -m "cedar migrate"` + run!(%Q{git commit --allow-empty -m "cedar migrate}) app.push! puts app.output diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index b73e8ddaf..ccdba351f 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -4,6 +4,8 @@ require 'hatchet' require 'rspec/retry' require 'language_pack' +require 'language_pack/shell_helpers' +include LanguagePack::ShellHelpers require 'knapsack' @@ -53,3 +55,4 @@ def create_file_with_size_in(size, dir) # Don't execute tests against "merge" commits exit 0 if ENV['TRAVIS_PULL_REQUEST'] != 'false' && ENV['TRAVIS_BRANCH'] == 'master' end + From 1ad577d71e2c633ef565ce5a9f7fc8dd92d5cdf8 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 25 Jun 2018 13:00:29 -0500 Subject: [PATCH 0536/1195] Fix accidental quote truncation --- spec/hatchet/stack_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/hatchet/stack_spec.rb b/spec/hatchet/stack_spec.rb index c0e4a8526..fbff72df2 100644 --- a/spec/hatchet/stack_spec.rb +++ b/spec/hatchet/stack_spec.rb @@ -18,7 +18,7 @@ app = Hatchet::Runner.new('default_ruby', stack: "cedar-14").setup! app.deploy do |app, heroku| app.update_stack("cedar-14") - run!(%Q{git commit --allow-empty -m "cedar migrate}) + run!(%Q{git commit --allow-empty -m "cedar migrate"}) app.push! puts app.output From 71f9df2127f1add8ecd9c089cc7aee4bc900153c Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 25 Jun 2018 13:01:28 -0500 Subject: [PATCH 0537/1195] Update stack spec to not use cedar-14 --- spec/hatchet/stack_spec.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/hatchet/stack_spec.rb b/spec/hatchet/stack_spec.rb index fbff72df2..54389a023 100644 --- a/spec/hatchet/stack_spec.rb +++ b/spec/hatchet/stack_spec.rb @@ -2,10 +2,10 @@ describe "Stack Changes" do xit "should reinstall gems on stack change" do - app = Hatchet::Runner.new('default_ruby', stack: "heroku-16").setup! + app = Hatchet::Runner.new('default_ruby', stack: "heroku-18").setup! app.deploy do |app, heroku| - app.update_stack("cedar-14") - run!('git commit --allow-empty -m "cedar-14 migrate"') + app.update_stack("heroku-16") + run!('git commit --allow-empty -m "heroku-16 migrate"') app.push! puts app.output @@ -15,9 +15,9 @@ end it "should not reinstall gems if the stack did not change" do - app = Hatchet::Runner.new('default_ruby', stack: "cedar-14").setup! + app = Hatchet::Runner.new('default_ruby', stack: "heroku-16").setup! app.deploy do |app, heroku| - app.update_stack("cedar-14") + app.update_stack("heroku-16") run!(%Q{git commit --allow-empty -m "cedar migrate"}) app.push! From f6a5b232527de981c4cfb33f79d7e4095d8a66ef Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 25 Jun 2018 13:03:47 -0500 Subject: [PATCH 0538/1195] Better knapsack report Should help better shard tests. --- knapsack_rspec_report.json | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/knapsack_rspec_report.json b/knapsack_rspec_report.json index f6bceb284..1f5f76105 100644 --- a/knapsack_rspec_report.json +++ b/knapsack_rspec_report.json @@ -1,4 +1,26 @@ { - "spec/hatchet/bugs_spec.rb": 83.60694026947021, - "spec/hatchet/ci_spec.rb": 184.3626697063446 + "spec/hatchet/bugs_spec.rb": 79.58106851577759, + "spec/hatchet/ci_spec.rb": 347.8413245677948, + "spec/hatchet/jvm_spec.rb": 84.96137690544128, + "spec/hatchet/node_spec.rb": 125.81749081611633, + "spec/hatchet/rails23_spec.rb": 27.812206029891968, + "spec/hatchet/rails3_spec.rb": 216.98798823356628, + "spec/hatchet/rails4_spec.rb": 619.4272434711456, + "spec/hatchet/rails5_spec.rb": 369.15442943573, + "spec/hatchet/rubies_spec.rb": 379.7627942562103, + "spec/hatchet/ruby_spec.rb": 209.7765176296234, + "spec/hatchet/stack_spec.rb": 34.790956020355225, + "spec/helpers/bundler_wrapper_spec.rb": 12.007025480270386, + "spec/helpers/fetcher_spec.rb": 0.5906188488006592, + "spec/helpers/jvm_installer_spec.rb": 21.238383293151855, + "spec/helpers/node_installer_spec.rb": 1.4972991943359375, + "spec/helpers/rails_runner_spec.rb": 0.3340415954589844, + "spec/helpers/rake_runner_spec.rb": 13.79833722114563, + "spec/helpers/ruby_version_spec.rb": 24.048339366912842, + "spec/helpers/shell_spec.rb": 0.601851224899292, + "spec/helpers/stale_file_cleaner_spec.rb": 2.0138986110687256, + "spec/helpers/yarn_installer_spec.rb": 0.5951690673828125, + "spec/installers/heroku_ruby_installer_spec.rb": 7.419133901596069, + "spec/installers/rbx_installer_spec.rb": 8.129172086715698, + "spec/installers/yarn_installer_spec.rb": 0.6401379108428955 } \ No newline at end of file From 6cf581c43c535affbc91149ad923bdd3298ae24b Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 25 Jun 2018 13:09:39 -0500 Subject: [PATCH 0539/1195] Bundle install not needed since Gemfile.lock is not modified. --- spec/hatchet/rubies_spec.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/spec/hatchet/rubies_spec.rb b/spec/hatchet/rubies_spec.rb index 50baf5cd2..6661e3f27 100644 --- a/spec/hatchet/rubies_spec.rb +++ b/spec/hatchet/rubies_spec.rb @@ -85,8 +85,6 @@ app = Hatchet::Runner.new("default_ruby") app.setup! app.deploy do |app| - - puts run!("env BUNDLE_GEMFILE=./Gemfile bundle install") run!(%Q{echo "ruby '2.4.1'" >> Gemfile}) run!("git add -A; git commit -m update-ruby") app.push! From 3e9c6e9575740f398010fd798c4c876cfa17ce15 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 25 Jun 2018 13:12:03 -0500 Subject: [PATCH 0540/1195] Fix shell helpers spec --- spec/spec_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index ccdba351f..58467922e 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -5,7 +5,6 @@ require 'rspec/retry' require 'language_pack' require 'language_pack/shell_helpers' -include LanguagePack::ShellHelpers require 'knapsack' @@ -25,6 +24,8 @@ c.syntax = :expect end config.mock_with :nothing + config.include LanguagePack::ShellHelpers + end def git_repo @@ -43,7 +44,6 @@ def create_file_with_size_in(size, dir) Pathname.new name end - ReplRunner.register_commands(:console) do |config| config.terminate_command "exit" # the command you use to end the 'rails console' config.startup_timeout 60 # seconds to boot From 7e18ef6e43ccd238c092b0d83fda4818efeea60d Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 25 Jun 2018 14:13:37 -0500 Subject: [PATCH 0541/1195] Update knapsack report --- knapsack_rspec_report.json | 48 +++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/knapsack_rspec_report.json b/knapsack_rspec_report.json index 1f5f76105..1d60bb07f 100644 --- a/knapsack_rspec_report.json +++ b/knapsack_rspec_report.json @@ -1,26 +1,26 @@ { - "spec/hatchet/bugs_spec.rb": 79.58106851577759, - "spec/hatchet/ci_spec.rb": 347.8413245677948, - "spec/hatchet/jvm_spec.rb": 84.96137690544128, - "spec/hatchet/node_spec.rb": 125.81749081611633, - "spec/hatchet/rails23_spec.rb": 27.812206029891968, - "spec/hatchet/rails3_spec.rb": 216.98798823356628, - "spec/hatchet/rails4_spec.rb": 619.4272434711456, - "spec/hatchet/rails5_spec.rb": 369.15442943573, - "spec/hatchet/rubies_spec.rb": 379.7627942562103, - "spec/hatchet/ruby_spec.rb": 209.7765176296234, - "spec/hatchet/stack_spec.rb": 34.790956020355225, - "spec/helpers/bundler_wrapper_spec.rb": 12.007025480270386, - "spec/helpers/fetcher_spec.rb": 0.5906188488006592, - "spec/helpers/jvm_installer_spec.rb": 21.238383293151855, - "spec/helpers/node_installer_spec.rb": 1.4972991943359375, - "spec/helpers/rails_runner_spec.rb": 0.3340415954589844, - "spec/helpers/rake_runner_spec.rb": 13.79833722114563, - "spec/helpers/ruby_version_spec.rb": 24.048339366912842, - "spec/helpers/shell_spec.rb": 0.601851224899292, - "spec/helpers/stale_file_cleaner_spec.rb": 2.0138986110687256, - "spec/helpers/yarn_installer_spec.rb": 0.5951690673828125, - "spec/installers/heroku_ruby_installer_spec.rb": 7.419133901596069, - "spec/installers/rbx_installer_spec.rb": 8.129172086715698, - "spec/installers/yarn_installer_spec.rb": 0.6401379108428955 + "spec/hatchet/bugs_spec.rb": 78.69840455055237, + "spec/hatchet/ci_spec.rb": 369.8046033382416, + "spec/hatchet/jvm_spec.rb": 91.47721910476685, + "spec/hatchet/node_spec.rb": 128.28125286102295, + "spec/hatchet/rails23_spec.rb": 28.82240319252014, + "spec/hatchet/rails3_spec.rb": 204.9839370250702, + "spec/hatchet/rails4_spec.rb": 633.7822301387787, + "spec/hatchet/rails5_spec.rb": 356.52119636535645, + "spec/hatchet/rubies_spec.rb": 388.03893065452576, + "spec/hatchet/ruby_spec.rb": 212.3235387802124, + "spec/hatchet/stack_spec.rb": 28.049747943878174, + "spec/helpers/bundler_wrapper_spec.rb": 12.645333766937256, + "spec/helpers/fetcher_spec.rb": 0.5732600688934326, + "spec/helpers/jvm_installer_spec.rb": 20.692670106887817, + "spec/helpers/node_installer_spec.rb": 1.5177021026611328, + "spec/helpers/rails_runner_spec.rb": 0.3653140068054199, + "spec/helpers/rake_runner_spec.rb": 13.448747634887695, + "spec/helpers/ruby_version_spec.rb": 23.302748680114746, + "spec/helpers/shell_spec.rb": 0.7545936107635498, + "spec/helpers/stale_file_cleaner_spec.rb": 2.0122320652008057, + "spec/helpers/yarn_installer_spec.rb": 0.5764100551605225, + "spec/installers/heroku_ruby_installer_spec.rb": 6.111052989959717, + "spec/installers/rbx_installer_spec.rb": 8.588847160339355, + "spec/installers/yarn_installer_spec.rb": 0.7034938335418701 } \ No newline at end of file From 08af9da7800983e6f11bca663bc423f50c078d4a Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 25 Jun 2018 16:51:12 -0500 Subject: [PATCH 0542/1195] Perf L --- app.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.json b/app.json index 17e896853..a26eece2c 100644 --- a/app.json +++ b/app.json @@ -11,7 +11,7 @@ }, "formation": { "test": { - "size": "performance-m", + "size": "performance-l", "quantity": 16 } }, From 2932d35e75d5216e8b1f88c0f4900f2747df177c Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 25 Jun 2018 17:04:21 -0500 Subject: [PATCH 0543/1195] Disable travis tests --- .travis.yml | 39 --------------------------------------- 1 file changed, 39 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 5e527b62f..000000000 --- a/.travis.yml +++ /dev/null @@ -1,39 +0,0 @@ -language: ruby -rvm: -- 2.4.4 -before_script: - - gem install bundler -v 1.16.2 - - bundle exec rake hatchet:setup_travis -script: bundle exec parallel_rspec -n 11 spec/$TEST_SUITE -env: - global: - - HATCHET_RETRIES=3 - - IS_RUNNING_ON_CI=true - - HATCHET_DEPLOY_STRATEGY=git - - HATCHET_APP_LIMIT=80 - - BUILDPACK_LOG_FILE=tmp/buildpack.log - - secure: xFS5oLPMGyT6N0LKwU7wllaEZEVLzE/D5HuD14q3Vfd4L369XpV6ORYJF/2mkf765m+LH1MaN09rJaKc00ZcQfQECMuzyWagLsr1bVKs+szta3G/nFjjVTwmoPX5kVw5q7e6TYvS/KAzo+n8u5pW+zu8MMTwnv40QI6LfcbZkTc= - - secure: wd/FBYI9I37PJ+eXhO8vesvWELkklNgGRA1xo/tuA31+ACpY/jG5EjrHd+semsfDTxM8fZe3s0foIch+jeMTIOcGs98tDC/L/8b/h6i0Qic0DqkAk6B30fT+5Nl3dufjiXsBJg5xj1zYqW6ka3DKIDjnn+3ao2cme05MtDQBHdc= - matrix: - - TEST_SUITE=helpers/ - - TEST_SUITE=installers/ - - TEST_SUITE=hatchet/bugs_spec.rb - - TEST_SUITE=hatchet/ci_spec.rb - - TEST_SUITE=hatchet/jvm_spec.rb - - TEST_SUITE=hatchet/node_spec.rb - - TEST_SUITE=hatchet/rails23_spec.rb - - TEST_SUITE=hatchet/rails3_spec.rb - - TEST_SUITE=hatchet/rails4_spec.rb - - TEST_SUITE=hatchet/rails5_spec.rb - - TEST_SUITE=hatchet/rubies_spec.rb - - TEST_SUITE=hatchet/ruby_spec.rb - - TEST_SUITE=hatchet/stack_spec.rb - -sudo: false -dist: trusty -addons: - apt: - sources: - - heroku - packages: - - heroku-toolbelt From 9e0fbe694e3fa23348293eeb141df17683279782 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 26 Jun 2018 11:22:41 -0500 Subject: [PATCH 0544/1195] Use Hatchet 4.0.1 Introduced rate limits for Heroku CI calls. --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index f2c2a4e62..1cb3d8b94 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -22,7 +22,7 @@ GEM excon moneta multi_json (>= 1.9.2) - heroku_hatchet (4.0.0) + heroku_hatchet (4.0.1) excon (~> 0) minitest-retry (~> 0.1.9) platform-api (~> 2) From fc41d1229981733c71734680858c71e823974294 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 27 Jun 2018 16:40:55 -0500 Subject: [PATCH 0545/1195] Try `ci-queue` --- Gemfile | 3 ++- Gemfile.lock | 9 ++++++--- Rakefile | 3 --- app.json | 5 ++++- spec/helpers/rake_runner_spec.rb | 4 ++-- spec/spec_helper.rb | 3 --- 6 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Gemfile b/Gemfile index 1a6921ff4..329f52a45 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,6 @@ source "https://rubygems.org" group :development, :test do gem "heroku_hatchet" - gem "knapsack" gem "rspec-core" gem "rspec-expectations" gem "excon" @@ -12,4 +11,6 @@ group :development, :test do gem "netrc" gem "git", github: "hone/ruby-git", branch: "master" gem 'json', '~> 2.0.2' + gem 'ci-queue' + gem 'redis' end diff --git a/Gemfile.lock b/Gemfile.lock index 1cb3d8b94..df86c60e9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -13,6 +13,9 @@ GEM i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) + ansi (1.5.0) + ci-queue (0.13.4) + ansi concurrent-ruby (1.0.5) diff-lcs (1.3) erubis (2.7.0) @@ -33,8 +36,6 @@ GEM i18n (1.0.1) concurrent-ruby (~> 1.0) json (2.0.4) - knapsack (1.16.0) - rake minitest (5.11.3) minitest-retry (0.1.9) minitest (>= 5.0) @@ -48,6 +49,7 @@ GEM heroics (~> 0.0.23) moneta (~> 0.8.1) rake (12.0.0) + redis (4.0.1) repl_runner (0.0.3) activesupport rrrretry (1.0.0) @@ -69,14 +71,15 @@ PLATFORMS ruby DEPENDENCIES + ci-queue excon git! heroku_hatchet json (~> 2.0.2) - knapsack netrc parallel_tests rake + redis rspec-core rspec-expectations rspec-retry diff --git a/Rakefile b/Rakefile index 41c9a0011..5e13030a3 100644 --- a/Rakefile +++ b/Rakefile @@ -1,7 +1,6 @@ require "fileutils" require "tmpdir" require 'hatchet/tasks' -require 'knapsack' ENV["BUILDPACK_LOG_FILE"] ||= "tmp/buildpack.log" S3_BUCKET_NAME = "heroku-buildpack-ruby" @@ -309,5 +308,3 @@ begin task :default => :spec rescue LoadError => e end - -Knapsack.load_tasks if defined?(Knapsack) diff --git a/app.json b/app.json index a26eece2c..0d9fe6f4c 100644 --- a/app.json +++ b/app.json @@ -3,6 +3,9 @@ "description":"The buildpack for Ruby", "environments": { "test": { + "addons":[ + "heroku-redis:hobby-dev" + ], "env": { "HATCHET_RETRIES": "3", "IS_RUNNING_ON_CI": "true", @@ -17,7 +20,7 @@ }, "scripts": { "test-setup": "bundle exec rake hatchet:setup_ci", - "test": "HATCHET_BUILDPACK_BRANCH=$HEROKU_TEST_RUN_BRANCH bundle exec rake knapsack:rspec" + "test": "HATCHET_BUILDPACK_BRANCH=$HEROKU_TEST_RUN_BRANCH bundle exec rspec-queue --max-requeues=3 --timeout 180 --build $HEROKU_TEST_RUN_ID --worker $CI_NODE_INDEX --queue $REDIS_URL" }, "buildpacks": [ { "url": "https://github.com/heroku/heroku-buildpack-apt" }, diff --git a/spec/helpers/rake_runner_spec.rb b/spec/helpers/rake_runner_spec.rb index 89ba78a1e..5fdcc7c14 100644 --- a/spec/helpers/rake_runner_spec.rb +++ b/spec/helpers/rake_runner_spec.rb @@ -7,8 +7,8 @@ task = rake.task("assets:precompile") task.invoke - expect(task.status).to eq(:pass) expect(task.output).to match("success!") + expect(task.status).to eq(:pass) expect(task.time).not_to be_nil end end @@ -19,8 +19,8 @@ task = rake.task("assets:precompile") task.invoke - expect(task.status).to eq(:fail) expect(task.output).to match("assets:precompile fails") + expect(task.status).to eq(:fail) expect(task.time).not_to be_nil end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 58467922e..e801b929b 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -6,9 +6,6 @@ require 'language_pack' require 'language_pack/shell_helpers' -require 'knapsack' - -Knapsack::Adapters::RSpecAdapter.bind ENV['RACK_ENV'] = 'test' From f792fdb8e0266034f8a5c2f9ba79ecf57ca19205 Mon Sep 17 00:00:00 2001 From: schneems Date: Fri, 29 Jun 2018 15:36:59 -0500 Subject: [PATCH 0546/1195] Upgrade to hatchet 4.0.2 Has support for Heroku CI env vars --- Gemfile.lock | 2 +- app.json | 2 +- spec/spec_helper.rb | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index df86c60e9..cbfebbcab 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -25,7 +25,7 @@ GEM excon moneta multi_json (>= 1.9.2) - heroku_hatchet (4.0.1) + heroku_hatchet (4.0.2) excon (~> 0) minitest-retry (~> 0.1.9) platform-api (~> 2) diff --git a/app.json b/app.json index 0d9fe6f4c..c233c5c5b 100644 --- a/app.json +++ b/app.json @@ -20,7 +20,7 @@ }, "scripts": { "test-setup": "bundle exec rake hatchet:setup_ci", - "test": "HATCHET_BUILDPACK_BRANCH=$HEROKU_TEST_RUN_BRANCH bundle exec rspec-queue --max-requeues=3 --timeout 180 --build $HEROKU_TEST_RUN_ID --worker $CI_NODE_INDEX --queue $REDIS_URL" + "test": "bundle exec rspec-queue --max-requeues=3 --timeout 180 --build $HEROKU_TEST_RUN_ID --worker $CI_NODE_INDEX --queue $REDIS_URL" }, "buildpacks": [ { "url": "https://github.com/heroku/heroku-buildpack-apt" }, diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index e801b929b..6282c3ad4 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -52,4 +52,3 @@ def create_file_with_size_in(size, dir) # Don't execute tests against "merge" commits exit 0 if ENV['TRAVIS_PULL_REQUEST'] != 'false' && ENV['TRAVIS_BRANCH'] == 'master' end - From ad77def0ad2d582d88e86bf18369cad3bf82dc73 Mon Sep 17 00:00:00 2001 From: schneems Date: Sat, 30 Jun 2018 22:03:08 -0500 Subject: [PATCH 0547/1195] Use ci-queue branch with Heroku CI support --- Gemfile | 3 ++- Gemfile.lock | 14 ++++++++++---- app.json | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Gemfile b/Gemfile index 329f52a45..34956a2d5 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,5 @@ source "https://rubygems.org" +git_source(:github) { |repo| "https://github.com/#{repo}.git" } group :development, :test do gem "heroku_hatchet" @@ -11,6 +12,6 @@ group :development, :test do gem "netrc" gem "git", github: "hone/ruby-git", branch: "master" gem 'json', '~> 2.0.2' - gem 'ci-queue' + gem 'ci-queue', github: "schneems/ci-queue", branch: 'schneems/heroku-ci' gem 'redis' end diff --git a/Gemfile.lock b/Gemfile.lock index cbfebbcab..b20670aec 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,10 +1,18 @@ GIT - remote: git://github.com/hone/ruby-git.git + remote: https://github.com/hone/ruby-git.git revision: 264836fcff3c037d8d8fc44bd770b150b46fdc4e branch: master specs: git (1.2.6) +GIT + remote: https://github.com/schneems/ci-queue.git + revision: 20d40ff742f7dc33d33a5a5d0bd9cfe043c9246e + branch: schneems/heroku-ci + specs: + ci-queue (0.13.4) + ansi + GEM remote: https://rubygems.org/ specs: @@ -14,8 +22,6 @@ GEM minitest (~> 5.1) tzinfo (~> 1.1) ansi (1.5.0) - ci-queue (0.13.4) - ansi concurrent-ruby (1.0.5) diff-lcs (1.3) erubis (2.7.0) @@ -71,7 +77,7 @@ PLATFORMS ruby DEPENDENCIES - ci-queue + ci-queue! excon git! heroku_hatchet diff --git a/app.json b/app.json index c233c5c5b..00c0e56ea 100644 --- a/app.json +++ b/app.json @@ -20,7 +20,7 @@ }, "scripts": { "test-setup": "bundle exec rake hatchet:setup_ci", - "test": "bundle exec rspec-queue --max-requeues=3 --timeout 180 --build $HEROKU_TEST_RUN_ID --worker $CI_NODE_INDEX --queue $REDIS_URL" + "test": "bundle exec rspec-queue --max-requeues=3 --timeout 180" }, "buildpacks": [ { "url": "https://github.com/heroku/heroku-buildpack-apt" }, From a1d603e3c283fb76a971ee94eea399a7f9cc645b Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 24 Jul 2018 11:47:50 -0500 Subject: [PATCH 0548/1195] Update CI queue gem to use deployed version --- Gemfile | 2 +- Gemfile.lock | 12 +++--------- app.json | 2 +- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/Gemfile b/Gemfile index 34956a2d5..b6e254fd3 100644 --- a/Gemfile +++ b/Gemfile @@ -12,6 +12,6 @@ group :development, :test do gem "netrc" gem "git", github: "hone/ruby-git", branch: "master" gem 'json', '~> 2.0.2' - gem 'ci-queue', github: "schneems/ci-queue", branch: 'schneems/heroku-ci' + gem 'ci-queue' gem 'redis' end diff --git a/Gemfile.lock b/Gemfile.lock index b20670aec..38686d000 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -5,14 +5,6 @@ GIT specs: git (1.2.6) -GIT - remote: https://github.com/schneems/ci-queue.git - revision: 20d40ff742f7dc33d33a5a5d0bd9cfe043c9246e - branch: schneems/heroku-ci - specs: - ci-queue (0.13.4) - ansi - GEM remote: https://rubygems.org/ specs: @@ -22,6 +14,8 @@ GEM minitest (~> 5.1) tzinfo (~> 1.1) ansi (1.5.0) + ci-queue (0.13.6) + ansi concurrent-ruby (1.0.5) diff-lcs (1.3) erubis (2.7.0) @@ -77,7 +71,7 @@ PLATFORMS ruby DEPENDENCIES - ci-queue! + ci-queue excon git! heroku_hatchet diff --git a/app.json b/app.json index 00c0e56ea..9111a02fd 100644 --- a/app.json +++ b/app.json @@ -20,7 +20,7 @@ }, "scripts": { "test-setup": "bundle exec rake hatchet:setup_ci", - "test": "bundle exec rspec-queue --max-requeues=3 --timeout 180" + "test": "bundle exec rspec-queue --max-requeues=3 --timeout 180 --queue $REDIS_URL" }, "buildpacks": [ { "url": "https://github.com/heroku/heroku-buildpack-apt" }, From dbb4c6da2049392678cd9d0a0bce7ceea23c132f Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 24 Jul 2018 11:50:08 -0500 Subject: [PATCH 0549/1195] Remove extra whitespace --- spec/spec_helper.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 6282c3ad4..b5252613c 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -6,7 +6,6 @@ require 'language_pack' require 'language_pack/shell_helpers' - ENV['RACK_ENV'] = 'test' RSpec.configure do |config| @@ -22,7 +21,6 @@ end config.mock_with :nothing config.include LanguagePack::ShellHelpers - end def git_repo From fcca29739af6ab466898cd233091017525600907 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 15 Aug 2018 16:02:26 -0500 Subject: [PATCH 0550/1195] Remove unused file --- knapsack_rspec_report.json | 26 -------------------------- 1 file changed, 26 deletions(-) delete mode 100644 knapsack_rspec_report.json diff --git a/knapsack_rspec_report.json b/knapsack_rspec_report.json deleted file mode 100644 index 1d60bb07f..000000000 --- a/knapsack_rspec_report.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "spec/hatchet/bugs_spec.rb": 78.69840455055237, - "spec/hatchet/ci_spec.rb": 369.8046033382416, - "spec/hatchet/jvm_spec.rb": 91.47721910476685, - "spec/hatchet/node_spec.rb": 128.28125286102295, - "spec/hatchet/rails23_spec.rb": 28.82240319252014, - "spec/hatchet/rails3_spec.rb": 204.9839370250702, - "spec/hatchet/rails4_spec.rb": 633.7822301387787, - "spec/hatchet/rails5_spec.rb": 356.52119636535645, - "spec/hatchet/rubies_spec.rb": 388.03893065452576, - "spec/hatchet/ruby_spec.rb": 212.3235387802124, - "spec/hatchet/stack_spec.rb": 28.049747943878174, - "spec/helpers/bundler_wrapper_spec.rb": 12.645333766937256, - "spec/helpers/fetcher_spec.rb": 0.5732600688934326, - "spec/helpers/jvm_installer_spec.rb": 20.692670106887817, - "spec/helpers/node_installer_spec.rb": 1.5177021026611328, - "spec/helpers/rails_runner_spec.rb": 0.3653140068054199, - "spec/helpers/rake_runner_spec.rb": 13.448747634887695, - "spec/helpers/ruby_version_spec.rb": 23.302748680114746, - "spec/helpers/shell_spec.rb": 0.7545936107635498, - "spec/helpers/stale_file_cleaner_spec.rb": 2.0122320652008057, - "spec/helpers/yarn_installer_spec.rb": 0.5764100551605225, - "spec/installers/heroku_ruby_installer_spec.rb": 6.111052989959717, - "spec/installers/rbx_installer_spec.rb": 8.588847160339355, - "spec/installers/yarn_installer_spec.rb": 0.7034938335418701 -} \ No newline at end of file From 884fa6d5a09ba84f987cb26a676d04e3496f60d4 Mon Sep 17 00:00:00 2001 From: schneems Date: Fri, 17 Aug 2018 10:14:27 -0500 Subject: [PATCH 0551/1195] Ignore bundler warning ``` Warning: the running version of Bundler (1.15.2) is older than the version that created the lockfile (1.16.1). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`. The latest bundler is 1.16.3, but you are currently running 1.15.2. ``` --- hatchet.json | 1 - lib/language_pack/ruby.rb | 6 ++++-- spec/hatchet/rails5_spec.rb | 3 +++ spec/hatchet/ruby_spec.rb | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/hatchet.json b/hatchet.json index a0af351ac..fcbdbb582 100644 --- a/hatchet.json +++ b/hatchet.json @@ -54,7 +54,6 @@ "sharpstone/rails3_runtime_assets", "sharpstone/rails3-fail-assets-compile", "sharpstone/rails3-fail-rakefile" - ], "rails4": [ "sharpstone/rails4-manifest", diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 43bc300e1..c2d1e592c 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -652,8 +652,10 @@ def build_bundler(default_bundle_without) "NOKOGIRI_USE_SYSTEM_LIBRARIES" => "true", "BUNDLE_DISABLE_VERSION_CHECK" => "true" } - env_vars["JAVA_HOME"] = noshellescape("#{pwd}/$JAVA_HOME") if ruby_version.jruby? - env_vars["BUNDLER_LIB_PATH"] = "#{bundler_path}" if ruby_version.ruby_version == "1.8.7" + env_vars["JAVA_HOME"] = noshellescape("#{pwd}/$JAVA_HOME") if ruby_version.jruby? + env_vars["BUNDLER_LIB_PATH"] = "#{bundler_path}" if ruby_version.ruby_version == "1.8.7" + env_vars["BUNDLE_DISABLE_VERSION_CHECK"] = "true" + puts "Running: #{bundle_command}" instrument "ruby.bundle_install" do bundle_time = Benchmark.realtime do diff --git a/spec/hatchet/rails5_spec.rb b/spec/hatchet/rails5_spec.rb index 2f66a48ae..b6723ba99 100644 --- a/spec/hatchet/rails5_spec.rb +++ b/spec/hatchet/rails5_spec.rb @@ -4,6 +4,9 @@ it "works" do Hatchet::Runner.new("rails5").deploy do |app, heroku| expect(app.run("rails -v")).to match("") + + # Test BUNDLE_DISABLE_VERSION_CHECK works + expect(app.output).not_to include("The latest bundler is") end end diff --git a/spec/hatchet/ruby_spec.rb b/spec/hatchet/ruby_spec.rb index da126efef..eae140d37 100644 --- a/spec/hatchet/ruby_spec.rb +++ b/spec/hatchet/ruby_spec.rb @@ -71,7 +71,7 @@ context "no active record" do it "writes a heroku specific database.yml" do Hatchet::Runner.new("default_ruby").deploy do |app, heroku| - expect(app.output).to include("Writing config/database.yml to read from DATABASE_URL") + expect(app.output).to include("Writing config/database.yml to read from DATABASE_URL") expect(app.output).not_to include("Your app was upgraded to bundler") end end From c873aa1f7847fbd295ab994d8b2af485a2039a4a Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 15 Aug 2018 14:08:16 -0500 Subject: [PATCH 0552/1195] Close #783 Warn on `action_dispatch.x_sendfile_header` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When serving files if the `action_dispatch.x_sendfile_header` is set then it is essentially saying “i don’t need to serve this asset, let nginx or apache do it for me”. The problem is…on heroku most people aren’t using apache or nginx so this causes a silent failure that is hard to debug. This warning will hopefully help people identify their mistake earlier. --- lib/language_pack/rails3.rb | 49 +++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/lib/language_pack/rails3.rb b/lib/language_pack/rails3.rb index 58a9c35d0..7200dd6ed 100644 --- a/lib/language_pack/rails3.rb +++ b/lib/language_pack/rails3.rb @@ -46,10 +46,13 @@ def compile def config_detect super @assets_compile_config = @rails_runner.detect("assets.compile") + @x_sendfile_config = @rails_runner.detect("action_dispatch.x_sendfile_header") end def best_practice_warnings super + warn_x_sendfile_use! + if assets_compile_enabled? mcount("warn.assets.compile.true") @@ -88,6 +91,52 @@ def best_practice_warnings private + def warn_x_sendfile_use! + return false unless @x_sendfile_config.success? + if @x_sendfile_config.did_match?("X-Sendfile") && !has_apache? # Apache + mcount("warn.x_sendfile_header.apache") + warn(<<-WARNING) +You set `config.action_dispatch.x_sendfile_header = 'X-Sendfile'` in production, +but you do not have `apache` installed on this app. This setting will cause any assets +being served by your application to be returned without a body. + +To fix this issue, please set: + +``` +config.action_dispatch.x_sendfile_header = nil +``` +WARNING + end + + if @x_sendfile_config.did_match?("X-Accel-Redirect") && !has_nginx? # Nginx + mcount("warn.x_sendfile_header.nginx") + + warn(<<-WARNING) +You set `config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'` in production, +but you do not have `nginx` installed on this app. This setting will cause any assets +being served by your application to be returned without a body. + +To fix this issue, please set: + +``` +config.action_dispatch.x_sendfile_header = nil +``` +WARNING + end + end + + def has_apache? + path = run("which apachectl") + return true if path && $?.success? + return false + end + + def has_nginx? + path = run("which nginx") + return true if path && $?.success? + return false + end + def sprocket_version_upgrade_needed # Due to https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-3760 sprockets_version = bundler.gem_version('sprockets') From 5e5cbc8f3b73e96f0573591f54819aa9e1a9e114 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 15 Aug 2018 16:40:29 -0500 Subject: [PATCH 0553/1195] Add test for x_sendfile_header warnings --- spec/hatchet/warnings_spec.rb | 48 +++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 spec/hatchet/warnings_spec.rb diff --git a/spec/hatchet/warnings_spec.rb b/spec/hatchet/warnings_spec.rb new file mode 100644 index 000000000..a206a273e --- /dev/null +++ b/spec/hatchet/warnings_spec.rb @@ -0,0 +1,48 @@ +require_relative "../spec_helper" + +describe "Best practice warnings" do + it "should warn when using x_sendfile_header" do + app = Hatchet::Runner.new("rails5") + app.in_directory do + add_composer_json! + set_x_sendfile_config! + + app.setup! + app.push_with_retry! + end + + assert(app.output).to match(%r{you do not have `apache` installed on this app}) + ensure + app.teardown! if app + end + + it "should not warn when binary is present" do + buildpacks = [ + "heroku/php", # used for adding apache + Hatchet::App.default_buildpack + ] + app = Hatchet::Runner.new("rails5", buildpacks: buildpacks) + app.in_directory do + add_composer_json! + set_x_sendfile_config! + + app.setup! + app.push_with_retry! + end + + assert(app.output).to_not match(%r{you do not have `apache` installed on this app}) + ensure + app.teardown! if app + end + + def set_x_sendfile_config! + run!(%Q{echo "config.action_dispatch.x_sendfile_header = 'X-Sendfile'" > config/initializers/sendfile.rb}) + run!(%Q{git add -A; git commit -m 'changing config'}) + end + + # Puts apache on the path + def add_composer_json! + run!('echo {} > composer.json') + run!(%Q{git add -A; git commit -m 'Adding apache'}) + end +end From 6429f7bab27bbe9a118a8a5607ec6516db303b9a Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 20 Aug 2018 11:05:32 -0500 Subject: [PATCH 0554/1195] Changelog to make David happy --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 31d796eaf..c3f0e9ec0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Master +## v190 (unreleased) + +* Warn when `config.action_dispatch.x_sendfile_header` is set but apache and nginx are not being used (https://github.com/heroku/heroku-buildpack-ruby/pull/795) + ## v190 (7/24/2018) * Support TAP output for Heroku CI (https://github.com/heroku/heroku-buildpack-ruby/pull/790). From 309d766c5c7f24da7b4c0a931f35b5cc5185b037 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 23 Aug 2018 10:00:08 -0500 Subject: [PATCH 0555/1195] v191 --- CHANGELOG.md | 2 +- lib/language_pack/version.rb | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c3f0e9ec0..1ada9b5a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ## Master -## v190 (unreleased) +## v191 (8/23/2018) * Warn when `config.action_dispatch.x_sendfile_header` is set but apache and nginx are not being used (https://github.com/heroku/heroku-buildpack-ruby/pull/795) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 617ffd73b..e07140b1c 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -1,8 +1,7 @@ require "language_pack/base" -# This file is automatically generated by rake module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v190" + BUILDPACK_VERSION = "v191" end end From c3401a27aeab901a0500483cd23c693715c767bf Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 12 Sep 2018 14:09:17 -0500 Subject: [PATCH 0556/1195] Get tests to work on Heroku-18 --- Gemfile.lock | 8 ++--- hatchet.lock | 8 ++--- spec/hatchet/rails3_spec.rb | 7 ---- spec/hatchet/rubies_spec.rb | 12 +++---- spec/hatchet/ruby_spec.rb | 14 ++++---- spec/hatchet/warnings_spec.rb | 48 ---------------------------- spec/helpers/bundler_wrapper_spec.rb | 4 +-- spec/spec_helper.rb | 2 ++ 8 files changed, 25 insertions(+), 78 deletions(-) delete mode 100644 spec/hatchet/warnings_spec.rb diff --git a/Gemfile.lock b/Gemfile.lock index 38686d000..1946b7c2f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -8,7 +8,7 @@ GIT GEM remote: https://rubygems.org/ specs: - activesupport (5.2.0) + activesupport (5.2.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) @@ -25,7 +25,7 @@ GEM excon moneta multi_json (>= 1.9.2) - heroku_hatchet (4.0.2) + heroku_hatchet (4.0.5) excon (~> 0) minitest-retry (~> 0.1.9) platform-api (~> 2) @@ -33,7 +33,7 @@ GEM rrrretry (~> 1) thor (~> 0) threaded (~> 0) - i18n (1.0.1) + i18n (1.1.0) concurrent-ruby (~> 1.0) json (2.0.4) minitest (5.11.3) @@ -85,4 +85,4 @@ DEPENDENCIES rspec-retry BUNDLED WITH - 1.16.2 + 1.16.4 diff --git a/hatchet.lock b/hatchet.lock index 7544bacb9..ec7598067 100644 --- a/hatchet.lock +++ b/hatchet.lock @@ -2,7 +2,7 @@ - - "./repos/bundler/bad_gemfile_on_platform" - 5dd45c83631f58d121afb48b513016cc9e2d3432 - - "./repos/bundler/bundle-ruby-version-not-in-lockfile" - - 892a75783913df4bd64ffb2fdb3c5517f65fdb46 + - 5c8219d8bbdc8faa6a98781867b9fce25a6f2abb - - "./repos/bundler/git_gemspec" - 19fc9a51a5c36c81c926bf8e16d07399e0e514aa - - "./repos/bundler/no_lockfile" @@ -10,7 +10,7 @@ - - "./repos/bundler/nokogiri_160" - d9a761776be43e1c685f98ef13c6ef1ee0292267 - - "./repos/bundler/problem_gemfile_version" - - c6266a7d121522b6219a52c69a1d104b00c03359 + - abc25a7b582a720b99148a1c8753d0d7452254bb - - "./repos/bundler/sqlite3_gemfile" - 116db685f54dae18f703b3beb90e64fdbddb048d - - "./repos/ci/activerecord_rake_tasks_does_not_exist" @@ -78,7 +78,7 @@ - - "./repos/rails5/rails5" - 1680c5da829e03ffb9345187971a13e5109d86a6 - - "./repos/rails51/rails51_webpacker" - - 61ade71748b50effae7fd4aef2832ed0d89660e2 + - 75c5c4f21b1d88fc3b8edf60b3f871df3ad70208 - - "./repos/rails52/active_storage_local" - e2119af6ddd4bc21fda9bc7da6401e7aa256e38d - - "./repos/rails52/active_storage_non_local" @@ -104,7 +104,7 @@ - - "./repos/ruby/bad_ruby_version" - 7bf3470265a87ea6361640aa4bfce6ce3b743520 - - "./repos/ruby/cd_ruby" - - 5d4139af87bbb941008ef945408eb8b6a5276369 + - 88df7181e301d25a8da992107747acff62670327 - - "./repos/ruby/empty-procfile" - 7cae0aae424c2028b81b5d37ee24d42db8e545b9 - - "./repos/ruby/jruby-minimal" diff --git a/spec/hatchet/rails3_spec.rb b/spec/hatchet/rails3_spec.rb index 003dd68e5..c6b684c72 100644 --- a/spec/hatchet/rails3_spec.rb +++ b/spec/hatchet/rails3_spec.rb @@ -34,13 +34,6 @@ end end - context "when not using the rails gem" do - it "should detect as a rails app" do - Hatchet::App.new('railties3_mri_193').in_directory do - expect(LanguagePack::Rails3.use?).to eq(true) - end - end - end it "fails if rake tasks cannot be detected" do Hatchet::Runner.new("rails3-fail-rakefile", allow_failure: true).deploy do |app| diff --git a/spec/hatchet/rubies_spec.rb b/spec/hatchet/rubies_spec.rb index 6661e3f27..283d97138 100644 --- a/spec/hatchet/rubies_spec.rb +++ b/spec/hatchet/rubies_spec.rb @@ -70,7 +70,7 @@ end it "should deploy jruby with the naether gem" do - app = Hatchet::Runner.new("jruby_naether") + app = Hatchet::Runner.new("jruby_naether", stack: DEFAULT_STACK) app.setup! app.deploy do |app| expect(app.output).to match("Installing naether") @@ -81,15 +81,15 @@ describe "Upgrading ruby apps" do - it "works when changing from default version", stack: :cedar do - app = Hatchet::Runner.new("default_ruby") + it "works when changing from default version" do + app = Hatchet::Runner.new("default_ruby", stack: DEFAULT_STACK) app.setup! app.deploy do |app| - run!(%Q{echo "ruby '2.4.1'" >> Gemfile}) + run!(%Q{echo "ruby '2.5.1'" >> Gemfile}) run!("git add -A; git commit -m update-ruby") app.push! - expect(app.output).to match("2.4.1") - expect(app.run("ruby -v")).to match("2.4.1") + expect(app.output).to match("2.5.1") + expect(app.run("ruby -v")).to match("2.5.1") expect(app.output).to match("Ruby version change detected") end end diff --git a/spec/hatchet/ruby_spec.rb b/spec/hatchet/ruby_spec.rb index eae140d37..f6641a39e 100644 --- a/spec/hatchet/ruby_spec.rb +++ b/spec/hatchet/ruby_spec.rb @@ -3,23 +3,23 @@ describe "Ruby apps" do describe "running Ruby from outside the default dir" do it "works" do - Hatchet::Runner.new('cd_ruby').deploy do |app| - expect(app.output).to match("2.3.5") + Hatchet::Runner.new('cd_ruby', stack: DEFAULT_STACK).deploy do |app| + expect(app.output).to match("cd version ruby 2.5.1") end end end describe "bundler ruby version matcher" do it "installs a version even when not present in the Gemfile.lock" do - Hatchet::Runner.new('bundle-ruby-version-not-in-lockfile').deploy do |app| - expect(app.output).to match("2.3.1") - expect(app.run("ruby -v")).to match("2.3.1") + Hatchet::Runner.new('bundle-ruby-version-not-in-lockfile', stack: DEFAULT_STACK).deploy do |app| + expect(app.output).to match("2.5.1") + expect(app.run("ruby -v")).to match("2.5.1") end end it "works even when patchfile is specified" do - Hatchet::Runner.new('problem_gemfile_version').deploy do |app| - expect(app.output).to match("2.3.0") + Hatchet::Runner.new('problem_gemfile_version', stack: DEFAULT_STACK).deploy do |app| + expect(app.output).to match("2.5.1") end end end diff --git a/spec/hatchet/warnings_spec.rb b/spec/hatchet/warnings_spec.rb deleted file mode 100644 index a206a273e..000000000 --- a/spec/hatchet/warnings_spec.rb +++ /dev/null @@ -1,48 +0,0 @@ -require_relative "../spec_helper" - -describe "Best practice warnings" do - it "should warn when using x_sendfile_header" do - app = Hatchet::Runner.new("rails5") - app.in_directory do - add_composer_json! - set_x_sendfile_config! - - app.setup! - app.push_with_retry! - end - - assert(app.output).to match(%r{you do not have `apache` installed on this app}) - ensure - app.teardown! if app - end - - it "should not warn when binary is present" do - buildpacks = [ - "heroku/php", # used for adding apache - Hatchet::App.default_buildpack - ] - app = Hatchet::Runner.new("rails5", buildpacks: buildpacks) - app.in_directory do - add_composer_json! - set_x_sendfile_config! - - app.setup! - app.push_with_retry! - end - - assert(app.output).to_not match(%r{you do not have `apache` installed on this app}) - ensure - app.teardown! if app - end - - def set_x_sendfile_config! - run!(%Q{echo "config.action_dispatch.x_sendfile_header = 'X-Sendfile'" > config/initializers/sendfile.rb}) - run!(%Q{git add -A; git commit -m 'changing config'}) - end - - # Puts apache on the path - def add_composer_json! - run!('echo {} > composer.json') - run!(%Q{git add -A; git commit -m 'Adding apache'}) - end -end diff --git a/spec/helpers/bundler_wrapper_spec.rb b/spec/helpers/bundler_wrapper_spec.rb index e9768bd90..7557d8992 100644 --- a/spec/helpers/bundler_wrapper_spec.rb +++ b/spec/helpers/bundler_wrapper_spec.rb @@ -32,10 +32,10 @@ it "handles apps with ruby versions locked in Gemfile.lock" do Hatchet::App.new("problem_gemfile_version").in_directory do |dir| - expect(@bundler.ruby_version).to eq("ruby-2.3.0-p0") + expect(@bundler.ruby_version).to eq("ruby-2.5.1-p0") ruby_version = LanguagePack::RubyVersion.new(@bundler.ruby_version, is_new: true) - expect(ruby_version.version_for_download).to eq("ruby-2.3.0") + expect(ruby_version.version_for_download).to eq("ruby-2.5.1") end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index b5252613c..1bcec1783 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -8,6 +8,8 @@ ENV['RACK_ENV'] = 'test' +DEFAULT_STACK = 'heroku-18' + RSpec.configure do |config| config.filter_run focused: true unless ENV['IS_RUNNING_ON_CI'] config.run_all_when_everything_filtered = true From dbe9d0a8de00caf31a795ade1293c91c357ce3c3 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 6 Sep 2018 14:41:31 -0500 Subject: [PATCH 0557/1195] Remove circle instead of upgrading --- circle.yml | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 circle.yml diff --git a/circle.yml b/circle.yml deleted file mode 100644 index 7deddc457..000000000 --- a/circle.yml +++ /dev/null @@ -1,16 +0,0 @@ -machine: - ruby: - version: 2.4.1 - environment: - HATCHET_RETRIES: 3 - IS_RUNNING_ON_CI: true - HATCHET_DEPLOY_STRATEGY: git - HATCHET_APP_LIMIT: 80 - -test: - pre: - - wget -qO- https://cli-assets.heroku.com/install-ubuntu.sh | sh - - heroku --version - - bundle exec rake hatchet:setup_travis - override: - - exit 0 # bundle exec parallel_rspec -n 11 spec/ From 32ac3aeb08456ddf08775deef3f0a384caa6614b Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 13 Sep 2018 17:30:32 -0500 Subject: [PATCH 0558/1195] Better failure message for CI apps using default stack --- lib/language_pack/ruby.rb | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index c2d1e592c..acd43fc96 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -380,6 +380,41 @@ def install_ruby true rescue LanguagePack::Fetcher::FetchError => error + if stack == "heroku-18" && ruby_version.version_for_download.match?(/ruby-2\.(2|3)/) + message = < Date: Thu, 13 Sep 2018 20:43:51 -0500 Subject: [PATCH 0559/1195] Remove "user env compile" test This test was added to ensure that we didn't accidentally write-over a user's environment variables when we first introduced "user env compile" as a default. It's no longer needed and Rails 4.0 apps cannot install with Ruby 2.4 or 2.5 and that is the only currently available rubies on Heroku 18. --- hatchet.json | 1 - hatchet.lock | 2 -- spec/hatchet/rails4_spec.rb | 9 --------- 3 files changed, 12 deletions(-) diff --git a/hatchet.json b/hatchet.json index fcbdbb582..94e1e5610 100644 --- a/hatchet.json +++ b/hatchet.json @@ -59,7 +59,6 @@ "sharpstone/rails4-manifest", "sharpstone/rails3-to-4-no-bin", "sharpstone/rails4_windows_mri193", - "sharpstone/rails4-env-assets-compile", "sharpstone/rails4-fail-assets-compile" ], "rails41": [ diff --git a/hatchet.lock b/hatchet.lock index ec7598067..42a6896cd 100644 --- a/hatchet.lock +++ b/hatchet.lock @@ -61,8 +61,6 @@ - 8cc041cffb9f5635017aa118d16688491f794e91 - - "./repos/rails4/rails3-to-4-no-bin" - 3fd6e84f5d8eaaadb6d95aeb1f367f62da28cc62 -- - "./repos/rails4/rails4-env-assets-compile" - - ba8c352856685c3e46ae227ffbc175d6aa8e868b - - "./repos/rails4/rails4-fail-assets-compile" - 7f65fbb04ca49be526906a1b0d9155cd24941b8e - - "./repos/rails4/rails4-manifest" diff --git a/spec/hatchet/rails4_spec.rb b/spec/hatchet/rails4_spec.rb index d517a3c50..028f99462 100644 --- a/spec/hatchet/rails4_spec.rb +++ b/spec/hatchet/rails4_spec.rb @@ -86,13 +86,4 @@ expect(app).not_to be_deployed end end - - it "should not override user settings rails 4.2" do - app = Hatchet::Runner.new("rails4-env-assets-compile") - app.setup! - app.set_config("RAILS_ENV" => "staging") - app.deploy do |a, heroku| - expect(a.output).to include("w00t") - end - end end From fb25a77f2a19690b350b045569a8021e6d5fdf88 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 13 Sep 2018 21:58:35 -0500 Subject: [PATCH 0560/1195] v192 --- CHANGELOG.md | 4 ++++ lib/language_pack/version.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ada9b5a0..f2401a9bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Master +## v192 (9/14/2018) + +* Add error messages when using unsupported Ruby versions on the Heroku 18 stack (https://github.com/heroku/heroku-buildpack-ruby/pull/809) + ## v191 (8/23/2018) * Warn when `config.action_dispatch.x_sendfile_header` is set but apache and nginx are not being used (https://github.com/heroku/heroku-buildpack-ruby/pull/795) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index e07140b1c..4b35b9197 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v191" + BUILDPACK_VERSION = "v192" end end From 786f440e1f7fc2e462ebbfd85525a18e3cdf6816 Mon Sep 17 00:00:00 2001 From: schneems Date: Fri, 14 Sep 2018 09:01:42 -0500 Subject: [PATCH 0561/1195] Heroku-18 instead of Heroku 18 --- CHANGELOG.md | 2 +- lib/language_pack/ruby.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f2401a9bb..b2f20b3c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## v192 (9/14/2018) -* Add error messages when using unsupported Ruby versions on the Heroku 18 stack (https://github.com/heroku/heroku-buildpack-ruby/pull/809) +* Add error messages when using unsupported Ruby versions on the Heroku-18 stack (https://github.com/heroku/heroku-buildpack-ruby/pull/809) ## v191 (8/23/2018) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index acd43fc96..283e95283 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -384,8 +384,8 @@ def install_ruby message = < Date: Fri, 14 Sep 2018 11:17:07 -0500 Subject: [PATCH 0562/1195] V193 --- CHANGELOG.md | 4 ++++ lib/language_pack/ruby.rb | 2 +- lib/language_pack/version.rb | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b2f20b3c6..58fc01611 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Master +## v193 (9/14/2018) + +* Fix link (https://github.com/heroku/heroku-buildpack-ruby/pull/811) + ## v192 (9/14/2018) * Add error messages when using unsupported Ruby versions on the Heroku-18 stack (https://github.com/heroku/heroku-buildpack-ruby/pull/809) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 283e95283..c765d4293 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -401,7 +401,7 @@ def install_ruby ``` More information about this change in behavior can be found at: - https://kb.heroku.com/3Y1HEXGJ/why-doesn-t-ruby-2-3-7-work-in-my-ci-tests + https://help.heroku.com/3Y1HEXGJ/why-doesn-t-ruby-2-3-7-work-in-my-ci-tests ERROR diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 4b35b9197..83dfcfc76 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v192" + BUILDPACK_VERSION = "v193" end end From 76ce839a804a6cc0d69050d792abe57e4d5e43c4 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 13 Sep 2018 15:23:52 -0500 Subject: [PATCH 0563/1195] [close #800] Don't add a default "worker" process if they don't have that task This PR first detects if `jobs:work` exist before adding it as a default task. Similar to #806 but it uses the existing RakeRunner object and also adds testing. Special thanks to @JacobEvelyn for the original PR and the motivation. --- CHANGELOG.md | 2 ++ lib/language_pack/rails2.rb | 10 +++++----- spec/hatchet/rails5_spec.rb | 22 ++++++++++++++++++++-- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 58fc01611..90326e907 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Master +* Do not add the `jobs:work` command if an app does not have that rake task available (https://github.com/heroku/heroku-buildpack-ruby/pull/810) + ## v193 (9/14/2018) * Fix link (https://github.com/heroku/heroku-buildpack-ruby/pull/811) diff --git a/lib/language_pack/rails2.rb b/lib/language_pack/rails2.rb index 7c18ec672..ef0482f62 100644 --- a/lib/language_pack/rails2.rb +++ b/lib/language_pack/rails2.rb @@ -48,11 +48,11 @@ def default_process_types "bundle exec thin start -e $RAILS_ENV -p $PORT" : "bundle exec ruby script/server -p $PORT" - super.merge({ - "web" => web_process, - "worker" => "bundle exec rake jobs:work", - "console" => "bundle exec script/console" - }) + process_types = super + process_types["web"] = web_process + process_types["worker"] = "bundle exec rake jobs:work" if rake.task("jobs:work").is_defined? + process_types["console"] = "bundle exec script/console" + process_types end end diff --git a/spec/hatchet/rails5_spec.rb b/spec/hatchet/rails5_spec.rb index b6723ba99..1ef1838e4 100644 --- a/spec/hatchet/rails5_spec.rb +++ b/spec/hatchet/rails5_spec.rb @@ -3,13 +3,31 @@ describe "Rails 5" do it "works" do Hatchet::Runner.new("rails5").deploy do |app, heroku| - expect(app.run("rails -v")).to match("") - # Test BUNDLE_DISABLE_VERSION_CHECK works expect(app.output).not_to include("The latest bundler is") + + # Test worker task only appears if the app has that rake task + worker_task = worker_task_for_app(app) + expect(worker_task).to be_nil + + run!(%Q{echo "task 'jobs:work' do ; end" >> Rakefile}) + app.commit! + + app.deploy do + worker_task = worker_task_for_app(app) + expect(worker_task["command"]).to eq("bundle exec rake jobs:work") + end end end + def worker_task_for_app(app) + app + .api_rate_limit.call + .formation + .list(app.name) + .detect { |h| h["type"] == "worker" } + end + describe "active storage" do it "non-local storage warnings" do Hatchet::Runner.new("active_storage_non_local").deploy do |app, heroku| From 5cb131ecdd3469e850ed7cc5635970cae084f172 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 9 Oct 2018 15:00:36 -0500 Subject: [PATCH 0564/1195] Record presence of `jobs:work` task --- lib/language_pack/rails2.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/language_pack/rails2.rb b/lib/language_pack/rails2.rb index ef0482f62..8542789e5 100644 --- a/lib/language_pack/rails2.rb +++ b/lib/language_pack/rails2.rb @@ -50,7 +50,7 @@ def default_process_types process_types = super process_types["web"] = web_process - process_types["worker"] = "bundle exec rake jobs:work" if rake.task("jobs:work").is_defined? + process_types["worker"] = "bundle exec rake jobs:work" if has_jobs_work_task? process_types["console"] = "bundle exec script/console" process_types end @@ -75,6 +75,14 @@ def best_practice_warnings end private + def has_jobs_work_task? + if result = rake.task("jobs:work").is_defined? + mcount("task.jobs:work.enabled") + else + mcount("task.jobs:work.disabled") + end + result + end def install_plugins instrument "rails2.install_plugins" do From 1476184ea7d9f1f96627a1af5c7f0539d367fafa Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 15 Oct 2018 19:57:32 -0500 Subject: [PATCH 0565/1195] v194 --- CHANGELOG.md | 2 ++ lib/language_pack/version.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 90326e907..21cefcfbc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Master +## v194 (10/16/2018) + * Do not add the `jobs:work` command if an app does not have that rake task available (https://github.com/heroku/heroku-buildpack-ruby/pull/810) ## v193 (9/14/2018) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 83dfcfc76..df399c391 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v193" + BUILDPACK_VERSION = "v194" end end From 02ff03d589298f74f84e57e73b8924f903473c45 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 18 Oct 2018 13:03:13 -0500 Subject: [PATCH 0566/1195] Default Ruby version is now 2.4.5 --- CHANGELOG.md | 4 ++++ lib/language_pack/ruby_version.rb | 2 +- lib/language_pack/version.rb | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 21cefcfbc..536a7e856 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Master +## v194 (10/18/2018) + +* Default Ruby version is now 2.4.5 (https://github.com/heroku/heroku-buildpack-ruby/pull/821) + ## v194 (10/16/2018) * Do not add the `jobs:work` command if an app does not have that rake task available (https://github.com/heroku/heroku-buildpack-ruby/pull/810) diff --git a/lib/language_pack/ruby_version.rb b/lib/language_pack/ruby_version.rb index e5c102017..795b7c543 100644 --- a/lib/language_pack/ruby_version.rb +++ b/lib/language_pack/ruby_version.rb @@ -12,7 +12,7 @@ def initialize(output = "") end end - DEFAULT_VERSION_NUMBER = "2.4.4" + DEFAULT_VERSION_NUMBER = "2.4.5" DEFAULT_VERSION = "ruby-#{DEFAULT_VERSION_NUMBER}" LEGACY_VERSION_NUMBER = "1.9.2" LEGACY_VERSION = "ruby-#{LEGACY_VERSION_NUMBER}" diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index df399c391..af1655dfc 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v194" + BUILDPACK_VERSION = "v195" end end From 54df1895f1f3a746573139c55b27f567adb182bb Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 18 Oct 2018 16:05:40 -0500 Subject: [PATCH 0567/1195] Fix changelog version --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 536a7e856..f6aef2646 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ## Master -## v194 (10/18/2018) +## v195 (10/18/2018) * Default Ruby version is now 2.4.5 (https://github.com/heroku/heroku-buildpack-ruby/pull/821) From cbf58934b8972a6c362244da17b20f2ace3910ec Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 17 Sep 2018 10:21:34 -0500 Subject: [PATCH 0568/1195] [close #797] Do not carry asset pipeline fragment cache into runtime When someone is using the asset pipeline, and they've disabled the config that allows them to build assets in production. So when ``` config.assets.compile = false ``` Then the `tmp/cache/assets/sprockets/` folder is not needed at runtime and should be safe to delete, which will lower the overall slug size. Do not merge until after Dreamforce. --- CHANGELOG.md | 2 ++ hatchet.json | 3 +++ hatchet.lock | 2 ++ lib/language_pack/rails4.rb | 5 +++++ lib/language_pack/ruby.rb | 4 ++++ spec/hatchet/getting_started_spec.rb | 9 +++++++++ 6 files changed, 25 insertions(+) create mode 100644 spec/hatchet/getting_started_spec.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index f6aef2646..6cbca56f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Master +* Delete the sprockets temp directory for a smaller runtime slug if they are not building assets at runtime (https://github.com/heroku/heroku-buildpack-ruby/pull/812) + ## v195 (10/18/2018) * Default Ruby version is now 2.4.5 (https://github.com/heroku/heroku-buildpack-ruby/pull/821) diff --git a/hatchet.json b/hatchet.json index 94e1e5610..10745ff56 100644 --- a/hatchet.json +++ b/hatchet.json @@ -79,6 +79,9 @@ "sharpstone/active_storage_local", "sharpstone/sprockets_asset_compile_true" ], + "heroku": [ + "heroku/ruby-getting-started" + ], "multibuildpack": [ "sharpstone/node_multi" ], diff --git a/hatchet.lock b/hatchet.lock index 42a6896cd..d3caf590b 100644 --- a/hatchet.lock +++ b/hatchet.lock @@ -27,6 +27,8 @@ - 540ec776eff3111ad9bb01af204c62725c94a11d - - "./repos/ci/ruby_no_rails_test" - 3916137106d59b008b67d738abe6a1438f8fbde6 +- - "./repos/heroku/ruby-getting-started" + - 7abd8af85c7ba6486bb03a4964da9cea98766b06 - - "./repos/jruby/jruby_naether" - c5081c07de64dcd4b480923e4b7e2a98a9b4a431 - - "./repos/multibuildpack/node_multi" diff --git a/lib/language_pack/rails4.rb b/lib/language_pack/rails4.rb index 1b44521c2..13f879611 100644 --- a/lib/language_pack/rails4.rb +++ b/lib/language_pack/rails4.rb @@ -66,6 +66,11 @@ def default_assets_cache "tmp/cache/assets" end + def cleanup + super + FileUtils.remove_dir(default_assets_cache) unless assets_compile_enabled? + end + def run_assets_precompile_rake_task instrument "rails4.run_assets_precompile_rake_task" do log("assets_precompile") do diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index c765d4293..cdefddffe 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -110,10 +110,14 @@ def compile end config_detect best_practice_warnings + cleanup super end end + def cleanup + end + def config_detect end diff --git a/spec/hatchet/getting_started_spec.rb b/spec/hatchet/getting_started_spec.rb new file mode 100644 index 000000000..7a732d61a --- /dev/null +++ b/spec/hatchet/getting_started_spec.rb @@ -0,0 +1,9 @@ +require_relative '../spec_helper' + +describe "Heroku ruby getting started" do + it "clears runtime cache" do + Hatchet::Runner.new("ruby-getting-started").deploy do |app| + expect(app.run("ls tmp/cache/assets")).to_not match("sprockets") + end + end +end From 18ce3e57bc4109db0968da07abcb106616e7a985 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 17 Sep 2018 10:44:11 -0500 Subject: [PATCH 0569/1195] Only delete directory if it exists --- lib/language_pack/rails4.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/language_pack/rails4.rb b/lib/language_pack/rails4.rb index 13f879611..a4a4b183a 100644 --- a/lib/language_pack/rails4.rb +++ b/lib/language_pack/rails4.rb @@ -68,7 +68,9 @@ def default_assets_cache def cleanup super - FileUtils.remove_dir(default_assets_cache) unless assets_compile_enabled? + return unless assets_compile_enabled? + return unless Dir.exist?(default_assets_cache) + FileUtils.remove_dir(default_assets_cache) end def run_assets_precompile_rake_task From 7303f8fbb05d168e9ff00f0db3a6318df24d664b Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 15 Oct 2018 17:16:26 -0500 Subject: [PATCH 0570/1195] Return if assets compiled is enabled --- lib/language_pack/rails4.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/rails4.rb b/lib/language_pack/rails4.rb index a4a4b183a..27041f96b 100644 --- a/lib/language_pack/rails4.rb +++ b/lib/language_pack/rails4.rb @@ -68,7 +68,7 @@ def default_assets_cache def cleanup super - return unless assets_compile_enabled? + return if assets_compile_enabled? return unless Dir.exist?(default_assets_cache) FileUtils.remove_dir(default_assets_cache) end From 8b5e748f4acadc251368a2ae9aa26407d9e3863e Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 23 Oct 2018 15:19:19 -0500 Subject: [PATCH 0571/1195] [close #825] Better Ruby version mismatch error --- lib/language_pack/ruby.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index c765d4293..fd7e21cca 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -734,7 +734,15 @@ def build_bundler(default_bundle_without) error_message += <<-ERROR Detected a mismatch between your Ruby version installed and -Ruby version specified in Gemfile or Gemfile.lock: +Ruby version specified in Gemfile or Gemfile.lock. You can +correct this by running: + + $ bundle update --ruby + $ git add Gemfile.lock + $ git commit -m "update ruby version" + +If this does not solve the issue please see this documentation: + https://devcenter.heroku.com/articles/ruby-versions#your-ruby-version-is-x-but-your-gemfile-specified-y ERROR end From dcfcf4c88cd06ec6451bfbea10c7407a8a0f9610 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 31 Oct 2018 12:51:47 -0500 Subject: [PATCH 0572/1195] v196 --- CHANGELOG.md | 2 ++ lib/language_pack/version.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6cbca56f2..252f3b245 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Master +## v196 (10/31/2018) + * Delete the sprockets temp directory for a smaller runtime slug if they are not building assets at runtime (https://github.com/heroku/heroku-buildpack-ruby/pull/812) ## v195 (10/18/2018) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index af1655dfc..783a7755e 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v195" + BUILDPACK_VERSION = "v196" end end From 64debcb03680b196fd42ae265acb5a4178a9869e Mon Sep 17 00:00:00 2001 From: Jeremy Morrell Date: Mon, 3 Dec 2018 10:09:56 -0800 Subject: [PATCH 0573/1195] Update included Node to latest LTS version --- lib/language_pack/helpers/nodebin.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/helpers/nodebin.rb b/lib/language_pack/helpers/nodebin.rb index 5f9dbb4f0..9acafadea 100644 --- a/lib/language_pack/helpers/nodebin.rb +++ b/lib/language_pack/helpers/nodebin.rb @@ -11,7 +11,7 @@ def self.query(q) end def self.hardcoded_node_lts - version = "8.10.0" + version = "10.14.1" { "number" => version, "url" => "https://s3.amazonaws.com/heroku-nodejs-bins/node/release/linux-x64/node-v#{version}-linux-x64.tar.gz" From bc3b075e58f01aba81f51f5e4ead36878cba7c4d Mon Sep 17 00:00:00 2001 From: Jeremy Morrell Date: Mon, 3 Dec 2018 10:13:09 -0800 Subject: [PATCH 0574/1195] Update included Yarn to latest 1.x version --- lib/language_pack/helpers/nodebin.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/helpers/nodebin.rb b/lib/language_pack/helpers/nodebin.rb index 5f9dbb4f0..b47f942ca 100644 --- a/lib/language_pack/helpers/nodebin.rb +++ b/lib/language_pack/helpers/nodebin.rb @@ -19,7 +19,7 @@ def self.hardcoded_node_lts end def self.hardcoded_yarn - version = "1.5.1" + version = "1.12.3" { "number" => version, "url" => "https://s3.amazonaws.com/heroku-nodejs-bins/yarn/release/yarn-v#{version}.tar.gz" From 1cbc95330285167dc59d4e7f12345e9d80530e25 Mon Sep 17 00:00:00 2001 From: Jeremy Morrell Date: Mon, 3 Dec 2018 10:16:18 -0800 Subject: [PATCH 0575/1195] Fix url to point to new bucket --- lib/language_pack/helpers/nodebin.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/helpers/nodebin.rb b/lib/language_pack/helpers/nodebin.rb index b47f942ca..c3836ee44 100644 --- a/lib/language_pack/helpers/nodebin.rb +++ b/lib/language_pack/helpers/nodebin.rb @@ -22,7 +22,7 @@ def self.hardcoded_yarn version = "1.12.3" { "number" => version, - "url" => "https://s3.amazonaws.com/heroku-nodejs-bins/yarn/release/yarn-v#{version}.tar.gz" + "url" => "https://s3.amazonaws.com/heroku-nodebin/yarn/release/yarn-v#{version}.tar.gz" } end From 8b288a321fd9c05a01d09de9e9ce61c404c04488 Mon Sep 17 00:00:00 2001 From: Jeremy Morrell Date: Mon, 3 Dec 2018 10:17:22 -0800 Subject: [PATCH 0576/1195] Fix url to point to new bucket --- lib/language_pack/helpers/nodebin.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/helpers/nodebin.rb b/lib/language_pack/helpers/nodebin.rb index 9acafadea..9619afdd8 100644 --- a/lib/language_pack/helpers/nodebin.rb +++ b/lib/language_pack/helpers/nodebin.rb @@ -14,7 +14,7 @@ def self.hardcoded_node_lts version = "10.14.1" { "number" => version, - "url" => "https://s3.amazonaws.com/heroku-nodejs-bins/node/release/linux-x64/node-v#{version}-linux-x64.tar.gz" + "url" => "https://s3.amazonaws.com/heroku-nodebin/node/release/linux-x64/node-v#{version}-linux-x64.tar.gz" } end From fb5bf391d017d033a13fcd91f16239310a25dc57 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 18 Dec 2018 09:49:57 -0600 Subject: [PATCH 0577/1195] V197 --- CHANGELOG.md | 5 +++++ lib/language_pack/version.rb | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 252f3b245..15f53ca30 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ ## Master +## v197 (12/18/2018) + +* Upgrade node version (https://github.com/heroku/heroku-buildpack-ruby/pull/831) +* Upgrade yarn version (https://github.com/heroku/heroku-buildpack-ruby/pull/832) + ## v196 (10/31/2018) * Delete the sprockets temp directory for a smaller runtime slug if they are not building assets at runtime (https://github.com/heroku/heroku-buildpack-ruby/pull/812) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 783a7755e..7e7194588 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v196" + BUILDPACK_VERSION = "v197" end end From cbcf6ff75b934e7699a504e19eba3aeee6d62b9f Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 27 Dec 2018 09:57:01 -0600 Subject: [PATCH 0578/1195] Update default ruby version to 2.5.3 --- CHANGELOG.md | 2 ++ lib/language_pack/ruby_version.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 15f53ca30..544e80e95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Master +* Rev-default Ruby version to be the latest patch release of last years Ruby version 2.5.3 (https://github.com/heroku/heroku-buildpack-ruby/pull/846) + ## v197 (12/18/2018) * Upgrade node version (https://github.com/heroku/heroku-buildpack-ruby/pull/831) diff --git a/lib/language_pack/ruby_version.rb b/lib/language_pack/ruby_version.rb index 795b7c543..a16035d48 100644 --- a/lib/language_pack/ruby_version.rb +++ b/lib/language_pack/ruby_version.rb @@ -12,7 +12,7 @@ def initialize(output = "") end end - DEFAULT_VERSION_NUMBER = "2.4.5" + DEFAULT_VERSION_NUMBER = "2.5.3" DEFAULT_VERSION = "ruby-#{DEFAULT_VERSION_NUMBER}" LEGACY_VERSION_NUMBER = "1.9.2" LEGACY_VERSION = "ruby-#{LEGACY_VERSION_NUMBER}" From 16795efb28f23db87a2dc6e2326eb59b1671ca1a Mon Sep 17 00:00:00 2001 From: schneems Date: Fri, 28 Dec 2018 11:34:42 -0600 Subject: [PATCH 0579/1195] Close #847 Allow apps to enable `RUBYOPT=--jit` If you set: ``` $ heroku config:set RUBYOT=--jit ``` Then this will be a global value so when the buildpack attempts to detect ruby version by running: ``` $ bundle platform --ruby ``` It is executed with the RUBYOPT set. Since the version of Ruby the buildpack executes does not have `--jit` it fails: ``` -----> Ruby app detected -----> Compiling Ruby/Rails ! ! There was an error parsing your Gemfile, we cannot continue ! ruby: invalid option --jit (-h will show valid options) (RuntimeError) ! ! Push rejected, failed to compile Ruby app. ! Push failed ``` --- CHANGELOG.md | 2 ++ lib/language_pack/shell_helpers.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 15f53ca30..6ba7592a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Master +* Allow apps to enable `RUBYOPT=--jit` (https://github.com/heroku/heroku-buildpack-ruby/pull/848) + ## v197 (12/18/2018) * Upgrade node version (https://github.com/heroku/heroku-buildpack-ruby/pull/831) diff --git a/lib/language_pack/shell_helpers.rb b/lib/language_pack/shell_helpers.rb index 5de58edfb..c7226a3fd 100644 --- a/lib/language_pack/shell_helpers.rb +++ b/lib/language_pack/shell_helpers.rb @@ -48,7 +48,7 @@ def env(var) end def self.blacklist?(key) - %w(PATH GEM_PATH GEM_HOME GIT_DIR JRUBY_OPTS JAVA_OPTS JAVA_TOOL_OPTIONS).include?(key) + %w(PATH GEM_PATH GEM_HOME GIT_DIR JRUBY_OPTS JAVA_OPTS JAVA_TOOL_OPTIONS RUBYOPT).include?(key) end def self.initialize_env(path) From 59e58cb0e1a2aad58c97ee6ffc3a95045c8fe4b5 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 17 Jan 2019 11:53:22 -0600 Subject: [PATCH 0580/1195] v198 --- CHANGELOG.md | 2 ++ lib/language_pack/version.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b6c597446..ff2e92cd0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Master +## v198 (1/17/2019) + * Rev-default Ruby version to be the latest patch release of last years Ruby version 2.5.3 (https://github.com/heroku/heroku-buildpack-ruby/pull/846) * Allow apps to enable `RUBYOPT=--jit` (https://github.com/heroku/heroku-buildpack-ruby/pull/848) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 7e7194588..45229cd61 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v197" + BUILDPACK_VERSION = "v198" end end From 08269099ecbe56387a103eb4ce78decf97c10487 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 17 Jan 2019 12:42:44 -0600 Subject: [PATCH 0581/1195] Fix JVM Spec --- spec/hatchet/jvm_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/hatchet/jvm_spec.rb b/spec/hatchet/jvm_spec.rb index 981d9f56e..9229d2fae 100644 --- a/spec/hatchet/jvm_spec.rb +++ b/spec/hatchet/jvm_spec.rb @@ -2,7 +2,7 @@ describe "JvmInstaller" do it "JVM is installed by jvm-common only" do - buildpacks = ["https://github.com/heroku/heroku-buildpack-jvm-common", + buildpacks = ["heroku/jvm", Hatchet::App.default_buildpack] # default is heroku-ruby-buildpack here app = Hatchet::Runner.new("ruby_193_jruby_17161", stack: 'cedar-14', buildpacks: buildpacks) app.setup! From 58ebc3a3b3f5de2bb199f580cc475cf6cdfd3b15 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 5 Feb 2019 15:25:14 -0600 Subject: [PATCH 0582/1195] Attempt to make rails runner tests less flappy Not sure why they flap, but this makes sure all examples are running in their own dir. --- spec/helpers/node_installer_spec.rb | 2 +- spec/helpers/rails_runner_spec.rb | 65 ++++++++++++++--------------- spec/helpers/yarn_installer_spec.rb | 3 +- 3 files changed, 33 insertions(+), 37 deletions(-) diff --git a/spec/helpers/node_installer_spec.rb b/spec/helpers/node_installer_spec.rb index 8475a2df7..dff419669 100644 --- a/spec/helpers/node_installer_spec.rb +++ b/spec/helpers/node_installer_spec.rb @@ -3,9 +3,9 @@ describe LanguagePack::Helpers::NodeInstaller do describe "#install" do it "should extract a node binary" do - installer = LanguagePack::Helpers::NodeInstaller.new Dir.mktmpdir do |dir| Dir.chdir(dir) do + installer = LanguagePack::Helpers::NodeInstaller.new installer.install expect(File.exist?("node")).to be(true) diff --git a/spec/helpers/rails_runner_spec.rb b/spec/helpers/rails_runner_spec.rb index 797b7f6c2..b8ea57f09 100644 --- a/spec/helpers/rails_runner_spec.rb +++ b/spec/helpers/rails_runner_spec.rb @@ -1,6 +1,15 @@ require 'spec_helper' describe "Rails Runner" do + around(:each) do |test| + Dir.mktmpdir do |tmpdir| + @tmpdir = tmpdir + Dir.chdir(tmpdir) do + test.run + end + end + end + it "config objects build propperly formatted commands" do rails_runner = LanguagePack::Helpers::RailsRunner.new local_storage = rails_runner.detect("active_storage.service") @@ -29,52 +38,40 @@ def rails_runner.called; @called; end end it "calls a mock interface" do - Dir.mktmpdir do |tmpdir| - Dir.chdir(tmpdir) do - mock_rails_runner - expect(File.executable?("bin/rails")).to eq(true) + mock_rails_runner + expect(File.executable?("bin/rails")).to eq(true) - rails_runner = LanguagePack::Helpers::RailsRunner.new - local_storage = rails_runner.detect("active_storage.service") - local_storage = rails_runner.detect("foo.bar") + rails_runner = LanguagePack::Helpers::RailsRunner.new + local_storage = rails_runner.detect("active_storage.service") + local_storage = rails_runner.detect("foo.bar") - expect(rails_runner.output).to match("heroku.detecting.config.for.active_storage.service=active_storage.service") - expect(rails_runner.output).to match("heroku.detecting.config.for.foo.bar=foo.bar") - expect(rails_runner.success?).to be(true) - end - end + expect(rails_runner.output).to match("heroku.detecting.config.for.active_storage.service=active_storage.service") + expect(rails_runner.output).to match("heroku.detecting.config.for.foo.bar=foo.bar") + expect(rails_runner.success?).to be(true) end it "timeout works as expected" do - Dir.mktmpdir do |tmpdir| - Dir.chdir(tmpdir) do - mock_rails_runner("pid = Process.spawn('sleep 5'); Process.wait(pid)") + mock_rails_runner("pid = Process.spawn('sleep 5'); Process.wait(pid)") - diff = time_it do - rails_runner = LanguagePack::Helpers::RailsRunner.new(false, 0.01) - local_storage = rails_runner.detect("active_storage.service") - expect(rails_runner.success?).to eq(false) - expect(rails_runner.timeout?).to eq(true) - end - - expect(diff < 1).to eq(true), "expected time difference #{diff} to be less than 1 second, but was longer" - end + diff = time_it do + rails_runner = LanguagePack::Helpers::RailsRunner.new(false, 0.01) + local_storage = rails_runner.detect("active_storage.service") + expect(rails_runner.success?).to eq(false) + expect(rails_runner.timeout?).to eq(true) end + + expect(diff < 1).to eq(true), "expected time difference #{diff} to be less than 1 second, but was longer" end it "failure in one task does not cause another to fail" do - Dir.mktmpdir do |tmpdir| - Dir.chdir(tmpdir) do - mock_rails_runner('raise "bad" if value == :bad') + mock_rails_runner('raise "bad" if value == :bad') - rails_runner = LanguagePack::Helpers::RailsRunner.new(false, 1) - bad_value = rails_runner.detect("bad.value") - local_storage = rails_runner.detect("active_storage.service") + rails_runner = LanguagePack::Helpers::RailsRunner.new(false, 1) + bad_value = rails_runner.detect("bad.value") + local_storage = rails_runner.detect("active_storage.service") - expect(!!bad_value.success?).to eq(false) - expect(!!local_storage.success?).to eq(true) - end - end + expect(!!bad_value.success?).to eq(false) + expect(!!local_storage.success?).to eq(true) end def time_it diff --git a/spec/helpers/yarn_installer_spec.rb b/spec/helpers/yarn_installer_spec.rb index 86ada6bb6..8359428e6 100644 --- a/spec/helpers/yarn_installer_spec.rb +++ b/spec/helpers/yarn_installer_spec.rb @@ -4,10 +4,9 @@ describe "#install" do it "should extract the yarn package" do - installer = LanguagePack::Helpers::YarnInstaller.new - Dir.mktmpdir do |dir| Dir.chdir(dir) do + installer = LanguagePack::Helpers::YarnInstaller.new installer.install # webpacker gem checks for yarnpkg From 45981c0580967badae19d70b2aa64d66916a1ebd Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 5 Feb 2019 11:10:26 -0600 Subject: [PATCH 0583/1195] De-couple BundlerWrapper from LanguagePack::Ruby --- lib/language_pack/helpers/bundler_wrapper.rb | 36 +++++++++++--------- lib/language_pack/ruby.rb | 14 ++++---- spec/helpers/fetcher_spec.rb | 5 ++- 3 files changed, 28 insertions(+), 27 deletions(-) diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index 218230b26..2f2b7902b 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -1,5 +1,9 @@ require 'language_pack/fetcher' +# This class is responsible for installing and maintaining a +# reference to bundler. It contains access to bundler internals +# that are used to introspect a project such as detecting presence +# of gems and their versions. class LanguagePack::Helpers::BundlerWrapper include LanguagePack::ShellHelpers @@ -11,24 +15,20 @@ def initialize(error) end end - VENDOR_URL = LanguagePack::Base::VENDOR_URL # coupling - DEFAULT_FETCHER = LanguagePack::Fetcher.new(VENDOR_URL) # coupling - BUNDLER_DIR_NAME = LanguagePack::Ruby::BUNDLER_GEM_PATH # coupling - BUNDLER_PATH = File.expand_path("../../../../tmp/#{BUNDLER_DIR_NAME}", __FILE__) - GEMFILE_PATH = Pathname.new "./Gemfile" - - attr_reader :bundler_path + attr_reader :bundler_path def initialize(options = {}) - @fetcher = options[:fetcher] || DEFAULT_FETCHER + @version = "1.15.2" @bundler_tmp = Dir.mktmpdir - @bundler_path = options[:bundler_path] || File.join(@bundler_tmp, "#{BUNDLER_DIR_NAME}") - @gemfile_path = options[:gemfile_path] || GEMFILE_PATH - @bundler_tar = options[:bundler_tar] || "#{BUNDLER_DIR_NAME}.tgz" + @fetcher = options[:fetcher] || LanguagePack::Fetcher.new(LanguagePack::Base::VENDOR_URL) # coupling + @bundler_path = options[:bundler_path] || File.join(@bundler_tmp, "#{dir_name}") + @gemfile_path = options[:gemfile_path] || Pathname.new("./Gemfile") + @bundler_tar = options[:bundler_tar] || "#{dir_name}.tgz" + @gemfile_lock_path = "#{@gemfile_path}.lock" @orig_bundle_gemfile = ENV['BUNDLE_GEMFILE'] ENV['BUNDLE_GEMFILE'] = @gemfile_path.to_s - @path = Pathname.new "#{@bundler_path}/gems/#{BUNDLER_DIR_NAME}/lib" + @path = Pathname.new "#{@bundler_path}/gems/#{dir_name}/lib" end def install @@ -42,7 +42,7 @@ def clean ENV['BUNDLE_GEMFILE'] = @orig_bundle_gemfile FileUtils.remove_entry_secure(@bundler_tmp) if Dir.exist?(@bundler_tmp) - if LanguagePack::Ruby::BUNDLER_VERSION == "1.7.12" + if version == "1.7.12" # Hack to cleanup after pre 1.8 versions of bundler. See https://github.com/bundler/bundler/pull/3277/ Dir["#{Dir.tmpdir}/bundler*"].each do |dir| FileUtils.remove_entry_secure(dir) if Dir.exist?(dir) && File.stat(dir).writable? @@ -71,7 +71,7 @@ def windows_gemfile_lock? end def specs - @specs ||= lockfile_parser.specs.each_with_object({}) {|spec, hash| hash[spec.name] = spec } + @specs ||= lockfile_parser.specs.each_with_object({}) {|spec, hash| hash[spec.name] = spec } end def platforms @@ -79,7 +79,11 @@ def platforms end def version - Bundler::VERSION + @version + end + + def dir_name + "bundler-#{version}" end def instrument(*args, &block) @@ -89,7 +93,7 @@ def instrument(*args, &block) def ruby_version instrument 'detect_ruby_version' do env = { "PATH" => "#{bundler_path}/bin:#{ENV['PATH']}", - "RUBYLIB" => File.join(bundler_path, "gems", BUNDLER_DIR_NAME, "lib"), + "RUBYLIB" => File.join(bundler_path, "gems", dir_name, "lib"), "GEM_PATH" => "#{bundler_path}:#{ENV["GEM_PATH"]}", "BUNDLE_DISABLE_VERSION_CHECK" => "true" } diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 88e42faee..a44977d85 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -16,8 +16,6 @@ class LanguagePack::Ruby < LanguagePack::Base NAME = "ruby" LIBYAML_VERSION = "0.1.7" LIBYAML_PATH = "libyaml-#{LIBYAML_VERSION}" - BUNDLER_VERSION = "1.15.2" - BUNDLER_GEM_PATH = "bundler-#{BUNDLER_VERSION}" RBX_BASE_URL = "http://binaries.rubini.us/heroku" NODE_BP_PATH = "vendor/node/bin" @@ -126,9 +124,9 @@ def config_detect def warn_bundler_upgrade old_bundler_version = @metadata.read("bundler_version").chomp if @metadata.exists?("bundler_version") - if old_bundler_version && old_bundler_version != BUNDLER_VERSION + if old_bundler_version && old_bundler_version != bundler.version puts(<<-WARNING) -Your app was upgraded to bundler #{ BUNDLER_VERSION }. +Your app was upgraded to bundler #{ bundler.version }. Previously you had a successful deploy with bundler #{ old_bundler_version }. If you see problems related to the bundler version please refer to: @@ -596,7 +594,7 @@ def bundler_binstubs_path end def bundler_path - @bundler_path ||= "#{slug_vendor_base}/gems/#{BUNDLER_GEM_PATH}" + @bundler_path ||= "#{slug_vendor_base}/gems/#{bundler.dir_name}" end def write_bundler_shim(path) @@ -607,7 +605,7 @@ def write_bundler_shim(path) #!/usr/bin/env ruby require 'rubygems' -version = "#{BUNDLER_VERSION}" +version = "#{bundler.version}" if ARGV.first str = ARGV.first @@ -678,7 +676,7 @@ def build_bundler(default_bundle_without) yaml_include = File.expand_path("#{libyaml_dir}/include").shellescape yaml_lib = File.expand_path("#{libyaml_dir}/lib").shellescape pwd = Dir.pwd - bundler_path = "#{pwd}/#{slug_vendor_base}/gems/#{BUNDLER_GEM_PATH}/lib" + bundler_path = "#{pwd}/#{slug_vendor_base}/gems/#{bundler.dir_name}/lib" # we need to set BUNDLE_CONFIG and BUNDLE_GEMFILE for # codon since it uses bundler. env_vars = { @@ -1081,7 +1079,7 @@ def load_bundler_cache FileUtils.mkdir_p(heroku_metadata) @metadata.write(ruby_version_cache, full_ruby_version, false) @metadata.write(buildpack_version_cache, BUILDPACK_VERSION, false) - @metadata.write(bundler_version_cache, BUNDLER_VERSION, false) + @metadata.write(bundler_version_cache, bundler.version, false) @metadata.write(rubygems_version_cache, rubygems_version, false) @metadata.write(stack_cache, @stack, false) @metadata.save diff --git a/spec/helpers/fetcher_spec.rb b/spec/helpers/fetcher_spec.rb index 03fd6d8ad..78b12d964 100644 --- a/spec/helpers/fetcher_spec.rb +++ b/spec/helpers/fetcher_spec.rb @@ -1,15 +1,14 @@ require 'spec_helper' describe "Fetches" do - it "bundler" do Dir.mktmpdir do |dir| Dir.chdir(dir) do + fetcher = LanguagePack::Fetcher.new(LanguagePack::Base::VENDOR_URL) - fetcher.fetch_untar("#{LanguagePack::Ruby::BUNDLER_GEM_PATH}.tgz") + fetcher.fetch_untar("#{LanguagePack::Helpers::BundlerWrapper.new.dir_name}.tgz") expect(`ls bin`).to match("bundle") end end end end - From 3eed97936ea69bf22fb1da7cdd855522becfe2e7 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 5 Feb 2019 13:00:14 -0600 Subject: [PATCH 0584/1195] Detect bundler version ## Problem 1 Bundler 2.x cannot be used with a Gemfile.lock that specifies bundler 1.x: ``` BUNDLED WITH 1.16.4 ``` If you try, then Bundler 2.x will look for an installed bundler 1.x version and try to use it. If no such version exists on the system then an error is thrown: ``` can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException) ``` - https://github.com/rubygems/rubygems/pull/2426 - https://github.com/rubygems/rubygems/pull/2515 ## Problem 2 Likewise a version of bundler 1.x cannot be used on a project where a `BUNDLED WITH` specifies 2.x: ``` $ bundle -v 1.17.3 $ cat Gemfile.lock | grep -A 1 BUNDLED WITH BUNDLED WITH 2.0.1 $ bundle Traceback (most recent call last): 2: from /Users/rschneeman/.gem/ruby/2.6.0/bin/bundle:23:in `
' 1: from /Users/rschneeman/.rubies/ruby-2.6.0/lib/ruby/2.6.0/rubygems.rb:302:in `activate_bin_path' /Users/rschneeman/.rubies/ruby-2.6.0/lib/ruby/2.6.0/rubygems.rb:283:in `find_spec_for_exe': Could not find 'bundler' (2.0.0) required by your /private/tmp/default_ruby/Gemfile.lock. (Gem::GemNotFoundException) To update to the latest version installed on your system, run `bundle update --bundler`. To install the missing version, run `gem install bundler:2.0.0` ``` This is due to a bug in Rubygems 3.x https://github.com/rubygems/rubygems/issues/2592 ## Proposed Solution This PR implements a solution where we have a different "blessed" version of bundler for each major version. The way this is implemented is to read in a Gemfile.lock and to read in the `BUNDLED WITH` value. Then the major version is pulled out and converted into a "blessed" version. This allows for multiple major versions of bundler to be used on Heroku without sacrificing stability. --- lib/language_pack/helpers/bundler_wrapper.rb | 79 ++++++++++++++++++-- spec/hatchet/bundler_spec.rb | 11 +++ spec/helpers/fetcher_spec.rb | 1 + 3 files changed, 83 insertions(+), 8 deletions(-) create mode 100644 spec/hatchet/bundler_spec.rb diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index 2f2b7902b..8d24bd4f1 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -1,34 +1,74 @@ +# frozen_string_literal: true + require 'language_pack/fetcher' # This class is responsible for installing and maintaining a # reference to bundler. It contains access to bundler internals # that are used to introspect a project such as detecting presence # of gems and their versions. +# +# Example: +# +# bundler = LanguagePack::Helpers::BundlerWrapper.new +# bundler.install +# bundler.version => "1.15.2" +# bundler.dir_name => "bundler-1.15.2" +# bundler.has_gem?("railties") => true +# bundler.gem_version("railties") => "5.2.2" +# +# Also used to determine the version of Ruby that a project is using +# based on `bundle platform --ruby` +# +# bundler.ruby_version # => "ruby-2.5.1" +# class LanguagePack::Helpers::BundlerWrapper include LanguagePack::ShellHelpers + BLESSED_BUNDLER_VERSIONS = {} + BLESSED_BUNDLER_VERSIONS["1"] = "1.15.2" + BLESSED_BUNDLER_VERSIONS["2"] = "2.0.1" + private_constant :BLESSED_BUNDLER_VERSIONS + class GemfileParseError < BuildpackError def initialize(error) - msg = "There was an error parsing your Gemfile, we cannot continue\n" + msg = String.new("There was an error parsing your Gemfile, we cannot continue\n") msg << error super msg end end + class UnsupportedBundlerVersion < BuildpackError + def initialize(version_hash, major) + msg = String.new("Your Gemfile.lock indicates you need bundler `#{major}.x`\n") + msg << "which is not currently supported. You can deploy with bundler version:\n" + version_hash.keys.each do |v| + msg << " - `#{v}.x`\n" + end + msg << "\nTo use another version of bundler, update your `Gemfile.lock` to poin\n" + msg << "to as supported version. For example:\n" + msg << "\n" + msg << "```\n" + msg << "BUNDLED WITH\n" + msg << " #{version_hash["1"]}" + msg << "```" + super msg + end + end + attr_reader :bundler_path def initialize(options = {}) - @version = "1.15.2" - @bundler_tmp = Dir.mktmpdir + @bundler_tmp = Pathname.new(Dir.mktmpdir) @fetcher = options[:fetcher] || LanguagePack::Fetcher.new(LanguagePack::Base::VENDOR_URL) # coupling - @bundler_path = options[:bundler_path] || File.join(@bundler_tmp, "#{dir_name}") @gemfile_path = options[:gemfile_path] || Pathname.new("./Gemfile") - @bundler_tar = options[:bundler_tar] || "#{dir_name}.tgz" + @gemfile_lock_path = Pathname.new("#{@gemfile_path}.lock") + detect_bundler_version_and_dir_name! - @gemfile_lock_path = "#{@gemfile_path}.lock" + @bundler_path = options[:bundler_path] || @bundler_tmp.join(dir_name) + @bundler_tar = options[:bundler_tar] || "bundler/#{dir_name}.tgz" @orig_bundle_gemfile = ENV['BUNDLE_GEMFILE'] ENV['BUNDLE_GEMFILE'] = @gemfile_path.to_s - @path = Pathname.new "#{@bundler_path}/gems/#{dir_name}/lib" + @path = Pathname.new("#{@bundler_path}/gems/#{dir_name}/lib") end def install @@ -40,7 +80,7 @@ def install def clean ENV['BUNDLE_GEMFILE'] = @orig_bundle_gemfile - FileUtils.remove_entry_secure(@bundler_tmp) if Dir.exist?(@bundler_tmp) + @bundler_tmp.rmtree if @bundler_tmp.directory? if version == "1.7.12" # Hack to cleanup after pre 1.8 versions of bundler. See https://github.com/bundler/bundler/pull/3277/ @@ -134,4 +174,27 @@ def parse_gemfile_lock Bundler::LockfileParser.new(gemfile_contents) end end + + def major_bundler_version + # https://rubular.com/r/uuRpai9IheL68d + bundler_version_match = @gemfile_lock_path.read.match(/^BUNDLED WITH$(\r?\n) (?\d*)\.\d*\.\d*/m) + + if bundler_version_match + bundler_version_match[:major] + else + "1" + end + end + + # You cannot use Bundler 2.x with a Gemfile.lock that points to a 1.x bundler + # version. The solution here is to read in the value set in the Gemfile.lock + # and download the "blessed" version with the same major version. + def detect_bundler_version_and_dir_name! + major = major_bundler_version + if BLESSED_BUNDLER_VERSIONS.key?(major) + @version = BLESSED_BUNDLER_VERSIONS[major] + else + raise UnsupportedBundlerVersion.new(BLESSED_BUNDLER_VERSIONS, major) + end + end end diff --git a/spec/hatchet/bundler_spec.rb b/spec/hatchet/bundler_spec.rb new file mode 100644 index 000000000..a774c6d14 --- /dev/null +++ b/spec/hatchet/bundler_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "Bundler" do + it "deploys with version 2.x" do + before_deploy = -> { run!(%Q{printf "\nBUNDLED WITH\n 2.0.1\n" >> Gemfile.lock}) } + + Hatchet::Runner.new("default_ruby", before_deploy: before_deploy).deploy do |app| + expect(app.output).to match("Installing dependencies using bundler 2.") + end + end +end diff --git a/spec/helpers/fetcher_spec.rb b/spec/helpers/fetcher_spec.rb index 78b12d964..17d9b1368 100644 --- a/spec/helpers/fetcher_spec.rb +++ b/spec/helpers/fetcher_spec.rb @@ -4,6 +4,7 @@ it "bundler" do Dir.mktmpdir do |dir| Dir.chdir(dir) do + FileUtils.touch("Gemfile.lock") fetcher = LanguagePack::Fetcher.new(LanguagePack::Base::VENDOR_URL) fetcher.fetch_untar("#{LanguagePack::Helpers::BundlerWrapper.new.dir_name}.tgz") From 80f3d88fc380273d6d16d9230ff01840480e285d Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 5 Feb 2019 16:23:03 -0600 Subject: [PATCH 0585/1195] Fix a flappy test based on the bundler wrapper Usually this would take a LONG time as the test suite when run serially takes about an hour. The other thing that is tough about this, is it only fails on CI and not locally. On a hunch I guessed the failing behavior came only from `spec/helpers` which is all unit tested and therefore pretty fast. This allowed me to actually find the failing order. Via `$ heroku ci:debug` First I ran: ``` $ bundle exec rspec spec/helpers --bisect --seed 1 ``` The `--seed` argument is used because otherwise the order is randomized on every run. It doesn't matter what value is used as long as it's consistent. This produce a "minimal failing example" of running: ``` $ rspec './spec/helpers/fetcher_spec.rb[1:1]' './spec/helpers/rails_runner_spec.rb[1:3,1:5]' './spec/helpers/rake_runner_spec.rb[1:1,1:2]' --seed 1 ``` Sure enough this command fails 100% of the time. I knew the culprit had to be mutating something global. Previously I've been focused on files on disk but considering every example is now run inside of it's own temp directory then it is likely something else. The other culprit could be an environment variable. This lead me to look into the bundler wrapper which sure enoug mutates the env var `BUNDLE_GEMFILE`. --- lib/language_pack/helpers/bundler_wrapper.rb | 22 +++++++++++++++----- spec/helpers/rails_runner_spec.rb | 7 +++++-- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index 8d24bd4f1..cc6aecd72 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -15,11 +15,22 @@ # bundler.dir_name => "bundler-1.15.2" # bundler.has_gem?("railties") => true # bundler.gem_version("railties") => "5.2.2" +# bundler.clean # # Also used to determine the version of Ruby that a project is using # based on `bundle platform --ruby` # # bundler.ruby_version # => "ruby-2.5.1" +# bundler.clean +# +# IMPORTANT: Calling `BundlerWrapper#install` on this class mutates the environment variable +# ENV['BUNDLE_GEMFILE']. If you're calling in a test context (or anything outside) +# of an isolated dyno, you must call `BundlerWrapper#clean`. To reset the environment +# variable: +# +# bundler = LanguagePack::Helpers::BundlerWrapper.new +# bundler.install +# bundler.clean # <========== IMPORTANT ============= # class LanguagePack::Helpers::BundlerWrapper include LanguagePack::ShellHelpers @@ -44,13 +55,13 @@ def initialize(version_hash, major) version_hash.keys.each do |v| msg << " - `#{v}.x`\n" end - msg << "\nTo use another version of bundler, update your `Gemfile.lock` to poin\n" - msg << "to as supported version. For example:\n" + msg << "\nTo use another version of bundler, update your `Gemfile.lock` to point\n" + msg << "to a supported version. For example:\n" msg << "\n" msg << "```\n" msg << "BUNDLED WITH\n" - msg << " #{version_hash["1"]}" - msg << "```" + msg << " #{version_hash["1"]}\n" + msg << "```\n" super msg end end @@ -67,11 +78,12 @@ def initialize(options = {}) @bundler_path = options[:bundler_path] || @bundler_tmp.join(dir_name) @bundler_tar = options[:bundler_tar] || "bundler/#{dir_name}.tgz" @orig_bundle_gemfile = ENV['BUNDLE_GEMFILE'] - ENV['BUNDLE_GEMFILE'] = @gemfile_path.to_s @path = Pathname.new("#{@bundler_path}/gems/#{dir_name}/lib") end def install + ENV['BUNDLE_GEMFILE'] = @gemfile_path.to_s + fetch_bundler $LOAD_PATH << @path require "bundler" diff --git a/spec/helpers/rails_runner_spec.rb b/spec/helpers/rails_runner_spec.rb index b8ea57f09..7bae1c922 100644 --- a/spec/helpers/rails_runner_spec.rb +++ b/spec/helpers/rails_runner_spec.rb @@ -2,12 +2,16 @@ describe "Rails Runner" do around(:each) do |test| + original_path = ENV["PATH"] + ENV["PATH"] = "./bin/:#{ENV['PATH']}" + Dir.mktmpdir do |tmpdir| - @tmpdir = tmpdir Dir.chdir(tmpdir) do test.run end end + ensure + ENV["PATH"] = original_path if original_path end it "config objects build propperly formatted commands" do @@ -119,7 +123,6 @@ def to_s FileUtils.mkdir("bin") File.open("bin/rails", "w") { |f| f << executable_contents } File.chmod(0777, "bin/rails") - ENV["PATH"] = "./bin/:#{ENV['PATH']}" unless ENV["PATH"].include?("./bin:") # BUILDPACK_LOG_FILE support for logging FileUtils.mkdir("tmp") From c1fd23ee8e37fc82766e141aa7cefbdab9b66a0a Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 6 Feb 2019 20:05:04 -0600 Subject: [PATCH 0586/1195] Ensure at least 1 digit in version --- lib/language_pack/helpers/bundler_wrapper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index cc6aecd72..51ae1c815 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -188,8 +188,8 @@ def parse_gemfile_lock end def major_bundler_version - # https://rubular.com/r/uuRpai9IheL68d - bundler_version_match = @gemfile_lock_path.read.match(/^BUNDLED WITH$(\r?\n) (?\d*)\.\d*\.\d*/m) + # https://rubular.com/r/jt9yj0aY7fU3hD + bundler_version_match = @gemfile_lock_path.read.match(/^BUNDLED WITH$(\r?\n) (?\d+)\.\d+\.\d+/m) if bundler_version_match bundler_version_match[:major] From 7108542b400297d30fac2d9bc9ab8833c04ef110 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 7 Feb 2019 12:12:37 -0600 Subject: [PATCH 0587/1195] Remove code that will never get called Since we control the version, this code will never execute unless we regress to a REALLY old version. I'm deleting it. --- lib/language_pack/helpers/bundler_wrapper.rb | 7 ------- 1 file changed, 7 deletions(-) diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index 51ae1c815..551416d2b 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -93,13 +93,6 @@ def install def clean ENV['BUNDLE_GEMFILE'] = @orig_bundle_gemfile @bundler_tmp.rmtree if @bundler_tmp.directory? - - if version == "1.7.12" - # Hack to cleanup after pre 1.8 versions of bundler. See https://github.com/bundler/bundler/pull/3277/ - Dir["#{Dir.tmpdir}/bundler*"].each do |dir| - FileUtils.remove_entry_secure(dir) if Dir.exist?(dir) && File.stat(dir).writable? - end - end end def has_gem?(name) From 72a9486eb26605eca640f1aa982a3fc04ad0631d Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 11 Feb 2019 10:38:06 -0600 Subject: [PATCH 0588/1195] v199 --- CHANGELOG.md | 5 +++++ lib/language_pack/version.rb | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ff2e92cd0..d44de05cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ ## Master + +## v199 (2/19/2019) + +* Add support for arbitrary Bundler major versions, most notably bundler 2 (https://github.com/heroku/heroku-buildpack-ruby/pull/850) + ## v198 (1/17/2019) * Rev-default Ruby version to be the latest patch release of last years Ruby version 2.5.3 (https://github.com/heroku/heroku-buildpack-ruby/pull/846) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 45229cd61..284d6e7ae 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v198" + BUILDPACK_VERSION = "v199" end end From 568afac4e41e7ec2ac95efe4f2514939f266b194 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 13 Feb 2019 12:19:44 -0600 Subject: [PATCH 0589/1195] Ignore invalid byte encodings when detecting rails config Previously if a customer had an invalid byte sequence emitted during boot up, it would raise an error: ``` invalid byte sequence in UTF-8 ``` Which would prevent configuration detection from functioning correctly. When detecting rails configuration, we know that the input we are trying to detect for success will be UTF-8. As a result, we can ignore any other encoded characters. This PR prevents an invalid byte sequence from blocking rails configuration detection. Reference internal support ticket number: 681812 Here's a blog post on invalid byte sequences if you're interested https://thoughtbot.com/blog/fight-back-utf-8-invalid-byte-sequences. --- CHANGELOG.md | 2 ++ lib/language_pack/shell_helpers.rb | 2 +- spec/helpers/rails_runner_spec.rb | 9 +++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d44de05cb..b481f47a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ ## Master +* Ignore invalid byte encodings when detecting rails config (https://github.com/heroku/heroku-buildpack-ruby/pull/854) + ## v199 (2/19/2019) * Add support for arbitrary Bundler major versions, most notably bundler 2 (https://github.com/heroku/heroku-buildpack-ruby/pull/850) diff --git a/lib/language_pack/shell_helpers.rb b/lib/language_pack/shell_helpers.rb index c7226a3fd..1e2401731 100644 --- a/lib/language_pack/shell_helpers.rb +++ b/lib/language_pack/shell_helpers.rb @@ -177,7 +177,7 @@ def initialize(command, options = {}) def output raise "no file name given" if @file.nil? exec_once - @file.read + @file.read.encode('UTF-8', invalid: :replace) end def timeout? diff --git a/spec/helpers/rails_runner_spec.rb b/spec/helpers/rails_runner_spec.rb index 7bae1c922..db123b0e0 100644 --- a/spec/helpers/rails_runner_spec.rb +++ b/spec/helpers/rails_runner_spec.rb @@ -78,6 +78,15 @@ def rails_runner.called; @called; end expect(!!local_storage.success?).to eq(true) end + it "does not fail when there is an invalid byte sequence" do + mock_rails_runner('puts "hi \255"') + + rails_runner = LanguagePack::Helpers::RailsRunner.new + local_storage = rails_runner.detect("active_storage.service") + + expect(local_storage.success?).to be_truthy + end + def time_it start = Time.now yield From 67ed3f893949d64dcd9369e951c578fdc9799963 Mon Sep 17 00:00:00 2001 From: Josh W Lewis Date: Wed, 27 Feb 2019 11:27:32 -0600 Subject: [PATCH 0590/1195] Setup export in tests too --- lib/language_pack/test/ruby.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/language_pack/test/ruby.rb b/lib/language_pack/test/ruby.rb index db6b93661..92d57e8cd 100644 --- a/lib/language_pack/test/ruby.rb +++ b/lib/language_pack/test/ruby.rb @@ -8,6 +8,7 @@ def compile install_ruby install_jvm setup_language_pack_environment + setup_export setup_profiled allow_git do install_bundler_in_app From d98373a1c58197572c9ce5f73b53b2c2068dced2 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 7 Mar 2019 14:21:30 -0600 Subject: [PATCH 0591/1195] v200 --- CHANGELOG.md | 2 ++ lib/language_pack/version.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b481f47a4..fa6a44498 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ ## Master +## v200 (3/7/2019) +* Fix: Environment variables not being exported for other buildpacks in CI (https://github.com/heroku/heroku-buildpack-ruby/pull/858) * Ignore invalid byte encodings when detecting rails config (https://github.com/heroku/heroku-buildpack-ruby/pull/854) ## v199 (2/19/2019) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 284d6e7ae..e727cc9de 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v199" + BUILDPACK_VERSION = "v200" end end From 43dcd4acded60b88b31a614ae95facc6399cc78c Mon Sep 17 00:00:00 2001 From: Jeremy Morrell Date: Thu, 7 Mar 2019 18:06:23 -0800 Subject: [PATCH 0592/1195] Set memory default for Node builds --- lib/language_pack/ruby.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index a44977d85..296217c22 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -57,7 +57,14 @@ def default_addons def default_config_vars instrument "ruby.default_config_vars" do vars = { - "LANG" => env("LANG") || "en_US.UTF-8" + "LANG" => env("LANG") || "en_US.UTF-8", + # By default Node can address 1.5GB of memory, a limitation it inherits from + # the underlying v8 engine. This can occasionally cause issues during frontend + # builds where memory use can exceed this threshold. + # + # This passes an argument to all Node processes during the build, so that they + # can take advantage of all available memory on the build dynos. + "NODE_OPTIONS" => env("NODE_OPTIONS") || "--max_old_space_size=2560" } ruby_version.jruby? ? vars.merge({ From e5c3f4a236ed1680d7352770b13f4a43a0e954b0 Mon Sep 17 00:00:00 2001 From: Jeremy Morrell Date: Fri, 8 Mar 2019 14:31:23 -0800 Subject: [PATCH 0593/1195] Move to different section based on feedback --- lib/language_pack/ruby.rb | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 296217c22..27b5ffd61 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -58,13 +58,6 @@ def default_config_vars instrument "ruby.default_config_vars" do vars = { "LANG" => env("LANG") || "en_US.UTF-8", - # By default Node can address 1.5GB of memory, a limitation it inherits from - # the underlying v8 engine. This can occasionally cause issues during frontend - # builds where memory use can exceed this threshold. - # - # This passes an argument to all Node processes during the build, so that they - # can take advantage of all available memory on the build dynos. - "NODE_OPTIONS" => env("NODE_OPTIONS") || "--max_old_space_size=2560" } ruby_version.jruby? ? vars.merge({ @@ -309,6 +302,14 @@ def setup_language_pack_environment ENV["PATH"] += ":#{node_preinstall_bin_path}" if node_js_installed? ENV["PATH"] += ":#{yarn_preinstall_bin_path}" if !yarn_not_preinstalled? + # By default Node can address 1.5GB of memory, a limitation it inherits from + # the underlying v8 engine. This can occasionally cause issues during frontend + # builds where memory use can exceed this threshold. + # + # This passes an argument to all Node processes during the build, so that they + # can take advantage of all available memory on the build dynos. + ENV["NODE_OPTIONS"] ||= "--max_old_space_size=2560" + # TODO when buildpack-env-args rolls out, we can get rid of # ||= and the manual setting below default_config_vars.each do |key, value| From 83f45b7ea9fd1e2c8e7e309ed07ebdc8b6583f29 Mon Sep 17 00:00:00 2001 From: Jeremy Morrell Date: Fri, 8 Mar 2019 14:32:37 -0800 Subject: [PATCH 0594/1195] Add changelog entry --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fa6a44498..6c2199c6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Master +* Set memory default for Node builds (https://github.com/heroku/heroku-buildpack-ruby/pull/861) + ## v200 (3/7/2019) * Fix: Environment variables not being exported for other buildpacks in CI (https://github.com/heroku/heroku-buildpack-ruby/pull/858) From 87a7af6ae11082e60cc63f05072053f7d8a30ada Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 25 Mar 2019 16:32:46 -0500 Subject: [PATCH 0595/1195] Update the Ruby version --- CHANGELOG.md | 2 ++ Gemfile | 2 ++ buildpack.toml | 6 +++--- lib/language_pack/ruby_version.rb | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fa6a44498..ac9e15b51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Master +* Default Ruby version is now 2.5.5, was previously 2.5.3 (https://github.com/heroku/heroku-buildpack-ruby/pull/863) + ## v200 (3/7/2019) * Fix: Environment variables not being exported for other buildpacks in CI (https://github.com/heroku/heroku-buildpack-ruby/pull/858) diff --git a/Gemfile b/Gemfile index b6e254fd3..c95c9aa4d 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,8 @@ source "https://rubygems.org" git_source(:github) { |repo| "https://github.com/#{repo}.git" } +ruby '2.5.5' + group :development, :test do gem "heroku_hatchet" gem "rspec-core" diff --git a/buildpack.toml b/buildpack.toml index 48e130b06..9b61fd1a4 100644 --- a/buildpack.toml +++ b/buildpack.toml @@ -12,11 +12,11 @@ name = "Ruby" dir = "." files = ["./.env"] [[publish.Vendor]] - url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/cedar-14/ruby-2.5.1.tgz" + url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/cedar-14/ruby-2.5.5.tgz" dir = "vendor/ruby/cedar-14" [[publish.Vendor]] - url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-16/ruby-2.5.1.tgz" + url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-16/ruby-2.5.5.tgz" dir = "vendor/ruby/heroku-16" [[publish.Vendor]] - url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-18/ruby-2.5.1.tgz" + url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-18/ruby-2.5.5.tgz" dir = "vendor/ruby/heroku-18" diff --git a/lib/language_pack/ruby_version.rb b/lib/language_pack/ruby_version.rb index a16035d48..5446d85ef 100644 --- a/lib/language_pack/ruby_version.rb +++ b/lib/language_pack/ruby_version.rb @@ -12,7 +12,7 @@ def initialize(output = "") end end - DEFAULT_VERSION_NUMBER = "2.5.3" + DEFAULT_VERSION_NUMBER = "2.5.5" DEFAULT_VERSION = "ruby-#{DEFAULT_VERSION_NUMBER}" LEGACY_VERSION_NUMBER = "1.9.2" LEGACY_VERSION = "ruby-#{LEGACY_VERSION_NUMBER}" From 85d876706676c77334d778938e5baee3d0fa38bd Mon Sep 17 00:00:00 2001 From: Matthew Mongeau Date: Tue, 14 May 2019 13:55:45 -0700 Subject: [PATCH 0596/1195] Use last line of bundler platform --ruby For determining the ruby version when `bundler platform --ruby` is used, no longer take into account all output from the command. Instead use the final line which should container the ruby version. This addresses issues where Gemfiles may contain debugging information or processes that produce output on STDOUT, and are then unable to to build due to using an inccrect ruby version name. --- lib/language_pack/helpers/bundler_wrapper.rb | 2 +- spec/helpers/bundler_wrapper_spec.rb | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index 551416d2b..3884b56fb 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -145,7 +145,7 @@ def ruby_version command = "bundle platform --ruby" # Silently check for ruby version - output = run_stdout(command, user_env: true, env: env) + output = run_stdout(command, user_env: true, env: env).strip.lines.last # If there's a gem in the Gemfile (i.e. syntax error) emit error raise GemfileParseError.new(run("bundle check", user_env: true, env: env)) unless $?.success? diff --git a/spec/helpers/bundler_wrapper_spec.rb b/spec/helpers/bundler_wrapper_spec.rb index 7557d8992..92303625c 100644 --- a/spec/helpers/bundler_wrapper_spec.rb +++ b/spec/helpers/bundler_wrapper_spec.rb @@ -50,5 +50,12 @@ expect(@bundler.ruby_version).to eq("ruby-1.9.3-p547") end end + + it "handles app with output in their Gemfile" do + Hatchet::App.new("problem_gemfile_version").in_directory do |dir| + run!(%{echo '\nputs "some output"\n' >> Gemfile}) + expect(@bundler.ruby_version).to eq("ruby-2.5.1-p0") + end + end end end From 1d22667d45378f7d0f1914e9f7e62366f40bd5be Mon Sep 17 00:00:00 2001 From: Jeremy Morrell Date: Fri, 24 May 2019 13:15:11 -0700 Subject: [PATCH 0597/1195] Bump versions for Node and Yarn Also remove the (unused) code that references the Nodebin service --- lib/language_pack/helpers/nodebin.rb | 23 +++++---------------- lib/language_pack/helpers/yarn_installer.rb | 2 +- 2 files changed, 6 insertions(+), 19 deletions(-) diff --git a/lib/language_pack/helpers/nodebin.rb b/lib/language_pack/helpers/nodebin.rb index b11c6a861..4d7d4cb00 100644 --- a/lib/language_pack/helpers/nodebin.rb +++ b/lib/language_pack/helpers/nodebin.rb @@ -1,17 +1,8 @@ require 'json' class LanguagePack::Helpers::Nodebin - URL = "https://nodebin.herokai.com/v1/" - - def self.query(q) - response = Net::HTTP.get_response(URI("#{URL}/#{q}")) - if response.code == '200' - JSON.parse(response.body) - end - end - def self.hardcoded_node_lts - version = "10.14.1" + version = "10.15.3" { "number" => version, "url" => "https://s3.amazonaws.com/heroku-nodebin/node/release/linux-x64/node-v#{version}-linux-x64.tar.gz" @@ -19,22 +10,18 @@ def self.hardcoded_node_lts end def self.hardcoded_yarn - version = "1.12.3" + version = "1.16.0" { "number" => version, "url" => "https://s3.amazonaws.com/heroku-nodebin/yarn/release/yarn-v#{version}.tar.gz" } end - def self.node(q) - query("node/linux-x64/#{q}") - end - def self.node_lts - hardcoded_node_lts # node("latest?range=6.x") + hardcoded_node_lts end - def self.yarn(q) - hardcoded_yarn # query("yarn/linux-x64/#{q}") + def self.yarn + hardcoded_yarn end end diff --git a/lib/language_pack/helpers/yarn_installer.rb b/lib/language_pack/helpers/yarn_installer.rb index a57c07884..49a4e777c 100644 --- a/lib/language_pack/helpers/yarn_installer.rb +++ b/lib/language_pack/helpers/yarn_installer.rb @@ -4,7 +4,7 @@ class LanguagePack::Helpers::YarnInstaller def initialize # Grab latest yarn, until release practice stabilizes # https://github.com/yarnpkg/yarn/issues/376#issuecomment-253366910 - nodebin = LanguagePack::Helpers::Nodebin.yarn("latest") + nodebin = LanguagePack::Helpers::Nodebin.yarn @version = nodebin["number"] @url = nodebin["url"] @fetcher = LanguagePack::Fetcher.new("") From 07c0b67e3d91f6435482c2cd7a2bc965179b16a6 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 28 May 2019 13:31:57 -0500 Subject: [PATCH 0598/1195] Update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a7b7d0bc..310043d43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ * Set memory default for Node builds (https://github.com/heroku/heroku-buildpack-ruby/pull/861) * Default Ruby version is now 2.5.5, was previously 2.5.3 (https://github.com/heroku/heroku-buildpack-ruby/pull/863) - +* Default Node version is now 10.15.3 and default Yarn version is now 1.16.0 (https://github.com/heroku/heroku-buildpack-ruby/pull/884) ## v200 (3/7/2019) From ab47ae5541262a80ce2cb3c004b9652086156c66 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 28 May 2019 13:10:21 -0500 Subject: [PATCH 0599/1195] Bootstrap Ruby version of buildpack Previously the ruby buildpack used itself to bootstrap a version of Ruby to run on. This technique works fine, but means that it must be able to load the HerokuRubyInstaller which requires shell helpers and lots of other code to be able to bootstrap. This means that these classes cannot use any syntax unless it is valid in all versions of system Ruby present. Currently that includes 1.9.3. By moving the bootstrap download code to bash we can target our syntax to use any version of Ruby that the buildpack bootstraps. In an attempt to keep things dry-ish the bash bootstrap code pulls the ruby version from the `buildpack.toml` file. This file also contains the vendor declarations that are used when the buildpack is published. Having all the versions in the same file should encourage keeping all versions up to date. --- Gemfile | 1 + Gemfile.lock | 9 +++++- bin/support/bash_functions.sh | 2 +- bin/support/download_ruby | 54 ++++++++++++++++++++++++++++------- buildpack.toml | 1 + spec/helpers/config_spec.rb | 10 +++++++ 6 files changed, 65 insertions(+), 12 deletions(-) create mode 100644 spec/helpers/config_spec.rb diff --git a/Gemfile b/Gemfile index c95c9aa4d..d6717574a 100644 --- a/Gemfile +++ b/Gemfile @@ -4,6 +4,7 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" } ruby '2.5.5' group :development, :test do + gem "toml-rb" gem "heroku_hatchet" gem "rspec-core" gem "rspec-expectations" diff --git a/Gemfile.lock b/Gemfile.lock index 1946b7c2f..f17763ba6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -16,6 +16,7 @@ GEM ansi (1.5.0) ci-queue (0.13.6) ansi + citrus (3.0.2) concurrent-ruby (1.0.5) diff-lcs (1.3) erubis (2.7.0) @@ -64,6 +65,8 @@ GEM thor (0.20.0) thread_safe (0.3.6) threaded (0.0.4) + toml-rb (1.1.2) + citrus (~> 3.0, > 3.0) tzinfo (1.2.5) thread_safe (~> 0.1) @@ -83,6 +86,10 @@ DEPENDENCIES rspec-core rspec-expectations rspec-retry + toml-rb + +RUBY VERSION + ruby 2.5.5p157 BUNDLED WITH - 1.16.4 + 1.17.3 diff --git a/bin/support/bash_functions.sh b/bin/support/bash_functions.sh index 4bee3e3c5..c6a9ce98f 100755 --- a/bin/support/bash_functions.sh +++ b/bin/support/bash_functions.sh @@ -32,7 +32,7 @@ heroku_buildpack_ruby_install_ruby() if [ ! -d "$heroku_buildpack_ruby_dir" ]; then heroku_buildpack_ruby_dir=$(mktemp -d) # bootstrap ruby - $bin_dir/support/download_ruby $heroku_buildpack_ruby_dir + $bin_dir/support/download_ruby "$BIN_DIR" "$heroku_buildpack_ruby_dir" function atexit { rm -rf $heroku_buildpack_ruby_dir } diff --git a/bin/support/download_ruby b/bin/support/download_ruby index 14a0e80ba..9b4f74bd1 100755 --- a/bin/support/download_ruby +++ b/bin/support/download_ruby @@ -1,14 +1,48 @@ -#!/usr/bin/env ruby +#!/usr/bin/env bash -# This script will download a version of Ruby for the buildpack to use -# and put it in the `ARGV.first` location. -$stdout.sync = true +# Downloads a bootstrap copy of Ruby for execution of the buildpack +# this is needed so we can totally control the Ruby version and are +# not dependant on the Ruby version of the stack image -$:.unshift File.expand_path("../../../lib", __FILE__) -require "language_pack" +# fail hard +set -o pipefail +# fail harder +set -eu -DEFAULT_STACK = "cedar-14" +BIN_DIR=$1 +RUBY_BOOTSTRAP_DIR=$2 -installer = LanguagePack::Installers::HerokuRubyInstaller.new(ENV['STACK'] || DEFAULT_STACK) -ruby_version = LanguagePack::RubyVersion.new("ruby-#{LanguagePack::RubyVersion::DEFAULT_VERSION_NUMBER}") -installer.fetch_unpack(ruby_version, ARGV[0]) +curl_retry_on_18() { + local ec=18; + local attempts=0; + while (( ec == 18 && attempts++ < 3 )); do + curl "$@" # -C - would return code 33 if unsupported by server + ec=$? + done + return $ec +} + +# Pull ruby version out of buildpack.toml to be used with bootstrapping +regex=".*ruby_version = [\'\"]([0-9]+\.[0-9]+\.[0-9]+)[\'\"].*" +if [[ $(cat "$BIN_DIR/../buildpack.toml") =~ $regex ]] + then + heroku_buildpack_ruby_url="https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/$STACK/ruby-${BASH_REMATCH[1]}.tgz" + else + echo "Could not detect ruby version to bootstrap" + exit 1 +fi + +mkdir -p "$RUBY_BOOTSTRAP_DIR" + +curl_retry_on_18 --fail --silent --location -o "$RUBY_BOOTSTRAP_DIR/ruby.tgz" "$heroku_buildpack_ruby_url" || { +cat< Date: Tue, 28 May 2019 14:21:08 -0500 Subject: [PATCH 0600/1195] Test that the ruby version string is also present in ruby vendor strings --- spec/helpers/config_spec.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/spec/helpers/config_spec.rb b/spec/helpers/config_spec.rb index 2ba71524a..e47bc1e96 100644 --- a/spec/helpers/config_spec.rb +++ b/spec/helpers/config_spec.rb @@ -6,5 +6,10 @@ config = TomlRB.load_file("buildpack.toml") bootstrap_version = config["buildpack"]["ruby_version"] expect(bootstrap_version).to eq(LanguagePack::RubyVersion::DEFAULT_VERSION_NUMBER) + + urls = config["publish"]["Vendor"].map {|h| h["url"] if h["dir"] != "." }.compact + urls.each do |url| + expect(url.include?(bootstrap_version)).to be_truthy, "expected #{url.inspect} to include #{bootstrap_version.inspect} but it did not" + end end end From be52b4f2ee33964c08a5b3762cc2bf2cf5f55e25 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 30 May 2019 15:54:50 -0500 Subject: [PATCH 0601/1195] Remove The latest bundler is from clean output ``` bundle clean ``` Emits a "suggestion" indicating a more recent version of bundler is available, his is not needed and adds a network request that slows us down. # Conflicts: # lib/language_pack/ruby.rb --- lib/language_pack/ruby.rb | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 27b5ffd61..68ea48c8e 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -676,6 +676,7 @@ def build_bundler(default_bundle_without) bundler_output = "" bundle_time = nil + env_vars = {} Dir.mktmpdir("libyaml-") do |tmpdir| libyaml_dir = "#{tmpdir}/#{LIBYAML_PATH}" install_libyaml(libyaml_dir) @@ -685,18 +686,17 @@ def build_bundler(default_bundle_without) yaml_lib = File.expand_path("#{libyaml_dir}/lib").shellescape pwd = Dir.pwd bundler_path = "#{pwd}/#{slug_vendor_base}/gems/#{bundler.dir_name}/lib" + # we need to set BUNDLE_CONFIG and BUNDLE_GEMFILE for # codon since it uses bundler. - env_vars = { - "BUNDLE_GEMFILE" => "#{pwd}/Gemfile", - "BUNDLE_CONFIG" => "#{pwd}/.bundle/config", - "CPATH" => noshellescape("#{yaml_include}:$CPATH"), - "CPPATH" => noshellescape("#{yaml_include}:$CPPATH"), - "LIBRARY_PATH" => noshellescape("#{yaml_lib}:$LIBRARY_PATH"), - "RUBYOPT" => syck_hack, - "NOKOGIRI_USE_SYSTEM_LIBRARIES" => "true", - "BUNDLE_DISABLE_VERSION_CHECK" => "true" - } + env_vars["BUNDLE_GEMFILE"] = "#{pwd}/Gemfile" + env_vars["BUNDLE_CONFIG"] = "#{pwd}/.bundle/config" + env_vars["CPATH"] = noshellescape("#{yaml_include}:$CPATH") + env_vars["CPPATH"] = noshellescape("#{yaml_include}:$CPPATH") + env_vars["LIBRARY_PATH"] = noshellescape("#{yaml_lib}:$LIBRARY_PATH") + env_vars["RUBYOPT"] = syck_hack + env_vars["NOKOGIRI_USE_SYSTEM_LIBRARIES"] = "true" + env_vars["BUNDLE_DISABLE_VERSION_CHECK"] = "true" env_vars["JAVA_HOME"] = noshellescape("#{pwd}/$JAVA_HOME") if ruby_version.jruby? env_vars["BUNDLER_LIB_PATH"] = "#{bundler_path}" if ruby_version.ruby_version == "1.8.7" env_vars["BUNDLE_DISABLE_VERSION_CHECK"] = "true" @@ -716,9 +716,9 @@ def build_bundler(default_bundle_without) instrument "ruby.bundle_clean" do # Only show bundle clean output when not using default cache if load_default_cache? - run("#{bundle_bin} clean > /dev/null", user_env: true) + run("#{bundle_bin} clean > /dev/null", user_env: true, env: env_vars) else - pipe("#{bundle_bin} clean", out: "2> /dev/null", user_env: true) + pipe("#{bundle_bin} clean", out: "2> /dev/null", user_env: true, env: env_vars) end end @bundler_cache.store From 8ea7b7ad0d3e0f14389940b2b06ada782c13f8f5 Mon Sep 17 00:00:00 2001 From: schneems Date: Fri, 31 May 2019 10:38:00 -0500 Subject: [PATCH 0602/1195] Update Hatchet v4.0.12 introduced a fix for a deadlock in the reaper: https://github.com/heroku/hatchet/pull/63/commits/446c280003a2fe8dfb0139905cfc7865fa5e69e3 # Conflicts: # Gemfile.lock --- Gemfile.lock | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index f17763ba6..098d92d14 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -8,25 +8,25 @@ GIT GEM remote: https://rubygems.org/ specs: - activesupport (5.2.1) + activesupport (5.2.3) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) ansi (1.5.0) - ci-queue (0.13.6) + ci-queue (0.16.0) ansi citrus (3.0.2) - concurrent-ruby (1.0.5) + concurrent-ruby (1.1.5) diff-lcs (1.3) erubis (2.7.0) - excon (0.62.0) - heroics (0.0.24) + excon (0.64.0) + heroics (0.0.25) erubis (~> 2.0) excon moneta multi_json (>= 1.9.2) - heroku_hatchet (4.0.5) + heroku_hatchet (4.0.12) excon (~> 0) minitest-retry (~> 0.1.9) platform-api (~> 2) @@ -34,35 +34,35 @@ GEM rrrretry (~> 1) thor (~> 0) threaded (~> 0) - i18n (1.1.0) + i18n (1.6.0) concurrent-ruby (~> 1.0) json (2.0.4) minitest (5.11.3) minitest-retry (0.1.9) minitest (>= 5.0) - moneta (0.8.1) + moneta (1.0.0) multi_json (1.13.1) netrc (0.11.0) - parallel (1.11.2) - parallel_tests (2.14.1) + parallel (1.17.0) + parallel_tests (2.29.0) parallel - platform-api (2.1.0) - heroics (~> 0.0.23) - moneta (~> 0.8.1) - rake (12.0.0) - redis (4.0.1) + platform-api (2.2.0) + heroics (~> 0.0.25) + moneta (~> 1.0.0) + rake (12.3.2) + redis (4.1.2) repl_runner (0.0.3) activesupport rrrretry (1.0.0) - rspec-core (3.6.0) - rspec-support (~> 3.6.0) - rspec-expectations (3.6.0) + rspec-core (3.8.0) + rspec-support (~> 3.8.0) + rspec-expectations (3.8.3) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.6.0) - rspec-retry (0.5.4) - rspec-core (> 3.3, < 3.7) - rspec-support (3.6.0) - thor (0.20.0) + rspec-support (~> 3.8.0) + rspec-retry (0.6.1) + rspec-core (> 3.3) + rspec-support (3.8.0) + thor (0.20.3) thread_safe (0.3.6) threaded (0.0.4) toml-rb (1.1.2) @@ -92,4 +92,4 @@ RUBY VERSION ruby 2.5.5p157 BUNDLED WITH - 1.17.3 + 2.0.1 From ed1aa76a754a847cc8e0725173868ef3e363fdc0 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 6 Jun 2019 12:28:40 -0500 Subject: [PATCH 0603/1195] Log test order Feature introduced in https://github.com/Shopify/ci-queue/pull/99 This will output a failing test order if the suite fails. --- Gemfile | 2 +- Gemfile.lock | 12 +++++++++--- app.json | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index d6717574a..7111681e2 100644 --- a/Gemfile +++ b/Gemfile @@ -15,6 +15,6 @@ group :development, :test do gem "netrc" gem "git", github: "hone/ruby-git", branch: "master" gem 'json', '~> 2.0.2' - gem 'ci-queue' + gem 'ci-queue', github: 'shopify/ci-queue', branch: 'rspec-log-order' gem 'redis' end diff --git a/Gemfile.lock b/Gemfile.lock index 098d92d14..8cfacdd71 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -5,6 +5,14 @@ GIT specs: git (1.2.6) +GIT + remote: https://github.com/shopify/ci-queue.git + revision: 0713fe26a8b0be6290ad109a651b7cf5b242930a + branch: rspec-log-order + specs: + ci-queue (0.16.0) + ansi + GEM remote: https://rubygems.org/ specs: @@ -14,8 +22,6 @@ GEM minitest (~> 5.1) tzinfo (~> 1.1) ansi (1.5.0) - ci-queue (0.16.0) - ansi citrus (3.0.2) concurrent-ruby (1.1.5) diff-lcs (1.3) @@ -74,7 +80,7 @@ PLATFORMS ruby DEPENDENCIES - ci-queue + ci-queue! excon git! heroku_hatchet diff --git a/app.json b/app.json index 9111a02fd..af85b7140 100644 --- a/app.json +++ b/app.json @@ -20,7 +20,7 @@ }, "scripts": { "test-setup": "bundle exec rake hatchet:setup_ci", - "test": "bundle exec rspec-queue --max-requeues=3 --timeout 180 --queue $REDIS_URL" + "test": "bundle exec rspec-queue --max-requeues=3 --timeout 180 --queue $REDIS_URL || { cat log/test_order.log; $(exit 1); }" }, "buildpacks": [ { "url": "https://github.com/heroku/heroku-buildpack-apt" }, From 665f1ab5ed491d9db70085a1c10607cfec85429a Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 19 Jun 2019 11:24:46 -0500 Subject: [PATCH 0604/1195] Rev Bundler 2 to 2.0.2 Due to https://github.com/bundler/bundler/issues/7205 --- lib/language_pack/helpers/bundler_wrapper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index 3884b56fb..b813905ff 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -37,7 +37,7 @@ class LanguagePack::Helpers::BundlerWrapper BLESSED_BUNDLER_VERSIONS = {} BLESSED_BUNDLER_VERSIONS["1"] = "1.15.2" - BLESSED_BUNDLER_VERSIONS["2"] = "2.0.1" + BLESSED_BUNDLER_VERSIONS["2"] = "2.0.2" private_constant :BLESSED_BUNDLER_VERSIONS class GemfileParseError < BuildpackError From 394653a9264488a70068647207b1b6f8562f8974 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 19 Jun 2019 13:26:00 -0500 Subject: [PATCH 0605/1195] Changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 310043d43..6cd03d1dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ * Set memory default for Node builds (https://github.com/heroku/heroku-buildpack-ruby/pull/861) * Default Ruby version is now 2.5.5, was previously 2.5.3 (https://github.com/heroku/heroku-buildpack-ruby/pull/863) * Default Node version is now 10.15.3 and default Yarn version is now 1.16.0 (https://github.com/heroku/heroku-buildpack-ruby/pull/884) +* Bundler 2 now uses 2.0.2 (https://github.com/heroku/heroku-buildpack-ruby/pull/894) ## v200 (3/7/2019) From f2858fc31e368401e4346b87c8c0c156d4b8d102 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 25 Jun 2019 09:44:25 -0500 Subject: [PATCH 0606/1195] v201 --- CHANGELOG.md | 2 ++ lib/language_pack/version.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6cd03d1dd..4a4568ffb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Master +## v201 (6/23/2019) + * Set memory default for Node builds (https://github.com/heroku/heroku-buildpack-ruby/pull/861) * Default Ruby version is now 2.5.5, was previously 2.5.3 (https://github.com/heroku/heroku-buildpack-ruby/pull/863) * Default Node version is now 10.15.3 and default Yarn version is now 1.16.0 (https://github.com/heroku/heroku-buildpack-ruby/pull/884) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index e727cc9de..5db62eea6 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v200" + BUILDPACK_VERSION = "v201" end end From 90cf4b8f4fc72603ad2b9e695b5f4dec74376a5f Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 1 Jul 2019 12:13:17 -0500 Subject: [PATCH 0607/1195] Update Bundler warning Use the correct coloring for a warning via using the `warn` method. Also link directly to the known upgrade issues, as that is likely what people will want to read when they hit a problem with bundler. --- lib/language_pack/ruby.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 68ea48c8e..6e0137e5e 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -125,12 +125,12 @@ def warn_bundler_upgrade old_bundler_version = @metadata.read("bundler_version").chomp if @metadata.exists?("bundler_version") if old_bundler_version && old_bundler_version != bundler.version - puts(<<-WARNING) + warn(<<-WARNING, inline: true) Your app was upgraded to bundler #{ bundler.version }. Previously you had a successful deploy with bundler #{ old_bundler_version }. If you see problems related to the bundler version please refer to: -https://devcenter.heroku.com/articles/bundler-version +https://devcenter.heroku.com/articles/bundler-version#known-upgrade-issues WARNING end From fa35a10f9f520cac602d15fbe0cc45cb41e8ce48 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 1 Jul 2019 11:37:32 -0500 Subject: [PATCH 0608/1195] Handle windows BUNDLED WITH Gemfile.lock Windows uses carriage return and newline which prevents the `$` regex from properly matching as currently placed. By opening the file in "text" mode i.e. `rt` the issue is avoided. --- CHANGELOG.md | 2 ++ lib/language_pack/helpers/bundler_wrapper.rb | 4 ++-- spec/fixtures/windows_lockfile/Gemfile.lock | 2 ++ spec/helpers/bundler_wrapper_spec.rb | 6 ++++++ spec/spec_helper.rb | 4 ++++ 5 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 spec/fixtures/windows_lockfile/Gemfile.lock diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a4568ffb..e6a5579fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Master +* Fix windows Gemfile.lock BUNDLED WITH support (https://github.com/heroku/heroku-buildpack-ruby/pull/898) + ## v201 (6/23/2019) * Set memory default for Node builds (https://github.com/heroku/heroku-buildpack-ruby/pull/861) diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index b813905ff..0cbb921b2 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -38,7 +38,7 @@ class LanguagePack::Helpers::BundlerWrapper BLESSED_BUNDLER_VERSIONS = {} BLESSED_BUNDLER_VERSIONS["1"] = "1.15.2" BLESSED_BUNDLER_VERSIONS["2"] = "2.0.2" - private_constant :BLESSED_BUNDLER_VERSIONS + BUNDLED_WITH_REGEX = /^BUNDLED WITH$(\r?\n) (?\d+)\.\d+\.\d+/m class GemfileParseError < BuildpackError def initialize(error) @@ -182,7 +182,7 @@ def parse_gemfile_lock def major_bundler_version # https://rubular.com/r/jt9yj0aY7fU3hD - bundler_version_match = @gemfile_lock_path.read.match(/^BUNDLED WITH$(\r?\n) (?\d+)\.\d+\.\d+/m) + bundler_version_match = @gemfile_lock_path.read(mode: "rt").match(BUNDLED_WITH_REGEX) if bundler_version_match bundler_version_match[:major] diff --git a/spec/fixtures/windows_lockfile/Gemfile.lock b/spec/fixtures/windows_lockfile/Gemfile.lock new file mode 100644 index 000000000..4d0fc2948 --- /dev/null +++ b/spec/fixtures/windows_lockfile/Gemfile.lock @@ -0,0 +1,2 @@ +BUNDLED WITH + 2.0.2 diff --git a/spec/helpers/bundler_wrapper_spec.rb b/spec/helpers/bundler_wrapper_spec.rb index 92303625c..e8f178898 100644 --- a/spec/helpers/bundler_wrapper_spec.rb +++ b/spec/helpers/bundler_wrapper_spec.rb @@ -19,6 +19,12 @@ @bundler.clean end + it "handles windows BUNDLED WITH" do + wrapper = LanguagePack::Helpers::BundlerWrapper.new(gemfile_path: fixture_path("windows_lockfile/Gemfile")) + + expect(wrapper.version).to eq(LanguagePack::Helpers::BundlerWrapper::BLESSED_BUNDLER_VERSIONS["2"]) + end + it "detects windows gemfiles" do Hatchet::App.new("rails4_windows_mri193").in_directory do |dir| expect(@bundler.install.windows_gemfile_lock?).to be_truthy diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 1bcec1783..b550dc225 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -52,3 +52,7 @@ def create_file_with_size_in(size, dir) # Don't execute tests against "merge" commits exit 0 if ENV['TRAVIS_PULL_REQUEST'] != 'false' && ENV['TRAVIS_BRANCH'] == 'master' end + +def fixture_path(path) + Pathname.new(__FILE__).join("../fixtures").expand_path.join(path) +end From aadc1ae89aa4894bb6e2fdb43164d585096d1e23 Mon Sep 17 00:00:00 2001 From: Joe Kutner Date: Tue, 9 Jul 2019 09:01:16 -0500 Subject: [PATCH 0609/1195] Update JRUby default JVM options to be like the JVM buildpack --- lib/language_pack/ruby.rb | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 68ea48c8e..03ff08c1c 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -219,23 +219,24 @@ def ruby_version # default JAVA_OPTS # return [String] string of JAVA_OPTS def default_java_opts - "-Xss512k -XX:+UseCompressedOops -Dfile.encoding=UTF-8" + "-Dfile.encoding=UTF-8" end def set_jvm_max_heap <<-EOF -case $(ulimit -u) in -256) # 1X Dyno - JVM_MAX_HEAP=384 +limit=$(ulimit -u) +case $limit in +512) # 2X, private-s: memory.limit_in_bytes=1073741824 + echo "$opts -Xmx671m -XX:CICompilerCount=2" ;; -512) # 2X Dyno - JVM_MAX_HEAP=768 +16384) # perf-m, private-m: memory.limit_in_bytes=2684354560 + echo "$opts -Xmx2g" ;; -16384) # IX Dyno - JVM_MAX_HEAP=2048 +32768) # perf-l, private-l: memory.limit_in_bytes=15032385536 + echo "$opts -Xmx12g" ;; -32768) # PX Dyno - JVM_MAX_HEAP=5120 +*) # Free, Hobby, 1X: memory.limit_in_bytes=536870912 + echo "$opts -Xmx300m -Xss512k -XX:CICompilerCount=2" ;; esac EOF From 7f6b91398f9c380d1fef222a040dcbfdc7611e98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Mon, 19 Aug 2019 17:09:33 -0400 Subject: [PATCH 0610/1195] Add support to Rails 6 by adding a new Language Pack The current Rails 5 language pack work for Rails 6 applications but it could not be used because of the version constraints. This was making Rails 6 apps to be handled as generic rack apps and causing problems at deploy if no SECRET_KEY_BASE was set. By adding a new class we can update the constraint so new Rails 6 apps can work as in the pre-releases. --- lib/language_pack.rb | 3 ++- lib/language_pack/rails6.rb | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 lib/language_pack/rails6.rb diff --git a/lib/language_pack.rb b/lib/language_pack.rb index c096774bf..6eb0b5890 100644 --- a/lib/language_pack.rb +++ b/lib/language_pack.rb @@ -13,7 +13,7 @@ def self.detect(*args) Instrument.instrument 'detect' do Dir.chdir(args.first) - pack = [ NoLockfile, Rails5, Rails42, Rails41, Rails4, Rails3, Rails2, Rack, Ruby ].detect do |klass| + pack = [ NoLockfile, Rails6, Rails5, Rails42, Rails41, Rails4, Rails3, Rails2, Rack, Ruby ].detect do |klass| klass.use? end @@ -47,4 +47,5 @@ def self.detect(*args) require "language_pack/rails41" require "language_pack/rails42" require "language_pack/rails5" +require "language_pack/rails6" require "language_pack/no_lockfile" diff --git a/lib/language_pack/rails6.rb b/lib/language_pack/rails6.rb new file mode 100644 index 000000000..49b33d693 --- /dev/null +++ b/lib/language_pack/rails6.rb @@ -0,0 +1,16 @@ +require 'securerandom' +require "language_pack" +require "language_pack/rails5" + +class LanguagePack::Rails6 < LanguagePack::Rails5 + # @return [Boolean] true if it's a Rails 6.x app + def self.use? + instrument "rails6.use" do + rails_version = bundler.gem_version('railties') + return false unless rails_version + is_rails = rails_version >= Gem::Version.new('6.x') && + rails_version < Gem::Version.new('7.0.0') + return is_rails + end + end +end From 0f74f66e40434bb801a4df9d4a8f321d1d092342 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Mon, 19 Aug 2019 16:18:03 -0700 Subject: [PATCH 0611/1195] add rails 6 test --- hatchet.json | 3 +++ spec/hatchet/rails6_spec.rb | 12 ++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 spec/hatchet/rails6_spec.rb diff --git a/hatchet.json b/hatchet.json index 10745ff56..ae8b579b3 100644 --- a/hatchet.json +++ b/hatchet.json @@ -79,6 +79,9 @@ "sharpstone/active_storage_local", "sharpstone/sprockets_asset_compile_true" ], + "rails6": [ + "sharpstone/rails6-basic" + ], "heroku": [ "heroku/ruby-getting-started" ], diff --git a/spec/hatchet/rails6_spec.rb b/spec/hatchet/rails6_spec.rb new file mode 100644 index 000000000..9e6c48394 --- /dev/null +++ b/spec/hatchet/rails6_spec.rb @@ -0,0 +1,12 @@ +require_relative '../spec_helper' + +describe "Rails 6" do + it "should detect successfully" do + Hatchet::App.new('rails6-basic').in_directory do + expect(LanguagePack::Rails5.use?).to eq(false) + end + Hatchet::App.new('rails6-basic').in_directory do + expect(LanguagePack::Rails6.use?).to eq(true) + end + end +end From 51d2e8bcf8fbf39f0bd7281a3df479341514c8d8 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Mon, 19 Aug 2019 16:23:09 -0700 Subject: [PATCH 0612/1195] use bundler 2.0.2 --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 098d92d14..bd7742cd4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -92,4 +92,4 @@ RUBY VERSION ruby 2.5.5p157 BUNDLED WITH - 2.0.1 + 2.0.2 From 1a5422e15f7c6299f71279a5803c03d75ea32cbd Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 19 Aug 2019 20:20:30 -0500 Subject: [PATCH 0613/1195] v202 --- CHANGELOG.md | 4 ++++ lib/language_pack/version.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a4568ffb..b255a343c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Master +## v202 (8/20/2019) + +* Add support class for Rails 6 (https://github.com/heroku/heroku-buildpack-ruby/pull/908) + ## v201 (6/23/2019) * Set memory default for Node builds (https://github.com/heroku/heroku-buildpack-ruby/pull/861) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 5db62eea6..f0304dcad 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v201" + BUILDPACK_VERSION = "v202" end end From 6dd4f4d718bd4fcd71884b34c2096044dde945f0 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 20 Aug 2019 10:50:07 -0500 Subject: [PATCH 0614/1195] Fix tmp/pids folder creation for Rails 6 apps Rails 6 release has a breaking change https://github.com/rails/rails/pull/36542. While this is fixed on 6-0-stable that version is not yet released. --- hatchet.lock | 2 ++ lib/language_pack/rails6.rb | 7 +++++++ spec/hatchet/rails6_spec.rb | 13 +++++++++++-- spec/spec_helper.rb | 20 ++++++++++++++++++++ 4 files changed, 40 insertions(+), 2 deletions(-) diff --git a/hatchet.lock b/hatchet.lock index d3caf590b..ff704630b 100644 --- a/hatchet.lock +++ b/hatchet.lock @@ -85,6 +85,8 @@ - cba59b7559f1f806684b65654228d44fcda91a82 - - "./repos/rails52/sprockets_asset_compile_true" - 98c6675cf97059278709cf75030e28063e0228d2 +- - "./repos/rails6/rails6-basic" + - b633fb14a58880bc21ccec4918af454fd5423843 - - "./repos/rake/asset_precompile_fail" - 16f7834331d6bb3fc5c284130b14eb1ff74d99d5 - - "./repos/rake/asset_precompile_not_found" diff --git a/lib/language_pack/rails6.rb b/lib/language_pack/rails6.rb index 49b33d693..32a603e6c 100644 --- a/lib/language_pack/rails6.rb +++ b/lib/language_pack/rails6.rb @@ -13,4 +13,11 @@ def self.use? return is_rails end end + + def compile + instrument "rails6.compile" do + FileUtils.mkdir_p("tmp/pids") + super + end + end end diff --git a/spec/hatchet/rails6_spec.rb b/spec/hatchet/rails6_spec.rb index 9e6c48394..dc553b1a2 100644 --- a/spec/hatchet/rails6_spec.rb +++ b/spec/hatchet/rails6_spec.rb @@ -4,9 +4,18 @@ it "should detect successfully" do Hatchet::App.new('rails6-basic').in_directory do expect(LanguagePack::Rails5.use?).to eq(false) - end - Hatchet::App.new('rails6-basic').in_directory do expect(LanguagePack::Rails6.use?).to eq(true) end end + + it "deploys and serves web requests via puma" do + before_deploy = Proc.new do + run! "echo 'web: bundle exec puma -t 5:5 -p ${PORT:-3000} -e ${RACK_ENV:-development}' > Procfile" + end + + Hatchet::Runner.new('rails6-basic', before_deploy: before_deploy).deploy do |app| + expect(app.output).to match("Fetching railties 6") + expect(web_boot_status(app)).to_not eq("crashed") + end + end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 1bcec1783..1513b436c 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -52,3 +52,23 @@ def create_file_with_size_in(size, dir) # Don't execute tests against "merge" commits exit 0 if ENV['TRAVIS_PULL_REQUEST'] != 'false' && ENV['TRAVIS_BRANCH'] == 'master' end + + +def dyno_status(app, ps_name = "web") + app + .api_rate_limit.call + .dyno + .list(app.name) + .detect {|x| x["type"] == ps_name } +end + +def wait_for_dyno_boot(app, ps_name = "web", sleep_val = 1) + while ["starting", "restarting"].include?(dyno_status(app, ps_name)["state"]) + sleep sleep_val + end + dyno_status(app, ps_name) +end + +def web_boot_status(app) + wait_for_dyno_boot(app)["state"] +end From 5407728c262109b151c4b63b1b5e8d58c5a18575 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 20 Aug 2019 12:44:24 -0500 Subject: [PATCH 0615/1195] v203 --- CHANGELOG.md | 4 ++++ lib/language_pack/version.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b255a343c..cf2f361ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Master +## v203 (8/20/2019) + +* Make sure Rails 6 apps have a `tmp/pids` folder so they can boot (https://github.com/heroku/heroku-buildpack-ruby/pull/909) + ## v202 (8/20/2019) * Add support class for Rails 6 (https://github.com/heroku/heroku-buildpack-ruby/pull/908) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index f0304dcad..0dbd13787 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v202" + BUILDPACK_VERSION = "v203" end end From a284c2bb8333b0682da735237d482f94b96dc933 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Fri, 6 Sep 2019 17:16:40 -0500 Subject: [PATCH 0616/1195] clean old bundler binstubs on load --- lib/language_pack/ruby.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 68ea48c8e..93f1b38ee 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -1015,6 +1015,9 @@ def load_bundler_cache rubygems_version_cache = "rubygems_version" stack_cache = "stack" + # bundle clean does not remove binstubs + FileUtils.rm_rf("vendor/bundler/bin") + old_rubygems_version = @metadata.read(ruby_version_cache).chomp if @metadata.exists?(ruby_version_cache) old_stack = @metadata.read(stack_cache).chomp if @metadata.exists?(stack_cache) old_stack ||= DEFAULT_LEGACY_STACK From 8dfdf9a9b25a82574d58e987630460ba88b800a8 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 10 Sep 2019 15:53:31 -0500 Subject: [PATCH 0617/1195] Remove mutating test The yarn_installer_spec mutates the current environment. It doesn't test anything other than that the yarn lib was added to the path, which doesn't even tell us if it's a valid test. This test also had competing chdir calls which trigger a warning in Ruby (sometimes, but not always which is really surprising to me). This warning happens because the `LanguagePack::Ruby.new includes a `Dir.chdir` call in it. Instead of working around this warning, we can safely get rid of this test as yarn is exercised directly in other integration tests. --- spec/installers/yarn_installer_spec.rb | 31 -------------------------- 1 file changed, 31 deletions(-) delete mode 100644 spec/installers/yarn_installer_spec.rb diff --git a/spec/installers/yarn_installer_spec.rb b/spec/installers/yarn_installer_spec.rb deleted file mode 100644 index 02d9c97fc..000000000 --- a/spec/installers/yarn_installer_spec.rb +++ /dev/null @@ -1,31 +0,0 @@ -require "spec_helper" - -describe LanguagePack::Ruby do - describe "#install_binary" do - context "installing yarn" do - before do - @old_path = ENV['PATH'] - @old_stack = ENV['STACK'] - ENV['STACK'] = 'cedar-14' - end - - after do - ENV['PATH'] = @old_path - ENV['STACK'] = @old_stack - end - - it "sets up PATH" do - Dir.mktmpdir do |build_path| - Dir.mktmpdir do |cache_path| - Dir.chdir(build_path) do - ruby = LanguagePack::Ruby.new(build_path, cache_path) - ruby.send(:install_binary, "yarn-0.22.0") - expect(ENV["PATH"]).to include("vendor/yarn") - end - end - end - end - - end - end -end From 50d3944f0d0111f70fba911a0154dc3d8abbecce Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 11 Sep 2019 13:03:12 -0500 Subject: [PATCH 0618/1195] Safer tests by not mutating current process If you don't know if code will mutate a process information, such as environment variables then run it in a fork to ensure it does not affect the parent process. Currently when you run any `LanguagePack::.use?` such as `LanguagePack::Rails6.use?` it will mutate the environment by loading in bundler and modifying the LOAD_PATH. This happens because the `use?` method relies on bundler: ``` def self.use? instrument "rails6.use" do rails_version = bundler.gem_version('railties') return false unless rails_version is_rails = rails_version >= Gem::Version.new('6.x') && rails_version < Gem::Version.new('7.0.0') return is_rails end end ``` Which loads and initializes this wrapper: ``` def self.bundler @@bundler ||= LanguagePack::Helpers::BundlerWrapper.new.install end ``` And the wrapper install method mutates globals: ``` def install ENV['BUNDLE_GEMFILE'] = @gemfile_path.to_s fetch_bundler $LOAD_PATH << @path require "bundler" self end ``` This is an issue because other tests such as the rake_runner_spec tests expect a specific version of Rake to be available however if the load path is mutated and bundler is required then only one specific version of rake will be available on the system. While I _believe_ that this fixes some flappy tests, I'm not totally sure why it only fails sometimes. You would think that it would either always pass or always fail for a given order. This test order is taken from a failing test run: ``` $ cat << EOL > log/test_order_fails_sometimes.log ./spec/helpers/rake_runner_spec.rb[1:2] ./spec/helpers/shell_spec.rb[1:2:1] ./spec/helpers/jvm_installer_spec.rb[1:4] ./spec/installers/yarn_installer_spec.rb[1:1:1:1] ./spec/installers/heroku_ruby_installer_spec.rb[1:1:1] ./spec/helpers/rake_runner_spec.rb[1:4] ./spec/hatchet/stack_spec.rb[1:1] ./spec/hatchet/rails6_spec.rb[1:1] ./spec/hatchet/jvm_spec.rb[1:1] ./spec/helpers/rake_runner_spec.rb[1:1] ./spec/helpers/jvm_installer_spec.rb[1:6] ./spec/helpers/jvm_installer_spec.rb[1:1] ./spec/hatchet/bugs_spec.rb[1:3:1] ./spec/hatchet/bundler_spec.rb[1:1] ./spec/installers/heroku_ruby_installer_spec.rb[1:1:2:1] ./spec/hatchet/ruby_spec.rb[1:4:2:1] ./spec/hatchet/rubies_spec.rb[1:3] ./spec/hatchet/node_spec.rb[1:2] ./spec/hatchet/getting_started_spec.rb[1:1] EOL $ while bundle exec rspec-queue --queue log/test_order_fails_sometimes.log --build 1 --worker 2; do :; done ``` Test output link https://dashboard.heroku.com/pipelines/ac057663-170b-4bdd-99d0-87560eb3a570/tests/519 This PR possible to the feature added in https://github.com/heroku/hatchet/pull/65 --- .gitignore | 1 + Gemfile.lock | 8 +++++--- log/.gitkeep | 0 spec/hatchet/rails4_spec.rb | 4 ++-- spec/hatchet/rails6_spec.rb | 2 +- spec/helpers/bundler_wrapper_spec.rb | 10 +++++----- spec/helpers/rake_runner_spec.rb | 10 +++++----- spec/helpers/ruby_version_spec.rb | 14 +++++++------- 8 files changed, 26 insertions(+), 23 deletions(-) create mode 100644 log/.gitkeep diff --git a/.gitignore b/.gitignore index 3421c3253..c8e3e471d 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ vendor/bundle/* buildpacks/* .anvil/ tmp/*.log +log/*.log diff --git a/Gemfile.lock b/Gemfile.lock index 12c1ff1f5..e9ab6287a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -16,23 +16,24 @@ GIT GEM remote: https://rubygems.org/ specs: - activesupport (5.2.3) + activesupport (6.0.0) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) + zeitwerk (~> 2.1, >= 2.1.8) ansi (1.5.0) citrus (3.0.2) concurrent-ruby (1.1.5) diff-lcs (1.3) erubis (2.7.0) - excon (0.64.0) + excon (0.66.0) heroics (0.0.25) erubis (~> 2.0) excon moneta multi_json (>= 1.9.2) - heroku_hatchet (4.0.12) + heroku_hatchet (4.0.13) excon (~> 0) minitest-retry (~> 0.1.9) platform-api (~> 2) @@ -75,6 +76,7 @@ GEM citrus (~> 3.0, > 3.0) tzinfo (1.2.5) thread_safe (~> 0.1) + zeitwerk (2.1.10) PLATFORMS ruby diff --git a/log/.gitkeep b/log/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/spec/hatchet/rails4_spec.rb b/spec/hatchet/rails4_spec.rb index 028f99462..66e7395b6 100644 --- a/spec/hatchet/rails4_spec.rb +++ b/spec/hatchet/rails4_spec.rb @@ -47,10 +47,10 @@ end it "should detect rails successfully" do - Hatchet::App.new('rails4-manifest').in_directory do + Hatchet::App.new('rails4-manifest').in_directory_fork do expect(LanguagePack::Rails4.use?).to eq(true) end - Hatchet::App.new('rails4-manifest').in_directory do + Hatchet::App.new('rails4-manifest').in_directory_fork do expect(LanguagePack::Rails3.use?).to eq(false) end end diff --git a/spec/hatchet/rails6_spec.rb b/spec/hatchet/rails6_spec.rb index dc553b1a2..2400531f2 100644 --- a/spec/hatchet/rails6_spec.rb +++ b/spec/hatchet/rails6_spec.rb @@ -2,7 +2,7 @@ describe "Rails 6" do it "should detect successfully" do - Hatchet::App.new('rails6-basic').in_directory do + Hatchet::App.new('rails6-basic').in_directory_fork do expect(LanguagePack::Rails5.use?).to eq(false) expect(LanguagePack::Rails6.use?).to eq(true) end diff --git a/spec/helpers/bundler_wrapper_spec.rb b/spec/helpers/bundler_wrapper_spec.rb index 92303625c..4aa0d9527 100644 --- a/spec/helpers/bundler_wrapper_spec.rb +++ b/spec/helpers/bundler_wrapper_spec.rb @@ -20,7 +20,7 @@ end it "detects windows gemfiles" do - Hatchet::App.new("rails4_windows_mri193").in_directory do |dir| + Hatchet::App.new("rails4_windows_mri193").in_directory_fork do |dir| expect(@bundler.install.windows_gemfile_lock?).to be_truthy end end @@ -31,7 +31,7 @@ end it "handles apps with ruby versions locked in Gemfile.lock" do - Hatchet::App.new("problem_gemfile_version").in_directory do |dir| + Hatchet::App.new("problem_gemfile_version").in_directory_fork do |dir| expect(@bundler.ruby_version).to eq("ruby-2.5.1-p0") ruby_version = LanguagePack::RubyVersion.new(@bundler.ruby_version, is_new: true) @@ -40,19 +40,19 @@ end it "handles JRuby pre gemfiles" do - Hatchet::App.new("jruby-minimal").in_directory do |dir| + Hatchet::App.new("jruby-minimal").in_directory_fork do |dir| expect(@bundler.ruby_version).to eq("ruby-2.3.1-p0-jruby-9.1.7.0") end end it "handles MRI patchlevel gemfiles" do - Hatchet::App.new("mri_193_p547").in_directory do |dir| + Hatchet::App.new("mri_193_p547").in_directory_fork do |dir| expect(@bundler.ruby_version).to eq("ruby-1.9.3-p547") end end it "handles app with output in their Gemfile" do - Hatchet::App.new("problem_gemfile_version").in_directory do |dir| + Hatchet::App.new("problem_gemfile_version").in_directory_fork do |dir| run!(%{echo '\nputs "some output"\n' >> Gemfile}) expect(@bundler.ruby_version).to eq("ruby-2.5.1-p0") end diff --git a/spec/helpers/rake_runner_spec.rb b/spec/helpers/rake_runner_spec.rb index 5fdcc7c14..eb05bbcab 100644 --- a/spec/helpers/rake_runner_spec.rb +++ b/spec/helpers/rake_runner_spec.rb @@ -2,7 +2,7 @@ describe "Rake Runner" do it "runs rake tasks that exist" do - Hatchet::App.new('asset_precompile_pass').in_directory do + Hatchet::App.new('asset_precompile_pass').in_directory_fork do rake = LanguagePack::Helpers::RakeRunner.new.load_rake_tasks! task = rake.task("assets:precompile") task.invoke @@ -14,7 +14,7 @@ end it "detects when rake tasks fail" do - Hatchet::App.new('asset_precompile_fail').in_directory do + Hatchet::App.new('asset_precompile_fail').in_directory_fork do rake = LanguagePack::Helpers::RakeRunner.new.load_rake_tasks! task = rake.task("assets:precompile") task.invoke @@ -26,7 +26,7 @@ end it "can show errors from bad Rakefiles" do - Hatchet::App.new('bad_rakefile').in_directory do + Hatchet::App.new('bad_rakefile').in_directory_fork do rake = LanguagePack::Helpers::RakeRunner.new.load_rake_tasks! task = rake.task("assets:precompile") expect(rake.rakefile_can_load?).to be_falsey @@ -35,14 +35,14 @@ end it "detects if task is missing" do - Hatchet::App.new('asset_precompile_not_found').in_directory do + Hatchet::App.new('asset_precompile_not_found').in_directory_fork do task = LanguagePack::Helpers::RakeRunner.new.task("assets:precompile") expect(task.task_defined?).to be_falsey end end it "detects when no rakefile is present" do - Hatchet::App.new('no_rakefile').in_directory do + Hatchet::App.new('no_rakefile').in_directory_fork do runner = LanguagePack::Helpers::RakeRunner.new expect(runner.rakefile_can_load?).to be_falsey end diff --git a/spec/helpers/ruby_version_spec.rb b/spec/helpers/ruby_version_spec.rb index 5c339b728..302ba6b9a 100644 --- a/spec/helpers/ruby_version_spec.rb +++ b/spec/helpers/ruby_version_spec.rb @@ -17,7 +17,7 @@ end it "correctly handles patch levels" do - Hatchet::App.new("mri_193_p547").in_directory do |dir| + Hatchet::App.new("mri_193_p547").in_directory_fork do |dir| ruby_version = LanguagePack::RubyVersion.new(@bundler.install.ruby_version, is_new: true) version_number = "1.9.3" version = "ruby-#{version_number}" @@ -37,7 +37,7 @@ end it "correctly sets ruby version for bundler specified versions" do - Hatchet::App.new("mri_193").in_directory do |dir| + Hatchet::App.new("mri_193").in_directory_fork do |dir| ruby_version = LanguagePack::RubyVersion.new(@bundler.install.ruby_version, is_new: true) version_number = "1.9.3" version = "ruby-#{version_number}" @@ -49,7 +49,7 @@ end it "correctly sets default ruby versions" do - Hatchet::App.new("default_ruby").in_directory do |dir| + Hatchet::App.new("default_ruby").in_directory_fork do |dir| ruby_version = LanguagePack::RubyVersion.new(@bundler.install.ruby_version, is_new: true) version_number = LanguagePack::RubyVersion::DEFAULT_VERSION_NUMBER version = LanguagePack::RubyVersion::DEFAULT_VERSION @@ -62,7 +62,7 @@ end it "correctly sets default legacy version" do - Hatchet::App.new("default_ruby").in_directory do |dir| + Hatchet::App.new("default_ruby").in_directory_fork do |dir| ruby_version = LanguagePack::RubyVersion.new(@bundler.install.ruby_version, is_new: false) version_number = LanguagePack::RubyVersion::LEGACY_VERSION_NUMBER version = LanguagePack::RubyVersion::LEGACY_VERSION @@ -74,7 +74,7 @@ end it "detects Ruby 2.0.0" do - Hatchet::App.new("mri_200").in_directory do |dir| + Hatchet::App.new("mri_200").in_directory_fork do |dir| ruby_version = LanguagePack::RubyVersion.new(@bundler.install.ruby_version, is_new: true) version_number = "2.0.0" version = "ruby-#{version_number}" @@ -87,7 +87,7 @@ it "detects non mri engines" do - Hatchet::App.new("ruby_193_jruby_173").in_directory do |dir| + Hatchet::App.new("ruby_193_jruby_173").in_directory_fork do |dir| ruby_version = LanguagePack::RubyVersion.new(@bundler.install.ruby_version, is_new: true) version_number = "1.9.3" engine_version = "1.7.3" @@ -104,7 +104,7 @@ it "surfaces error message from bundler" do bundle_error_msg = "Zomg der was a problem in da gemfile" error_klass = LanguagePack::Helpers::BundlerWrapper::GemfileParseError - Hatchet::App.new("bad_gemfile_on_platform").in_directory do |dir| + Hatchet::App.new("bad_gemfile_on_platform").in_directory_fork do |dir| @bundler = LanguagePack::Helpers::BundlerWrapper.new().install expect { LanguagePack::RubyVersion.new(@bundler.ruby_version) }.to raise_error(error_klass, /#{Regexp.escape(bundle_error_msg)}/) end From bfcabd627d7d407a1b5c40d144c7e316d81f9d3b Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 10 Sep 2019 15:00:36 -0500 Subject: [PATCH 0619/1195] Changelog for #914 --- CHANGELOG.md | 2 ++ changelogs/master/clean_binstubs.md | 5 +++++ 2 files changed, 7 insertions(+) create mode 100644 changelogs/master/clean_binstubs.md diff --git a/CHANGELOG.md b/CHANGELOG.md index cf2f361ec..4bd81b08f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Master +* Ensure that old binstubs are removed before new ones are generated (https://github.com/heroku/heroku-buildpack-ruby/pull/914) + ## v203 (8/20/2019) * Make sure Rails 6 apps have a `tmp/pids` folder so they can boot (https://github.com/heroku/heroku-buildpack-ruby/pull/909) diff --git a/changelogs/master/clean_binstubs.md b/changelogs/master/clean_binstubs.md new file mode 100644 index 000000000..6c7c3c9cf --- /dev/null +++ b/changelogs/master/clean_binstubs.md @@ -0,0 +1,5 @@ +## Ruby buildpack now cleans unused binstubs before install + +After a Ruby application's dependencies have been installed via `bundle install` the old dependencies are cleaned up by running `bundle clean`. Recently it was discovered that this does not clean up unused binstubs. To correct this problem the Ruby buildpack now manually cleans up generated binstubs in `vendor/bundler/bin`. Then when `bundle install` is executed, only currently used binstubs will be generated. + +[Buildpack PR](https://github.com/heroku/heroku-buildpack-ruby/pull/914) and [Heroku Ruby support](https://devcenter.heroku.com/articles/ruby-support). \ No newline at end of file From b4ac70c69dbcd1d37b36f001b61d75b8d553ed1a Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 12 Sep 2019 09:30:00 -0500 Subject: [PATCH 0620/1195] Default Ruby version now 2.5.6 --- buildpack.toml | 8 ++++---- changelogs/master/default_ruby.md | 3 +++ lib/language_pack/ruby_version.rb | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) create mode 100644 changelogs/master/default_ruby.md diff --git a/buildpack.toml b/buildpack.toml index 1fed1b645..20f91752d 100644 --- a/buildpack.toml +++ b/buildpack.toml @@ -1,6 +1,6 @@ [buildpack] name = "Ruby" -ruby_version = "2.5.5" +ruby_version = "2.5.6" [publish.Ignore] files = [ @@ -13,11 +13,11 @@ ruby_version = "2.5.5" dir = "." files = ["./.env"] [[publish.Vendor]] - url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/cedar-14/ruby-2.5.5.tgz" + url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/cedar-14/ruby-2.5.6.tgz" dir = "vendor/ruby/cedar-14" [[publish.Vendor]] - url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-16/ruby-2.5.5.tgz" + url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-16/ruby-2.5.6.tgz" dir = "vendor/ruby/heroku-16" [[publish.Vendor]] - url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-18/ruby-2.5.5.tgz" + url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-18/ruby-2.5.6.tgz" dir = "vendor/ruby/heroku-18" diff --git a/changelogs/master/default_ruby.md b/changelogs/master/default_ruby.md new file mode 100644 index 000000000..ac67b0c70 --- /dev/null +++ b/changelogs/master/default_ruby.md @@ -0,0 +1,3 @@ +## Default Ruby version for new apps is now 2.5.6 + +The [default Ruby version for new Ruby applications is 2.5.6](https://devcenter.heroku.com/articles/ruby-support#default-ruby-version-for-new-apps). You’ll only get the default if the application does not specify a ruby version. \ No newline at end of file diff --git a/lib/language_pack/ruby_version.rb b/lib/language_pack/ruby_version.rb index 5446d85ef..2a57ed886 100644 --- a/lib/language_pack/ruby_version.rb +++ b/lib/language_pack/ruby_version.rb @@ -12,7 +12,7 @@ def initialize(output = "") end end - DEFAULT_VERSION_NUMBER = "2.5.5" + DEFAULT_VERSION_NUMBER = "2.5.6" DEFAULT_VERSION = "ruby-#{DEFAULT_VERSION_NUMBER}" LEGACY_VERSION_NUMBER = "1.9.2" LEGACY_VERSION = "ruby-#{LEGACY_VERSION_NUMBER}" From 0a874039b8059816cae024273fbf770b48e7f00f Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 12 Sep 2019 12:31:34 -0500 Subject: [PATCH 0621/1195] Add changelog entry for #919 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b20a8c4c0..1869e00c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## Master +* Default Ruby version for new apps is now 2.5.6 (https://github.com/heroku/heroku-buildpack-ruby/pull/919) * Ensure that old binstubs are removed before new ones are generated (https://github.com/heroku/heroku-buildpack-ruby/pull/914) * Fix windows Gemfile.lock BUNDLED WITH support (https://github.com/heroku/heroku-buildpack-ruby/pull/898) From 3e77be846a1948c8707a2605396e7d1d88f14a7c Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 12 Sep 2019 12:35:36 -0500 Subject: [PATCH 0622/1195] v204 --- CHANGELOG.md | 4 +++- changelogs/{master => v204}/clean_binstubs.md | 0 changelogs/{master => v204}/default_ruby.md | 0 changelogs/v205/.gitkeep | 1 + lib/language_pack/version.rb | 2 +- 5 files changed, 5 insertions(+), 2 deletions(-) rename changelogs/{master => v204}/clean_binstubs.md (100%) rename changelogs/{master => v204}/default_ruby.md (100%) create mode 100644 changelogs/v205/.gitkeep diff --git a/CHANGELOG.md b/CHANGELOG.md index 1869e00c3..3e645edf7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,6 @@ -## Master +## v205 (unreleased) + +## v204 (9/12/2019) * Default Ruby version for new apps is now 2.5.6 (https://github.com/heroku/heroku-buildpack-ruby/pull/919) * Ensure that old binstubs are removed before new ones are generated (https://github.com/heroku/heroku-buildpack-ruby/pull/914) diff --git a/changelogs/master/clean_binstubs.md b/changelogs/v204/clean_binstubs.md similarity index 100% rename from changelogs/master/clean_binstubs.md rename to changelogs/v204/clean_binstubs.md diff --git a/changelogs/master/default_ruby.md b/changelogs/v204/default_ruby.md similarity index 100% rename from changelogs/master/default_ruby.md rename to changelogs/v204/default_ruby.md diff --git a/changelogs/v205/.gitkeep b/changelogs/v205/.gitkeep new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/changelogs/v205/.gitkeep @@ -0,0 +1 @@ + diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 0dbd13787..1fd780bd0 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v203" + BUILDPACK_VERSION = "v204" end end From 0e573b1cf59cd2a0b377078379224e4a1823cab0 Mon Sep 17 00:00:00 2001 From: Leon Miller-Out Date: Thu, 15 Jun 2017 09:35:57 -0400 Subject: [PATCH 0623/1195] Update comment to reflect support file location The other comment change is a clarification. I think that "compilation code" is a clearer name than "bin/compile code". # Conflicts: # bin/compile --- bin/compile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/compile b/bin/compile index 35e550801..ddf84f713 100755 --- a/bin/compile +++ b/bin/compile @@ -1,6 +1,6 @@ #!/bin/bash -# The actual `bin/compile` code lives in `bin/support/ruby_compile`. This file -# instead bootstraps the ruby needed and then executes `bin/support/ruby_compile` +# The actual compilation code lives in `bin/support/ruby_compile`. This file instead +# bootstraps the ruby needed and then executes `bin/support/ruby_compile` BIN_DIR=$(cd $(dirname $0); pwd) BUILDPACK_DIR=$(dirname $BIN_DIR) From 350abd72d6270807b5457958ba12cfb25fefb36e Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 16 Sep 2019 09:29:33 -0500 Subject: [PATCH 0624/1195] Revert "Merge pull request #755 from heroku/schneems/fix-rubocop-ci-error" This reverts commit 6d41fb17d60f5f1162aeee871c488dd8a46b1f33, reversing changes made to 5fda279a095f91f62d02f89f0bc5aac49a67d9cf. The purpose of this PR was to reduce errors in the CI environment However it was reported in https://github.com/heroku/heroku-buildpack-ruby/commit/1dc39bb0ca86bb5e3dd3287609e471f639952f95 that the commit itself actually causes a break. --- lib/language_pack/test/rails2.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/language_pack/test/rails2.rb b/lib/language_pack/test/rails2.rb index 6eb6b8eba..17cacdd8b 100644 --- a/lib/language_pack/test/rails2.rb +++ b/lib/language_pack/test/rails2.rb @@ -36,7 +36,6 @@ def db_test_tasks_to_clear def clear_db_test_tasks FileUtils::mkdir_p 'lib/tasks' File.open("lib/tasks/heroku_clear_tasks.rake", "w") do |file| - file.puts "# rubocop:disable Lint/UnneededCopDisableDirective" file.puts "# rubocop:disable all" content = db_test_tasks_to_clear.map do |task_name| <<-FILE @@ -49,7 +48,6 @@ def clear_db_test_tasks end.join("\n") file.print content file.puts "# rubocop:enable all" - file.puts "# rubocop:enable Lint/UnneededCopDisableDirective" end end From 4f76122182dbcc6d806eaa4e0e3bd8bb7101c7ef Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 25 Apr 2018 21:23:46 -0500 Subject: [PATCH 0625/1195] [close #751] Default MALLOC_ARENA_MAX new apps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR will set MALLOC_ARENA_MAX=2 by default for new Ruby apps While we currently have [documentation on tuning the memory behavior of glibc by setting this environment variable](https://devcenter.heroku.com/articles/tuning-glibc-memory-behavior) the default does not produce good results for Ruby applications that are using threads: - https://www.mikeperham.com/2018/04/25/taming-rails-memory-bloat/ - https://www.speedshop.co/2017/12/04/malloc-doubles-ruby-memory.html In general most Ruby applications are memory bound and by decreasing the memory footprint of the application we can enable scaling out via more workers. Less memory might also mean a cheaper to run application, as it consumes fewer resources. Setting this value is not entirely free. It does come with a performance trade off. For more information, see how we originally benchmarked this setting: - https://devcenter.heroku.com/articles/testing-cedar-14-memory-use If a customer’s application is not memory bound and would prefer slightly faster execution over the decreased memory use, they can set their MALLOC_ARENA_MAX to a higher value. The default as specified by the [linux man page](http://man7.org/linux/man-pages/man3/mallopt.3.html) is 8 times the number of cores on the system. Or they can use the 3rd party [jemalloc buildpack](https://elements.heroku.com/buildpacks/mojodna/heroku-buildpack-jemalloc). Our documentation will be updated to reflect this change once the PR is merged and deployed. --- CHANGELOG.md | 2 ++ changelogs/v205/malloc.md | 32 ++++++++++++++++++++++++++++++++ lib/language_pack/metadata.rb | 8 +++++++- lib/language_pack/ruby.rb | 23 ++++++++++++++++++----- spec/hatchet/rubies_spec.rb | 4 +++- 5 files changed, 62 insertions(+), 7 deletions(-) create mode 100644 changelogs/v205/malloc.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e645edf7..196124535 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## v205 (unreleased) +* Default `MALLOC_ARENA_MAX=2` for new applications (https://github.com/heroku/heroku-buildpack-ruby/pull/752) + ## v204 (9/12/2019) * Default Ruby version for new apps is now 2.5.6 (https://github.com/heroku/heroku-buildpack-ruby/pull/919) diff --git a/changelogs/v205/malloc.md b/changelogs/v205/malloc.md new file mode 100644 index 000000000..b8cd03e8e --- /dev/null +++ b/changelogs/v205/malloc.md @@ -0,0 +1,32 @@ +## Default `MALLOC_ARENA_MAX=2` for new Ruby applications + +The environment variable `MALLOC_ARENA_MAX` will now default to `2` for Ruby applications. This environment variable was +previously unset. This change will only affect new applications on the platform, to update an existing application please +run: + +``` +$ heroku config:set MALLOC_ARENA_MAX=2 +``` + +The goal of setting this value is to decrease memory usage for the majority of Ruby applications that are using threads +such as apps that use Sidekiq or Puma. To understand more about the relationship between this value and memory please see +the following external resources: + +- https://www.speedshop.co/2017/12/04/malloc-doubles-ruby-memory.html +- https://www.mikeperham.com/2018/04/25/taming-rails-memory-bloat/ + +We also maintain our own [documentation on tuning the memory behavior of glibc by setting this environment variable](https://devcenter.heroku.com/articles/tuning-glibc-memory-behavior). + +If a your application is not memory bound and would prefer slightly faster execution over the decreased memory use, +you can set their `MALLOC_ARENA_MAX` to a higher value. The default as specified by the [linux man page](http://man7.org/linux/man-pages/man3/mallopt.3.html) +is 8 times the number of cores on the system. + +## Jemalloc + +Another popular alternative memory allocator is jemalloc. At this time Heroku does not maintain a supported version of this memory allocator, +but you can use it in your application with a 3rd party [jemalloc buildpack](https://elements.heroku.com/buildpacks/mojodna/heroku-buildpack-jemalloc). + +If you are using jemalloc, setting `MALLOC_ARENA_MAX` will have no impact on memory or performance. For more information on +how jemalloc interacts with Ruby applications see this external post: + +- https://www.speedshop.co/2017/12/04/malloc-doubles-ruby-memory.html#fix-2-use-jemalloc diff --git a/lib/language_pack/metadata.rb b/lib/language_pack/metadata.rb index f6979883c..4cc1d33e1 100644 --- a/lib/language_pack/metadata.rb +++ b/lib/language_pack/metadata.rb @@ -13,7 +13,7 @@ def initialize(cache) def read(key) full_key = "#{FOLDER}/#{key}" - File.read(full_key) if exists?(key) + File.read(full_key).chomp if exists?(key) end def exists?(key) @@ -27,6 +27,12 @@ def write(key, value, isave = true) full_key = "#{FOLDER}/#{key}" File.open(full_key, 'w') {|f| f.puts value } save if isave + + return true + end + + def touch(key) + write(key, "true") end def save diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index ee72e3c50..8de8513cc 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -121,6 +121,22 @@ def config_detect private + def default_malloc_arena_max? + return true if @metadata.exists?("default_malloc_arena_max") + return @metadata.touch("default_malloc_arena_max") if new_app? + + return false + end + + def stack_not_14_not_16? + case stack + when "cedar-14", "heroku-16" + return false + else + return true + end + end + def warn_bundler_upgrade old_bundler_version = @metadata.read("bundler_version").chomp if @metadata.exists?("bundler_version") @@ -352,6 +368,7 @@ def setup_profiled set_env_override "GEM_PATH", "$HOME/#{slug_vendor_base}:$GEM_PATH" set_env_override "PATH", profiled_path.join(":") + set_env_default "MALLOC_ARENA_MAX", "2" if default_malloc_arena_max? add_to_profiled set_default_web_concurrency if env("SENSIBLE_DEFAULTS") if ruby_version.jruby? @@ -568,11 +585,7 @@ def load_default_cache # install libyaml into the LP to be referenced for psych compilation # @param [String] tmpdir to store the libyaml files def install_libyaml(dir) - case stack - when "cedar-14", "heroku-16" - else - return - end + return false if stack_not_14_not_16? instrument 'ruby.install_libyaml' do FileUtils.mkdir_p dir diff --git a/spec/hatchet/rubies_spec.rb b/spec/hatchet/rubies_spec.rb index 283d97138..b1b2d3e42 100644 --- a/spec/hatchet/rubies_spec.rb +++ b/spec/hatchet/rubies_spec.rb @@ -85,6 +85,8 @@ app = Hatchet::Runner.new("default_ruby", stack: DEFAULT_STACK) app.setup! app.deploy do |app| + expect(app.run(%Q{echo 'MALLOC_ARENA_MAX_is=$MALLOC_ARENA_MAX'})).to match("MALLOC_ARENA_MAX_is=2") + run!(%Q{echo "ruby '2.5.1'" >> Gemfile}) run!("git add -A; git commit -m update-ruby") app.push! @@ -93,4 +95,4 @@ expect(app.output).to match("Ruby version change detected") end end -end \ No newline at end of file +end From e1c94861f2db607ef607b59cedf165725aa2ec45 Mon Sep 17 00:00:00 2001 From: schneems Date: Fri, 21 Dec 2018 10:54:15 -0600 Subject: [PATCH 0626/1195] Bundler 1.17.3 --- lib/language_pack/helpers/bundler_wrapper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index 0cbb921b2..eca6501d1 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -36,7 +36,7 @@ class LanguagePack::Helpers::BundlerWrapper include LanguagePack::ShellHelpers BLESSED_BUNDLER_VERSIONS = {} - BLESSED_BUNDLER_VERSIONS["1"] = "1.15.2" + BLESSED_BUNDLER_VERSIONS["1"] = "1.17.3" BLESSED_BUNDLER_VERSIONS["2"] = "2.0.2" BUNDLED_WITH_REGEX = /^BUNDLED WITH$(\r?\n) (?\d+)\.\d+\.\d+/m From c44dc2a854b2e4c12057418f62f66689e244e9d0 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 16 Sep 2019 11:18:39 -0500 Subject: [PATCH 0627/1195] Remove app that's not used --- hatchet.json | 1 - hatchet.lock | 2 -- 2 files changed, 3 deletions(-) diff --git a/hatchet.json b/hatchet.json index ae8b579b3..e5a4cd0fc 100644 --- a/hatchet.json +++ b/hatchet.json @@ -25,7 +25,6 @@ "sharpstone/ruby_193_jruby_176", "sharpstone/ruby_193_jruby_17161", "sharpstone/ruby_193_jruby_17161_jdk7", - "sharpstone/ruby_193_jruby_17161_jdk8", "sharpstone/ruby_193_bad_patch_cedar_14", "sharpstone/ruby_25", "sharpstone/jruby-minimal", diff --git a/hatchet.lock b/hatchet.lock index ff704630b..8b10e2006 100644 --- a/hatchet.lock +++ b/hatchet.lock @@ -121,8 +121,6 @@ - 130cbe4bc2d8325ecb6d450fb7f5f2248390f0f8 - - "./repos/ruby/ruby_193_jruby_17161_jdk7" - c1b632f8a96cf9b902f5cdcd7a190d46544a8144 -- - "./repos/ruby/ruby_193_jruby_17161_jdk8" - - 01d90df2547488151f3add3b237f15e47e62a4e9 - - "./repos/ruby/ruby_193_jruby_173" - a08e8b2cc61d08bd611accaa455dbcbfff80f831 - - "./repos/ruby/ruby_193_jruby_176" From 17e7fcf359a7323f805f4639374ecf72a379b91f Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 16 Sep 2019 11:46:16 -0500 Subject: [PATCH 0628/1195] Use 1.7.27 for jruby tests --- hatchet.json | 2 +- hatchet.lock | 4 ++-- spec/hatchet/jvm_spec.rb | 2 +- spec/hatchet/rubies_spec.rb | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hatchet.json b/hatchet.json index e5a4cd0fc..01183c55b 100644 --- a/hatchet.json +++ b/hatchet.json @@ -23,7 +23,7 @@ "sharpstone/mri_193_p547", "sharpstone/ruby_193_jruby_173", "sharpstone/ruby_193_jruby_176", - "sharpstone/ruby_193_jruby_17161", + "sharpstone/ruby_193_jruby_1_7_27", "sharpstone/ruby_193_jruby_17161_jdk7", "sharpstone/ruby_193_bad_patch_cedar_14", "sharpstone/ruby_25", diff --git a/hatchet.lock b/hatchet.lock index 8b10e2006..540dbfcf7 100644 --- a/hatchet.lock +++ b/hatchet.lock @@ -117,13 +117,13 @@ - 39f4753b620f9ff427c547fd19f04c89f8441f6f - - "./repos/ruby/ruby_193_bad_patch_cedar_14" - 6948c1460c596f08c4642d616ae73a45dc0ae51a -- - "./repos/ruby/ruby_193_jruby_17161" - - 130cbe4bc2d8325ecb6d450fb7f5f2248390f0f8 - - "./repos/ruby/ruby_193_jruby_17161_jdk7" - c1b632f8a96cf9b902f5cdcd7a190d46544a8144 - - "./repos/ruby/ruby_193_jruby_173" - a08e8b2cc61d08bd611accaa455dbcbfff80f831 - - "./repos/ruby/ruby_193_jruby_176" - 9fcbc184cb386abc8784e9935d52d403e35c532c +- - "./repos/ruby/ruby_193_jruby_1_7_27" + - 289fb2c94ebfc69e77f95b6c9640da6e009505bd - - "./repos/ruby/ruby_25" - 0cb3df80d55b61e9417f2ac00adb06e15ae37982 diff --git a/spec/hatchet/jvm_spec.rb b/spec/hatchet/jvm_spec.rb index 9229d2fae..47d7895ec 100644 --- a/spec/hatchet/jvm_spec.rb +++ b/spec/hatchet/jvm_spec.rb @@ -4,7 +4,7 @@ it "JVM is installed by jvm-common only" do buildpacks = ["heroku/jvm", Hatchet::App.default_buildpack] # default is heroku-ruby-buildpack here - app = Hatchet::Runner.new("ruby_193_jruby_17161", stack: 'cedar-14', buildpacks: buildpacks) + app = Hatchet::Runner.new("ruby_193_jruby_1_7_27", stack: 'cedar-14', buildpacks: buildpacks) app.setup! app.deploy do |app| diff --git a/spec/hatchet/rubies_spec.rb b/spec/hatchet/rubies_spec.rb index b1b2d3e42..9e215fa63 100644 --- a/spec/hatchet/rubies_spec.rb +++ b/spec/hatchet/rubies_spec.rb @@ -44,7 +44,7 @@ end it "should deploy jdk 8 on cedar-14 by default" do - app = Hatchet::Runner.new("ruby_193_jruby_17161", stack: "cedar-14") + app = Hatchet::Runner.new("ruby_193_jruby_1_7_27", stack: "cedar-14") app.setup! app.deploy do |app| expect(app.output).to match("Installing JVM: openjdk-8") From 16d938eed4e932aadfa92623f9704f807a84f8ae Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 16 Sep 2019 12:04:25 -0500 Subject: [PATCH 0629/1195] Pre-release binary is heroku-18 only --- spec/hatchet/jvm_spec.rb | 2 +- spec/hatchet/rubies_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/hatchet/jvm_spec.rb b/spec/hatchet/jvm_spec.rb index 47d7895ec..b60350cfe 100644 --- a/spec/hatchet/jvm_spec.rb +++ b/spec/hatchet/jvm_spec.rb @@ -4,7 +4,7 @@ it "JVM is installed by jvm-common only" do buildpacks = ["heroku/jvm", Hatchet::App.default_buildpack] # default is heroku-ruby-buildpack here - app = Hatchet::Runner.new("ruby_193_jruby_1_7_27", stack: 'cedar-14', buildpacks: buildpacks) + app = Hatchet::Runner.new("ruby_193_jruby_1_7_27", stack: 'heroku-18', buildpacks: buildpacks) app.setup! app.deploy do |app| diff --git a/spec/hatchet/rubies_spec.rb b/spec/hatchet/rubies_spec.rb index 9e215fa63..c2b6abb48 100644 --- a/spec/hatchet/rubies_spec.rb +++ b/spec/hatchet/rubies_spec.rb @@ -44,7 +44,7 @@ end it "should deploy jdk 8 on cedar-14 by default" do - app = Hatchet::Runner.new("ruby_193_jruby_1_7_27", stack: "cedar-14") + app = Hatchet::Runner.new("ruby_193_jruby_1_7_27", stack: "heroku-18") app.setup! app.deploy do |app| expect(app.output).to match("Installing JVM: openjdk-8") From d77e6f0fdc807b97333b019ebc4bcefc9bd12756 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 23 Sep 2019 13:29:36 -0500 Subject: [PATCH 0630/1195] Switch back to a version of jruby that officially exists --- hatchet.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hatchet.lock b/hatchet.lock index 540dbfcf7..1772c3bd6 100644 --- a/hatchet.lock +++ b/hatchet.lock @@ -124,6 +124,6 @@ - - "./repos/ruby/ruby_193_jruby_176" - 9fcbc184cb386abc8784e9935d52d403e35c532c - - "./repos/ruby/ruby_193_jruby_1_7_27" - - 289fb2c94ebfc69e77f95b6c9640da6e009505bd + - 06d5e86180ff0e5b6894f823736cd649dcfebed4 - - "./repos/ruby/ruby_25" - 0cb3df80d55b61e9417f2ac00adb06e15ae37982 From a38029bd5dd9679e571cb1e7cd03aeccde4b2437 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 23 Sep 2019 13:36:09 -0500 Subject: [PATCH 0631/1195] Add changelog for PR --- CHANGELOG.md | 1 + changelogs/v205/bundler.md | 3 +++ 2 files changed, 4 insertions(+) create mode 100644 changelogs/v205/bundler.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 196124535..ba48ae9cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## v205 (unreleased) +* Update bundler 1.x to 1.17.3 (https://github.com/heroku/heroku-buildpack-ruby/pull/845) * Default `MALLOC_ARENA_MAX=2` for new applications (https://github.com/heroku/heroku-buildpack-ruby/pull/752) ## v204 (9/12/2019) diff --git a/changelogs/v205/bundler.md b/changelogs/v205/bundler.md new file mode 100644 index 000000000..8df197d9a --- /dev/null +++ b/changelogs/v205/bundler.md @@ -0,0 +1,3 @@ +## Ruby apps with Bundler 1.x now receive version 1.17.3 + +The [Ruby Buildpack](https://devcenter.heroku.com/articles/ruby-support#libraries) now includes Bundler 1.17.3. Applications specifying Bundler 1.x in their `Gemfile.lock` will now receive bundler: 1.17.3. From cf765f39c5096b1bf2ae8d64e2890a9632cdcfe7 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 24 Sep 2019 09:44:58 -0500 Subject: [PATCH 0632/1195] v206 --- CHANGELOG.md | 4 +++- changelogs/v206/.gitkeep | 0 lib/language_pack/version.rb | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 changelogs/v206/.gitkeep diff --git a/CHANGELOG.md b/CHANGELOG.md index ba48ae9cb..f95786e01 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,6 @@ -## v205 (unreleased) +## v206 (unreleased) + +## v205 (9/24/2019) * Update bundler 1.x to 1.17.3 (https://github.com/heroku/heroku-buildpack-ruby/pull/845) * Default `MALLOC_ARENA_MAX=2` for new applications (https://github.com/heroku/heroku-buildpack-ruby/pull/752) diff --git a/changelogs/v206/.gitkeep b/changelogs/v206/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 1fd780bd0..264f7cbe8 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v204" + BUILDPACK_VERSION = "v205" end end From 2dc2ffd5a388a70efc0a85bfb3d5a0b67c7a6f82 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 23 Sep 2019 11:27:02 -0500 Subject: [PATCH 0633/1195] [changelog skip] Introduce change log check to all PRs The intent here is that changelogs should be written at the time of the PR and not at the time of deploy. This code solidifies a policy we technically already have, but have been enforcing it manually (and with a huge amount of variability). --- .github/workflows/check_changelog.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .github/workflows/check_changelog.yml diff --git a/.github/workflows/check_changelog.yml b/.github/workflows/check_changelog.yml new file mode 100644 index 000000000..64f4f2bd0 --- /dev/null +++ b/.github/workflows/check_changelog.yml @@ -0,0 +1,12 @@ +name: Check Changelog + +on: [pull_request] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: Check that CHANGELOG is touched + run: | + cat $GITHUB_EVENT_PATH | jq .pull_request.title | grep -i '\[\(\(changelog skip\)\|\(ci skip\)\)\]' || git diff remotes/origin/${{ github.base_ref }} --name-only | grep CHANGELOG.md From 2d95fb064c0f700b04154fdfe7ff31b90076c979 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 1 Oct 2019 15:12:49 -0500 Subject: [PATCH 0634/1195] Bump default Ruby version to 2.5.7 --- CHANGELOG.md | 2 ++ buildpack.toml | 8 ++++---- changelogs/v206/default_ruby.md | 3 +++ lib/language_pack/ruby_version.rb | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) create mode 100644 changelogs/v206/default_ruby.md diff --git a/CHANGELOG.md b/CHANGELOG.md index f95786e01..6f013e50d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## v206 (unreleased) +* Default Ruby version for new apps is now 2.5.7 (https://github.com/heroku/heroku-buildpack-ruby/pull/926) + ## v205 (9/24/2019) * Update bundler 1.x to 1.17.3 (https://github.com/heroku/heroku-buildpack-ruby/pull/845) diff --git a/buildpack.toml b/buildpack.toml index 20f91752d..055db5585 100644 --- a/buildpack.toml +++ b/buildpack.toml @@ -1,6 +1,6 @@ [buildpack] name = "Ruby" -ruby_version = "2.5.6" +ruby_version = "2.5.7" [publish.Ignore] files = [ @@ -13,11 +13,11 @@ ruby_version = "2.5.6" dir = "." files = ["./.env"] [[publish.Vendor]] - url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/cedar-14/ruby-2.5.6.tgz" + url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/cedar-14/ruby-2.5.7.tgz" dir = "vendor/ruby/cedar-14" [[publish.Vendor]] - url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-16/ruby-2.5.6.tgz" + url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-16/ruby-2.5.7.tgz" dir = "vendor/ruby/heroku-16" [[publish.Vendor]] - url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-18/ruby-2.5.6.tgz" + url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-18/ruby-2.5.7.tgz" dir = "vendor/ruby/heroku-18" diff --git a/changelogs/v206/default_ruby.md b/changelogs/v206/default_ruby.md new file mode 100644 index 000000000..e1a3c29cf --- /dev/null +++ b/changelogs/v206/default_ruby.md @@ -0,0 +1,3 @@ +## Default Ruby version for new apps is now 2.5.7 + +The [default Ruby version for new Ruby applications is 2.5.7](https://devcenter.heroku.com/articles/ruby-support#default-ruby-version-for-new-apps). You’ll only get the default if the application does not specify a ruby version. \ No newline at end of file diff --git a/lib/language_pack/ruby_version.rb b/lib/language_pack/ruby_version.rb index 2a57ed886..66048458e 100644 --- a/lib/language_pack/ruby_version.rb +++ b/lib/language_pack/ruby_version.rb @@ -12,7 +12,7 @@ def initialize(output = "") end end - DEFAULT_VERSION_NUMBER = "2.5.6" + DEFAULT_VERSION_NUMBER = "2.5.7" DEFAULT_VERSION = "ruby-#{DEFAULT_VERSION_NUMBER}" LEGACY_VERSION_NUMBER = "1.9.2" LEGACY_VERSION = "ruby-#{LEGACY_VERSION_NUMBER}" From ea01842ce1d7ed1a799b286a8013a1f2b6edc1b7 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 26 Mar 2019 12:19:08 -0500 Subject: [PATCH 0635/1195] Warn when app is not using the latest Ruby version Developers should be using the latest Ruby version for their minor series. For example currently developers using 2.4.x should be using 2.4.7, if not then this PR will give them a warning: ``` There is a more recent Ruby version available for you to use: ruby-2.4.7 The latest version will include security and bug fixes, we always recommend running the latest version of your minor release. See https://devcenter.heroku.com/articles/ruby-versions for all available versions. ``` Since it is relatively expensive to check each version serially, we can instead queue up 5 version checks at a time using threads. If the last version check shows that it is a valid version, then it will enqueue another round of 5 checks in parallel. We use similar logic for detecting EOL versions. For example when someone is using 2.2 then we traverse the s3 repository, 2.3.0, 2.4.0, 2.5.0, 2.6.0, 2.7.0, etc. In this case there are more than 3 more recent versions so 2.2 is for sure EOL and we recommend that people update to the 3rd most recent version in the above case it would be 2.5.0. We also have to account for the case that there is a major version bump, so in addition to the minor version check we will check to see if 3.0.0 is released. If it has been then we will also check for 3.1.0, 3.2.0, 3.3.0, etc. There is a problem with relying on deployed Ruby versions on S3 to indicate EOL support since pre-released binaries are not marked. For example 2.7.0 is currently in "preview" mode, however the binary is at 2.7.0. So when someone using 2.4.x ruby executes the EOL check it will see that 2.5, 2.6, and 2.7 are out. Because of this we have 2 different EOL warnings, one for "maybe" eol that warns the version they are on either is already EOL or is about to become EOL at the next release. For example in the future when 2.7.0 is released and someone is using 2.5.0 then they will start getting a warning when the 2.8.0 (or 3.0.0) preview version is released even though 2.5.0 would still technically be supported until the full release at Christmas. This is reasonable as it gives people a heads up that they need to upgrade soon. They would keep getting this "maybe" warning until the preview of 2.9.0 (or 3.1.0) would be released. At that time they would start to receive the more severe EOL message. --- Gemfile.lock | 8 +- lib/language_pack.rb | 1 + lib/language_pack/base.rb | 1 + lib/language_pack/fetcher.rb | 7 + .../helpers/outdated_ruby_version.rb | 150 ++++++++++++++++++ .../installers/ruby_installer.rb | 5 + lib/language_pack/ruby.rb | 83 +++++++++- lib/language_pack/ruby_version.rb | 27 ++++ lib/language_pack/shell_helpers.rb | 4 +- spec/hatchet/ruby_spec.rb | 5 +- spec/helpers/outdated_ruby_version_spec.rb | 96 +++++++++++ spec/helpers/ruby_version_spec.rb | 22 +++ spec/installers/heroku_ruby_installer_spec.rb | 1 - 13 files changed, 401 insertions(+), 9 deletions(-) create mode 100644 lib/language_pack/helpers/outdated_ruby_version.rb create mode 100644 spec/helpers/outdated_ruby_version_spec.rb diff --git a/Gemfile.lock b/Gemfile.lock index e9ab6287a..62280ff6e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -51,7 +51,7 @@ GEM multi_json (1.13.1) netrc (0.11.0) parallel (1.17.0) - parallel_tests (2.29.0) + parallel_tests (2.29.1) parallel platform-api (2.2.0) heroics (~> 0.0.25) @@ -61,14 +61,14 @@ GEM repl_runner (0.0.3) activesupport rrrretry (1.0.0) - rspec-core (3.8.0) + rspec-core (3.8.2) rspec-support (~> 3.8.0) - rspec-expectations (3.8.3) + rspec-expectations (3.8.4) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.8.0) rspec-retry (0.6.1) rspec-core (> 3.3) - rspec-support (3.8.0) + rspec-support (3.8.2) thor (0.20.3) thread_safe (0.3.6) threaded (0.0.4) diff --git a/lib/language_pack.rb b/lib/language_pack.rb index 6eb0b5890..8fc5663fa 100644 --- a/lib/language_pack.rb +++ b/lib/language_pack.rb @@ -34,6 +34,7 @@ def self.detect(*args) require "language_pack/helpers/rake_runner" require "language_pack/helpers/rails_runner" require "language_pack/helpers/bundler_wrapper" +require "language_pack/helpers/outdated_ruby_version" require "language_pack/installers/ruby_installer" require "language_pack/installers/heroku_ruby_installer" require "language_pack/installers/rbx_installer" diff --git a/lib/language_pack/base.rb b/lib/language_pack/base.rb index f95287388..9f3921d07 100644 --- a/lib/language_pack/base.rb +++ b/lib/language_pack/base.rb @@ -87,6 +87,7 @@ def compile Kernel.puts "" puts warning Kernel.puts "" + Kernel.puts "" end if deprecations.any? topic "DEPRECATIONS:" diff --git a/lib/language_pack/fetcher.rb b/lib/language_pack/fetcher.rb index c4415dacb..37709edab 100644 --- a/lib/language_pack/fetcher.rb +++ b/lib/language_pack/fetcher.rb @@ -14,6 +14,13 @@ def initialize(host_url, stack = nil) @host_url += File.basename(stack) if stack end + def exists?(path, max_attempts = 1) + curl = curl_command("-I #{@host_url.join(path)}") + run!(curl, error_class: FetchError, max_attempts: max_attempts, silent: true) + rescue FetchError + false + end + def fetch(path) curl = curl_command("-O #{@host_url.join(path)}") run!(curl, error_class: FetchError) diff --git a/lib/language_pack/helpers/outdated_ruby_version.rb b/lib/language_pack/helpers/outdated_ruby_version.rb new file mode 100644 index 000000000..268f37b58 --- /dev/null +++ b/lib/language_pack/helpers/outdated_ruby_version.rb @@ -0,0 +1,150 @@ +# Queries S3 in the background to determine +# what versions are supported so they can be recommended +# to the user +# +# Example: +# +# ruby_version = LanguagePack::RubyVersion.new("ruby-2.2.5") +# outdated = LanguagePack::Helpers::OutdatedRubyVersion.new( +# current_ruby_version: ruby_version, +# fetcher: LanguagePack::Fetcher.new(LanguagePack::Base::VENDOR_URL, "heroku-16") +# ) +# +# outdated.call +# puts outdated.suggested_ruby_minor_version +# #=> "ruby-2.2.10" +class LanguagePack::Helpers::OutdatedRubyVersion + DEFAULT_RANGE = 1..5 + attr_reader :current_ruby_version + + def initialize(current_ruby_version: , fetcher:) + @current_ruby_version = current_ruby_version + @fetcher = fetcher + + @minor_versions = [current_ruby_version] + @eol_versions = [] + @threads = [] + end + + # Enqueues checks in the background + def call + return unless can_check? + + check_minor_versions + check_eol_versions_major + check_eol_versions_minor + self + end + + def join + return false if current_ruby_version.patchlevel_is_significant? + return false if current_ruby_version.rbx? + return false if current_ruby_version.jruby? + + @threads.each(&:join) + + true + end + alias :can_check? :join + + def suggested_ruby_minor_version + return current_ruby_version unless can_check? + + @minor_versions.reverse_each do |version| + return version if version + end + end + + def latest_minor_version? + suggested_ruby_minor_version == current_ruby_version + end + + def eol? + return false unless can_check? + + true if @eol_versions.length > 3 + end + + # Account for preview releases + def maybe_eol? + return false unless can_check? + + true if @eol_versions.length > 2 + end + + def suggest_ruby_eol_version + return false unless maybe_eol? + + versions = @eol_versions + .map { |v| v.sub('ruby-', '') } + .sort_by { |v| Gem::Version.new(v) } + + versions.last(3).first.sub(/0$/, 'x') + end + + # Checks for a range of "tiny" versions in parallel + # + # For example if 2.5.0 is given it will check for the existance of + # - 2.5.1 + # - 2.5.2 + # - 2.5.3 + # - 2.5.4 + # - 2.5.5 + # + # If the last elment in the series exists, it will continue to + # search by enqueuing additional numbers until the final + # value in the series is found + private def check_minor_versions(range: DEFAULT_RANGE, base_version: current_ruby_version, &block) + range.each do |i| + @threads << Thread.new do + version = base_version.next_logical_version(i) + next if !@fetcher.exists?("#{version}.tgz") + + @minor_versions[i] = version + + check_minor_versions(range: Range.new(i+1, i+i), base_version: base_version) if i == range.last + end + end + end + + # Checks to see if 3 minor versions exist above current version + # + # for example 2.4.0 would check for existance of: + # - 2.5.0 + # - 2.6.0 + # - 2.7.0 + # - 2.8.0 + private def check_eol_versions_minor(range: DEFAULT_RANGE, base_version: current_ruby_version) + range.each do |i| + @threads << Thread.new do + version = base_version.next_minor_version(i) + next if !@fetcher.exists?("#{version}.tgz") + + @eol_versions << version + + check_eol_versions_minor(range: Range.new(i+1, i+i), base_version: base_version) if i == range.last + end + end + end + + # Checks to see if one major version exists above current version + # if it does, then it will check for minor versions of that version + # + # For checking 2.5. it would check for the existance of 3.0.0 + # + # If 3.0.0 exists then it will check for: + # - 3.1.0 + # - 3.2.0 + # - 3.3.0 + private def check_eol_versions_major + @threads << Thread.new do + version = current_ruby_version.next_major_version(1) + + next if !@fetcher.exists?("#{version}.tgz") + + @eol_versions << version + + check_eol_versions_minor(base_version: RubyVersion.new(version)) + end + end +end diff --git a/lib/language_pack/installers/ruby_installer.rb b/lib/language_pack/installers/ruby_installer.rb index 96657133c..7df658a44 100644 --- a/lib/language_pack/installers/ruby_installer.rb +++ b/lib/language_pack/installers/ruby_installer.rb @@ -1,9 +1,14 @@ require "language_pack/shell_helpers" module LanguagePack::Installers; end +# This is a base module that is later included by other +# classes such as LanguagePack::Installers::HerokuRubyInstaller +# module LanguagePack::Installers::RubyInstaller include LanguagePack::ShellHelpers + attr_reader :fetcher + DEFAULT_BIN_DIR = "bin" def self.installer(ruby_version) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 8de8513cc..b0c00b82d 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -108,9 +108,13 @@ def compile end config_detect best_practice_warnings + warn_outdated_ruby cleanup super end + rescue => e + warn_outdated_ruby + raise e end def cleanup @@ -380,12 +384,83 @@ def setup_profiled end end + def warn_outdated_ruby + return unless defined?(@outdated_version_check) + + @warn_outdated ||= begin + @outdated_version_check.join + + warn_outdated_minor + warn_outdated_eol + true + end + end + + def warn_outdated_eol + return unless @outdated_version_check.maybe_eol? + + if @outdated_version_check.eol? + warn(<<~WARNING) + EOL Ruby Version + + You are using a Ruby version that has reached its End of Life (EOL) + + We strongly suggest you upgrade to Ruby #{@outdated_version_check.suggest_ruby_eol_version} or later + + Your current Ruby version no longer receives security updates from + Ruby Core and may have serious vulnerabilities. While you will continue + to be able to deploy on Heroku with this Ruby version you must upgrade + to a non-EOL version to be eligable to receive support. + + Upgrade your Ruby version as soon as possible. + + For a list of supported Ruby versions see: + https://devcenter.heroku.com/articles/ruby-support#supported-runtimes + WARNING + else + # Maybe EOL + warn(<<~WARNING) + Potential EOL Ruby Version + + You are using a Ruby version that has either reached its End of Life (EOL) + or will reach its End of Life on December 25th of this year. + + We suggest you upgrade to Ruby #{@outdated_version_check.suggest_ruby_eol_version} or later + + Once a Ruby version becomes EOL, it will no longer receive + security updates from Ruby core and may have serious vulnerabilities. + + Please upgrade your Ruby version. + + For a list of supported Ruby versions see: + https://devcenter.heroku.com/articles/ruby-support#supported-runtimes + WARNING + end + end + + def warn_outdated_minor + return if @outdated_version_check.latest_minor_version? + + warn(<<~WARNING) + There is a more recent Ruby version available for you to use: + + #{@outdated_version_check.suggested_ruby_minor_version} + + The latest version will include security and bug fixes, we always recommend + running the latest version of your minor release. + + Please upgrade your Ruby version. + + For all available Ruby versions see: + https://devcenter.heroku.com/articles/ruby-support#supported-runtimes + WARNING + end + # install the vendored ruby # @return [Boolean] true if it installs the vendored ruby and false otherwise def install_ruby instrument 'ruby.install_ruby' do return false unless ruby_version - installer = LanguagePack::Installers::RubyInstaller.installer(ruby_version).new(@stack) if ruby_version.build? @@ -393,6 +468,12 @@ def install_ruby end installer.install(ruby_version, slug_vendor_ruby) + @outdated_version_check = LanguagePack::Helpers::OutdatedRubyVersion.new( + current_ruby_version: ruby_version, + fetcher: installer.fetcher + ) + @outdated_version_check.call + @metadata.write("buildpack_ruby_version", ruby_version.version_for_download) topic "Using Ruby version: #{ruby_version.version_for_download}" diff --git a/lib/language_pack/ruby_version.rb b/lib/language_pack/ruby_version.rb index 66048458e..575b3470d 100644 --- a/lib/language_pack/ruby_version.rb +++ b/lib/language_pack/ruby_version.rb @@ -96,6 +96,33 @@ def vendored_bundler? false end + # Returns the next logical version in the minor series + # for example if the current ruby version is + # `ruby-2.3.1` then then `next_logical_version(1)` + # will produce `ruby-2.3.2`. + def next_logical_version(increment = 1) + return false if patchlevel_is_significant? + split_version = @version_without_patchlevel.split(".") + teeny = split_version.pop + split_version << teeny.to_i + increment + split_version.join(".") + end + + def next_minor_version(increment = 1) + split_version = @version_without_patchlevel.split(".") + split_version[1] = split_version[1].to_i + increment + split_version[2] = 0 + split_version.join(".") + end + + def next_major_version(increment = 1) + split_version = @version_without_patchlevel.split("-").last.split(".") + split_version[0] = Integer(split_version[0]) + increment + split_version[1] = 0 + split_version[2] = 0 + return "ruby-#{split_version.join(".")}" + end + private def none diff --git a/lib/language_pack/shell_helpers.rb b/lib/language_pack/shell_helpers.rb index 1e2401731..a7c4f2c09 100644 --- a/lib/language_pack/shell_helpers.rb +++ b/lib/language_pack/shell_helpers.rb @@ -85,7 +85,8 @@ def self.display_error_and_exit(e) # @option options [Integer] :max_attempts Number of times to attempt command before raising def run!(command, options = {}) max_attempts = options[:max_attempts] || 1 - error_class = options[:error_class] || StandardError + error_class = options[:error_class] || StandardError + silent = options.key?(:silent) ? options[:silent] : false max_attempts.times do |attempt_number| result = run(command, options) if $?.success? @@ -94,6 +95,7 @@ def run!(command, options = {}) if attempt_number == max_attempts - 1 raise error_class, "Command: '#{command}' failed unexpectedly:\n#{result}" else + next if silent puts "Command: '#{command}' failed on attempt #{attempt_number + 1} of #{max_attempts}." end end diff --git a/spec/hatchet/ruby_spec.rb b/spec/hatchet/ruby_spec.rb index f6641a39e..a3d42690c 100644 --- a/spec/hatchet/ruby_spec.rb +++ b/spec/hatchet/ruby_spec.rb @@ -27,7 +27,7 @@ describe "2.5.0" do it "works" do Hatchet::Runner.new("ruby_25").deploy do - # works + expect(app.output).to include("There is a more recent Ruby version available") end end end @@ -89,7 +89,8 @@ describe "Raise errors on specific gems" do it "should should raise on sqlite3" do - Hatchet::Runner.new("sqlite3_gemfile", allow_failure: true).deploy do |app| + before_deploy = -> { run!(%Q{echo "ruby '2.5.4' >> Gemfile"}) } + Hatchet::Runner.new("sqlite3_gemfile", allow_failure: true, before_deploy: before_deploy).deploy do |app| expect(app).not_to be_deployed expect(app.output).to include("Detected sqlite3 gem which is not supported") expect(app.output).to include("devcenter.heroku.com/articles/sqlite3") diff --git a/spec/helpers/outdated_ruby_version_spec.rb b/spec/helpers/outdated_ruby_version_spec.rb new file mode 100644 index 000000000..880480efe --- /dev/null +++ b/spec/helpers/outdated_ruby_version_spec.rb @@ -0,0 +1,96 @@ +require "spec_helper" + +describe LanguagePack::Helpers::OutdatedRubyVersion do + let(:stack) { "heroku-16" } + let(:fetcher) { LanguagePack::Fetcher.new(LanguagePack::Base::VENDOR_URL, stack) } + + it "finds the latest version on a stack" do + ruby_version = LanguagePack::RubyVersion.new("ruby-2.2.5") + outdated = LanguagePack::Helpers::OutdatedRubyVersion.new( + current_ruby_version: ruby_version, + fetcher: fetcher + ) + + outdated.call + expect(outdated.suggested_ruby_minor_version).to eq("ruby-2.2.10") + expect(outdated.eol?).to eq(true) + expect(outdated.maybe_eol?).to eq(true) + end + + it "detects returns original ruby version when using the latest" do + ruby_version = LanguagePack::RubyVersion.new("ruby-2.2.10") + outdated = LanguagePack::Helpers::OutdatedRubyVersion.new( + current_ruby_version: ruby_version, + fetcher: fetcher + ) + + outdated.call + expect(outdated.suggested_ruby_minor_version).to eq(ruby_version) + expect(outdated.latest_minor_version?).to be_truthy + end + + it "Doesn't do anything when using a patch significant version" do + ruby_version = LanguagePack::RubyVersion.new("ruby-1.9.3p123") + outdated = LanguagePack::Helpers::OutdatedRubyVersion.new( + current_ruby_version: ruby_version, + fetcher: fetcher + ) + + outdated.call + expect(outdated.suggested_ruby_minor_version).to eq(ruby_version) + expect(outdated.can_check?).to eq(false) + end + + it "recommends a non EOL version of Ruby" do + ruby_version_one = LanguagePack::RubyVersion.new("ruby-2.1.10") + ruby_version_two = LanguagePack::RubyVersion.new("ruby-2.2.10") + + outdated_one = LanguagePack::Helpers::OutdatedRubyVersion.new( + current_ruby_version: ruby_version_one, + fetcher: fetcher + ) + outdated_two = LanguagePack::Helpers::OutdatedRubyVersion.new( + current_ruby_version: ruby_version_two, + fetcher: fetcher + ) + + outdated_one.call + outdated_two.call + + expect(outdated_one.eol?).to be_truthy + expect(outdated_one.maybe_eol?).to be_truthy + + expect(outdated_two.eol?).to be_truthy + expect(outdated_one.maybe_eol?).to be_truthy + + suggested_one = outdated_one.suggest_ruby_eol_version + expect(suggested_one).to eq(outdated_two.suggest_ruby_eol_version) + expect(suggested_one.chars.last).to eq("x") # i.e. 2.5.x + + actual = Gem::Version.new(suggested_one) + expect(actual).to be > Gem::Version.new("2.4.x") + end + + it "does not recommend EOL for recent ruby version" do + ruby_version = LanguagePack::RubyVersion.new("ruby-2.2.10") + + outdated = LanguagePack::Helpers::OutdatedRubyVersion.new( + current_ruby_version: ruby_version, + fetcher: fetcher + ) + + outdated.call + + good_version = outdated.suggest_ruby_eol_version.sub("x", "0") + ruby_version = LanguagePack::RubyVersion.new("ruby-#{good_version}") + + outdated = LanguagePack::Helpers::OutdatedRubyVersion.new( + current_ruby_version: ruby_version, + fetcher: fetcher + ) + + expect(outdated.eol?).to be_falsey + expect(outdated.maybe_eol?).to be_falsey + end +end + diff --git a/spec/helpers/ruby_version_spec.rb b/spec/helpers/ruby_version_spec.rb index 302ba6b9a..a346c1cd4 100644 --- a/spec/helpers/ruby_version_spec.rb +++ b/spec/helpers/ruby_version_spec.rb @@ -16,6 +16,28 @@ @bundler.clean end + it "knows the next logical version" do + Hatchet::App.new("ruby_25").in_directory_fork do |dir| + ruby_version = LanguagePack::RubyVersion.new(@bundler.install.ruby_version, is_new: true) + version_number = "2.5.0" + version = "ruby-#{version_number}" + + expect(ruby_version.version_without_patchlevel).to eq(version) + expect(ruby_version.next_logical_version).to eq("ruby-2.5.1") + expect(ruby_version.next_logical_version).to eq("ruby-2.5.1") + expect(ruby_version.next_logical_version(2)).to eq("ruby-2.5.2") + expect(ruby_version.next_logical_version(20)).to eq("ruby-2.5.20") + + # Minor version + expect(ruby_version.next_minor_version).to eq("ruby-2.6.0") + expect(ruby_version.next_minor_version(2)).to eq("ruby-2.7.0") + + # Major Version + expect(ruby_version.next_major_version).to eq("ruby-3.0.0") + expect(ruby_version.next_major_version(2)).to eq("ruby-4.0.0") + end + end + it "correctly handles patch levels" do Hatchet::App.new("mri_193_p547").in_directory_fork do |dir| ruby_version = LanguagePack::RubyVersion.new(@bundler.install.ruby_version, is_new: true) diff --git a/spec/installers/heroku_ruby_installer_spec.rb b/spec/installers/heroku_ruby_installer_spec.rb index 6648a870a..2fa788a69 100644 --- a/spec/installers/heroku_ruby_installer_spec.rb +++ b/spec/installers/heroku_ruby_installer_spec.rb @@ -5,7 +5,6 @@ let(:ruby_version) { LanguagePack::RubyVersion.new("ruby-2.3.3") } describe "#fetch_unpack" do - it "should fetch and unpack mri" do Dir.mktmpdir do |dir| Dir.chdir(dir) do From cdf785a0f662c30704ad422b1aa6e79efbcec341 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 12 Sep 2019 20:57:45 -0500 Subject: [PATCH 0636/1195] mend --- spec/hatchet/ruby_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/hatchet/ruby_spec.rb b/spec/hatchet/ruby_spec.rb index a3d42690c..41ecbdeba 100644 --- a/spec/hatchet/ruby_spec.rb +++ b/spec/hatchet/ruby_spec.rb @@ -26,7 +26,7 @@ describe "2.5.0" do it "works" do - Hatchet::Runner.new("ruby_25").deploy do + Hatchet::Runner.new("ruby_25").deploy do |app| expect(app.output).to include("There is a more recent Ruby version available") end end From baeaf27296dfdf88c011a34bba50a8e1b2799b25 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 24 Sep 2019 10:37:07 -0500 Subject: [PATCH 0637/1195] Add changelog for Ruby warnings --- CHANGELOG.md | 1 + changelogs/v206/ruby_warning.md | 9 +++++++++ 2 files changed, 10 insertions(+) create mode 100644 changelogs/v206/ruby_warning.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f013e50d..706721b49 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## v206 (unreleased) * Default Ruby version for new apps is now 2.5.7 (https://github.com/heroku/heroku-buildpack-ruby/pull/926) +* Using old and EOL versions of Ruby now generate warnings (https://github.com/heroku/heroku-buildpack-ruby/pull/864) ## v205 (9/24/2019) diff --git a/changelogs/v206/ruby_warning.md b/changelogs/v206/ruby_warning.md new file mode 100644 index 000000000..00fbba134 --- /dev/null +++ b/changelogs/v206/ruby_warning.md @@ -0,0 +1,9 @@ +## Using old and EOL versions of Ruby now generate warnings + +If your application is using a version of MRI Ruby that is below the latest released patch level, you'll now receive a warning on deploy in the build output. For example, if you are using `2.3.3`, you'll be encouraged to upgrade to the latest in the series which is `2.3.8`. + +In addition to the version warning, you'll now receive warnings when you're using a version of Ruby that may be EOL (End of Life) soon or is already EOL. Ruby Core officially supports up to 3 releases of Ruby at a time. For example, when `2.7` is released, then the supported versions will be `2.7.x`, `2.6.x`, and `2.5.x`. Our support mirrors Ruby Core support. You can see the [latest versions of Ruby available on our Ruby support page](https://devcenter.heroku.com/articles/ruby-support#supported-runtimes). + +Right now you'll receive a warning indicating that your version of Ruby is close to being EOL if you're using `2.4.x`. If you're using `2.3.x` or older, you'll receive a warning indicating that your version is already EOL and we will not be providing support or security patches for the version. + +We highly recommend staying on a non-EOL version of Ruby and using the latest patch release as these versions contain the most up to date security and bug fixes. \ No newline at end of file From ca31c0fffaa30b69bddc8fdc71e50f4a60ea1155 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 24 Sep 2019 10:56:17 -0500 Subject: [PATCH 0638/1195] No idea why this fails sometimes but this should be more robust. --- spec/hatchet/rubies_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/hatchet/rubies_spec.rb b/spec/hatchet/rubies_spec.rb index c2b6abb48..84c6e51b0 100644 --- a/spec/hatchet/rubies_spec.rb +++ b/spec/hatchet/rubies_spec.rb @@ -85,7 +85,7 @@ app = Hatchet::Runner.new("default_ruby", stack: DEFAULT_STACK) app.setup! app.deploy do |app| - expect(app.run(%Q{echo 'MALLOC_ARENA_MAX_is=$MALLOC_ARENA_MAX'})).to match("MALLOC_ARENA_MAX_is=2") + expect(app.run("env | grep MALLOC_ARENA_MAX")).to match("MALLOC_ARENA_MAX=2") run!(%Q{echo "ruby '2.5.1'" >> Gemfile}) run!("git add -A; git commit -m update-ruby") From 54cc2ad71d7fa7c84309039d517791b8f9391cf2 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 30 Sep 2019 14:36:29 -0500 Subject: [PATCH 0639/1195] Store values in thread directly This commit removes storing intermediate values in an array and instead persists them directly in the thread. This uses a fan/out fan/in approach as suggested by Terence. --- .../helpers/outdated_ruby_version.rb | 61 +++++++++++++------ spec/helpers/outdated_ruby_version_spec.rb | 4 +- 2 files changed, 45 insertions(+), 20 deletions(-) diff --git a/lib/language_pack/helpers/outdated_ruby_version.rb b/lib/language_pack/helpers/outdated_ruby_version.rb index 268f37b58..25187bfd9 100644 --- a/lib/language_pack/helpers/outdated_ruby_version.rb +++ b/lib/language_pack/helpers/outdated_ruby_version.rb @@ -20,15 +20,20 @@ class LanguagePack::Helpers::OutdatedRubyVersion def initialize(current_ruby_version: , fetcher:) @current_ruby_version = current_ruby_version @fetcher = fetcher + @already_joined = false - @minor_versions = [current_ruby_version] + @minor_versions = [current_ruby_version.ruby_version] @eol_versions = [] - @threads = [] + + @minor_verison_threads = [] + @eol_versions_threads = [] end # Enqueues checks in the background def call - return unless can_check? + return false if current_ruby_version.patchlevel_is_significant? + return false if current_ruby_version.rbx? + return false if current_ruby_version.jruby? check_minor_versions check_eol_versions_major @@ -41,22 +46,29 @@ def join return false if current_ruby_version.rbx? return false if current_ruby_version.jruby? - @threads.each(&:join) + return true if @already_joined + + @minor_verison_threads.each(&:join) + @eol_versions_threads.each(&:join) - true + @minor_versions += @minor_verison_threads.map(&:value).compact + @eol_versions += @eol_versions_threads.map(&:value).compact + + @already_joined = true end alias :can_check? :join def suggested_ruby_minor_version return current_ruby_version unless can_check? - @minor_versions.reverse_each do |version| - return version if version - end + @minor_versions + .map { |v| v.sub('ruby-', '') } + .sort_by { |v| Gem::Version.new(v) } + .last end def latest_minor_version? - suggested_ruby_minor_version == current_ruby_version + suggested_ruby_minor_version == current_ruby_version.ruby_version end def eol? @@ -96,13 +108,18 @@ def suggest_ruby_eol_version # value in the series is found private def check_minor_versions(range: DEFAULT_RANGE, base_version: current_ruby_version, &block) range.each do |i| - @threads << Thread.new do + @minor_verison_threads << Thread.new do version = base_version.next_logical_version(i) next if !@fetcher.exists?("#{version}.tgz") - @minor_versions[i] = version + if i == range.last + check_minor_versions( + range: Range.new(i+1, i+i), + base_version: base_version + ) + end - check_minor_versions(range: Range.new(i+1, i+i), base_version: base_version) if i == range.last + version end end end @@ -116,13 +133,19 @@ def suggest_ruby_eol_version # - 2.8.0 private def check_eol_versions_minor(range: DEFAULT_RANGE, base_version: current_ruby_version) range.each do |i| - @threads << Thread.new do + @eol_versions_threads << Thread.new do version = base_version.next_minor_version(i) + next if !@fetcher.exists?("#{version}.tgz") - @eol_versions << version + if i == range.last + check_eol_versions_minor( + range: Range.new(i+1, i+i), + base_version: base_version + ) + end - check_eol_versions_minor(range: Range.new(i+1, i+i), base_version: base_version) if i == range.last + version end end end @@ -137,14 +160,16 @@ def suggest_ruby_eol_version # - 3.2.0 # - 3.3.0 private def check_eol_versions_major - @threads << Thread.new do + @eol_versions_threads << Thread.new do version = current_ruby_version.next_major_version(1) next if !@fetcher.exists?("#{version}.tgz") - @eol_versions << version + check_eol_versions_minor( + base_version: RubyVersion.new(version) + ) - check_eol_versions_minor(base_version: RubyVersion.new(version)) + version end end end diff --git a/spec/helpers/outdated_ruby_version_spec.rb b/spec/helpers/outdated_ruby_version_spec.rb index 880480efe..3a9e280e8 100644 --- a/spec/helpers/outdated_ruby_version_spec.rb +++ b/spec/helpers/outdated_ruby_version_spec.rb @@ -12,7 +12,7 @@ ) outdated.call - expect(outdated.suggested_ruby_minor_version).to eq("ruby-2.2.10") + expect(outdated.suggested_ruby_minor_version).to eq("2.2.10") expect(outdated.eol?).to eq(true) expect(outdated.maybe_eol?).to eq(true) end @@ -25,7 +25,7 @@ ) outdated.call - expect(outdated.suggested_ruby_minor_version).to eq(ruby_version) + expect(outdated.suggested_ruby_minor_version).to eq("2.2.10") expect(outdated.latest_minor_version?).to be_truthy end From 7dd9d2c1dc8f243aba64ce4c16ca72cca4ba78bc Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 1 Oct 2019 10:52:29 -0500 Subject: [PATCH 0640/1195] Safer interface for outdated ruby version `call` now asserts that it is only called once. `join` now requires that `call` has been exercised previously --- .../helpers/outdated_ruby_version.rb | 76 +++++++++++-------- spec/helpers/outdated_ruby_version_spec.rb | 3 +- 2 files changed, 45 insertions(+), 34 deletions(-) diff --git a/lib/language_pack/helpers/outdated_ruby_version.rb b/lib/language_pack/helpers/outdated_ruby_version.rb index 25187bfd9..441308da1 100644 --- a/lib/language_pack/helpers/outdated_ruby_version.rb +++ b/lib/language_pack/helpers/outdated_ruby_version.rb @@ -25,16 +25,26 @@ def initialize(current_ruby_version: , fetcher:) @minor_versions = [current_ruby_version.ruby_version] @eol_versions = [] - @minor_verison_threads = [] - @eol_versions_threads = [] + @minor_version_threads = [] + @eol_version_threads = [] + + @suggested_eol_version = nil + @suggested_minor_version = nil end - # Enqueues checks in the background - def call + def can_check? return false if current_ruby_version.patchlevel_is_significant? return false if current_ruby_version.rbx? return false if current_ruby_version.jruby? + true + end + + # Enqueues checks in the background + def call + return unless can_check? + raise "Cannot `call()` twice" unless @minor_version_threads.empty? + check_minor_versions check_eol_versions_major check_eol_versions_minor @@ -42,56 +52,56 @@ def call end def join - return false if current_ruby_version.patchlevel_is_significant? - return false if current_ruby_version.rbx? - return false if current_ruby_version.jruby? - + return unless can_check? return true if @already_joined + raise "Must initalize threads with `call()` before joining" if @minor_version_threads.empty? + + @minor_version_threads.each(&:join) + @eol_version_threads.each(&:join) + + @minor_versions += @minor_version_threads.map(&:value).compact + @eol_versions += @eol_version_threads.map(&:value).compact - @minor_verison_threads.each(&:join) - @eol_versions_threads.each(&:join) + @suggested_minor_version = @minor_versions + .map { |v| v.sub('ruby-', '') } + .sort_by { |v| Gem::Version.new(v) } + .last - @minor_versions += @minor_verison_threads.map(&:value).compact - @eol_versions += @eol_versions_threads.map(&:value).compact + eol_versions = @eol_versions + .map { |v| v.sub('ruby-', '') } + .sort_by { |v| Gem::Version.new(v) } + + @suggested_eol_version = eol_versions.last(3).first.sub(/0$/, 'x') @already_joined = true end - alias :can_check? :join def suggested_ruby_minor_version - return current_ruby_version unless can_check? - - @minor_versions - .map { |v| v.sub('ruby-', '') } - .sort_by { |v| Gem::Version.new(v) } - .last + join + @suggested_minor_version end def latest_minor_version? - suggested_ruby_minor_version == current_ruby_version.ruby_version + join + @suggested_minor_version == current_ruby_version.ruby_version end def eol? - return false unless can_check? + join - true if @eol_versions.length > 3 + return @eol_versions.length > 3 end # Account for preview releases def maybe_eol? - return false unless can_check? + join - true if @eol_versions.length > 2 + return @eol_versions.length > 2 end def suggest_ruby_eol_version return false unless maybe_eol? - - versions = @eol_versions - .map { |v| v.sub('ruby-', '') } - .sort_by { |v| Gem::Version.new(v) } - - versions.last(3).first.sub(/0$/, 'x') + @suggested_eol_version end # Checks for a range of "tiny" versions in parallel @@ -108,7 +118,7 @@ def suggest_ruby_eol_version # value in the series is found private def check_minor_versions(range: DEFAULT_RANGE, base_version: current_ruby_version, &block) range.each do |i| - @minor_verison_threads << Thread.new do + @minor_version_threads << Thread.new do version = base_version.next_logical_version(i) next if !@fetcher.exists?("#{version}.tgz") @@ -133,7 +143,7 @@ def suggest_ruby_eol_version # - 2.8.0 private def check_eol_versions_minor(range: DEFAULT_RANGE, base_version: current_ruby_version) range.each do |i| - @eol_versions_threads << Thread.new do + @eol_version_threads << Thread.new do version = base_version.next_minor_version(i) next if !@fetcher.exists?("#{version}.tgz") @@ -160,7 +170,7 @@ def suggest_ruby_eol_version # - 3.2.0 # - 3.3.0 private def check_eol_versions_major - @eol_versions_threads << Thread.new do + @eol_version_threads << Thread.new do version = current_ruby_version.next_major_version(1) next if !@fetcher.exists?("#{version}.tgz") diff --git a/spec/helpers/outdated_ruby_version_spec.rb b/spec/helpers/outdated_ruby_version_spec.rb index 3a9e280e8..7c179fc09 100644 --- a/spec/helpers/outdated_ruby_version_spec.rb +++ b/spec/helpers/outdated_ruby_version_spec.rb @@ -37,8 +37,8 @@ ) outdated.call - expect(outdated.suggested_ruby_minor_version).to eq(ruby_version) expect(outdated.can_check?).to eq(false) + expect(outdated.suggested_ruby_minor_version).to eq(nil) end it "recommends a non EOL version of Ruby" do @@ -88,6 +88,7 @@ current_ruby_version: ruby_version, fetcher: fetcher ) + outdated.call expect(outdated.eol?).to be_falsey expect(outdated.maybe_eol?).to be_falsey From 4e1d451ccda19e0210b2754383292e9ec29820c6 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 2 Oct 2019 09:53:05 -0500 Subject: [PATCH 0641/1195] Bump Ruby version --- Gemfile | 2 +- Gemfile.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 7111681e2..5dbdd17f0 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ source "https://rubygems.org" git_source(:github) { |repo| "https://github.com/#{repo}.git" } -ruby '2.5.5' +ruby '2.5.7' group :development, :test do gem "toml-rb" diff --git a/Gemfile.lock b/Gemfile.lock index 62280ff6e..703c4588a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -97,7 +97,7 @@ DEPENDENCIES toml-rb RUBY VERSION - ruby 2.5.5p157 + ruby 2.5.7p206 BUNDLED WITH 2.0.2 From 4095719b03bf0a20c1137eda2bcb3f8f6877bd8d Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 2 Oct 2019 09:56:57 -0500 Subject: [PATCH 0642/1195] Clean up OutdatedRubyVersion#join `value` will also block, so we can use it directly. --- .../helpers/outdated_ruby_version.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/language_pack/helpers/outdated_ruby_version.rb b/lib/language_pack/helpers/outdated_ruby_version.rb index 441308da1..9f9f59496 100644 --- a/lib/language_pack/helpers/outdated_ruby_version.rb +++ b/lib/language_pack/helpers/outdated_ruby_version.rb @@ -22,7 +22,7 @@ def initialize(current_ruby_version: , fetcher:) @fetcher = fetcher @already_joined = false - @minor_versions = [current_ruby_version.ruby_version] + @minor_versions = [] @eol_versions = [] @minor_version_threads = [] @@ -56,22 +56,22 @@ def join return true if @already_joined raise "Must initalize threads with `call()` before joining" if @minor_version_threads.empty? - @minor_version_threads.each(&:join) - @eol_version_threads.each(&:join) + @eol_versions = @eol_version_threads.map(&:value).compact + @minor_versions = @minor_version_threads.map(&:value).compact + @minor_versions << current_ruby_version.ruby_version - @minor_versions += @minor_version_threads.map(&:value).compact - @eol_versions += @eol_version_threads.map(&:value).compact @suggested_minor_version = @minor_versions .map { |v| v.sub('ruby-', '') } .sort_by { |v| Gem::Version.new(v) } .last - eol_versions = @eol_versions + @suggested_eol_version = @eol_versions .map { |v| v.sub('ruby-', '') } .sort_by { |v| Gem::Version.new(v) } - - @suggested_eol_version = eol_versions.last(3).first.sub(/0$/, 'x') + .last(3) + .first + .sub(/0$/, 'x') @already_joined = true end From e0a386dfcab0d57131fea0fdc8b705c473efe2f2 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 2 Oct 2019 10:00:26 -0500 Subject: [PATCH 0643/1195] Test current ruby version is also same as default ruby version --- spec/helpers/config_spec.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spec/helpers/config_spec.rb b/spec/helpers/config_spec.rb index e47bc1e96..32f3b0e98 100644 --- a/spec/helpers/config_spec.rb +++ b/spec/helpers/config_spec.rb @@ -11,5 +11,7 @@ urls.each do |url| expect(url.include?(bootstrap_version)).to be_truthy, "expected #{url.inspect} to include #{bootstrap_version.inspect} but it did not" end + + expect(`ruby -v`).to match(Regexp.escape(LanguagePack::RubyVersion::DEFAULT_VERSION_NUMBER)) end end From fbc2c76bb6b7827e56b0be973f776b77a7f4dd29 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 2 Oct 2019 10:30:15 -0500 Subject: [PATCH 0644/1195] [changelog skip] Fix logic for Outdated check Previously when calling this logic on a Ruby version that is truly the last in line, then we would end up with an empty array that we then call `first` on and then expect it to be a string. That string we then call `sub` on. This fails when nil is returned from the array. Instead of doing this logic inside of the join method, we can put it directly in the suggest_ruby_eol_version method which runs after a guard statement so it will never run unless the array provided a value. We can test this in a way that does not depend on external existence of the files by stubbing out the fetcher to always return false when it checks for another ruby version. --- .../helpers/outdated_ruby_version.rb | 2 +- spec/helpers/outdated_ruby_version_spec.rb | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/lib/language_pack/helpers/outdated_ruby_version.rb b/lib/language_pack/helpers/outdated_ruby_version.rb index 9f9f59496..a6f8e5501 100644 --- a/lib/language_pack/helpers/outdated_ruby_version.rb +++ b/lib/language_pack/helpers/outdated_ruby_version.rb @@ -71,7 +71,6 @@ def join .sort_by { |v| Gem::Version.new(v) } .last(3) .first - .sub(/0$/, 'x') @already_joined = true end @@ -102,6 +101,7 @@ def maybe_eol? def suggest_ruby_eol_version return false unless maybe_eol? @suggested_eol_version + .sub(/0$/, 'x') end # Checks for a range of "tiny" versions in parallel diff --git a/spec/helpers/outdated_ruby_version_spec.rb b/spec/helpers/outdated_ruby_version_spec.rb index 7c179fc09..29d0a8f1c 100644 --- a/spec/helpers/outdated_ruby_version_spec.rb +++ b/spec/helpers/outdated_ruby_version_spec.rb @@ -93,5 +93,23 @@ expect(outdated.eol?).to be_falsey expect(outdated.maybe_eol?).to be_falsey end + + it "can call eol? on the latest Ruby version" do + ruby_version = LanguagePack::RubyVersion.new("ruby-2.6.0") + + new_fetcher = fetcher.dup + def new_fetcher.exists?(value); false; end + + outdated = LanguagePack::Helpers::OutdatedRubyVersion.new( + current_ruby_version: ruby_version, + fetcher: new_fetcher + ) + + outdated.call + + expect(outdated.eol?).to be_falsey + expect(outdated.maybe_eol?).to be_falsey + end + end From 1fdab11e6cc458896e94b8253ca3d5d787eb094e Mon Sep 17 00:00:00 2001 From: Mikkel Malmberg Date: Mon, 14 Oct 2019 11:29:13 +0200 Subject: [PATCH 0645/1195] Fix missing constant --- lib/language_pack/helpers/outdated_ruby_version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/helpers/outdated_ruby_version.rb b/lib/language_pack/helpers/outdated_ruby_version.rb index a6f8e5501..28bfa6efb 100644 --- a/lib/language_pack/helpers/outdated_ruby_version.rb +++ b/lib/language_pack/helpers/outdated_ruby_version.rb @@ -176,7 +176,7 @@ def suggest_ruby_eol_version next if !@fetcher.exists?("#{version}.tgz") check_eol_versions_minor( - base_version: RubyVersion.new(version) + base_version: LanguagePack::RubyVersion.new(version) ) version From 5b83b426e16b133a9c33094a6d1acacb7c5fe7e7 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 14 Oct 2019 13:25:35 -0500 Subject: [PATCH 0646/1195] v207 --- CHANGELOG.md | 2 +- changelogs/v207/.gitkeep | 0 lib/language_pack/version.rb | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 changelogs/v207/.gitkeep diff --git a/CHANGELOG.md b/CHANGELOG.md index 706721b49..d7f0f309c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## v206 (unreleased) +## v206 (10/15/2019) * Default Ruby version for new apps is now 2.5.7 (https://github.com/heroku/heroku-buildpack-ruby/pull/926) * Using old and EOL versions of Ruby now generate warnings (https://github.com/heroku/heroku-buildpack-ruby/pull/864) diff --git a/changelogs/v207/.gitkeep b/changelogs/v207/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 264f7cbe8..67c0a908c 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v205" + BUILDPACK_VERSION = "v206" end end From e07ffff4e6461ef3af257f1fea02c5572774cce0 Mon Sep 17 00:00:00 2001 From: schneems Date: Fri, 4 Oct 2019 14:43:48 -0500 Subject: [PATCH 0647/1195] Remove bundler version in Gemfile.lock https://twitter.com/schneems/status/1179413794583392257 --- lib/language_pack/ruby.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index b0c00b82d..45f1c5ca4 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -733,6 +733,12 @@ def write_bundler_shim(path) # runs bundler to install the dependencies def build_bundler(default_bundle_without) instrument 'ruby.build_bundler' do + topic("Removing BUNDLED WITH version in the Gemfile.lock") + contents = File.read("Gemfile.lock") + File.open("Gemfile.lock", "w") do |f| + f.write contents.sub(/^BUNDLED WITH$(\r?\n) (?\d+)\.\d+\.\d+/m, '') + end + log("bundle") do bundle_without = env("BUNDLE_WITHOUT") || default_bundle_without bundle_bin = "bundle" From 41ed0b691cc19461d1f779387cd3cdf47ecb0210 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 3 Jul 2019 13:38:41 -0500 Subject: [PATCH 0648/1195] # This is a combination of 2 commits. # This is the 1st commit message: Failing test for Bundler 2 and Ruby 2.5.5 When you deploy an app with Bundler 2.0.1 in the Gemfile.lock with Bundler 2.0.2 on the system, it works the first time, but on the second deploy it fails: ``` 1) Bundler deploys with version 2.x Failure/Error: app.push! Hatchet::App::FailedDeploy: Could not deploy 'hatchet-t-31aafb8954' (default_ruby) using 'Hatchet::GitApp' at path: './repos/rack/default_ruby' if this was expected add `allow_failure: true` to your deploy hash. output: Buildpack: nil Repo: https://git.heroku.com/hatchet-t-31aafb8954.git remote: Compressing source files... done. remote: Building source: remote: remote: -----> Ruby app detected remote: -----> Compiling Ruby/Rack remote: -----> Using Ruby version: ruby-2.5.5 remote: -----> Installing dependencies using bundler 2.0.2 remote: Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment remote: Activating bundler (2.0.1) failed: remote: Could not find 'bundler' (2.0.1) required by your /tmp/build_a9c801af0c0fc42d984cfda6569e532c/Gemfile.lock. remote: To update to the latest version installed on your system, run `bundle update --bundler`. remote: To install the missing version, run `gem install bundler:2.0.1` remote: Checked in 'GEM_PATH=vendor/bundle/ruby/2.5.0', execute `gem env` for more information remote: remote: To install the version of bundler this project requires, run `gem install bundler -v '2.0.1'` remote: Bundler Output: Activating bundler (2.0.1) failed: remote: Could not find 'bundler' (2.0.1) required by your /tmp/build_a9c801af0c0fc42d984cfda6569e532c/Gemfile.lock. remote: To update to the latest version installed on your system, run `bundle update --bundler`. remote: To install the missing version, run `gem install bundler:2.0.1` remote: Checked in 'GEM_PATH=vendor/bundle/ruby/2.5.0', execute `gem env` for more information remote: remote: To install the version of bundler this project requires, run `gem install bundler -v '2.0.1'` remote: remote: ! remote: ! Failed to install gems via Bundler. remote: ! remote: ! Push rejected, failed to compile Ruby app. remote: remote: ! Push failed remote: Verifying deploy... remote: remote: ! Push rejected to hatchet-t-31aafb8954. remote: To https://git.heroku.com/hatchet-t-31aafb8954.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'https://git.heroku.com/hatchet-t-31aafb8954.git' ``` The first deploy succeeds because there is no cache. The second deploy fails because the cache exists and `which bundler` points to a file generated by this bundler template (in `vendor/bundle/bin/bundle`): https://github.com/bundler/bundler/blob/905dce42705d0e92fa5c74ce4b9133c7d77a6fb1/lib/bundler/templates/Executable.bundler It fails due to this code which is run: ``` def activate_bundler(bundler_version) if Gem::Version.correct?(bundler_version) && Gem::Version.new(bundler_version).release < Gem::Version.new("2.0") bundler_version = "< 2" end gem_error = activation_error_handling do gem "bundler", bundler_version end ``` The `bundler_version` here will be 2.0.1 but it sees that it's own version is 2.0.2. This can potentially be mitigated by manually setting `BUNDLER_VERSION=2.0.2`, however I'm not in love with that solution as it doesn't seem like it should be required. Another solution is to not call this `vendor/bundle/bin/bundle` executable directly and instead go through a shim such as: ``` #!/usr/bin/env ruby require 'rubygems' version = "#{bundler.version}" if ARGV.first str = ARGV.first str = str.dup.force_encoding("BINARY") if str.respond_to? :force_encoding if str =~ /\A_(.*)_\z/ and Gem::Version.correct?($1) then version = $1 ARGV.shift end end if Gem.respond_to?(:activate_bin_path) load Gem.activate_bin_path('bundler', 'bundle', version) else gem "bundler", version load Gem.bin_path("bundler", "bundle", version) end ``` This is similar (if not identical) to the shim that rubygems would install and use on a "normal" system. On Heroku we do not use this system since we do not actually install bundler through rubygems, but rather we pre-package it as a tarball, put it on S3 and then download it. We invoke bundler, not through rubygems, but by placing it's executable on the PATH and then letting the OS find it directly. There are two fixes listed here: - Use BUNDLE_VERSION env var - Pros: Fixes the problem. A relatively small change. - Cons: Requires us to propagate this env var into the dyno and/or remember to set it any time we invoke bundler. This will be very hard to catch incorrect uses as failure to include it does not always make things fail right away, but they may fail in the future. There's also no guarantee that this will continue to work into the future. I.e. this might be a fix for today - Write our own shim file and pretend to be rubygems - Pros: Fixes the problem - Cons: We're effectively forking Rubygems shim logic with this method, any bugfixes or upstream changes to Rubygems would need to be mirrored in the buildpack, not great. Possibly brittle. A large change. I'm interested in looking for a third solution, one where Heroku will behave more like a "normal" install of Ruby w/ Bundler. Ideally we would find a way for all `bundle` calls when the client's codebase does not include a `bin/bundle` binstub, to go through whatever version of Rubygems is on the system for all invocations of `bundle` as this is how it will eventually be executed on the Dyno. - Pros: Fixes the problem. No need to worry about following upstream fixes or changes to Rubygems shim logic. - Cons: There might be additional Rubygems bugs that we're successfully avoiding today due to our current (accidental?) logic. This would be the largest change. # This is the commit message #2: Update to 2.5.7 --- spec/hatchet/bundler_spec.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/spec/hatchet/bundler_spec.rb b/spec/hatchet/bundler_spec.rb index a774c6d14..469806e28 100644 --- a/spec/hatchet/bundler_spec.rb +++ b/spec/hatchet/bundler_spec.rb @@ -2,10 +2,17 @@ describe "Bundler" do it "deploys with version 2.x" do - before_deploy = -> { run!(%Q{printf "\nBUNDLED WITH\n 2.0.1\n" >> Gemfile.lock}) } + before_deploy = Proc.new do + run!(%Q{echo "ruby '2.5.7'" >> Gemfile}) + run!(%Q{printf "\nBUNDLED WITH\n 2.0.1\n" >> Gemfile.lock}) + end Hatchet::Runner.new("default_ruby", before_deploy: before_deploy).deploy do |app| expect(app.output).to match("Installing dependencies using bundler 2.") + + # Double deploy problem with Ruby 2.5.5 + run!(%Q{git commit --allow-empty -m 'Deploying again'}) + app.push! end end end From 21bb1a956536b42742bd8f9353204efae0d47cb9 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 4 Nov 2019 13:48:21 -0600 Subject: [PATCH 0649/1195] Changelog for deleting BUNDLED WITH --- CHANGELOG.md | 4 ++++ changelogs/v207/remove_bundle_with.md | 11 +++++++++++ 2 files changed, 15 insertions(+) create mode 100644 changelogs/v207/remove_bundle_with.md diff --git a/CHANGELOG.md b/CHANGELOG.md index d7f0f309c..d9aafd5dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## v207 (unreleased) + +* Remove possibilities of false exceptions being raised by removing `BUNDLED WITH` from the `Gemfile.lock` (https://github.com/heroku/heroku-buildpack-ruby/pull/928) + ## v206 (10/15/2019) * Default Ruby version for new apps is now 2.5.7 (https://github.com/heroku/heroku-buildpack-ruby/pull/926) diff --git a/changelogs/v207/remove_bundle_with.md b/changelogs/v207/remove_bundle_with.md new file mode 100644 index 000000000..9eb53918a --- /dev/null +++ b/changelogs/v207/remove_bundle_with.md @@ -0,0 +1,11 @@ +## Ruby apps will now have the `BUNDLED WITH` declaration in their `Gemfile.lock` removed after detecting Bundler version + +The version listed in the `BUNDLED WITH` key of the `Gemfile.lock` is used by Heroku to [detect what version of Bundler to use](https://devcenter.heroku.com/articles/ruby-support#libraries). + +This declaration is also used internally by an integration between RubyGems and Bundler to attempt to recognize version differences and raise an error. This logic contains bugs and has been embeded in many versions of already released for many existing Ruby versions. In an effort to remove false errors from application deployments, the `BUNDLED WITH` declaration will now be removed from the `Gemfile.lock` after it has been used to determine and install a compatible version of Bundler for the application. + +A message will be emitted in the build process when this happens: + +``` +-----> Removing BUNDLED WITH version in the Gemfile.lock +``` \ No newline at end of file From 195ac9549a942f3ea154c1213e1b0c4d6e5905e7 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 26 Nov 2019 13:16:33 -0600 Subject: [PATCH 0650/1195] Vendor libpq5.12.1 into Slugs Libpq is the client library used to communicate to postgresql. There was a bug in libpq 5.11 that essentially said if there is a problem with a configuration value, for example if you tried to set `pool` (which should be an integer) to a string, then the value would be silently ignored. In libpq 5.12 this behavior was "fixed" so that if you try to set a value to an incorrect type it will raise an error: ``` PG::UnableToSend: no connection to the server ``` Or ``` CONNECTION_BAD ``` Here is the commit that changed the behavior https://github.com/postgres/postgres/commit/e7a2217978d9cbb2149bfcb4ef1e45716cfcbefb The largest failure mode is when someone accidentally forgets to put a space after their ERB tag in `database.yml` but before their comment. For example: ``` connect_timeout: <%= ENV['DB_CONNECT_TIMEOUT'] || 5 %># seconds ``` Would be evaluated to a string of "5# seconds". This will work in libpq5.11 but fail in libpq5.12. This can be fixed by adding a space between `%>` and `# seconds`. This change was rolled out on our stack image, but then rolled back to customers getting failures in the middle of the night when they had seemingly changed nothing. By vendoring this library in the slug, we have more control around when the update will happen. Rather than breaking changes when the stack image rolls out which might happen in the middle of the night for some developers, this change will only be applied as customers are deploying their apps. If they have a release phase then the error will likely be caught there and prevented from going into production. This behavior introduces a helpful warning message along with URLs for getting more information around this issue. We do not anticipate that a majority of applications will be affected by this change, however those that are affected experience large problems. The intent of rolling this change out in a buildpack is to minimize the exposure of apps that will trigger this failing condition. Eventually libpq5.12.1 will be the default version on the stack. This change works to prepare developers for that change. --- lib/language_pack/ruby.rb | 58 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 45f1c5ca4..fce9d0c2c 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -99,6 +99,7 @@ def compile setup_export setup_profiled allow_git do + patch_libpq install_bundler_in_app build_bundler("development:test") post_bundler @@ -117,6 +118,63 @@ def compile raise e end + def patch_libpq + # Check for existing libraries + out = run!("ls /usr/lib/x86_64-linux-gnu/ | grep libpq") + out.each_line do |line| + version = line.sub(/libpq\.so\./, '') + return if Gem::Version.new(version) >= Gem::Version("5.12") + end + + case ENV['STACK'] + when 'heroku-16' + pkg = "libpq5_12.1-1.pgdg16.04+1_amd64.deb" + when 'heroku-18' + pkg = "libpq5_12.1-1.pgdg18.04+1_amd64.deb" + when 'cedar-14' + return + else + return + end + + @metadata.touch("patched_libpq12") + + topic("Vendoring libpq 5.12.1") + warn(<<~EOF) + Replacing libpq with version libpq 5.12.1 + + This version includes a bug fix that can cause an exception + on boot for applications with incorrectly configured connection + values. For more information see: + + + If your application breaks you can rollback to your last build. + You can also temporarially opt out of this behavior by setting: + + ``` + $ heroku config:set HEROKU_SKIP_LIBPQ12=1 + ``` + + In the future libpq 5.12 will be the default on the platform and + you will not be able to opt-out of the library. For more information see: + + EOF + + Dir.chdir("vendor") do + run!("curl --remote-name-all http://apt.postgresql.org/pub/repos/apt/pool/main/p/postgresql-12/#{pkg}") + run!("dpkg -x #{pkg} .") + + load_libpq_12_unless_env_var = <<~EOF + if [ "$HEROKU_SKIP_LIBPQ12" == "" ]; then + export LD_LIBRARY_PATH="$HOME/vendor/usr/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH" + fi + EOF + add_to_export load_libpq_12_unless_env_var + add_to_profiled load_libpq_12_unless_env_var + ENV["LD_LIBRARY_PATH"] = Dir.pwd + "/usr/lib/x86_64-linux-gnu:#{ENV["LD_LIBRARY_PATH"]}" + end + end + def cleanup end From 0a17d3232dae0babf7b1543d73e8ff1a909aba13 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 26 Nov 2019 13:24:25 -0600 Subject: [PATCH 0651/1195] Debugging --- lib/language_pack/ruby.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index fce9d0c2c..ea4104df5 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -121,8 +121,10 @@ def compile def patch_libpq # Check for existing libraries out = run!("ls /usr/lib/x86_64-linux-gnu/ | grep libpq") + puts out out.each_line do |line| version = line.sub(/libpq\.so\./, '') + next unless version.match?(/\Ad/) # avoid libpq.so.libpq.a return if Gem::Version.new(version) >= Gem::Version("5.12") end From 809ffa5e9ab567a15a3154ea736f600d6cdd8eed Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 26 Nov 2019 13:27:07 -0600 Subject: [PATCH 0652/1195] Remove debug line --- lib/language_pack/ruby.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index ea4104df5..796db138c 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -121,7 +121,6 @@ def compile def patch_libpq # Check for existing libraries out = run!("ls /usr/lib/x86_64-linux-gnu/ | grep libpq") - puts out out.each_line do |line| version = line.sub(/libpq\.so\./, '') next unless version.match?(/\Ad/) # avoid libpq.so.libpq.a From bb1514ccfe1c1deec03a86822abd0801bf8b08c4 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 26 Nov 2019 13:35:03 -0600 Subject: [PATCH 0653/1195] Changelog --- CHANGELOG.md | 1 + changelogs/v207/vendor_libpq.md | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 changelogs/v207/vendor_libpq.md diff --git a/CHANGELOG.md b/CHANGELOG.md index d9aafd5dd..5260b55ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## v207 (unreleased) +* Vendor in libpq 5.12.1 (https://github.com/heroku/heroku-buildpack-ruby/pull/935) * Remove possibilities of false exceptions being raised by removing `BUNDLED WITH` from the `Gemfile.lock` (https://github.com/heroku/heroku-buildpack-ruby/pull/928) ## v206 (10/15/2019) diff --git a/changelogs/v207/vendor_libpq.md b/changelogs/v207/vendor_libpq.md new file mode 100644 index 000000000..697686e9f --- /dev/null +++ b/changelogs/v207/vendor_libpq.md @@ -0,0 +1,15 @@ +## Postgresql client library libpq version 5.12.1 now vendored into Ruby applications + +Ruby applications will get a vendored version of the libpq client library version 5.12.1 starting today. For more information about the reasons for this change and the possible effects see: + + + +If your application breaks due to this change you can rollback to your last build. You can also temporarially opt out of this behavior by setting: + +``` +$ heroku config:set HEROKU_SKIP_LIBPQ12=1 +``` + +In the future libpq 5.12 will be the default on the platform and you will not be able to opt-out of the library. For more information see: + + \ No newline at end of file From 118d8ea701c3391bfa989ca9615cc89d3c21aac5 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 26 Nov 2019 13:39:40 -0600 Subject: [PATCH 0654/1195] Update URL --- changelogs/v207/vendor_libpq.md | 4 ++-- lib/language_pack/ruby.rb | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/changelogs/v207/vendor_libpq.md b/changelogs/v207/vendor_libpq.md index 697686e9f..bddf762db 100644 --- a/changelogs/v207/vendor_libpq.md +++ b/changelogs/v207/vendor_libpq.md @@ -2,7 +2,7 @@ Ruby applications will get a vendored version of the libpq client library version 5.12.1 starting today. For more information about the reasons for this change and the possible effects see: - +https://devcenter.heroku.com/articles/libpq-5-12-1-breaking-connection-behavior If your application breaks due to this change you can rollback to your last build. You can also temporarially opt out of this behavior by setting: @@ -12,4 +12,4 @@ $ heroku config:set HEROKU_SKIP_LIBPQ12=1 In the future libpq 5.12 will be the default on the platform and you will not be able to opt-out of the library. For more information see: - \ No newline at end of file +https://devcenter.heroku.com/articles/libpq-5-12-1-breaking-connection-behavior \ No newline at end of file diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 796db138c..f1e102df8 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -147,7 +147,8 @@ def patch_libpq This version includes a bug fix that can cause an exception on boot for applications with incorrectly configured connection values. For more information see: - + + https://devcenter.heroku.com/articles/libpq-5-12-1-breaking-connection-behavior If your application breaks you can rollback to your last build. You can also temporarially opt out of this behavior by setting: @@ -158,7 +159,8 @@ def patch_libpq In the future libpq 5.12 will be the default on the platform and you will not be able to opt-out of the library. For more information see: - + + https://devcenter.heroku.com/articles/libpq-5-12-1-breaking-connection-behavior EOF Dir.chdir("vendor") do From 43bea3110571a7dc320114bd2969682d19d2f11a Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 3 Dec 2019 15:56:38 -0600 Subject: [PATCH 0655/1195] Use secure url --- lib/language_pack/ruby.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index f1e102df8..188176a0e 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -164,7 +164,7 @@ def patch_libpq EOF Dir.chdir("vendor") do - run!("curl --remote-name-all http://apt.postgresql.org/pub/repos/apt/pool/main/p/postgresql-12/#{pkg}") + run!("curl --remote-name-all https://apt.postgresql.org/pub/repos/apt/pool/main/p/postgresql-12/#{pkg}") run!("dpkg -x #{pkg} .") load_libpq_12_unless_env_var = <<~EOF From 1e56ffe54e2b983864916bc3c2eb76ad97b68c32 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 3 Dec 2019 15:57:28 -0600 Subject: [PATCH 0656/1195] Tests for libpq5.12.1 known failure modes --- hatchet.json | 3 ++- spec/hatchet/ruby_spec.rb | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/hatchet.json b/hatchet.json index 01183c55b..19a5ad70a 100644 --- a/hatchet.json +++ b/hatchet.json @@ -30,7 +30,8 @@ "sharpstone/jruby-minimal", "sharpstone/empty-procfile", "sharpstone/bad_ruby_version", - "sharpstone/activerecord41_scaffold" + "sharpstone/activerecord41_scaffold", + "sharpstone/libpq_connection_error" ], "jruby": [ "sharpstone/jruby_naether" diff --git a/spec/hatchet/ruby_spec.rb b/spec/hatchet/ruby_spec.rb index 41ecbdeba..6e67cfd91 100644 --- a/spec/hatchet/ruby_spec.rb +++ b/spec/hatchet/ruby_spec.rb @@ -1,6 +1,22 @@ require_relative '../spec_helper' describe "Ruby apps" do + describe "vendoring libpq" do + it "works on heroku-16" do + Hatchet::Runner.new("libpq_connection_error", stack: "heroku-16").deploy do |app| + out = app.run("ruby reproduce_error.rb") + expect(out).to match(%Q{invalid integer value "15s"}) + end + end + + it "works on heroku-18" do + Hatchet::Runner.new("libpq_connection_error", stack: "heroku-18").deploy do |app| + out = app.run("ruby reproduce_error.rb") + expect(out).to match(%Q{invalid integer value "15s"}) + end + end + end + describe "running Ruby from outside the default dir" do it "works" do Hatchet::Runner.new('cd_ruby', stack: DEFAULT_STACK).deploy do |app| From 14533da724e922180ea2b948b16a405e2f5bc309 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 9 Dec 2019 11:42:13 -0600 Subject: [PATCH 0657/1195] Rename method to be more correct --- lib/language_pack/ruby.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 188176a0e..d22b8257b 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -99,7 +99,7 @@ def compile setup_export setup_profiled allow_git do - patch_libpq + vendor_libpq install_bundler_in_app build_bundler("development:test") post_bundler @@ -118,7 +118,7 @@ def compile raise e end - def patch_libpq + def vendor_libpq # Check for existing libraries out = run!("ls /usr/lib/x86_64-linux-gnu/ | grep libpq") out.each_line do |line| From 723d648bc748b0b8a252252f512d59b7d35c81ff Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 9 Dec 2019 11:42:56 -0600 Subject: [PATCH 0658/1195] Drop heroku-16 behavior for vendoring libpq --- lib/language_pack/ruby.rb | 19 ++----------------- spec/hatchet/ruby_spec.rb | 2 ++ 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index d22b8257b..5df40e059 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -120,23 +120,8 @@ def compile def vendor_libpq # Check for existing libraries - out = run!("ls /usr/lib/x86_64-linux-gnu/ | grep libpq") - out.each_line do |line| - version = line.sub(/libpq\.so\./, '') - next unless version.match?(/\Ad/) # avoid libpq.so.libpq.a - return if Gem::Version.new(version) >= Gem::Version("5.12") - end - - case ENV['STACK'] - when 'heroku-16' - pkg = "libpq5_12.1-1.pgdg16.04+1_amd64.deb" - when 'heroku-18' - pkg = "libpq5_12.1-1.pgdg18.04+1_amd64.deb" - when 'cedar-14' - return - else - return - end + return unless File.exist?("/usr/lib/x86_64-linux-gnu/libpq.so.5.11") + return unless ENV['STACK'] == 'heroku-18' @metadata.touch("patched_libpq12") diff --git a/spec/hatchet/ruby_spec.rb b/spec/hatchet/ruby_spec.rb index 6e67cfd91..053785e5a 100644 --- a/spec/hatchet/ruby_spec.rb +++ b/spec/hatchet/ruby_spec.rb @@ -3,6 +3,8 @@ describe "Ruby apps" do describe "vendoring libpq" do it "works on heroku-16" do + skip "Blocked on getting heroku-16 docker example to work https://github.com/schneems/libpq_heroku_16_reproduction/tree/schneems/manually-download-install" + Hatchet::Runner.new("libpq_connection_error", stack: "heroku-16").deploy do |app| out = app.run("ruby reproduce_error.rb") expect(out).to match(%Q{invalid integer value "15s"}) From 504ef2218935dbaa0ace205d721f7b009fb49890 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 9 Dec 2019 11:43:18 -0600 Subject: [PATCH 0659/1195] Move deb download to our S3 bucket. --- lib/language_pack/ruby.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 5df40e059..c6f7aa4c7 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -149,8 +149,9 @@ def vendor_libpq EOF Dir.chdir("vendor") do - run!("curl --remote-name-all https://apt.postgresql.org/pub/repos/apt/pool/main/p/postgresql-12/#{pkg}") - run!("dpkg -x #{pkg} .") + @fetchers[:mri].fetch_untar("libpq5_12.1-1.deb.tgz") + run!("dpkg -x libpq5_12.1-1.deb .") + run!("rm libpq5_12.1-1.deb") load_libpq_12_unless_env_var = <<~EOF if [ "$HEROKU_SKIP_LIBPQ12" == "" ]; then From a8cb5cb7d6691ee5e72bcaa56854e8ef77821928 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 9 Dec 2019 11:47:55 -0600 Subject: [PATCH 0660/1195] Use deb directly, add hatchet lock file --- hatchet.lock | 2 ++ lib/language_pack/ruby.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/hatchet.lock b/hatchet.lock index 1772c3bd6..6315a9577 100644 --- a/hatchet.lock +++ b/hatchet.lock @@ -111,6 +111,8 @@ - 7cae0aae424c2028b81b5d37ee24d42db8e545b9 - - "./repos/ruby/jruby-minimal" - f79860bc2866449fe065484f1542aaadd3f7cfd2 +- - "./repos/ruby/libpq_connection_error" + - c211c245f09d8335a520cd7a0b5360897d4988eb - - "./repos/ruby/mri_187" - 43cecfacbedda64f09310a4408ce73c5dc3a9c44 - - "./repos/ruby/mri_193_p547" diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index c6f7aa4c7..e829d8552 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -149,7 +149,7 @@ def vendor_libpq EOF Dir.chdir("vendor") do - @fetchers[:mri].fetch_untar("libpq5_12.1-1.deb.tgz") + @fetchers[:mri].fetch("libpq5_12.1-1.deb") run!("dpkg -x libpq5_12.1-1.deb .") run!("rm libpq5_12.1-1.deb") From 8e8a6200834682773e782cfe03eb0dfe1eec0aba Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 9 Dec 2019 12:01:52 -0600 Subject: [PATCH 0661/1195] Specify change only applies to Heroku-18 --- CHANGELOG.md | 2 +- changelogs/v207/vendor_libpq.md | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5260b55ce..5d6b41ff2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ## v207 (unreleased) -* Vendor in libpq 5.12.1 (https://github.com/heroku/heroku-buildpack-ruby/pull/935) +* Vendor in libpq 5.12.1 for Heroku-18 (https://github.com/heroku/heroku-buildpack-ruby/pull/936) * Remove possibilities of false exceptions being raised by removing `BUNDLED WITH` from the `Gemfile.lock` (https://github.com/heroku/heroku-buildpack-ruby/pull/928) ## v206 (10/15/2019) diff --git a/changelogs/v207/vendor_libpq.md b/changelogs/v207/vendor_libpq.md index bddf762db..86cc578f7 100644 --- a/changelogs/v207/vendor_libpq.md +++ b/changelogs/v207/vendor_libpq.md @@ -1,6 +1,6 @@ -## Postgresql client library libpq version 5.12.1 now vendored into Ruby applications +## Postgresql client library libpq version 5.12.1 now vendored into Ruby applications on Heroku-18 -Ruby applications will get a vendored version of the libpq client library version 5.12.1 starting today. For more information about the reasons for this change and the possible effects see: +Ruby applications deploying to Heroku-18 will get a vendored version of the libpq client library version 5.12.1 starting today. For more information about the reasons for this change and the possible effects see: https://devcenter.heroku.com/articles/libpq-5-12-1-breaking-connection-behavior @@ -12,4 +12,4 @@ $ heroku config:set HEROKU_SKIP_LIBPQ12=1 In the future libpq 5.12 will be the default on the platform and you will not be able to opt-out of the library. For more information see: -https://devcenter.heroku.com/articles/libpq-5-12-1-breaking-connection-behavior \ No newline at end of file +https://devcenter.heroku.com/articles/libpq-5-12-1-breaking-connection-behavior From f2c6b93968fd034dd05146716e8ed5b00f21ad8a Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 11 Dec 2019 12:35:47 -0600 Subject: [PATCH 0662/1195] Only warn on first deploy Adding a cache `fetch` method that will only trigger on the first time it is executed and sees that the key does not exist in the cache. Using this to only warn on the first deploy. --- lib/language_pack/metadata.rb | 9 +++++++++ lib/language_pack/ruby.rb | 37 +++++++++++++++++++---------------- 2 files changed, 29 insertions(+), 17 deletions(-) diff --git a/lib/language_pack/metadata.rb b/lib/language_pack/metadata.rb index 4cc1d33e1..9ca6b4522 100644 --- a/lib/language_pack/metadata.rb +++ b/lib/language_pack/metadata.rb @@ -35,6 +35,15 @@ def touch(key) write(key, "true") end + def fetch(key) + return read(key) if exists?(key) + + value = yield + + write(key, value.to_s) + return value + end + def save @cache ? @cache.add(FOLDER) : false end diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index e829d8552..513f29bab 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -123,30 +123,33 @@ def vendor_libpq return unless File.exist?("/usr/lib/x86_64-linux-gnu/libpq.so.5.11") return unless ENV['STACK'] == 'heroku-18' - @metadata.touch("patched_libpq12") - topic("Vendoring libpq 5.12.1") - warn(<<~EOF) - Replacing libpq with version libpq 5.12.1 - This version includes a bug fix that can cause an exception - on boot for applications with incorrectly configured connection - values. For more information see: + @metadata.fetch("vendor_libpq12") do + warn(<<~EOF) + Replacing libpq with version libpq 5.12.1 + + This version includes a bug fix that can cause an exception + on boot for applications with incorrectly configured connection + values. For more information see: - https://devcenter.heroku.com/articles/libpq-5-12-1-breaking-connection-behavior + https://devcenter.heroku.com/articles/libpq-5-12-1-breaking-connection-behavior - If your application breaks you can rollback to your last build. - You can also temporarially opt out of this behavior by setting: + If your application breaks you can rollback to your last build. + You can also temporarially opt out of this behavior by setting: - ``` - $ heroku config:set HEROKU_SKIP_LIBPQ12=1 - ``` + ``` + $ heroku config:set HEROKU_SKIP_LIBPQ12=1 + ``` - In the future libpq 5.12 will be the default on the platform and - you will not be able to opt-out of the library. For more information see: + In the future libpq 5.12 will be the default on the platform and + you will not be able to opt-out of the library. For more information see: - https://devcenter.heroku.com/articles/libpq-5-12-1-breaking-connection-behavior - EOF + https://devcenter.heroku.com/articles/libpq-5-12-1-breaking-connection-behavior + EOF + + "true" # Set future cache value + end Dir.chdir("vendor") do @fetchers[:mri].fetch("libpq5_12.1-1.deb") From 1d6fa3445a5e2649de9be900c2ef1bfec7e55e8d Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 16 Dec 2019 11:12:32 -0600 Subject: [PATCH 0663/1195] [changelog skip] v207 --- lib/language_pack/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 67c0a908c..8e9fb0bc0 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v206" + BUILDPACK_VERSION = "v207" end end From f3baa89db91f3db0807ab487346251664ff51c70 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 22 Jan 2020 12:56:58 -0600 Subject: [PATCH 0664/1195] Update tests - Skip the naether test which is failing for unknown reasons that need further investigation - Change the description so that only tests that use `cedar-14` have it in the description --- spec/hatchet/rubies_spec.rb | 38 +++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/spec/hatchet/rubies_spec.rb b/spec/hatchet/rubies_spec.rb index 84c6e51b0..2824edcac 100644 --- a/spec/hatchet/rubies_spec.rb +++ b/spec/hatchet/rubies_spec.rb @@ -43,7 +43,18 @@ end end - it "should deploy jdk 8 on cedar-14 by default" do + it "should deploy jruby 1.7.16.1 (jdk 7) properly on cedar-14 with sys props file" do + app = Hatchet::Runner.new("ruby_193_jruby_17161_jdk7", stack: "cedar-14") + app.setup! + app.deploy do |app| + expect(app.output).to match("Installing JVM: openjdk-7") + expect(app.output).not_to include("OpenJDK 64-Bit Server VM warning") + end + end +end + +describe "Ruby versions" do + it "should deploy jdk 8 on heroku-18 by default" do app = Hatchet::Runner.new("ruby_193_jruby_1_7_27", stack: "heroku-18") app.setup! app.deploy do |app| @@ -60,23 +71,14 @@ end end - it "should deploy jruby 1.7.16.1 (jdk 7) properly on cedar-14 with sys props file" do - app = Hatchet::Runner.new("ruby_193_jruby_17161_jdk7", stack: "cedar-14") - app.setup! - app.deploy do |app| - expect(app.output).to match("Installing JVM: openjdk-7") - expect(app.output).not_to include("OpenJDK 64-Bit Server VM warning") - end - end - - it "should deploy jruby with the naether gem" do - app = Hatchet::Runner.new("jruby_naether", stack: DEFAULT_STACK) - app.setup! - app.deploy do |app| - expect(app.output).to match("Installing naether") - expect(app.output).not_to include("An error occurred while installing naether") - end - end + # it "should deploy jruby with the naether gem" do + # app = Hatchet::Runner.new("jruby_naether", stack: DEFAULT_STACK) + # app.setup! + # app.deploy do |app| + # expect(app.output).to match("Installing naether") + # expect(app.output).not_to include("An error occurred while installing naether") + # end + # end end From 6b7f38c68db91c754f056540560e77bdf95ab938 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 22 Jan 2020 13:19:55 -0600 Subject: [PATCH 0665/1195] Default Ruby version to 2.6.5 --- CHANGELOG.md | 6 +++++- Gemfile | 2 +- Gemfile.lock | 2 +- buildpack.toml | 8 ++++---- changelogs/v208/default_ruby_2_6_5.md | 3 +++ lib/language_pack/ruby_version.rb | 2 +- 6 files changed, 15 insertions(+), 8 deletions(-) create mode 100644 changelogs/v208/default_ruby_2_6_5.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d6b41ff2..cbc9a1990 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ -## v207 (unreleased) +## Master (unreleased) + +* Update default Ruby version to 2.6.5 (https://github.com/heroku/heroku-buildpack-ruby/pull/947) + +## v207 (12/16/2019) * Vendor in libpq 5.12.1 for Heroku-18 (https://github.com/heroku/heroku-buildpack-ruby/pull/936) * Remove possibilities of false exceptions being raised by removing `BUNDLED WITH` from the `Gemfile.lock` (https://github.com/heroku/heroku-buildpack-ruby/pull/928) diff --git a/Gemfile b/Gemfile index 5dbdd17f0..161c219e6 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ source "https://rubygems.org" git_source(:github) { |repo| "https://github.com/#{repo}.git" } -ruby '2.5.7' +ruby '2.6.5' group :development, :test do gem "toml-rb" diff --git a/Gemfile.lock b/Gemfile.lock index 703c4588a..db02451a0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -97,7 +97,7 @@ DEPENDENCIES toml-rb RUBY VERSION - ruby 2.5.7p206 + ruby 2.6.5p114 BUNDLED WITH 2.0.2 diff --git a/buildpack.toml b/buildpack.toml index 055db5585..0b190ce60 100644 --- a/buildpack.toml +++ b/buildpack.toml @@ -1,6 +1,6 @@ [buildpack] name = "Ruby" -ruby_version = "2.5.7" +ruby_version = "2.6.5" [publish.Ignore] files = [ @@ -13,11 +13,11 @@ ruby_version = "2.5.7" dir = "." files = ["./.env"] [[publish.Vendor]] - url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/cedar-14/ruby-2.5.7.tgz" + url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/cedar-14/ruby-2.6.5.tgz" dir = "vendor/ruby/cedar-14" [[publish.Vendor]] - url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-16/ruby-2.5.7.tgz" + url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-16/ruby-2.6.5.tgz" dir = "vendor/ruby/heroku-16" [[publish.Vendor]] - url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-18/ruby-2.5.7.tgz" + url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-18/ruby-2.6.5.tgz" dir = "vendor/ruby/heroku-18" diff --git a/changelogs/v208/default_ruby_2_6_5.md b/changelogs/v208/default_ruby_2_6_5.md new file mode 100644 index 000000000..c68c573d3 --- /dev/null +++ b/changelogs/v208/default_ruby_2_6_5.md @@ -0,0 +1,3 @@ +## Default Ruby version for new apps is now 2.6.5 + +The [default Ruby version for new Ruby applications is 2.6.5](https://devcenter.heroku.com/articles/ruby-support#default-ruby-version-for-new-apps). You’ll only get the default if the application does not specify a ruby version. diff --git a/lib/language_pack/ruby_version.rb b/lib/language_pack/ruby_version.rb index 575b3470d..e55e6269e 100644 --- a/lib/language_pack/ruby_version.rb +++ b/lib/language_pack/ruby_version.rb @@ -12,7 +12,7 @@ def initialize(output = "") end end - DEFAULT_VERSION_NUMBER = "2.5.7" + DEFAULT_VERSION_NUMBER = "2.6.5" DEFAULT_VERSION = "ruby-#{DEFAULT_VERSION_NUMBER}" LEGACY_VERSION_NUMBER = "1.9.2" LEGACY_VERSION = "ruby-#{LEGACY_VERSION_NUMBER}" From 4b3bfc6fe1659e9e7b0a00f29d3f0341a73ff029 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 22 Jan 2020 13:50:29 -0600 Subject: [PATCH 0666/1195] Remove BUNDLED WITH earlier Because Ruby 2.6.5 ships with Bundler 2 it also includes a check for bundler version and will error if the version does not match. This commit bumps up the logic of when the BUNDLED WITH lines in the Gemfile.lock get removed so they allow the Buildpack to execute correctly. --- lib/language_pack/helpers/bundler_wrapper.rb | 12 ++++++++++++ lib/language_pack/ruby.rb | 6 ------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index eca6501d1..7a4e46b37 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -165,6 +165,10 @@ def lockfile_parser def fetch_bundler instrument 'fetch_bundler' do return true if Dir.exists?(bundler_path) + + topic("Installing bundler #{@version}") + bundler_version_escape_valve! + FileUtils.mkdir_p(bundler_path) Dir.chdir(bundler_path) do @fetcher.fetch_untar(@bundler_tar) @@ -202,4 +206,12 @@ def detect_bundler_version_and_dir_name! raise UnsupportedBundlerVersion.new(BLESSED_BUNDLER_VERSIONS, major) end end + + def bundler_version_escape_valve! + topic("Removing BUNDLED WITH version in the Gemfile.lock") + contents = File.read("Gemfile.lock") + File.open("Gemfile.lock", "w") do |f| + f.write contents.sub(/^BUNDLED WITH$(\r?\n) (?\d+)\.\d+\.\d+/m, '') + end + end end diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 513f29bab..146bca97a 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -783,12 +783,6 @@ def write_bundler_shim(path) # runs bundler to install the dependencies def build_bundler(default_bundle_without) instrument 'ruby.build_bundler' do - topic("Removing BUNDLED WITH version in the Gemfile.lock") - contents = File.read("Gemfile.lock") - File.open("Gemfile.lock", "w") do |f| - f.write contents.sub(/^BUNDLED WITH$(\r?\n) (?\d+)\.\d+\.\d+/m, '') - end - log("bundle") do bundle_without = env("BUNDLE_WITHOUT") || default_bundle_without bundle_bin = "bundle" From 51d470345a88396b9b27325e2356d4071ad130c7 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 22 Jan 2020 12:56:58 -0600 Subject: [PATCH 0667/1195] Update tests - Skip the naether test which is failing for unknown reasons that need further investigation - Change the description so that only tests that use `cedar-14` have it in the description --- spec/hatchet/rubies_spec.rb | 38 +++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/spec/hatchet/rubies_spec.rb b/spec/hatchet/rubies_spec.rb index 84c6e51b0..2824edcac 100644 --- a/spec/hatchet/rubies_spec.rb +++ b/spec/hatchet/rubies_spec.rb @@ -43,7 +43,18 @@ end end - it "should deploy jdk 8 on cedar-14 by default" do + it "should deploy jruby 1.7.16.1 (jdk 7) properly on cedar-14 with sys props file" do + app = Hatchet::Runner.new("ruby_193_jruby_17161_jdk7", stack: "cedar-14") + app.setup! + app.deploy do |app| + expect(app.output).to match("Installing JVM: openjdk-7") + expect(app.output).not_to include("OpenJDK 64-Bit Server VM warning") + end + end +end + +describe "Ruby versions" do + it "should deploy jdk 8 on heroku-18 by default" do app = Hatchet::Runner.new("ruby_193_jruby_1_7_27", stack: "heroku-18") app.setup! app.deploy do |app| @@ -60,23 +71,14 @@ end end - it "should deploy jruby 1.7.16.1 (jdk 7) properly on cedar-14 with sys props file" do - app = Hatchet::Runner.new("ruby_193_jruby_17161_jdk7", stack: "cedar-14") - app.setup! - app.deploy do |app| - expect(app.output).to match("Installing JVM: openjdk-7") - expect(app.output).not_to include("OpenJDK 64-Bit Server VM warning") - end - end - - it "should deploy jruby with the naether gem" do - app = Hatchet::Runner.new("jruby_naether", stack: DEFAULT_STACK) - app.setup! - app.deploy do |app| - expect(app.output).to match("Installing naether") - expect(app.output).not_to include("An error occurred while installing naether") - end - end + # it "should deploy jruby with the naether gem" do + # app = Hatchet::Runner.new("jruby_naether", stack: DEFAULT_STACK) + # app.setup! + # app.deploy do |app| + # expect(app.output).to match("Installing naether") + # expect(app.output).not_to include("An error occurred while installing naether") + # end + # end end From f8bdb021cb3017fbb58ef262a36835223e07db82 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 22 Jan 2020 15:21:46 -0600 Subject: [PATCH 0668/1195] [changelog skip] Update naether test. # Conflicts: # spec/hatchet/rubies_spec.rb --- hatchet.lock | 2 +- spec/hatchet/rubies_spec.rb | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/hatchet.lock b/hatchet.lock index 6315a9577..dfa9041e1 100644 --- a/hatchet.lock +++ b/hatchet.lock @@ -30,7 +30,7 @@ - - "./repos/heroku/ruby-getting-started" - 7abd8af85c7ba6486bb03a4964da9cea98766b06 - - "./repos/jruby/jruby_naether" - - c5081c07de64dcd4b480923e4b7e2a98a9b4a431 + - 4a11f8af5a3cca21f3659394e5bbac3cca9b6a2c - - "./repos/multibuildpack/node_multi" - c8f822a0cdd3b7ed92f19bd1112bd9e301bc4a5e - - "./repos/node/webpacker_no_execjs" diff --git a/spec/hatchet/rubies_spec.rb b/spec/hatchet/rubies_spec.rb index 2824edcac..6a29daa27 100644 --- a/spec/hatchet/rubies_spec.rb +++ b/spec/hatchet/rubies_spec.rb @@ -71,14 +71,14 @@ end end - # it "should deploy jruby with the naether gem" do - # app = Hatchet::Runner.new("jruby_naether", stack: DEFAULT_STACK) - # app.setup! - # app.deploy do |app| - # expect(app.output).to match("Installing naether") - # expect(app.output).not_to include("An error occurred while installing naether") - # end - # end + it "should deploy jruby with the naether gem" do + app = Hatchet::Runner.new("jruby_naether", stack: DEFAULT_STACK) + app.setup! + app.deploy do |app| + expect(app.output).to match("Installing naether") + expect(app.output).not_to include("An error occurred while installing naether") + end + end end From cbb30f47ea523f1930f96551f5c027622e64e1cd Mon Sep 17 00:00:00 2001 From: schneems Date: Fri, 31 Jan 2020 13:21:02 -0600 Subject: [PATCH 0669/1195] [changelog skip] Bump hatchet version --- Gemfile.lock | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 703c4588a..1ade106c3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -16,24 +16,24 @@ GIT GEM remote: https://rubygems.org/ specs: - activesupport (6.0.0) + activesupport (6.0.2.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) - zeitwerk (~> 2.1, >= 2.1.8) + zeitwerk (~> 2.2) ansi (1.5.0) citrus (3.0.2) concurrent-ruby (1.1.5) diff-lcs (1.3) erubis (2.7.0) - excon (0.66.0) + excon (0.72.0) heroics (0.0.25) erubis (~> 2.0) excon moneta multi_json (>= 1.9.2) - heroku_hatchet (4.0.13) + heroku_hatchet (4.1.0) excon (~> 0) minitest-retry (~> 0.1.9) platform-api (~> 2) @@ -41,14 +41,14 @@ GEM rrrretry (~> 1) thor (~> 0) threaded (~> 0) - i18n (1.6.0) + i18n (1.8.2) concurrent-ruby (~> 1.0) json (2.0.4) - minitest (5.11.3) + minitest (5.14.0) minitest-retry (0.1.9) minitest (>= 5.0) moneta (1.0.0) - multi_json (1.13.1) + multi_json (1.14.1) netrc (0.11.0) parallel (1.17.0) parallel_tests (2.29.1) @@ -74,9 +74,9 @@ GEM threaded (0.0.4) toml-rb (1.1.2) citrus (~> 3.0, > 3.0) - tzinfo (1.2.5) + tzinfo (1.2.6) thread_safe (~> 0.1) - zeitwerk (2.1.10) + zeitwerk (2.2.2) PLATFORMS ruby From ab9df319ad03905963fe1e48a683adc71dde213a Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 5 Feb 2020 15:23:29 -0600 Subject: [PATCH 0670/1195] Fix tests That app fails with Postgres 12 errors with the message: ``` /time_zone.rb:270: warning: circular argument reference - now -- initialize_schema_migrations_table() rake aborted! ActiveRecord::StatementInvalid: PG::InvalidParameterValue: ERROR: invalid value for parameter "client_min_messages": "panic" HINT: Available values: debug5, debug4, debug3, debug2, debug1, log, notice, warning, error. : SET client_min_messages TO 'panic' /app/vendor/bundle/ruby/2.6.0/gems/activerecord-3.1.12/lib/active_record/connection_adapters/postgresql_adapter.rb:605:in `async_exec' /app/vendor/bundle/ruby/2.6.0/gems/activerecord-3.1.12/lib/active_record/connection_adapters/postgresql_adapter.rb:605:in `block in execute' /app/vendor/bundle/ruby/2.6.0/gems/activerecord-3.1.12/lib/active_record/connection_adapters/abstract_adapter.rb:245:in `block in log' /app/vendor/bundle/ruby/2.6.0/gems/activesupport-3.1.12/lib/active_support/notifications/instrumenter.rb:21:in `instrument' ``` This commit locks it to a specific Postgres version (Postgres 11) --- hatchet.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hatchet.lock b/hatchet.lock index dfa9041e1..4b0457ea0 100644 --- a/hatchet.lock +++ b/hatchet.lock @@ -22,7 +22,7 @@ - - "./repos/ci/rails5_sql_schema_format" - df48237c57f89bb3629937ae6b1d6af070100ed3 - - "./repos/ci/rails_31_ruby_schema_format" - - 4dfec62253a2a09e004e396a8849c3bf11c3f68a + - 76dacc65e0483c7c0b659504d8d56e6cfaee4bf1 - - "./repos/ci/rails_31_sql_schema_format" - 540ec776eff3111ad9bb01af204c62725c94a11d - - "./repos/ci/ruby_no_rails_test" From b2d3f760015ba33778c05853004d26c76dcb6835 Mon Sep 17 00:00:00 2001 From: schneems Date: Fri, 21 Feb 2020 15:45:40 -0600 Subject: [PATCH 0671/1195] Ruby version installation errors and warnings Currently when a customer tries to upgrade their stack and are using an old version of Ruby they get a very unhelpful error: ``` Command: 'set -o pipefail; curl -L --fail --retry 5 --retry-delay 1 --connect-timeout 3 --max-time 30 https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-18/ruby-1.9.3.tgz -s -o - | tar zxf - ' failed on attempt 1 of 3. Command: 'set -o pipefail; curl -L --fail --retry 5 --retry-delay 1 --connect-timeout 3 --max-time 30 https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-18/ruby-1.9.3.tgz -s -o - | tar zxf - ' failed on attempt 2 of 3. ! ! An error occurred while installing ruby-1.9.3 ! ! Heroku recommends you use the latest supported Ruby version listed here: ! https://devcenter.heroku.com/articles/ruby-support#supported-runtimes ! ! For more information on syntax for declaring a Ruby version see: ! https://devcenter.heroku.com/articles/ruby-versions ! ! ! Debug InformationCommand: 'set -o pipefail; curl -L --fail --retry 5 --retry-delay 1 --connect-timeout 3 --max-time 30 https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-18/ruby-1.9.3.tgz -s -o - | tar zxf - ' failed unexpectedly: ! ! gzip: stdin: unexpected end of file ! tar: Child returned status 1 ! tar: Error is not recoverable: exiting now ! ! Push rejected, failed to compile Ruby app. ! Push failed ``` This is awful and gives no context. The goal of this PR is to do a few things: - If a Ruby version does not exist on any stack, explicitly state the problem - If a Ruby version exists, but not on your current stack, list the stacks it is present on - If a Ruby version exists, but not for the next stack (i.e. heroku-16 if you're deploying to cedar-14) then the customer should get a warning --- CHANGELOG.md | 1 + lib/language_pack.rb | 1 + .../helpers/download_presence.rb | 67 +++++++++++++ .../installers/heroku_ruby_installer.rb | 3 +- lib/language_pack/ruby.rb | 94 ++++++++++--------- lib/language_pack/ruby_version.rb | 6 ++ spec/helpers/download_presence_spec.rb | 66 +++++++++++++ 7 files changed, 192 insertions(+), 46 deletions(-) create mode 100644 lib/language_pack/helpers/download_presence.rb create mode 100644 spec/helpers/download_presence_spec.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index cbc9a1990..c07ca6441 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## Master (unreleased) +* Improve Ruby version download error messages (https://github.com/heroku/heroku-buildpack-ruby/pull/953) * Update default Ruby version to 2.6.5 (https://github.com/heroku/heroku-buildpack-ruby/pull/947) ## v207 (12/16/2019) diff --git a/lib/language_pack.rb b/lib/language_pack.rb index 8fc5663fa..23f41bbd7 100644 --- a/lib/language_pack.rb +++ b/lib/language_pack.rb @@ -35,6 +35,7 @@ def self.detect(*args) require "language_pack/helpers/rails_runner" require "language_pack/helpers/bundler_wrapper" require "language_pack/helpers/outdated_ruby_version" +require "language_pack/helpers/download_presence" require "language_pack/installers/ruby_installer" require "language_pack/installers/heroku_ruby_installer" require "language_pack/installers/rbx_installer" diff --git a/lib/language_pack/helpers/download_presence.rb b/lib/language_pack/helpers/download_presence.rb new file mode 100644 index 000000000..edd62392b --- /dev/null +++ b/lib/language_pack/helpers/download_presence.rb @@ -0,0 +1,67 @@ +# This class is used to check whether a binary exists on one or more stacks. +# The main motivation for adding this logic is to help people who are upgrading +# to a new stack if it does not have a given Ruby version. For example if someone +# is using Ruby 1.9.3 on the cedar-14 stack then they should be informed that it +# does not exist if they try to use it on the Heroku-18 stack. +# +# Example +# +# download = LanguagePack::Helpers::DownloadPresence.new( +# 'ruby-1.9.3.tgz', +# stacks: ['cedar-14', 'heroku-16', 'heroku-18'] +# ) +# +# download.call +# +# puts download.exists? #=> true +# puts download.valid_stack_list #=> ['cedar-14'] +class LanguagePack::Helpers::DownloadPresence + STACKS = ['cedar-14', 'heroku-16', 'heroku-18'] + + def initialize(path, stacks: STACKS) + @path = path + @stacks = stacks + @fetchers = [] + @threads = [] + @stacks.each do |stack| + @fetchers << LanguagePack::Fetcher.new(LanguagePack::Base::VENDOR_URL, stack) + end + end + + def next_stack(stack) + next_index = @stacks.index(stack) + 1 + + @stacks[next_index] + end + + def exists_on_next_stack?(stack) + next_index = @stacks.index(stack) + 1 + @threads[next_index] + end + + def valid_stack_list + raise "not invoked yet, use the `call` method first" if @threads.empty? + + @threads.map.with_index do |thread, i| + @stacks[i] if thread.value + end.compact + end + + def exists? + raise "not invoked yet, use the `call` method first" if @threads.empty? + + @threads.any? {|t| t.value } + end + + def does_not_exist? + !exists? + end + + def call + @fetchers.map do |fetcher| + @threads << Thread.new do + fetcher.exists?(@path) + end + end + end +end diff --git a/lib/language_pack/installers/heroku_ruby_installer.rb b/lib/language_pack/installers/heroku_ruby_installer.rb index c752be37e..e306c812b 100644 --- a/lib/language_pack/installers/heroku_ruby_installer.rb +++ b/lib/language_pack/installers/heroku_ruby_installer.rb @@ -16,8 +16,7 @@ def fetch_unpack(ruby_version, install_dir, build = false) Dir.chdir(install_dir) do file = "#{ruby_version.version_for_download}.tgz" if build - ruby_vm = "ruby" - file.sub!(ruby_vm, "#{ruby_vm}-build") + file.sub!("ruby", "ruby-build") end @fetcher.fetch_untar(file) end diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 146bca97a..2b66e5fb4 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -442,10 +442,31 @@ def warn_outdated_ruby warn_outdated_minor warn_outdated_eol + warn_stack_upgrade true end end + def warn_stack_upgrade + return unless defined?(@ruby_download_check) + return unless @ruby_download_check.next_stack(stack) + return unless @ruby_download_check.exists_on_next_stack?(stack) + + warn(<<~WARNING) + Your Ruby version is not present on the next stack + + You are currently using #{ruby_version.version_for_download} on #{stack} stack. + This version does not exist on #{@ruby_download_check.next_stack(stack)}. In order to upgrade your stack you will + need to upgrade to a supported Ruby version. + + For a list of supported Ruby versions see: + https://devcenter.heroku.com/articles/ruby-support#supported-runtimes + + For a list of the oldest Ruby versions present on a given stack see: + https://devcenter.heroku.com/articles/ruby-support#oldest-available-runtimes + WARNING + end + def warn_outdated_eol return unless @outdated_version_check.maybe_eol? @@ -513,9 +534,13 @@ def install_ruby return false unless ruby_version installer = LanguagePack::Installers::RubyInstaller.installer(ruby_version).new(@stack) + @ruby_download_check = LanguagePack::Helpers::DownloadPresence.new(ruby_version.file_name) + @ruby_download_check.call + if ruby_version.build? installer.fetch_unpack(ruby_version, build_ruby_path, true) end + installer.install(ruby_version, slug_vendor_ruby) @outdated_version_check = LanguagePack::Helpers::OutdatedRubyVersion.new( @@ -538,61 +563,42 @@ def install_ruby end true - rescue LanguagePack::Fetcher::FetchError => error - if stack == "heroku-18" && ruby_version.version_for_download.match?(/ruby-2\.(2|3)/) - message = < Date: Mon, 2 Mar 2020 11:29:25 -0600 Subject: [PATCH 0672/1195] Adding test for scenario where a Ruby version does not exist --- hatchet.json | 1 + hatchet.lock | 2 ++ spec/hatchet/ruby_spec.rb | 9 +++++++++ 3 files changed, 12 insertions(+) diff --git a/hatchet.json b/hatchet.json index 19a5ad70a..4793bb11d 100644 --- a/hatchet.json +++ b/hatchet.json @@ -18,6 +18,7 @@ "sharpstone/bundle-ruby-version-not-in-lockfile" ], "ruby": [ + "sharpstone/ruby_version_does_not_exist", "sharpstone/cd_ruby", "sharpstone/mri_187", "sharpstone/mri_193_p547", diff --git a/hatchet.lock b/hatchet.lock index 4b0457ea0..b8130049a 100644 --- a/hatchet.lock +++ b/hatchet.lock @@ -129,3 +129,5 @@ - 06d5e86180ff0e5b6894f823736cd649dcfebed4 - - "./repos/ruby/ruby_25" - 0cb3df80d55b61e9417f2ac00adb06e15ae37982 +- - "./repos/ruby/ruby_version_does_not_exist" + - 9b6ad8e3b4fa7850393a5f232bb40ff3cd414d8b diff --git a/spec/hatchet/ruby_spec.rb b/spec/hatchet/ruby_spec.rb index 053785e5a..e89c7f9d1 100644 --- a/spec/hatchet/ruby_spec.rb +++ b/spec/hatchet/ruby_spec.rb @@ -19,6 +19,15 @@ end end + + describe "bad ruby version" do + it "gives a helpful error" do + Hatchet::Runner.new('ruby_version_does_not_exist', allow_failure: true, stack: DEFAULT_STACK).deploy do |app| + expect(app.output).to match("The Ruby version you are trying to install does not exist: ruby-2.9.0.lol") + end + end + end + describe "running Ruby from outside the default dir" do it "works" do Hatchet::Runner.new('cd_ruby', stack: DEFAULT_STACK).deploy do |app| From 671c3a67027b40137d49b1c3b8f83377b6f99550 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Thu, 10 Jan 2019 16:26:15 -0600 Subject: [PATCH 0673/1195] first pass at a CNB buildpack, but no layer/caching --- bin/build | 17 ++++++++++++ bin/detect | 14 +++++++++- bin/support/ruby_build | 33 +++++++++++++++++++++++ buildpack.toml | 5 ++++ lib/language_pack/base.rb | 53 ++++++++++++++++++++++++++++++++----- lib/language_pack/cache.rb | 22 ++++++++++++++- lib/language_pack/rails2.rb | 2 +- lib/language_pack/ruby.rb | 5 ++-- 8 files changed, 140 insertions(+), 11 deletions(-) create mode 100755 bin/build create mode 100755 bin/support/ruby_build diff --git a/bin/build b/bin/build new file mode 100755 index 000000000..1249f840d --- /dev/null +++ b/bin/build @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +LAYERS_DIR=$1 +PLATFORM_DIR=$2 +ENV_DIR="$PLATFORM_DIR/env" +PLAN=$3 +APP_DIR=$(pwd) +BIN_DIR=$(cd $(dirname $0); pwd) +BUILDPACK_DIR=$(dirname $BIN_DIR) + +# legacy buildpack uses $STACK +STACK=$PACK_STACK_ID + +source "$BIN_DIR/support/bash_functions.sh" +heroku_buildpack_ruby_install_ruby "$BIN_DIR" "$BUILDPACK_DIR" + +$heroku_buildpack_ruby_dir/bin/ruby $BIN_DIR/support/ruby_build $APP_DIR $LAYERS_DIR $PLATFORM_DIR $PLAN diff --git a/bin/detect b/bin/detect index 66237255d..c11c4fc80 100755 --- a/bin/detect +++ b/bin/detect @@ -1,6 +1,18 @@ #!/bin/sh -if [ -f "$1/Gemfile" ]; then + +if [ -z "$PACK_STACK_ID" ]; then + # v2 API + APP_DIR=$1 +else + PLATFORM_DIR=$1 + PLAN=$2 + # working is the cwd now + # v3 API + APP_DIR=$(pwd) +fi + +if [ -f "$APP_DIR/Gemfile" ]; then echo "Ruby" exit 0 else diff --git a/bin/support/ruby_build b/bin/support/ruby_build new file mode 100755 index 000000000..f86aefc87 --- /dev/null +++ b/bin/support/ruby_build @@ -0,0 +1,33 @@ +#!/usr/bin/env ruby + +# This script compiles an application so it can run on Heroku. +# It will install the application's specified version of Ruby, it's dependencies +# and certain framework specific requirements (such as calling `rake assets:precompile` +# for rails apps). You can see all features described in the devcenter +# https://devcenter.heroku.com/articles/ruby-support +$stdout.sync = true + +$:.unshift File.expand_path("../../../lib", __FILE__) +require "language_pack" +require "language_pack/shell_helpers" + +APP_DIR=ARGV[0] +LAYER_DIR=ARGV[1] +PLATFORM_DIR=ARGV[2] +ENV_DIR="#{PLATFORM_DIR}/env" +PLAN=ARGV[3] + +begin + LanguagePack::Instrument.trace 'compile', 'app.compile' do + LanguagePack::ShellHelpers.initialize_env(ENV_DIR) + if pack = LanguagePack.detect(ARGV[0], nil, LAYER_DIR) + pack.topic("Compiling #{pack.name}") + pack.log("compile") do + pack.build + end + end + end +rescue Exception => e + LanguagePack::ShellHelpers.display_error_and_exit(e) +end + diff --git a/buildpack.toml b/buildpack.toml index 0b190ce60..bccbdfd2e 100644 --- a/buildpack.toml +++ b/buildpack.toml @@ -1,4 +1,6 @@ [buildpack] +id = "heroku/ruby" +version = "0.0.1" name = "Ruby" ruby_version = "2.6.5" @@ -21,3 +23,6 @@ ruby_version = "2.6.5" [[publish.Vendor]] url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-18/ruby-2.6.5.tgz" dir = "vendor/ruby/heroku-18" + +[[stacks]] +id = "heroku-18" diff --git a/lib/language_pack/base.rb b/lib/language_pack/base.rb index 9f3921d07..f251713cf 100644 --- a/lib/language_pack/base.rb +++ b/lib/language_pack/base.rb @@ -26,15 +26,16 @@ class LanguagePack::Base # changes directory to the build_path # @param [String] the path of the build dir # @param [String] the path of the cache dir this is nil during detect and release - def initialize(build_path, cache_path=nil) + def initialize(build_path, cache_path = nil, layer_dir=nil) self.class.instrument "base.initialize" do @build_path = build_path @stack = ENV.fetch("STACK") - @cache = LanguagePack::Cache.new(cache_path) if cache_path + @cache = LanguagePack::Cache.new(cache_path) @metadata = LanguagePack::Metadata.new(@cache) @bundler_cache = LanguagePack::BundlerCache.new(@cache, @stack) @id = Digest::SHA1.hexdigest("#{Time.now.to_f}-#{rand(1000000)}")[0..10] @fetchers = {:buildpack => LanguagePack::Fetcher.new(VENDOR_URL) } + @layer_dir = layer_dir Dir.chdir build_path end @@ -79,7 +80,7 @@ def default_process_types # this is called to build the slug def compile - write_release_yaml + write_release instrument 'base.compile' do Kernel.puts "" warnings.each do |warning| @@ -98,11 +99,44 @@ def compile mcount "success" end - def write_release_yaml + def build_release release = {} release["addons"] = default_addons release["config_vars"] = default_config_vars release["default_process_types"] = default_process_types + + release + end + + def write_release_toml + release = build_release + + FileUtils.mkdir_p("#{@layer_dir}/ruby/env.launch") + release["config_vars"].each do |key, value| + File.open("#{@layer_dir}/ruby/env.launch/#{key.upcase}", 'a') do |f| + f.write(value) + end + end + File.open("#{@layer_dir}/ruby.toml", 'w') do |f| + f.write(< Date: Thu, 31 Jan 2019 17:43:40 -0600 Subject: [PATCH 0674/1195] add support for layers --- lib/language_pack/base.rb | 87 ++++++++++++-- lib/language_pack/helpers/layer.rb | 60 ++++++++++ .../installers/ruby_installer.rb | 7 +- lib/language_pack/rails2.rb | 8 +- lib/language_pack/rails41.rb | 4 +- lib/language_pack/rails42.rb | 4 +- lib/language_pack/rails5.rb | 4 +- lib/language_pack/ruby.rb | 108 +++++++++++++----- vendor/toml.rb | 49 ++++++++ 9 files changed, 281 insertions(+), 50 deletions(-) create mode 100644 lib/language_pack/helpers/layer.rb create mode 100644 vendor/toml.rb diff --git a/lib/language_pack/base.rb b/lib/language_pack/base.rb index f251713cf..8344197ad 100644 --- a/lib/language_pack/base.rb +++ b/lib/language_pack/base.rb @@ -5,6 +5,7 @@ require "language_pack/shell_helpers" require "language_pack/cache" require "language_pack/helpers/bundler_cache" +require "language_pack/helpers/layer" require "language_pack/metadata" require "language_pack/fetcher" require "language_pack/instrument" @@ -80,7 +81,26 @@ def default_process_types # this is called to build the slug def compile - write_release + write_release_yaml + instrument 'base.compile' do + Kernel.puts "" + warnings.each do |warning| + Kernel.puts "\e[1m\e[33m###### WARNING:\e[0m"# Bold yellow + Kernel.puts "" + puts warning + Kernel.puts "" + end + if deprecations.any? + topic "DEPRECATIONS:" + puts @deprecations.join("\n") + end + Kernel.puts "" + end + mcount "success" + end + + def build + write_release_toml instrument 'base.compile' do Kernel.puts "" warnings.each do |warning| @@ -111,17 +131,13 @@ def build_release def write_release_toml release = build_release - FileUtils.mkdir_p("#{@layer_dir}/ruby/env.launch") + layer = LanguagePack::Helpers::Layer.new(@layer_dir, "env", launch: true) + FileUtils.mkdir_p("#{layer.path}/env.launch") release["config_vars"].each do |key, value| - File.open("#{@layer_dir}/ruby/env.launch/#{key.upcase}", 'a') do |f| + File.open("#{layer.path}/env.launch/#{key.upcase}", 'w') do |f| f.write(value) end end - File.open("#{@layer_dir}/ruby.toml", 'w') do |f| - f.write(< Date: Wed, 27 Mar 2019 18:00:44 -0500 Subject: [PATCH 0675/1195] bundler caching works --- lib/language_pack/helpers/layer.rb | 46 ++++++------- lib/language_pack/metadata.rb | 13 +++- lib/language_pack/ruby.rb | 98 +++++++++++++++++++++++--- vendor/toml.rb | 107 ++++++++++++++++++++++++++++- 4 files changed, 227 insertions(+), 37 deletions(-) diff --git a/lib/language_pack/helpers/layer.rb b/lib/language_pack/helpers/layer.rb index 635c59a07..38eedfa9b 100644 --- a/lib/language_pack/helpers/layer.rb +++ b/lib/language_pack/helpers/layer.rb @@ -7,28 +7,23 @@ class LanguagePack::Helpers::Layer def initialize(layer_dir, name, launch: false, build: false, cache: false) @layer_dir = layer_dir @name = name - @path = "#{@layer_dir}/#{@name}" + @path = Pathname.new "#{@layer_dir}/#{@name}" @toml = if File.exist?(toml_file) TOML.load(File.read(toml_file)) else Hash.new end - @toml[:launch] = launch.to_s - @toml[:build] = build.to_s - @toml[:cache] = cache.to_s - @toml[:metadata] = Hash.new + @toml[:launch] = launch + @toml[:build] = build + @toml[:cache] = cache + if File.exist?(toml_file) + @toml[:metadata] = TOML.load(File.read(toml_file))[:metadata] + end + @toml[:metadata] ||= Hash.new - puts "Creating Layer: #{@path}" FileUtils.mkdir_p(@path) - puts "Writing: #{toml_file}" - File.open(toml_file, "w") do |file| - file.write < Date: Thu, 28 Mar 2019 17:39:43 -0500 Subject: [PATCH 0676/1195] fix binstub PATHing to support non rails apps --- lib/language_pack/rack.rb | 4 ++-- lib/language_pack/rails2.rb | 6 ++++++ lib/language_pack/ruby.rb | 36 ++++++++++++++++++------------------ 3 files changed, 26 insertions(+), 20 deletions(-) diff --git a/lib/language_pack/rack.rb b/lib/language_pack/rack.rb index 00b5e8669..048101685 100644 --- a/lib/language_pack/rack.rb +++ b/lib/language_pack/rack.rb @@ -40,8 +40,8 @@ def default_process_types private # sets up the profile.d script for this buildpack - def setup_profiled - super + def setup_profiled(*args) + super(*args) set_env_default "RACK_ENV", "production" end diff --git a/lib/language_pack/rails2.rb b/lib/language_pack/rails2.rb index a12141b17..a7fe9d7db 100644 --- a/lib/language_pack/rails2.rb +++ b/lib/language_pack/rails2.rb @@ -63,6 +63,12 @@ def compile end end + def build + # TODO install plugins into separate layer + #install_plugins + super + end + def best_practice_warnings if env("RAILS_ENV") != "production" warn(<<-WARNING) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 2e37e67a4..1ac30aaef 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -183,7 +183,7 @@ def build ruby_layer.write gem_layer = Layer.new(@layer_dir, "gems", launch: true, cache: true) - setup_language_pack_environment(ruby_layer, gem_layer) + setup_language_pack_environment(ruby_layer.path, gem_layer.path) setup_export(gem_layer) setup_profiled(ruby_layer, gem_layer) allow_git do @@ -256,11 +256,11 @@ def warn_bundler_upgrade # the base PATH environment variable to be used # @return [String] the resulting PATH - def default_path + def default_path(gem_layer_path = nil) # need to remove bin/ folder since it links # to the wrong --prefix ruby binstubs # breaking require. This only applies to Ruby 1.9.2 and 1.8.7. - safe_binstubs = binstubs_relative_paths - ["bin"] + safe_binstubs = binstubs_relative_paths(gem_layer_path) - ["bin"] paths = [ ENV["PATH"], "bin", @@ -272,11 +272,11 @@ def default_path paths.join(":") end - def binstubs_relative_paths + def binstubs_relative_paths(gem_layer_path = ".") [ "bin", - bundler_binstubs_path, - "#{slug_vendor_base}/bin" + "#{gem_layer_path}/#{bundler_binstubs_path}", + "#{gem_layer_path}/#{slug_vendor_base}/bin" ] end @@ -406,7 +406,7 @@ def default_java_mem end # sets up the environment variables for the build process - def setup_language_pack_environment(ruby_layer = nil, gem_layer = nil) + def setup_language_pack_environment(ruby_layer_path = nil, gem_layer_path = nil) instrument 'ruby.setup_language_pack_environment' do if ruby_version.jruby? ENV["PATH"] += ":bin" @@ -417,7 +417,7 @@ def setup_language_pack_environment(ruby_layer = nil, gem_layer = nil) ENV["JRUBY_OPTS"] = env('JRUBY_BUILD_OPTS') || env('JRUBY_OPTS') ENV["JAVA_HOME"] = @jvm_installer.java_home end - setup_ruby_install_env(ruby_layer) + setup_ruby_install_env(ruby_layer_path) ENV["PATH"] += ":#{node_preinstall_bin_path}" if node_js_installed? ENV["PATH"] += ":#{yarn_preinstall_bin_path}" if !yarn_not_preinstalled? @@ -435,10 +435,10 @@ def setup_language_pack_environment(ruby_layer = nil, gem_layer = nil) ENV[key] ||= value end - gem_path = gem_layer ? "#{gem_layer.path}/#{slug_vendor_base}" : slug_vendor_base + gem_path = gem_layer_path ? "#{gem_layer_path}/#{slug_vendor_base}" : slug_vendor_base ENV["GEM_PATH"] = gem_path ENV["GEM_HOME"] = gem_path - ENV["PATH"] = default_path + ENV["PATH"] = default_path(gem_layer_path) end end @@ -469,14 +469,14 @@ def setup_export(layer = nil) end # sets up the profile.d script for this buildpack - def setup_profiled(ruby_layer = nil, gem_layer = nil) + def setup_profiled(ruby_layer_path = nil, gem_layer_path = nil) instrument 'setup_profiled' do profiled_path_prefix = @layer_dir ? @build_path : "$HOME" - profiled_path = [binstubs_relative_paths.map {|path| "#{profiled_path_prefix}/#{path}" }.join(":")] + profiled_path = [binstubs_relative_paths(gem_layer_path).map {|path| "#{profiled_path_prefix}/#{path}" }.join(":")] profiled_path << "vendor/#{@yarn_installer.binary_path}" if has_yarn_binary? profiled_path << "$PATH" - gem_path_prefix = gem_layer ? gem_layer.path : "$HOME" + gem_path_prefix = gem_layer_path ? gem_layer_path : "$HOME" set_env_default "LANG", "en_US.UTF-8" set_env_override "GEM_PATH", "#{gem_path_prefix}/#{slug_vendor_base}:$GEM_PATH" @@ -680,10 +680,10 @@ def install_jvm(forced = false) # find the ruby install path for its binstubs during build # @return [String] resulting path or empty string if ruby is not vendored - def ruby_install_binstub_path(ruby_layer = nil) + def ruby_install_binstub_path(ruby_layer_path = nil) @ruby_install_binstub_path ||= - if ruby_layer - "#{ruby_layer.path}/bin" + if ruby_layer_path + "#{ruby_layer_path}/bin" elsif ruby_version.build? "#{build_ruby_path}/bin" elsif ruby_version @@ -694,9 +694,9 @@ def ruby_install_binstub_path(ruby_layer = nil) end # setup the environment so we can use the vendored ruby - def setup_ruby_install_env(ruby_layer = nil) + def setup_ruby_install_env(ruby_layer_path = nil) instrument 'ruby.setup_ruby_install_env' do - ENV["PATH"] = "#{File.expand_path(ruby_install_binstub_path(ruby_layer))}:#{ENV["PATH"]}" + ENV["PATH"] = "#{File.expand_path(ruby_install_binstub_path(ruby_layer_path))}:#{ENV["PATH"]}" if ruby_version.jruby? ENV['JAVA_OPTS'] = default_java_opts From a932e36b62b4c8fb3ed5eb6d5a6214e257e2edb1 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Mon, 1 Apr 2019 11:02:47 -0500 Subject: [PATCH 0677/1195] change PACK_ env vars to CNB_ env vars --- bin/build | 2 +- bin/detect | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/bin/build b/bin/build index 1249f840d..0299f6bfa 100755 --- a/bin/build +++ b/bin/build @@ -9,7 +9,7 @@ BIN_DIR=$(cd $(dirname $0); pwd) BUILDPACK_DIR=$(dirname $BIN_DIR) # legacy buildpack uses $STACK -STACK=$PACK_STACK_ID +STACK=$CNB_STACK_ID source "$BIN_DIR/support/bash_functions.sh" heroku_buildpack_ruby_install_ruby "$BIN_DIR" "$BUILDPACK_DIR" diff --git a/bin/detect b/bin/detect index c11c4fc80..6f72d4790 100755 --- a/bin/detect +++ b/bin/detect @@ -1,7 +1,6 @@ #!/bin/sh - -if [ -z "$PACK_STACK_ID" ]; then +if [ -z "$CNB_STACK_ID" ]; then # v2 API APP_DIR=$1 else From 57ab1c1adca1d39ac35ff2ab5b0c35fd48948c83 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Mon, 1 Apr 2019 11:14:32 -0500 Subject: [PATCH 0678/1195] simplify env var configuration --- lib/language_pack/ruby.rb | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 1ac30aaef..3e407f91c 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -175,7 +175,7 @@ def build remove_vendor_bundle ruby_layer = Layer.new(@layer_dir, "ruby", launch: true) - install_ruby(ruby_layer.path) + install_ruby("#{ruby_layer.path}/#{slug_vendor_ruby}") ruby_layer.metadata[:version] = ruby_version.version ruby_layer.metadata[:patchlevel] = ruby_version.patchlevel if ruby_version.patchlevel ruby_layer.metadata[:engine] = ruby_version.engine.to_s @@ -185,7 +185,7 @@ def build gem_layer = Layer.new(@layer_dir, "gems", launch: true, cache: true) setup_language_pack_environment(ruby_layer.path, gem_layer.path) setup_export(gem_layer) - setup_profiled(ruby_layer, gem_layer) + setup_profiled(ruby_layer.path, gem_layer.path) allow_git do # TODO install bundler in separate layer topic "Loading Bundler Cache" @@ -256,7 +256,7 @@ def warn_bundler_upgrade # the base PATH environment variable to be used # @return [String] the resulting PATH - def default_path(gem_layer_path = nil) + def default_path(gem_layer_path = ".") # need to remove bin/ folder since it links # to the wrong --prefix ruby binstubs # breaking require. This only applies to Ruby 1.9.2 and 1.8.7. @@ -406,7 +406,7 @@ def default_java_mem end # sets up the environment variables for the build process - def setup_language_pack_environment(ruby_layer_path = nil, gem_layer_path = nil) + def setup_language_pack_environment(ruby_layer_path = ".", gem_layer_path = ".") instrument 'ruby.setup_language_pack_environment' do if ruby_version.jruby? ENV["PATH"] += ":bin" @@ -435,7 +435,7 @@ def setup_language_pack_environment(ruby_layer_path = nil, gem_layer_path = nil) ENV[key] ||= value end - gem_path = gem_layer_path ? "#{gem_layer_path}/#{slug_vendor_base}" : slug_vendor_base + gem_path = "#{gem_layer_path}/#{slug_vendor_base}" ENV["GEM_PATH"] = gem_path ENV["GEM_HOME"] = gem_path ENV["PATH"] = default_path(gem_layer_path) @@ -447,6 +447,8 @@ def setup_language_pack_environment(ruby_layer_path = nil, gem_layer_path = nil) def setup_export(layer = nil) instrument 'ruby.setup_export' do paths = ENV["PATH"].split(":") + paths = paths.map { |path| /^\/.*/ !~ path ? "#{build_path}/#{path}" : path }.join(":") unless layer + gem_path = if layer "#{layer.path}/#{slug_vendor_base}" @@ -456,7 +458,7 @@ def setup_export(layer = nil) set_export_path "GEM_PATH", gem_path, layer set_export_default "LANG", "en_US.UTF-8", layer # TODO ensure path exported is correct - set_export_path "PATH", paths.map { |path| /^\/.*/ !~ path ? "#{build_path}/#{path}" : path }.join(":"), layer + set_export_path "PATH", paths.join(":"), layer # TODO handle jruby if ruby_version.jruby? @@ -469,17 +471,14 @@ def setup_export(layer = nil) end # sets up the profile.d script for this buildpack - def setup_profiled(ruby_layer_path = nil, gem_layer_path = nil) + def setup_profiled(ruby_layer_path = "$HOME", gem_layer_path = "$HOME") instrument 'setup_profiled' do - profiled_path_prefix = @layer_dir ? @build_path : "$HOME" - profiled_path = [binstubs_relative_paths(gem_layer_path).map {|path| "#{profiled_path_prefix}/#{path}" }.join(":")] + profiled_path = binstubs_relative_paths(gem_layer_path) profiled_path << "vendor/#{@yarn_installer.binary_path}" if has_yarn_binary? profiled_path << "$PATH" - gem_path_prefix = gem_layer_path ? gem_layer_path : "$HOME" - set_env_default "LANG", "en_US.UTF-8" - set_env_override "GEM_PATH", "#{gem_path_prefix}/#{slug_vendor_base}:$GEM_PATH" + set_env_override "GEM_PATH", "#{gem_layer_path}/#{slug_vendor_base}:$GEM_PATH" set_env_override "PATH", profiled_path.join(":") set_env_default "MALLOC_ARENA_MAX", "2" if default_malloc_arena_max? @@ -680,21 +679,19 @@ def install_jvm(forced = false) # find the ruby install path for its binstubs during build # @return [String] resulting path or empty string if ruby is not vendored - def ruby_install_binstub_path(ruby_layer_path = nil) + def ruby_install_binstub_path(ruby_layer_path = ".") @ruby_install_binstub_path ||= - if ruby_layer_path - "#{ruby_layer_path}/bin" - elsif ruby_version.build? + if ruby_version.build? "#{build_ruby_path}/bin" elsif ruby_version - "#{slug_vendor_ruby}/bin" + "#{ruby_layer_path}/#{slug_vendor_ruby}/bin" else "" end end # setup the environment so we can use the vendored ruby - def setup_ruby_install_env(ruby_layer_path = nil) + def setup_ruby_install_env(ruby_layer_path = ".") instrument 'ruby.setup_ruby_install_env' do ENV["PATH"] = "#{File.expand_path(ruby_install_binstub_path(ruby_layer_path))}:#{ENV["PATH"]}" From a27fad2ac13003f468b8c73753974290ed0b6914 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Mon, 1 Apr 2019 16:38:46 -0500 Subject: [PATCH 0679/1195] check new_app at beginning, removing purging stack message on first build --- lib/language_pack/ruby.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 3e407f91c..8d8e657ea 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -172,6 +172,7 @@ def vendor_libpq end def build + new_app? remove_vendor_bundle ruby_layer = Layer.new(@layer_dir, "ruby", launch: true) From 8c42a8c690e613d078f7c28ff068aa773b7dc669 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Wed, 3 Apr 2019 01:14:09 -0500 Subject: [PATCH 0680/1195] need to override the launch env vars so they don't get path separated --- lib/language_pack/base.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/base.rb b/lib/language_pack/base.rb index 8344197ad..40e129009 100644 --- a/lib/language_pack/base.rb +++ b/lib/language_pack/base.rb @@ -134,7 +134,7 @@ def write_release_toml layer = LanguagePack::Helpers::Layer.new(@layer_dir, "env", launch: true) FileUtils.mkdir_p("#{layer.path}/env.launch") release["config_vars"].each do |key, value| - File.open("#{layer.path}/env.launch/#{key.upcase}", 'w') do |f| + File.open("#{layer.path}/env.launch/#{key.upcase}.override", 'w') do |f| f.write(value) end end From 66715b6d7ad762d28e1818ca6c50302d82bbe876 Mon Sep 17 00:00:00 2001 From: Joe Kutner Date: Fri, 20 Sep 2019 12:23:58 -0500 Subject: [PATCH 0681/1195] Add api version 0.2 to buildpack.toml --- buildpack.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/buildpack.toml b/buildpack.toml index bccbdfd2e..ee89b3a9c 100644 --- a/buildpack.toml +++ b/buildpack.toml @@ -1,3 +1,5 @@ +api = "0.2" + [buildpack] id = "heroku/ruby" version = "0.0.1" From a907dba5d0241845f5561387cbe44c391637157c Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 15 Oct 2019 14:02:28 -0500 Subject: [PATCH 0682/1195] README WIP --- lib/language_pack/helpers/layer.rb | 7 +++++++ lib/language_pack/ruby.rb | 1 + vendor/toml.rb | 5 +++++ 3 files changed, 13 insertions(+) diff --git a/lib/language_pack/helpers/layer.rb b/lib/language_pack/helpers/layer.rb index 38eedfa9b..3e36df101 100644 --- a/lib/language_pack/helpers/layer.rb +++ b/lib/language_pack/helpers/layer.rb @@ -4,6 +4,12 @@ class LanguagePack::Helpers::Layer attr_reader :path + # Launch: True if you want the layer to exist in the final image, for example + # if you want maven for building an app but don't want it to boot the image. + # Build: True if you want to make the results of this buildpack available to other + # buildpacks in the compilation process. + # Cache: True if you want the layer to be pulled back in on the next build. False + # means the layer dir for this component will be empty on the next time. def initialize(layer_dir, name, launch: false, build: false, cache: false) @layer_dir = layer_dir @name = name @@ -26,6 +32,7 @@ def initialize(layer_dir, name, launch: false, build: false, cache: false) write end + # Key value store per layer def metadata @toml[:metadata] end diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 8d8e657ea..596c76a84 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -592,6 +592,7 @@ def warn_outdated_minor # @return [Boolean] true if it installs the vendored ruby and false otherwise def install_ruby(install_path, build_ruby_path = nil) instrument 'ruby.install_ruby' do + # Could do a compare operation to avoid re-downloading ruby return false unless ruby_version installer = LanguagePack::Installers::RubyInstaller.installer(ruby_version).new(@stack) diff --git a/vendor/toml.rb b/vendor/toml.rb index b60ab082c..aaae10de5 100644 --- a/vendor/toml.rb +++ b/vendor/toml.rb @@ -1,6 +1,11 @@ require "ostruct" require "date" +# From charlie Somerville +# https://github.com/charliesome/toml2 +# https://github.com/hone/toml2 +# +# Cloned and patched module TOML def self.safe_load raise NotImplementedError, "whoops" From f9716b9f0332af80316943ee1162db9ccfffcab7 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 19 Dec 2019 15:16:29 -0600 Subject: [PATCH 0683/1195] Default PORT to 5000 on Rails processes This is needed because docker when running CNB does not set a $PORT by default locally. --- lib/language_pack/rack.rb | 4 ++-- lib/language_pack/rails2.rb | 4 ++-- lib/language_pack/rails3.rb | 4 ++-- lib/language_pack/rails4.rb | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/language_pack/rack.rb b/lib/language_pack/rack.rb index 048101685..3a77b58ef 100644 --- a/lib/language_pack/rack.rb +++ b/lib/language_pack/rack.rb @@ -28,8 +28,8 @@ def default_process_types instrument "rack.default_process_types" do # let's special case thin here if we detect it web_process = bundler.has_gem?("thin") ? - "bundle exec thin start -R config.ru -e $RACK_ENV -p $PORT" : - "bundle exec rackup config.ru -p $PORT" + "bundle exec thin start -R config.ru -e $RACK_ENV -p ${PORT:-5000}" : + "bundle exec rackup config.ru -p ${PORT:-5000}" super.merge({ "web" => web_process diff --git a/lib/language_pack/rails2.rb b/lib/language_pack/rails2.rb index a7fe9d7db..d7f49f4ec 100644 --- a/lib/language_pack/rails2.rb +++ b/lib/language_pack/rails2.rb @@ -45,8 +45,8 @@ def default_config_vars def default_process_types instrument "rails2.default_process_types" do web_process = bundler.has_gem?("thin") ? - "bundle exec thin start -e $RAILS_ENV -p $PORT" : - "bundle exec ruby script/server -p $PORT" + "bundle exec thin start -e $RAILS_ENV -p ${PORT:-5000}" : + "bundle exec ruby script/server -p ${PORT:-5000}" process_types = super process_types["web"] = web_process diff --git a/lib/language_pack/rails3.rb b/lib/language_pack/rails3.rb index 7200dd6ed..b40e2594c 100644 --- a/lib/language_pack/rails3.rb +++ b/lib/language_pack/rails3.rb @@ -23,8 +23,8 @@ def default_process_types instrument "rails3.default_process_types" do # let's special case thin here web_process = bundler.has_gem?("thin") ? - "bundle exec thin start -R config.ru -e $RAILS_ENV -p $PORT" : - "bundle exec rails server -p $PORT" + "bundle exec thin start -R config.ru -e $RAILS_ENV -p ${PORT:-5000}" : + "bundle exec rails server -p ${PORT:-5000}" super.merge({ "web" => web_process, diff --git a/lib/language_pack/rails4.rb b/lib/language_pack/rails4.rb index 27041f96b..d60bd3772 100644 --- a/lib/language_pack/rails4.rb +++ b/lib/language_pack/rails4.rb @@ -24,7 +24,7 @@ def name def default_process_types instrument "rails4.default_process_types" do super.merge({ - "web" => "bin/rails server -p $PORT -e $RAILS_ENV", + "web" => "bin/rails server -p ${PORT:-5000} -e $RAILS_ENV", "console" => "bin/rails console" }) end From 345913468b59f7cdf184ee4e98e9b6d2dde1d961 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 14 Jan 2020 14:42:38 -0600 Subject: [PATCH 0684/1195] First attempt at a CNB test --- hatchet.lock | 2 +- spec/cnb/basic_local_pack_spec.rb | 22 ++++++++++++++++++++++ spec/spec_helper.rb | 8 ++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 spec/cnb/basic_local_pack_spec.rb diff --git a/hatchet.lock b/hatchet.lock index b8130049a..f1ad109e2 100644 --- a/hatchet.lock +++ b/hatchet.lock @@ -28,7 +28,7 @@ - - "./repos/ci/ruby_no_rails_test" - 3916137106d59b008b67d738abe6a1438f8fbde6 - - "./repos/heroku/ruby-getting-started" - - 7abd8af85c7ba6486bb03a4964da9cea98766b06 + - 9ddca7b694875499165eb56adffd3e29b38405c5 - - "./repos/jruby/jruby_naether" - 4a11f8af5a3cca21f3659394e5bbac3cca9b6a2c - - "./repos/multibuildpack/node_multi" diff --git a/spec/cnb/basic_local_pack_spec.rb b/spec/cnb/basic_local_pack_spec.rb new file mode 100644 index 000000000..7dfd456d6 --- /dev/null +++ b/spec/cnb/basic_local_pack_spec.rb @@ -0,0 +1,22 @@ +require_relative '../spec_helper' + +describe "cnb" do + it "locally" do + run!("which pack") + + repo_path = hatchet_path("heroku/ruby-getting-started") + image_name = "heroku-buildpack-ruby-tests:#{SecureRandom.hex}" + + build_out = run!("pack build #{image_name} --path #{repo_path} --buildpack #{buildpack_path} --builder heroku/buildpacks:18") + expect(build_out).to match("Compiling Ruby/Rails") + + run_out = run!("docker run #{image_name} 'ruby -v'").chomp + expect(run_out).to match("2.4.4") + ensure + if image_name + docker_list = run("docker images | grep #{image_name}").chomp + run!("docker rmi #{image_name}") if !docker_list.empty? + end + end +end + diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 5a9741677..0019240ea 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -53,10 +53,18 @@ def create_file_with_size_in(size, dir) exit 0 if ENV['TRAVIS_PULL_REQUEST'] != 'false' && ENV['TRAVIS_BRANCH'] == 'master' end +def buildpack_path + File.expand_path(File.join("../.."), __FILE__) +end + def fixture_path(path) Pathname.new(__FILE__).join("../fixtures").expand_path.join(path) end +def hatchet_path(path = "") + Pathname.new(__FILE__).join("../../repos").expand_path.join(path) +end + def dyno_status(app, ps_name = "web") app .api_rate_limit.call From 8842d66a3b9cf671ef27f09e72723af250585749 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 22 Jan 2020 15:21:46 -0600 Subject: [PATCH 0685/1195] CNB tests on CNB first pass --- .circleci/config.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 000000000..0e856177a --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,28 @@ +version: 2.1 +orbs: + buildpacks: jkutner/buildpacks@0.0.7 + ruby: circleci/ruby@0.2.1 +jobs: + build: + machine: true + steps: + - buildpacks/install-pack: + version: "0.7.0" + - checkout + - run: + command: | + rvm install 2.5.7 + rvm use ruby-2.5.7 + export PATH="/opt/circleci/.rvm/rubies/ruby-2.5.7/bin:$PATH" + export GEM_HOME="/opt/circleci/.rvm/gems/ruby-2.5.7" + export GEM_PATH="/opt/circleci/.rvm/gems/ruby-2.5.7" + gem install bundler -v 2.1.0 + bundle install + bundle exec rake hatchet:setup_ci + rspec spec/cnb/ + +workflows: + main: + jobs: + - build + From 3df5c5c609ff2ac734196314506005f7e8194c88 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 28 Jan 2020 09:53:19 -0600 Subject: [PATCH 0686/1195] Exclude CNB tests from being run on Heroku CI Circle CI runs our CNB tests --- app.json | 2 +- lib/language_pack/base.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app.json b/app.json index af85b7140..dc00e8c1e 100644 --- a/app.json +++ b/app.json @@ -20,7 +20,7 @@ }, "scripts": { "test-setup": "bundle exec rake hatchet:setup_ci", - "test": "bundle exec rspec-queue --max-requeues=3 --timeout 180 --queue $REDIS_URL || { cat log/test_order.log; $(exit 1); }" + "test": "bundle exec rspec-queue --max-requeues=3 --timeout 180 --queue $REDIS_URL --exclude-pattern 'cnb/**/*' || { cat log/test_order.log; $(exit 1); }" }, "buildpacks": [ { "url": "https://github.com/heroku/heroku-buildpack-apt" }, diff --git a/lib/language_pack/base.rb b/lib/language_pack/base.rb index 40e129009..c5b96ef0a 100644 --- a/lib/language_pack/base.rb +++ b/lib/language_pack/base.rb @@ -230,7 +230,7 @@ def add_to_export(string) end end - def export(key, value, layer: nil, option: nil) + def export(key, val, layer: nil, option: nil) if layer # don't replace if the key is already set return if ENV[key] && option == :default @@ -246,7 +246,7 @@ def export(key, value, layer: nil, option: nil) FileUtils.mkdir_p("#{layer.path}/env.build") File.open("#{layer.path}/env.build/#{filename}", "w") do |f| - f.write(value) + f.write(val) end else string = From 8b26b5eefb074c633577c5368448847d5b12d7a7 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 28 Jan 2020 10:38:25 -0600 Subject: [PATCH 0687/1195] Fixing tests --- lib/language_pack/ruby.rb | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 596c76a84..87d9c455f 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -105,7 +105,7 @@ def compile vendor_libpq install_bundler_in_app(slug_vendor_base) load_bundler_cache - build_bundler(path: "vendor/bundle", default_bundle_without: "development:test") + build_bundler(bundle_path: "vendor/bundle", default_bundle_without: "development:test") post_bundler create_database_yml install_binaries @@ -447,19 +447,24 @@ def setup_language_pack_environment(ruby_layer_path = ".", gem_layer_path = ".") # muiltibuildpack. We can't use profile.d because $HOME isn't set up def setup_export(layer = nil) instrument 'ruby.setup_export' do - paths = ENV["PATH"].split(":") - paths = paths.map { |path| /^\/.*/ !~ path ? "#{build_path}/#{path}" : path }.join(":") unless layer + if layer + paths = ENV["PATH"] + else + paths = ENV["PATH"].split(":").map do |path| + /^\/.*/ !~ path ? "#{build_path}/#{path}" : path + end.join(":") + end - gem_path = - if layer - "#{layer.path}/#{slug_vendor_base}" - else - "#{build_path}/#{slug_vendor_base}" - end + # TODO ensure path exported is correct + set_export_path "PATH", paths, layer + + if layer + gem_path = "#{layer.path}/#{slug_vendor_base}" + else + gem_path = "#{build_path}/#{slug_vendor_base}" + end set_export_path "GEM_PATH", gem_path, layer set_export_default "LANG", "en_US.UTF-8", layer - # TODO ensure path exported is correct - set_export_path "PATH", paths.join(":"), layer # TODO handle jruby if ruby_version.jruby? @@ -1326,7 +1331,7 @@ def load_bundler_cache FileUtils.rm_rf("vendor/ruby_version") purge_bundler_cache # fix bug introduced in v38 - elsif !metadata.include?(buildpack_version_cache) && @metadata.exists?(ruby_version_cache) + elsif !@metadata.include?(buildpack_version_cache) && @metadata.exists?(ruby_version_cache) puts "Broken cache detected. Purging build cache." purge_bundler_cache elsif (@bundler_cache.exists? || @bundler_cache.old?) && @metadata.exists?(ruby_version_cache) && full_ruby_version != @metadata.read(ruby_version_cache).chomp From bba53a3f746db460b38b0d35d3943ed38da85cc5 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 29 Jan 2020 16:14:09 -0600 Subject: [PATCH 0688/1195] Fixing CI support --- lib/language_pack/test/ruby.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/language_pack/test/ruby.rb b/lib/language_pack/test/ruby.rb index 92d57e8cd..e7ef6a326 100644 --- a/lib/language_pack/test/ruby.rb +++ b/lib/language_pack/test/ruby.rb @@ -5,14 +5,14 @@ def compile new_app? Dir.chdir(build_path) remove_vendor_bundle - install_ruby + install_ruby(slug_vendor_ruby, build_ruby_path) install_jvm setup_language_pack_environment setup_export setup_profiled allow_git do - install_bundler_in_app - build_bundler("development") + install_bundler_in_app(slug_vendor_base) + build_bundler(bundle_path: "vendor/bundle", default_bundle_without: "development") post_bundler create_database_yml install_binaries From 6291e62dfc72742bb0349f19f173b7180e8a6a3d Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 29 Jan 2020 16:38:52 -0600 Subject: [PATCH 0689/1195] Fix tests --- lib/language_pack/ruby.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 87d9c455f..85b3f5719 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -1393,7 +1393,7 @@ def purge_bundler_cache(stack = nil) instrument "ruby.purge_bundler_cache" do @bundler_cache.clear(stack) # need to reinstall language pack gems - install_bundler_in_app + install_bundler_in_app(slug_vendor_base) end end end From 6ddb6530193ca2eccd04d81d3491c9efe4485205 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 30 Jan 2020 10:27:51 -0600 Subject: [PATCH 0690/1195] Changelog for CNB --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c07ca6441..1f217e854 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ * Improve Ruby version download error messages (https://github.com/heroku/heroku-buildpack-ruby/pull/953) * Update default Ruby version to 2.6.5 (https://github.com/heroku/heroku-buildpack-ruby/pull/947) +* Cloud Native Buildpack support (https://github.com/heroku/heroku-buildpack-ruby/pull/888) ## v207 (12/16/2019) From 8db8f2624f8929d5709d5f0bbb7f16c4e5f75e26 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 3 Mar 2020 12:26:48 -0600 Subject: [PATCH 0691/1195] Circle CI to use 2.6.5 --- .circleci/config.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0e856177a..7aad2eb7a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -11,11 +11,11 @@ jobs: - checkout - run: command: | - rvm install 2.5.7 - rvm use ruby-2.5.7 - export PATH="/opt/circleci/.rvm/rubies/ruby-2.5.7/bin:$PATH" - export GEM_HOME="/opt/circleci/.rvm/gems/ruby-2.5.7" - export GEM_PATH="/opt/circleci/.rvm/gems/ruby-2.5.7" + rvm install 2.6.5 + rvm use ruby-2.6.5 + export PATH="/opt/circleci/.rvm/rubies/ruby-2.6.5/bin:$PATH" + export GEM_HOME="/opt/circleci/.rvm/gems/ruby-2.6.5" + export GEM_PATH="/opt/circleci/.rvm/gems/ruby-2.6.5" gem install bundler -v 2.1.0 bundle install bundle exec rake hatchet:setup_ci From c89edeec32a59848b6efe8d93d24174539450973 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 4 Mar 2020 12:57:13 -0600 Subject: [PATCH 0692/1195] v208 --- CHANGELOG.md | 2 ++ lib/language_pack/version.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c07ca6441..10adbf9d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Master (unreleased) +## v208 (3/4/2020) + * Improve Ruby version download error messages (https://github.com/heroku/heroku-buildpack-ruby/pull/953) * Update default Ruby version to 2.6.5 (https://github.com/heroku/heroku-buildpack-ruby/pull/947) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 8e9fb0bc0..9b93fb6e5 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v207" + BUILDPACK_VERSION = "v208" end end From 5017ce0babd2251372730679c5438b2d06c10371 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 5 Mar 2020 10:06:46 -0600 Subject: [PATCH 0693/1195] Make version warnings more robust Users are mistakenly getting this warning when building apps: ``` Your Ruby version is not present on the next stack You are currently using ruby-2.6.5 on heroku-16 stack. This version does not exist on heroku-18. In order to upgrade your stack you will need to upgrade to a supported Ruby version. For a list of supported Ruby versions see: https://devcenter.heroku.com/articles/ruby-support#supported-runtimes For a list of the oldest Ruby versions present on a given stack see: https://devcenter.heroku.com/articles/ruby-support#oldest-available-runtimes ``` I believe this is a result of network glitches. We should be cautious about warning about issues that don't actually exist. --- CHANGELOG.md | 4 ++++ .../helpers/download_presence.rb | 10 ++++----- lib/language_pack/ruby.rb | 6 ++--- lib/language_pack/version.rb | 2 +- spec/helpers/download_presence_spec.rb | 22 +++++++++++++++---- 5 files changed, 31 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 10adbf9d6..80ab1c98d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Master (unreleased) +## v209 (3/5/2020) + +* Fix bug in version download error message logic (https://github.com/heroku/heroku-buildpack-ruby/pull/957) + ## v208 (3/4/2020) * Improve Ruby version download error messages (https://github.com/heroku/heroku-buildpack-ruby/pull/953) diff --git a/lib/language_pack/helpers/download_presence.rb b/lib/language_pack/helpers/download_presence.rb index edd62392b..dcf450e3a 100644 --- a/lib/language_pack/helpers/download_presence.rb +++ b/lib/language_pack/helpers/download_presence.rb @@ -28,14 +28,14 @@ def initialize(path, stacks: STACKS) end end - def next_stack(stack) - next_index = @stacks.index(stack) + 1 + def next_stack(current_stack: ) + next_index = @stacks.index(current_stack) + 1 @stacks[next_index] end - def exists_on_next_stack?(stack) - next_index = @stacks.index(stack) + 1 + def exists_on_next_stack?(current_stack: ) + next_index = @stacks.index(current_stack) + 1 @threads[next_index] end @@ -60,7 +60,7 @@ def does_not_exist? def call @fetchers.map do |fetcher| @threads << Thread.new do - fetcher.exists?(@path) + fetcher.exists?(@path, 3) end end end diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 2b66e5fb4..d6e9d0245 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -449,14 +449,14 @@ def warn_outdated_ruby def warn_stack_upgrade return unless defined?(@ruby_download_check) - return unless @ruby_download_check.next_stack(stack) - return unless @ruby_download_check.exists_on_next_stack?(stack) + return unless @ruby_download_check.next_stack(current_stack: stack) + return unless @ruby_download_check.exists_on_next_stack?(current_stack: stack) warn(<<~WARNING) Your Ruby version is not present on the next stack You are currently using #{ruby_version.version_for_download} on #{stack} stack. - This version does not exist on #{@ruby_download_check.next_stack(stack)}. In order to upgrade your stack you will + This version does not exist on #{@ruby_download_check.next_stack(current_stack: stack)}. In order to upgrade your stack you will need to upgrade to a supported Ruby version. For a list of supported Ruby versions see: diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 9b93fb6e5..7ba553609 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v208" + BUILDPACK_VERSION = "v209" end end diff --git a/spec/helpers/download_presence_spec.rb b/spec/helpers/download_presence_spec.rb index fd4f4f467..6982a29f8 100644 --- a/spec/helpers/download_presence_spec.rb +++ b/spec/helpers/download_presence_spec.rb @@ -9,13 +9,27 @@ download.call - expect(download.next_stack("cedar-14")).to eq("heroku-16") - expect(download.next_stack("heroku-16")).to eq("heroku-18") - expect(download.next_stack("heroku-18")).to be_falsey + expect(download.next_stack(current_stack: "cedar-14")).to eq("heroku-16") + expect(download.next_stack(current_stack: "heroku-16")).to eq("heroku-18") + expect(download.next_stack(current_stack: "heroku-18")).to be_falsey - expect(download.exists_on_next_stack?("cedar-14")).to be_truthy + expect(download.exists_on_next_stack?(current_stack:"cedar-14")).to be_truthy end + it "detects when a package is present on higher stacks" do + download = LanguagePack::Helpers::DownloadPresence.new( + 'ruby-2.6.5.tgz', + stacks: ['cedar-14', 'heroku-16', 'heroku-18'] + ) + + download.call + + expect(download.exists?).to eq(true) + expect(download.valid_stack_list).to eq(['cedar-14', 'heroku-16', 'heroku-18']) + + expect(download.exists_on_next_stack?(current_stack: "heroku-16")).to be_truthy + expect(download.next_stack(current_stack: "heroku-16")).to eq("heroku-18") + end it "detects when a package is not present on higher stacks" do download = LanguagePack::Helpers::DownloadPresence.new( From 2e847071ce9070cb8a18d0165037c3daadc513af Mon Sep 17 00:00:00 2001 From: schneems Date: Fri, 6 Mar 2020 15:41:42 -0600 Subject: [PATCH 0694/1195] Fix version download warning logic The logic was inverted so that versions that exist get a warning but not versions that do not exist. --- CHANGELOG.md | 5 +++++ lib/language_pack/ruby.rb | 2 +- lib/language_pack/version.rb | 2 +- spec/hatchet/ruby_spec.rb | 1 + 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 80ab1c98d..80465bbf0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ ## Master (unreleased) + +## v210 (3/6/2020) + +* Fix version download error warning inversion logic (https://github.com/heroku/heroku-buildpack-ruby/pull/958) + ## v209 (3/5/2020) * Fix bug in version download error message logic (https://github.com/heroku/heroku-buildpack-ruby/pull/957) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index d6e9d0245..ff2bebc88 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -450,7 +450,7 @@ def warn_outdated_ruby def warn_stack_upgrade return unless defined?(@ruby_download_check) return unless @ruby_download_check.next_stack(current_stack: stack) - return unless @ruby_download_check.exists_on_next_stack?(current_stack: stack) + return if @ruby_download_check.exists_on_next_stack?(current_stack: stack) warn(<<~WARNING) Your Ruby version is not present on the next stack diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 7ba553609..27c1d01fd 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v209" + BUILDPACK_VERSION = "v210" end end diff --git a/spec/hatchet/ruby_spec.rb b/spec/hatchet/ruby_spec.rb index e89c7f9d1..ffbff0f1a 100644 --- a/spec/hatchet/ruby_spec.rb +++ b/spec/hatchet/ruby_spec.rb @@ -100,6 +100,7 @@ Hatchet::Runner.new("default_ruby").deploy do |app, heroku| expect(app.output).to include("Writing config/database.yml to read from DATABASE_URL") expect(app.output).not_to include("Your app was upgraded to bundler") + expect(app.output).not_to include("Your Ruby version is not present on the next stack") end end end From 2bf0cc37d51aa7f4139829d15a8280120c216ab1 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 10 Mar 2020 11:39:43 -0500 Subject: [PATCH 0695/1195] Remove libpq vendoring As an effort to slow roll out libpq client it was vendored into the dyno. This PR removes this vendoring to use the version available on the stack. --- CHANGELOG.md | 1 + lib/language_pack/ruby.rb | 50 --------------------------------------- 2 files changed, 1 insertion(+), 50 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 80465bbf0..b8e96197a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## Master (unreleased) +* Remove libpq external dependency (https://github.com/heroku/heroku-buildpack-ruby/pull/959) ## v210 (3/6/2020) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index ff2bebc88..bab030122 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -99,7 +99,6 @@ def compile setup_export setup_profiled allow_git do - vendor_libpq install_bundler_in_app build_bundler("development:test") post_bundler @@ -118,55 +117,6 @@ def compile raise e end - def vendor_libpq - # Check for existing libraries - return unless File.exist?("/usr/lib/x86_64-linux-gnu/libpq.so.5.11") - return unless ENV['STACK'] == 'heroku-18' - - topic("Vendoring libpq 5.12.1") - - @metadata.fetch("vendor_libpq12") do - warn(<<~EOF) - Replacing libpq with version libpq 5.12.1 - - This version includes a bug fix that can cause an exception - on boot for applications with incorrectly configured connection - values. For more information see: - - https://devcenter.heroku.com/articles/libpq-5-12-1-breaking-connection-behavior - - If your application breaks you can rollback to your last build. - You can also temporarially opt out of this behavior by setting: - - ``` - $ heroku config:set HEROKU_SKIP_LIBPQ12=1 - ``` - - In the future libpq 5.12 will be the default on the platform and - you will not be able to opt-out of the library. For more information see: - - https://devcenter.heroku.com/articles/libpq-5-12-1-breaking-connection-behavior - EOF - - "true" # Set future cache value - end - - Dir.chdir("vendor") do - @fetchers[:mri].fetch("libpq5_12.1-1.deb") - run!("dpkg -x libpq5_12.1-1.deb .") - run!("rm libpq5_12.1-1.deb") - - load_libpq_12_unless_env_var = <<~EOF - if [ "$HEROKU_SKIP_LIBPQ12" == "" ]; then - export LD_LIBRARY_PATH="$HOME/vendor/usr/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH" - fi - EOF - add_to_export load_libpq_12_unless_env_var - add_to_profiled load_libpq_12_unless_env_var - ENV["LD_LIBRARY_PATH"] = Dir.pwd + "/usr/lib/x86_64-linux-gnu:#{ENV["LD_LIBRARY_PATH"]}" - end - end - def cleanup end From 4c7f0f730f4bbfdeba1e5fd3150d6d525dbfe01d Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 11 Mar 2020 13:47:20 -0500 Subject: [PATCH 0696/1195] I'm not 100% sure why this failure mode happens, but it looks like for some reason even though the path is set correctly bundler incorrectly uses the wrong path to load the wrong version of Ruby (the buildpack Ruby version instead of the Ruby version the customer's app wants/needs). This is what the failure mode looks like: ``` # test setup -----> Fetching heroku/ruby buildpack... buildpack downloaded -----> Ruby app detected -----> Installing bundler 2.0.2 -----> Removing BUNDLED WITH version in the Gemfile.lock -----> Setting up Test for Ruby/Rack -----> Using Ruby version: ruby-2.7.0 -----> Installing dependencies using bundler 2.0.2 ``` ``` # test actual -----> Running Ruby buildpack tests... -----> Installing bundler 1.17.3 -----> Removing BUNDLED WITH version in the Gemfile.lock -----> Running test: bundle exec rspec bundler: failed to load command: rspec (/app/vendor/bundle/bin/rspec) Bundler::RubyVersionMismatch: Your Ruby version is 2.6.5, but your Gemfile specified 2.7.0 ``` From inside of a `bin/support/test_ruby` modified run: ``` $ which bundle 25c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/vendor/ruby/heroku-16/bin//bundle $ bundle -v Bundler version 2.0.2 ``` It appears that the `test/support/test_ruby` script is invoking bundler and in these cases the system `bundle` is being invoked instead of the customer's bundler version. This then causes the wrong version of Ruby to be loaded, presumably due to some coupling in the default Bundler ruby gem. Internal tickets: - https://heroku.support/834258 - https://heroku.support/834446 --- CHANGELOG.md | 1 + hatchet.json | 3 ++- hatchet.lock | 2 ++ spec/hatchet/ci_spec.rb | 6 ++++++ 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b8e96197a..31d06bb18 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## Master (unreleased) +* Fix issue where the wrong version of bundler is used on CI apps (https://github.com/heroku/heroku-buildpack-ruby/pull/961) * Remove libpq external dependency (https://github.com/heroku/heroku-buildpack-ruby/pull/959) ## v210 (3/6/2020) diff --git a/hatchet.json b/hatchet.json index 4793bb11d..c9ed6dab2 100644 --- a/hatchet.json +++ b/hatchet.json @@ -99,6 +99,7 @@ "sharpstone/rails_31_ruby_schema_format", "sharpstone/rails_31_sql_schema_format", "sharpstone/ruby_no_rails_test", - "sharpstone/activerecord_rake_tasks_does_not_exist" + "sharpstone/activerecord_rake_tasks_does_not_exist", + "sharpstone/ci_fails_ruby_default_bundler" ] } diff --git a/hatchet.lock b/hatchet.lock index b8130049a..55338f9c1 100644 --- a/hatchet.lock +++ b/hatchet.lock @@ -15,6 +15,8 @@ - 116db685f54dae18f703b3beb90e64fdbddb048d - - "./repos/ci/activerecord_rake_tasks_does_not_exist" - a6b711be6921cf7a0aa4e31269c37965799ea110 +- - "./repos/ci/ci_fails_ruby_default_bundler" + - 43cbf196245957be6242b1e1bc56b8f1bfa00004 - - "./repos/ci/heroku-ci-json-example" - 4e5410a7381f486ba3df7739e02e52f32fdd4dda - - "./repos/ci/rails5_ruby_schema_format" diff --git a/spec/hatchet/ci_spec.rb b/spec/hatchet/ci_spec.rb index 3b1d2e230..82a4c57ac 100644 --- a/spec/hatchet/ci_spec.rb +++ b/spec/hatchet/ci_spec.rb @@ -38,4 +38,10 @@ expect(test_run.output).to_not match("db:migrate") end end + + it "works when using a Ruby version different from default with an older version of bundler and not declaring a test script" do + Hatchet::Runner.new("ci_fails_ruby_default_bundler").run_ci do |test_run| + expect(test_run.output).to match("rspec") + end + end end From 3d042013c1723fa0ea36ebd280a516eb79a94f10 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 11 Mar 2020 14:07:17 -0500 Subject: [PATCH 0697/1195] Force user's bundler on the path in CI Ruby 2.6+ ships with a version of bundler. If we do not ensure that the customer's `bundle` binary is on the path before the Ruby buildpack's then the buildpacks version may be used. This PR prevents this problem by ensuring that the vendored customer version of bundler is always first in the path before any existing binaries and after the customers `bin/` dir. # Do not modify or remove the line above. # Everything below it will be ignored. # # Date: Wed Mar 11 14:07:17 2020 -0500 # # interactive rebase in progress; onto f20f977 # Last commands done (3 commands done): # pick 0b5e9f8 Force user's bundler on the path # squash d51fa3b Blerg # No commands remaining. # You are currently rebasing branch 'schneems/ci-fails-with-ruby-265' on 'f20f977'. # # Changes to be committed: # modified: bin/support/ruby_test # --- bin/support/ruby_test | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/bin/support/ruby_test b/bin/support/ruby_test index b138cf319..977e9b8e1 100755 --- a/bin/support/ruby_test +++ b/bin/support/ruby_test @@ -30,19 +30,20 @@ def execute_command(command) end # $ bin/test BUILD_DIR ENV_DIR ARTIFACT_DIR -build_dir, env_dir, artifact_dir = ARGV +build_dir, env_dir, _ = ARGV LanguagePack::ShellHelpers.initialize_env(env_dir) +bundler = LanguagePack::Helpers::BundlerWrapper.new( + gemfile_path: "#{build_dir}/Gemfile" +) + # The `ruby_test-compile` program installs a version of Ruby for the # user's application. It needs the propper `PATH`, where ever Ruby is installed # we always add a symlink to the `bin/ruby` file so that is always valid. # We calculate the gem path the same way we do when compiling. -LanguagePack::ShellHelpers.user_env_hash["PATH"] = "#{build_dir}/bin:#{ENV["PATH"]}" +LanguagePack::ShellHelpers.user_env_hash["PATH"] = "#{build_dir}/bin:#{bundler.bundler_path}/bin:#{ENV["PATH"]}" LanguagePack::ShellHelpers.user_env_hash["GEM_PATH"] = LanguagePack::Ruby.slug_vendor_base -bundler = LanguagePack::Helpers::BundlerWrapper.new( - gemfile_path: "#{build_dir}/Gemfile" -) # load bundler bundler.install From 2856008720e90781741330eb7a9f1ca6711075ee Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 12 Mar 2020 10:27:38 -0500 Subject: [PATCH 0698/1195] v211 --- CHANGELOG.md | 2 ++ lib/language_pack/version.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 31d06bb18..97bdedd27 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Master (unreleased) +## v211 (3/12/2020) + * Fix issue where the wrong version of bundler is used on CI apps (https://github.com/heroku/heroku-buildpack-ruby/pull/961) * Remove libpq external dependency (https://github.com/heroku/heroku-buildpack-ruby/pull/959) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 27c1d01fd..c048294be 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v210" + BUILDPACK_VERSION = "v211" end end From 42655e5b0e47d944b136e547e1cf1d16adb7091f Mon Sep 17 00:00:00 2001 From: schneems Date: Fri, 13 Mar 2020 11:44:54 -0500 Subject: [PATCH 0699/1195] Clean up CNB --- CHANGELOG.md | 3 ++- lib/language_pack/base.rb | 10 ++-------- lib/language_pack/rails2.rb | 2 +- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 477c0fe8b..b8a34e3dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Master (unreleased) +* Cloud Native Buildpack support (https://github.com/heroku/heroku-buildpack-ruby/pull/888) + ## v211 (3/12/2020) * Fix issue where the wrong version of bundler is used on CI apps (https://github.com/heroku/heroku-buildpack-ruby/pull/961) @@ -17,7 +19,6 @@ * Improve Ruby version download error messages (https://github.com/heroku/heroku-buildpack-ruby/pull/953) * Update default Ruby version to 2.6.5 (https://github.com/heroku/heroku-buildpack-ruby/pull/947) -* Cloud Native Buildpack support (https://github.com/heroku/heroku-buildpack-ruby/pull/888) ## v207 (12/16/2019) diff --git a/lib/language_pack/base.rb b/lib/language_pack/base.rb index c5b96ef0a..94e8f2ae9 100644 --- a/lib/language_pack/base.rb +++ b/lib/language_pack/base.rb @@ -230,6 +230,8 @@ def add_to_export(string) end end + # option can be :path, :default, :override + # https://github.com/buildpacks/spec/blob/366ac1aa0be59d11010cc21aa06c16d81d8d43e7/buildpack.md#environment-variable-modification-rules def export(key, val, layer: nil, option: nil) if layer # don't replace if the key is already set @@ -265,14 +267,6 @@ def export(key, val, layer: nil, option: nil) end end - #def set_export_default(key, val, layer = nil) - # add_to_export "export #{key}=${#{key}:-#{val}}" - #end - - #def set_export_override(key, val) - # add_to_export %{export #{key}="#{val.gsub('"','\"')}"} - #end - def set_export_default(key, val, layer = nil) export key, val, layer: layer, option: :default end diff --git a/lib/language_pack/rails2.rb b/lib/language_pack/rails2.rb index d7f49f4ec..75177f6ad 100644 --- a/lib/language_pack/rails2.rb +++ b/lib/language_pack/rails2.rb @@ -65,7 +65,7 @@ def compile def build # TODO install plugins into separate layer - #install_plugins + install_plugins super end From 778e3faae297d839b002c6363201425998a1905c Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 17 Mar 2020 11:36:22 -0500 Subject: [PATCH 0700/1195] Fix `\n` in export path The command `which` returns a newline which was being put in the PATH and then exported to the export file: ``` which node: "/tmp/build_d21ec1d0a2e7e9466b95cd2f7f79b41a/.heroku/node/bin/node\n" ``` Would cause this to be in the PATH: ``` remote: export PATH=/tmp/build_449e75fdca9780bfa7f33fac3b86065e/./vendor/bundle/bin:/tmp/build_449e75fdca9780bfa7f33fac3b86065e/./vendor/bundle/ruby/2.6.0/bin:/tmp/build_449e75fdca9780bfa7f33fac3b86065e/vendor/ruby-2.6.2/bin:/tmp/tmp.ly4bnGG8nm/bin/:/tmp/build_449e75fdca9780bfa7f33fac3b86065e/.heroku/node/bin:/tmp/build_449e75fdca9780bfa7f33fac3b86065e/.heroku/yarn/bin:/usr/local/bin:/usr/bin:/bin:/tmp/codon/vendor/bin:/tmp/build_449e75fdca9780bfa7f33fac3b86065e/node_modules/.bin:/tmp/build_449e75fdca9780bfa7f33fac3b86065e/.heroku/node/bin/node remote: :/tmp/build_449e75fdca9780bfa7f33fac3b86065e/bin:/usr/local/bin:/usr/bin:/bin:$PATH ``` This causes the multi buildpack to fail https://github.com/heroku/heroku-buildpack-ruby/issues/963, but only the multi buildpack. Error is: ``` remote: /tmp/buildpackYYwZE/export: line 2: :/tmp/build_71238ae8789a5e65c5afca4e8abc6c3a/bin:/usr/local/bin:/usr/bin:/bin:/tmp/build_71238ae8789a5e65c5afca4e8abc6c3a/./vendor/bundle/bin:/tmp/build_71238ae8789a5e65c5afca4e8abc6c3a/./vendor/bundle/ruby/2.6.0/bin:/tmp/build_71238ae8789a5e65c5afca4e8abc6c3a/vendor/ruby-2.6.5/bin:/tmp/tmp.behzAImwsj/bin/:/tmp/build_71238ae8789a5e65c5afca4e8abc6c3a/.heroku/node/bin:/tmp/build_71238ae8789a5e65c5afca4e8abc6c3a/.heroku/yarn/bin:/usr/local/bin:/usr/bin:/bin:/tmp/codon/vendor/bin:/tmp/build_71238ae8789a5e65c5afca4e8abc6c3a/node_modules/.bin:/tmp/build_71238ae8789a5e65c5afca4e8abc6c3a/.heroku/node/bin/node: No such file or directory ``` Even though this is the bug, it has been in the ruby buildpack for some time. Something in #888 introduced a failure mode. Since multi-buildpack is deprecated and unmaintained I don't want to add an automated test here. You can manually reproduce the failure by running: ``` cd /tmp dir_name=$(ruby -e "require 'securerandom'; puts SecureRandom.hex") mkdir $dir_name cd $dir_name echo "source 'https://rubygems.org'" > Gemfile bundle install git init . git add . git commit -m first echo '{ "engines" : { "node": "8.9.4" } }' > package.json heroku create heroku buildpacks:set https://github.com/heroku/heroku-buildpack-multi echo "https://github.com/heroku/heroku-buildpack-nodejs.git" >> .buildpacks echo "https://github.com/heroku/heroku-buildpack-ruby" >> .buildpacks git add . ; git commit -m next git push heroku master ``` You can get it to pass by running ``` rm .buildpacks echo "https://github.com/heroku/heroku-buildpack-nodejs.git" >> .buildpacks echo "https://github.com/heroku/heroku-buildpack-ruby#schneems/fix-node-which" >> .buildpacks ``` Which points the app at this PR. --- lib/language_pack/ruby.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 09c5f9662..373870ee6 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -1099,7 +1099,7 @@ def node_preinstall_bin_path return @node_preinstall_bin_path if defined?(@node_preinstall_bin_path) legacy_path = "#{Dir.pwd}/#{NODE_BP_PATH}" - path = run("which node") + path = run("which node").chomp if path && $?.success? @node_preinstall_bin_path = path elsif run("#{legacy_path}/node -v") && $?.success? @@ -1117,7 +1117,7 @@ def node_not_preinstalled? def yarn_preinstall_bin_path return @yarn_preinstall_bin_path if defined?(@yarn_preinstall_bin_path) - path = run("which yarn") + path = run("which yarn").chomp if path && $?.success? @yarn_preinstall_bin_path = path else From 992c2dc210eaa5fbc52e1a407e05092ea61e7dff Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 17 Mar 2020 15:05:13 -0500 Subject: [PATCH 0701/1195] Update multi-buildpack test to use current branch of the buildpack --- spec/hatchet/node_spec.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/spec/hatchet/node_spec.rb b/spec/hatchet/node_spec.rb index dbd651844..7fd9c43d3 100644 --- a/spec/hatchet/node_spec.rb +++ b/spec/hatchet/node_spec.rb @@ -2,7 +2,17 @@ describe "Node" do it "works with node buildpack" do - Hatchet::Runner.new("node_multi", buildpack_url: "https://github.com/heroku/heroku-buildpack-multi.git").deploy do |app| + before_deploy = Proc.new do + run!("rm .buildpacks") + run!("echo https://github.com/heroku/heroku-buildpack-nodejs.git >> .buildpacks") + run!("echo #{Hatchet::App.default_buildpack} >> .buildpacks") + end + + Hatchet::Runner.new( + "node_multi", + before_deploy: before_deploy, + buildpack_url: "https://github.com/heroku/heroku-buildpack-multi.git" + ).deploy do |app| expect(app.output).to match("Node Version in Ruby buildpack is: v4.1.2") expect(app.run("node -v")).to match("v4.1.2") end From 211624d8c7543827fa9de6ee6cb65fe906cc5989 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 18 Mar 2020 10:16:55 -0500 Subject: [PATCH 0702/1195] [changelog skip] Quote buildpack's `export` values MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a followup from #965. In #888 the values in the buildpack's `export` file dropped their quoting for paths causing a few failures that were not caught by our tests. This PR fixes the underlying problem and adds a test that would have caught the regression. The test uses a buildpack that intentionally adds a quoted newline to it's export file https://github.com/sharpstone/export_path_with_newlines_buildpack/blob/master/bin/compile this gets picked up by the Ruby buildpack and put back into Ruby's `export` file. Since ruby after #888 did not quote these values it would result in this failure: ``` 1) Buildpack internals handles PATH with a newline in it correctly Failure/Error: Hatchet::Runner.new("default_ruby", buildpacks: buildpacks).deploy do |app| expect(app.output).to_not match("No such file or directory") end Hatchet::App::FailedDeploy: Could not deploy 'hatchet-t-3e6bacb18a' (default_ruby) using 'Hatchet::GitApp' at path: './repos/rack/default_ruby' if this was expected add `allow_failure: true` to your deploy hash. output: Buildpack: nil Repo: https://git.heroku.com/hatchet-t-3e6bacb18a.git remote: Compressing source files... done. remote: Building source: remote: remote: -----> I add newlines to the export file app detected remote: -----> Ruby app detected remote: -----> Installing bundler 1.17.3 remote: -----> Removing BUNDLED WITH version in the Gemfile.lock remote: -----> Compiling Ruby/Rack remote: -----> Using Ruby version: ruby-2.6.5 remote: -----> Installing dependencies using bundler 1.17.3 remote: Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment remote: Fetching gem metadata from https://rubygems.org/............... remote: Using bundler 1.17.3 remote: Fetching rack 1.5.0 remote: Installing rack 1.5.0 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 (3.14s) remote: Cleaning up the bundler cache. remote: -----> Writing config/database.yml to read from DATABASE_URL remote: -----> Detecting rake tasks remote: remote: ###### WARNING: remote: remote: You have not declared a Ruby version in your Gemfile. remote: To set your Ruby version add this line to your Gemfile: remote: ruby '2.6.5' remote: # See https://devcenter.heroku.com/articles/ruby-versions for more information. 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: -----> Null Buildpack app detected remote: /app/tmp/buildpacks/6ccd2b9f41db985dbeffeeafa11877f50b22197988b0d84a055bdf7fe48efeff0c1fbccefc0b0ef5dd833ede16523bd9cec929eeebc3e0e3bfe67c0f12460db2/export: line 2: /dog:/tmp/build_fdb4f5eaca8a5eb93660ff3af68703df/hello/there:/usr/local/bin:/usr/bin:/bin:/tmp/codon/vendor/bin:/tmp/build_fdb4f5eaca8a5eb93660ff3af68703df/bin:/usr/local/bin:/usr/bin:/bin:/tmp/build_fdb4f5eaca8a5eb93660ff3af68703df/./vendor/bundle/bin:/tmp/build_fdb4f5eaca8a5eb93660ff3af68703df/./vendor/bundle/ruby/2.6.0/bin:/tmp/build_fdb4f5eaca8a5eb93660ff3af68703df/vendor/ruby-2.6.5/bin:/tmp/tmp.HN41keQoC9/bin/:cinco/: No such file or directory remote: /usr/bin/env: ‘bash’: No such file or directory remote: ! Push rejected, failed to compile Null Buildpack app. remote: remote: ! Push failed remote: Verifying deploy... remote: remote: ! Push rejected to hatchet-t-3e6bacb18a. remote: ``` --- lib/language_pack/base.rb | 4 ++-- spec/hatchet/buildpack_spec.rb | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 spec/hatchet/buildpack_spec.rb diff --git a/lib/language_pack/base.rb b/lib/language_pack/base.rb index 94e8f2ae9..fa169c4b3 100644 --- a/lib/language_pack/base.rb +++ b/lib/language_pack/base.rb @@ -253,9 +253,9 @@ def export(key, val, layer: nil, option: nil) else string = if option == :default - "export #{key}=${#{key}:-#{val}}" + %{export #{key}="${#{key}:-#{val}}"} elsif option == :path - "export #{key}=#{val}:$#{key}" + %{export #{key}="#{val}:$#{key}"} else %{export #{key}="#{val.gsub('"','\"')}"} end diff --git a/spec/hatchet/buildpack_spec.rb b/spec/hatchet/buildpack_spec.rb new file mode 100644 index 000000000..36d922194 --- /dev/null +++ b/spec/hatchet/buildpack_spec.rb @@ -0,0 +1,15 @@ +require_relative '../spec_helper' + +describe "Buildpack internals" do + it "handles PATH with a newline in it correctly" do + buildpacks = [ + "https://github.com/sharpstone/export_path_with_newlines_buildpack", + Hatchet::App.default_buildpack, + "https://github.com/heroku/null-buildpack" + ] + Hatchet::Runner.new("default_ruby", buildpacks: buildpacks).deploy do |app| + expect(app.output).to_not match("No such file or directory") + end + end +end + From c4bfac786bfef955d40e556cfe46345366b77bcf Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Fri, 20 Mar 2020 12:32:33 -0700 Subject: [PATCH 0703/1195] [changelog skip] export STACK so it can be used in scripts --- bin/build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/build b/bin/build index 0299f6bfa..016645c90 100755 --- a/bin/build +++ b/bin/build @@ -9,7 +9,7 @@ BIN_DIR=$(cd $(dirname $0); pwd) BUILDPACK_DIR=$(dirname $BIN_DIR) # legacy buildpack uses $STACK -STACK=$CNB_STACK_ID +export STACK=$CNB_STACK_ID source "$BIN_DIR/support/bash_functions.sh" heroku_buildpack_ruby_install_ruby "$BIN_DIR" "$BUILDPACK_DIR" From 6135dd73bb978b43a5d6367375518c49817b94fa Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 26 Mar 2020 11:02:52 -0500 Subject: [PATCH 0704/1195] v212 --- CHANGELOG.md | 2 ++ lib/language_pack/version.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b8a34e3dc..b720d6d7e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Master (unreleased) +## v212 (3/26/2020) + * Cloud Native Buildpack support (https://github.com/heroku/heroku-buildpack-ruby/pull/888) ## v211 (3/12/2020) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index c048294be..78bbbc346 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v211" + BUILDPACK_VERSION = "v212" end end From 0e52f71365990d7e63d47a0f0212fb6715916f47 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 31 Mar 2020 13:36:25 -0500 Subject: [PATCH 0705/1195] Fix absolute path bug in .profile.d/ruby.sh $PATH In #888 a relative path was accidentally introduced into the `.profile.d/ruby.sh` script: ``` export PATH="bin:$HOME/vendor/bundle/bin:$HOME/vendor/bundle/ruby/2.6.0/bin:$PATH" ``` That first path `bin` is relative and should be `$HOME/bin`. Without it, then changing into a different directory means that the system version of ruby will be used ``` ~ $ which ruby bin/ruby ~ $ mkdir foo; cd foo ~/foo $ which ruby /usr/bin/ruby ``` This is a regression was not caught by tests previously because the version of ruby that the test `cd_ruby` uses is 2.5.1 and that happens to match system ruby. To fix for catching future regressions the test is now more explicit. Unfortunately there's a bug in hatchet preventing that specific test https://github.com/heroku/hatchet/issues/71 so instead I'm at least asserting that it's an absolute path. --- CHANGELOG.md | 4 ++++ app.json | 2 +- lib/language_pack/ruby.rb | 4 ++-- spec/hatchet/ruby_spec.rb | 2 ++ 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b720d6d7e..1e36f7d71 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Master (unreleased) +## v213 (4/1/2020) + +* Fix regression. PATH value at runtime was relative instead of absolute (https://github.com/heroku/heroku-buildpack-ruby/pull/973) + ## v212 (3/26/2020) * Cloud Native Buildpack support (https://github.com/heroku/heroku-buildpack-ruby/pull/888) diff --git a/app.json b/app.json index dc00e8c1e..d6f64eae5 100644 --- a/app.json +++ b/app.json @@ -25,7 +25,7 @@ "buildpacks": [ { "url": "https://github.com/heroku/heroku-buildpack-apt" }, { "url": "https://github.com/heroku/heroku-buildpack-cli.git" }, - { "url": "heroku/ruby" } + { "url": "https://github.com/heroku/heroku-buildpack-ruby#v211" } ] } } diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 373870ee6..645c0d877 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -211,7 +211,7 @@ def default_path(gem_layer_path = ".") # need to remove bin/ folder since it links # to the wrong --prefix ruby binstubs # breaking require. This only applies to Ruby 1.9.2 and 1.8.7. - safe_binstubs = binstubs_relative_paths(gem_layer_path) - ["bin"] + safe_binstubs = binstubs_relative_paths(gem_layer_path) - ["bin", "#{gem_layer_path}/bin"] paths = [ ENV["PATH"], "bin", @@ -225,7 +225,7 @@ def default_path(gem_layer_path = ".") def binstubs_relative_paths(gem_layer_path = ".") [ - "bin", + "#{gem_layer_path}/bin", "#{gem_layer_path}/#{bundler_binstubs_path}", "#{gem_layer_path}/#{slug_vendor_base}/bin" ] diff --git a/spec/hatchet/ruby_spec.rb b/spec/hatchet/ruby_spec.rb index ffbff0f1a..d0318c35b 100644 --- a/spec/hatchet/ruby_spec.rb +++ b/spec/hatchet/ruby_spec.rb @@ -32,6 +32,8 @@ it "works" do Hatchet::Runner.new('cd_ruby', stack: DEFAULT_STACK).deploy do |app| expect(app.output).to match("cd version ruby 2.5.1") + + expect(app.run("which ruby").chomp).to eq("/app/bin/ruby") end end end From 203e9eae47393b272877ed6c3b0ea2e7fc79871a Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 31 Mar 2020 20:52:20 -0500 Subject: [PATCH 0706/1195] CNB extra test and test helper class Fix CNB case. In the CNB build process the `gem_layer_path` is not `$HOME` to ensure that `$HOME/bin` is always on the path, we can manually add it. If it gets added multiple times, we'll call `uniq` on the array before setting the override. --- lib/language_pack/ruby.rb | 5 ++- spec/cnb/basic_local_pack_spec.rb | 64 +++++++++++++++++++++++++------ 2 files changed, 55 insertions(+), 14 deletions(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 645c0d877..8a8506fc0 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -429,13 +429,14 @@ def setup_export(layer = nil) # sets up the profile.d script for this buildpack def setup_profiled(ruby_layer_path = "$HOME", gem_layer_path = "$HOME") instrument 'setup_profiled' do - profiled_path = binstubs_relative_paths(gem_layer_path) + profiled_path = ["$HOME/bin"] + profiled_path << binstubs_relative_paths(gem_layer_path) profiled_path << "vendor/#{@yarn_installer.binary_path}" if has_yarn_binary? profiled_path << "$PATH" set_env_default "LANG", "en_US.UTF-8" set_env_override "GEM_PATH", "#{gem_layer_path}/#{slug_vendor_base}:$GEM_PATH" - set_env_override "PATH", profiled_path.join(":") + set_env_override "PATH", profiled_path.uniq.join(":") set_env_default "MALLOC_ARENA_MAX", "2" if default_malloc_arena_max? add_to_profiled set_default_web_concurrency if env("SENSIBLE_DEFAULTS") diff --git a/spec/cnb/basic_local_pack_spec.rb b/spec/cnb/basic_local_pack_spec.rb index 7dfd456d6..31a73522d 100644 --- a/spec/cnb/basic_local_pack_spec.rb +++ b/spec/cnb/basic_local_pack_spec.rb @@ -1,21 +1,61 @@ require_relative '../spec_helper' -describe "cnb" do - it "locally" do - run!("which pack") - repo_path = hatchet_path("heroku/ruby-getting-started") - image_name = "heroku-buildpack-ruby-tests:#{SecureRandom.hex}" +class CnbRun + attr_accessor :image_name, :output, :repo_path, :buildpack_path, :builder - build_out = run!("pack build #{image_name} --path #{repo_path} --buildpack #{buildpack_path} --builder heroku/buildpacks:18") - expect(build_out).to match("Compiling Ruby/Rails") + def initialize(repo_path, builder: "heroku/buildpacks:18", buildpack_path: ) + @repo_path = repo_path + @image_name = "heroku-buildpack-ruby-tests:#{SecureRandom.hex}" + @builder = builder + @buildpack_path = buildpack_path + @build_output = "" + end - run_out = run!("docker run #{image_name} 'ruby -v'").chomp - expect(run_out).to match("2.4.4") + def call + command = "pack build #{image_name} --path #{repo_path} --buildpack #{buildpack_path} --builder heroku/buildpacks:18" + @output = `#{command}` + raise "Command #{command.inspect} failed. Output: #{out}" unless $?.success? + yield self ensure - if image_name - docker_list = run("docker images | grep #{image_name}").chomp - run!("docker rmi #{image_name}") if !docker_list.empty? + teardown + end + + def teardown + return unless image_name + + docker_list = run("docker images | grep #{image_name}").chomp + run!("docker rmi #{image_name}") if !docker_list.empty? + @image_name = nil + end + + def run(cmd) + `docker run #{image_name} '#{cmd}'`.chomp + end + + def run!(cmd) + out = run(cmd) + raise "Command #{cmd.inspect} failed. Output: #{out}" unless $?.success? + out + end +end + +describe "cnb" do + it "locally runs default_ruby app" do + CnbRun.new(hatchet_path("rack/default_ruby"), buildpack_path: buildpack_path).call do |app| + expect(app.output).to match("Compiling Ruby/Rack") + + run_out = app.run!("ruby -v") + expect(run_out).to match(LanguagePack::RubyVersion::DEFAULT_VERSION_NUMBER) + end + end + + it "locally runs rails getting started" do + CnbRun.new(hatchet_path("heroku/ruby-getting-started"), buildpack_path: buildpack_path).call do |app| + expect(app.output).to match("Compiling Ruby/Rails") + + run_out = app.run!("ruby -v") + expect(run_out).to match("2.4.4") end end end From 977f318c95728c9ae1fd982a3946e7b16e208f18 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 31 Mar 2020 16:32:35 -0500 Subject: [PATCH 0707/1195] Ruby 2.6.6 is the new default --- .circleci/config.yml | 10 +++++----- CHANGELOG.md | 2 ++ Gemfile | 2 +- Gemfile.lock | 4 ++-- buildpack.toml | 8 ++++---- changelogs/v213/default_ruby_266.md | 3 +++ lib/language_pack/ruby_version.rb | 2 +- lib/language_pack/version.rb | 2 +- 8 files changed, 19 insertions(+), 14 deletions(-) create mode 100644 changelogs/v213/default_ruby_266.md diff --git a/.circleci/config.yml b/.circleci/config.yml index 7aad2eb7a..a8d33025d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -11,11 +11,11 @@ jobs: - checkout - run: command: | - rvm install 2.6.5 - rvm use ruby-2.6.5 - export PATH="/opt/circleci/.rvm/rubies/ruby-2.6.5/bin:$PATH" - export GEM_HOME="/opt/circleci/.rvm/gems/ruby-2.6.5" - export GEM_PATH="/opt/circleci/.rvm/gems/ruby-2.6.5" + rvm install 2.6.6 + rvm use ruby-2.6.6 + export PATH="/opt/circleci/.rvm/rubies/ruby-2.6.6/bin:$PATH" + export GEM_HOME="/opt/circleci/.rvm/gems/ruby-2.6.6" + export GEM_PATH="/opt/circleci/.rvm/gems/ruby-2.6.6" gem install bundler -v 2.1.0 bundle install bundle exec rake hatchet:setup_ci diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e36f7d71..488ed6d66 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Master (unreleased) +* Default Ruby version is now 2.6.6 (https://github.com/heroku/heroku-buildpack-ruby/pull/974) + ## v213 (4/1/2020) * Fix regression. PATH value at runtime was relative instead of absolute (https://github.com/heroku/heroku-buildpack-ruby/pull/973) diff --git a/Gemfile b/Gemfile index 161c219e6..9836203a0 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ source "https://rubygems.org" git_source(:github) { |repo| "https://github.com/#{repo}.git" } -ruby '2.6.5' +ruby '2.6.6' group :development, :test do gem "toml-rb" diff --git a/Gemfile.lock b/Gemfile.lock index 645470078..6732be4fa 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -97,7 +97,7 @@ DEPENDENCIES toml-rb RUBY VERSION - ruby 2.6.5p114 + ruby 2.6.6p146 BUNDLED WITH - 2.0.2 + 2.1.4 diff --git a/buildpack.toml b/buildpack.toml index ee89b3a9c..6526491b9 100644 --- a/buildpack.toml +++ b/buildpack.toml @@ -4,7 +4,7 @@ api = "0.2" id = "heroku/ruby" version = "0.0.1" name = "Ruby" -ruby_version = "2.6.5" +ruby_version = "2.6.6" [publish.Ignore] files = [ @@ -17,13 +17,13 @@ ruby_version = "2.6.5" dir = "." files = ["./.env"] [[publish.Vendor]] - url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/cedar-14/ruby-2.6.5.tgz" + url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/cedar-14/ruby-2.6.6.tgz" dir = "vendor/ruby/cedar-14" [[publish.Vendor]] - url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-16/ruby-2.6.5.tgz" + url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-16/ruby-2.6.6.tgz" dir = "vendor/ruby/heroku-16" [[publish.Vendor]] - url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-18/ruby-2.6.5.tgz" + url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-18/ruby-2.6.6.tgz" dir = "vendor/ruby/heroku-18" [[stacks]] diff --git a/changelogs/v213/default_ruby_266.md b/changelogs/v213/default_ruby_266.md new file mode 100644 index 000000000..e4fda1813 --- /dev/null +++ b/changelogs/v213/default_ruby_266.md @@ -0,0 +1,3 @@ +## Default Ruby version for new apps is now 2.6.6 + +The [default Ruby version for new Ruby applications is 2.6.6](https://devcenter.heroku.com/articles/ruby-support#default-ruby-version-for-new-apps). You’ll only get the default if the application does not specify a ruby version. diff --git a/lib/language_pack/ruby_version.rb b/lib/language_pack/ruby_version.rb index 067f78254..6bb113632 100644 --- a/lib/language_pack/ruby_version.rb +++ b/lib/language_pack/ruby_version.rb @@ -12,7 +12,7 @@ def initialize(output = "") end end - DEFAULT_VERSION_NUMBER = "2.6.5" + DEFAULT_VERSION_NUMBER = "2.6.6" DEFAULT_VERSION = "ruby-#{DEFAULT_VERSION_NUMBER}" LEGACY_VERSION_NUMBER = "1.9.2" LEGACY_VERSION = "ruby-#{LEGACY_VERSION_NUMBER}" diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 78bbbc346..69e15f316 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v212" + BUILDPACK_VERSION = "v213" end end From 7cbcd41b6b4a56e897f8346b2fd57c257375bbb8 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 2 Apr 2020 11:17:35 -0500 Subject: [PATCH 0708/1195] Fix yarn relative path in PATH --- CHANGELOG.md | 5 ++++- lib/language_pack/ruby.rb | 2 +- lib/language_pack/version.rb | 2 +- spec/hatchet/rails5_spec.rb | 4 +++- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 488ed6d66..7611d4322 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,13 @@ ## Master (unreleased) +## v214 (4/2/2020) + * Default Ruby version is now 2.6.6 (https://github.com/heroku/heroku-buildpack-ruby/pull/974) +* Fix regression. PATH value for `yarn` at runtime was relative instead of absolute (https://github.com/heroku/heroku-buildpack-ruby/pull/975) ## v213 (4/1/2020) -* Fix regression. PATH value at runtime was relative instead of absolute (https://github.com/heroku/heroku-buildpack-ruby/pull/973) +* Fix regression. PATH value for `ruby` at runtime was relative instead of absolute (https://github.com/heroku/heroku-buildpack-ruby/pull/973) ## v212 (3/26/2020) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 8a8506fc0..8335cb4dd 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -431,7 +431,7 @@ def setup_profiled(ruby_layer_path = "$HOME", gem_layer_path = "$HOME") instrument 'setup_profiled' do profiled_path = ["$HOME/bin"] profiled_path << binstubs_relative_paths(gem_layer_path) - profiled_path << "vendor/#{@yarn_installer.binary_path}" if has_yarn_binary? + profiled_path << "$HOME/vendor/#{@yarn_installer.binary_path}" if has_yarn_binary? profiled_path << "$PATH" set_env_default "LANG", "en_US.UTF-8" diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 69e15f316..f16cf5fc5 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v213" + BUILDPACK_VERSION = "v214" end end diff --git a/spec/hatchet/rails5_spec.rb b/spec/hatchet/rails5_spec.rb index 1ef1838e4..529f90812 100644 --- a/spec/hatchet/rails5_spec.rb +++ b/spec/hatchet/rails5_spec.rb @@ -69,7 +69,9 @@ def worker_task_for_app(app) Hatchet::Runner.new("rails51_webpacker").deploy do |app, heroku| expect(app.output).to include("Installing yarn") expect(app.output).to include("yarn install") - expect(app.run("rails -v")).to match("") + + expect(app.run("which -a node")).to match("/app/bin/node") + expect(app.run("which -a yarn")).to match("/app/vendor/yarn-") end end end From 1c570480ece6b77070351a753895833ac30a14c1 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 2 Apr 2020 12:13:44 -0500 Subject: [PATCH 0709/1195] Move changelog to correct directory --- changelogs/{v213 => v214}/default_ruby_266.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename changelogs/{v213 => v214}/default_ruby_266.md (100%) diff --git a/changelogs/v213/default_ruby_266.md b/changelogs/v214/default_ruby_266.md similarity index 100% rename from changelogs/v213/default_ruby_266.md rename to changelogs/v214/default_ruby_266.md From b515bb3d70315a16b6e507261aac975adb01fa44 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 8 Apr 2020 14:10:16 -0500 Subject: [PATCH 0710/1195] Fix CI Test runs not using bundler cache When testing the same code in the same pipeline the cache should be used so gems do not have to be re-installed. This same test passes using an older version of the buildpack: ``` $ HATCHET_BUILDPACK_BRANCH="v211" rspec spec/hatchet/ci_spec.rb:39 ``` --- CHANGELOG.md | 4 ++++ lib/language_pack/test/ruby.rb | 1 + spec/hatchet/ci_spec.rb | 13 +++++++++++++ 3 files changed, 18 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7611d4322..cc8d399c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Master (unreleased) +## v215 (4/9/2020) + +* Fix bundler cache not being used in CI builds (https://github.com/heroku/heroku-buildpack-ruby/pull/978) + ## v214 (4/2/2020) * Default Ruby version is now 2.6.6 (https://github.com/heroku/heroku-buildpack-ruby/pull/974) diff --git a/lib/language_pack/test/ruby.rb b/lib/language_pack/test/ruby.rb index e7ef6a326..4f48b740d 100644 --- a/lib/language_pack/test/ruby.rb +++ b/lib/language_pack/test/ruby.rb @@ -12,6 +12,7 @@ def compile setup_profiled allow_git do install_bundler_in_app(slug_vendor_base) + load_bundler_cache build_bundler(bundle_path: "vendor/bundle", default_bundle_without: "development") post_bundler create_database_yml diff --git a/spec/hatchet/ci_spec.rb b/spec/hatchet/ci_spec.rb index 82a4c57ac..e756ea06a 100644 --- a/spec/hatchet/ci_spec.rb +++ b/spec/hatchet/ci_spec.rb @@ -33,6 +33,19 @@ end end + it "Uses the cache" do + runner = Hatchet::Runner.new("ruby_no_rails_test") + runner.run_ci do |test_run| + expect(test_run.output).to match("Fetching rake") + + test_run.instance_variable_set(:"@status", false) + test_run.create_test_run + test_run.wait! { } + + expect(test_run.output).to_not match("Fetching rake") + end + end + it "Works with a rails app that does not have activerecord" do Hatchet::Runner.new("activerecord_rake_tasks_does_not_exist").run_ci do |test_run| expect(test_run.output).to_not match("db:migrate") From 1e408dbc384ba4024b3ea285b409ff5a6ff7ccac Mon Sep 17 00:00:00 2001 From: Ed Morley <501702+edmorley@users.noreply.github.com> Date: Sat, 18 Apr 2020 17:31:47 +0100 Subject: [PATCH 0711/1195] Gracefully handle unrecognised stacks Previously if the current stack was not in the download presence check's list of known stacks, the compile would fail with: ``` lib/language_pack/helpers/download_presence.rb:32:in `next_stack': undefined method `+' for nil:NilClass (NoMethodError) from /app/tmp/buildpacks/.../lib/language_pack/ruby.rb:469:in `warn_stack_upgrade' from /app/tmp/buildpacks/.../lib/language_pack/ruby.rb:462:in `warn_outdated_ruby' from /app/tmp/buildpacks/.../lib/language_pack/ruby.rb:115:in `block in compile' ``` Refs W-7457678. --- CHANGELOG.md | 2 ++ lib/language_pack/helpers/download_presence.rb | 9 ++++++++- spec/helpers/download_presence_spec.rb | 12 ++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cc8d399c0..3259b907c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Master (unreleased) +* Gracefully handle unrecognised stacks ([#982](https://github.com/heroku/heroku-buildpack-ruby/pull/982)) + ## v215 (4/9/2020) * Fix bundler cache not being used in CI builds (https://github.com/heroku/heroku-buildpack-ruby/pull/978) diff --git a/lib/language_pack/helpers/download_presence.rb b/lib/language_pack/helpers/download_presence.rb index dcf450e3a..9f9430ad6 100644 --- a/lib/language_pack/helpers/download_presence.rb +++ b/lib/language_pack/helpers/download_presence.rb @@ -28,13 +28,20 @@ def initialize(path, stacks: STACKS) end end + def supported_stack?(current_stack: ) + @stacks.include?(current_stack) + end + def next_stack(current_stack: ) - next_index = @stacks.index(current_stack) + 1 + return unless supported_stack?(current_stack: current_stack) + next_index = @stacks.index(current_stack) + 1 @stacks[next_index] end def exists_on_next_stack?(current_stack: ) + return false unless supported_stack?(current_stack: current_stack) + next_index = @stacks.index(current_stack) + 1 @threads[next_index] end diff --git a/spec/helpers/download_presence_spec.rb b/spec/helpers/download_presence_spec.rb index 6982a29f8..19e442510 100644 --- a/spec/helpers/download_presence_spec.rb +++ b/spec/helpers/download_presence_spec.rb @@ -77,4 +77,16 @@ expect(download.exists?).to eq(true) expect(download.valid_stack_list).to include(LanguagePack::Helpers::DownloadPresence::STACKS.last) end + + it "handles the current stack not being in the known stacks list" do + download = LanguagePack::Helpers::DownloadPresence.new( + "#{LanguagePack::RubyVersion::DEFAULT_VERSION}.tgz", + ) + + download.call + + expect(download.supported_stack?(current_stack: "unknown-stack")).to be_falsey + expect(download.next_stack(current_stack: "unknown-stack")).to be_nil + expect(download.exists_on_next_stack?(current_stack:"unknown-stack")).to be_falsey + end end From b9db745f4b896e3ad57d9384dcd9338089301be3 Mon Sep 17 00:00:00 2001 From: Ed Morley <501702+edmorley@users.noreply.github.com> Date: Tue, 21 Apr 2020 10:09:58 +0100 Subject: [PATCH 0712/1195] Vendor Heroku-20 binaries in the published buildpack For parity with the existing stacks. Refs W-7457565. --- buildpack.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/buildpack.toml b/buildpack.toml index 6526491b9..f4dd8f587 100644 --- a/buildpack.toml +++ b/buildpack.toml @@ -25,6 +25,9 @@ ruby_version = "2.6.6" [[publish.Vendor]] url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-18/ruby-2.6.6.tgz" dir = "vendor/ruby/heroku-18" + [[publish.Vendor]] + url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-20/ruby-2.6.6.tgz" + dir = "vendor/ruby/heroku-20" [[stacks]] id = "heroku-18" From 6f19e1a2ff7fe3fab1bc2fd3eaedd5507ee82ffa Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 23 Apr 2020 10:08:21 -0500 Subject: [PATCH 0713/1195] Clean up tests - Remove extra newlines - Don't use buildpack-multi unless necessary - Remove commented tests - Remove libpq tests (Should have been removed with the PR) - "Bad versions" spec is tested twice - Remove puts - Fix typo in test name - ReplRunner is no longer used/needed - Removed Unused spec helper --- Gemfile.lock | 12 +++--- spec/hatchet/bugs_spec.rb | 8 ---- spec/hatchet/buildpack_spec.rb | 1 - spec/hatchet/ci_spec.rb | 5 +-- spec/hatchet/node_spec.rb | 13 +----- spec/hatchet/rails4_spec.rb | 8 ---- spec/hatchet/ruby_spec.rb | 48 +--------------------- spec/hatchet/stack_spec.rb | 2 +- spec/helpers/outdated_ruby_version_spec.rb | 2 - spec/helpers/rails_runner_spec.rb | 1 - spec/spec_helper.rb | 11 ----- 11 files changed, 11 insertions(+), 100 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 6732be4fa..c01dea877 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -16,7 +16,7 @@ GIT GEM remote: https://rubygems.org/ specs: - activesupport (6.0.2.1) + activesupport (6.0.2.2) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) @@ -24,16 +24,16 @@ GEM zeitwerk (~> 2.2) ansi (1.5.0) citrus (3.0.2) - concurrent-ruby (1.1.5) + concurrent-ruby (1.1.6) diff-lcs (1.3) erubis (2.7.0) - excon (0.72.0) + excon (0.73.0) heroics (0.0.25) erubis (~> 2.0) excon moneta multi_json (>= 1.9.2) - heroku_hatchet (4.1.0) + heroku_hatchet (5.0.1) excon (~> 0) minitest-retry (~> 0.1.9) platform-api (~> 2) @@ -74,9 +74,9 @@ GEM threaded (0.0.4) toml-rb (1.1.2) citrus (~> 3.0, > 3.0) - tzinfo (1.2.6) + tzinfo (1.2.7) thread_safe (~> 0.1) - zeitwerk (2.2.2) + zeitwerk (2.3.0) PLATFORMS ruby diff --git a/spec/hatchet/bugs_spec.rb b/spec/hatchet/bugs_spec.rb index 31f220655..13ddac117 100644 --- a/spec/hatchet/bugs_spec.rb +++ b/spec/hatchet/bugs_spec.rb @@ -15,12 +15,4 @@ end end end - - context "bad versions" do - it "fails with better error message" do - Hatchet::Runner.new("bad_ruby_version", allow_failure: true).deploy do |app| - expect(app.output).to match("devcenter.heroku.com/articles/ruby-support") - end - end - end end diff --git a/spec/hatchet/buildpack_spec.rb b/spec/hatchet/buildpack_spec.rb index 36d922194..1978544a4 100644 --- a/spec/hatchet/buildpack_spec.rb +++ b/spec/hatchet/buildpack_spec.rb @@ -12,4 +12,3 @@ end end end - diff --git a/spec/hatchet/ci_spec.rb b/spec/hatchet/ci_spec.rb index e756ea06a..775e7fb40 100644 --- a/spec/hatchet/ci_spec.rb +++ b/spec/hatchet/ci_spec.rb @@ -38,10 +38,9 @@ runner.run_ci do |test_run| expect(test_run.output).to match("Fetching rake") - test_run.instance_variable_set(:"@status", false) - test_run.create_test_run - test_run.wait! { } + test_run.run_again + expect(test_run.output).to match("Using rake") expect(test_run.output).to_not match("Fetching rake") end end diff --git a/spec/hatchet/node_spec.rb b/spec/hatchet/node_spec.rb index 7fd9c43d3..d8ef276b7 100644 --- a/spec/hatchet/node_spec.rb +++ b/spec/hatchet/node_spec.rb @@ -2,17 +2,7 @@ describe "Node" do it "works with node buildpack" do - before_deploy = Proc.new do - run!("rm .buildpacks") - run!("echo https://github.com/heroku/heroku-buildpack-nodejs.git >> .buildpacks") - run!("echo #{Hatchet::App.default_buildpack} >> .buildpacks") - end - - Hatchet::Runner.new( - "node_multi", - before_deploy: before_deploy, - buildpack_url: "https://github.com/heroku/heroku-buildpack-multi.git" - ).deploy do |app| + Hatchet::Runner.new("node_multi", buildpacks: ["heroku/nodejs", :default]).deploy do |app| expect(app.output).to match("Node Version in Ruby buildpack is: v4.1.2") expect(app.run("node -v")).to match("v4.1.2") end @@ -38,4 +28,3 @@ end end end - diff --git a/spec/hatchet/rails4_spec.rb b/spec/hatchet/rails4_spec.rb index 66e7395b6..1b6facc54 100644 --- a/spec/hatchet/rails4_spec.rb +++ b/spec/hatchet/rails4_spec.rb @@ -15,14 +15,6 @@ end end - it "should handle secrets.yml properly" do - Hatchet::Runner.new("rails41_scaffold").deploy do |app, heroku| - ReplRunner.new(:rails_console, "heroku run bin/rails console -a #{app.name}").run do |console| - console.run("ENV['SECRET_KEY_BASE'] == Rails.application.config.secrets.secret_key_base") {|result| expect(result).not_to eq("true") } - end - end - end - it "should not overwrite existing files with cached files" do string = SecureRandom.hex(13) new_string = SecureRandom.hex(13) diff --git a/spec/hatchet/ruby_spec.rb b/spec/hatchet/ruby_spec.rb index d0318c35b..ca5f4089e 100644 --- a/spec/hatchet/ruby_spec.rb +++ b/spec/hatchet/ruby_spec.rb @@ -1,25 +1,6 @@ require_relative '../spec_helper' describe "Ruby apps" do - describe "vendoring libpq" do - it "works on heroku-16" do - skip "Blocked on getting heroku-16 docker example to work https://github.com/schneems/libpq_heroku_16_reproduction/tree/schneems/manually-download-install" - - Hatchet::Runner.new("libpq_connection_error", stack: "heroku-16").deploy do |app| - out = app.run("ruby reproduce_error.rb") - expect(out).to match(%Q{invalid integer value "15s"}) - end - end - - it "works on heroku-18" do - Hatchet::Runner.new("libpq_connection_error", stack: "heroku-18").deploy do |app| - out = app.run("ruby reproduce_error.rb") - expect(out).to match(%Q{invalid integer value "15s"}) - end - end - end - - describe "bad ruby version" do it "gives a helpful error" do Hatchet::Runner.new('ruby_version_does_not_exist', allow_failure: true, stack: DEFAULT_STACK).deploy do |app| @@ -61,32 +42,7 @@ end end - # describe "default WEB_CONCURRENCY" do - # it "auto scales WEB_CONCURRENCY" do - # pending("https://github.com/heroku/api/issues/4426") - # app = Hatchet::Runner.new("default_ruby") - # app.setup! - # app.set_config("SENSIBLE_DEFAULTS" => "enabled") - # app.deploy do |app| - # app.run('echo "loaded"') - # expect(app.run(:bash, 'echo "value: $WEB_CONCURRENCY"', heroku: { size: "1X" } )).to match("value: 2") - # expect(app.run(:bash, 'echo "value: $WEB_CONCURRENCY"', heroku: { size: "2X" } )).to match("value: 4") - # expect(app.run(:bash, 'echo "value: $WEB_CONCURRENCY"', heroku: { size: "PX" } )).to match("value: 16") - # end - # end - # end - describe "Rake detection" do - context "default" do - # it "adds default process types" do - # Hatchet::Runner.new('empty-procfile').deploy do |app| - # app.run("console") do |console| - # console.run("puts 'hello' + 'world'") {|result| expect(result).to match('helloworld')} - # end - # end - # end - end - context "Ruby 1.9+" do it "runs a rake task if the gem exists" do Hatchet::Runner.new('default_with_rakefile').deploy do |app, heroku| @@ -118,7 +74,7 @@ end describe "Raise errors on specific gems" do - it "should should raise on sqlite3" do + it "should raise on sqlite3" do before_deploy = -> { run!(%Q{echo "ruby '2.5.4' >> Gemfile"}) } Hatchet::Runner.new("sqlite3_gemfile", allow_failure: true, before_deploy: before_deploy).deploy do |app| expect(app).not_to be_deployed @@ -128,8 +84,6 @@ end end - - describe "No Lockfile" do it "should not deploy" do Hatchet::Runner.new("no_lockfile", allow_failure: true).deploy do |app| diff --git a/spec/hatchet/stack_spec.rb b/spec/hatchet/stack_spec.rb index 54389a023..0e77f0a73 100644 --- a/spec/hatchet/stack_spec.rb +++ b/spec/hatchet/stack_spec.rb @@ -8,7 +8,7 @@ run!('git commit --allow-empty -m "heroku-16 migrate"') app.push! - puts app.output + expect(app.output).to match("Installing rack 1.5.0") expect(app.output).to match("Changing stack") end diff --git a/spec/helpers/outdated_ruby_version_spec.rb b/spec/helpers/outdated_ruby_version_spec.rb index 29d0a8f1c..69db8925f 100644 --- a/spec/helpers/outdated_ruby_version_spec.rb +++ b/spec/helpers/outdated_ruby_version_spec.rb @@ -110,6 +110,4 @@ def new_fetcher.exists?(value); false; end expect(outdated.eol?).to be_falsey expect(outdated.maybe_eol?).to be_falsey end - end - diff --git a/spec/helpers/rails_runner_spec.rb b/spec/helpers/rails_runner_spec.rb index db123b0e0..8646c232a 100644 --- a/spec/helpers/rails_runner_spec.rb +++ b/spec/helpers/rails_runner_spec.rb @@ -138,4 +138,3 @@ def to_s FileUtils.touch("buildpack.log") end end - diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 0019240ea..eff331830 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -25,10 +25,6 @@ config.include LanguagePack::ShellHelpers end -def git_repo - "https://github.com/heroku/heroku-buildpack-ruby.git" -end - def successful_body(app, options = {}) retry_limit = options[:retry_limit] || 50 url = "http://#{app.name}.herokuapp.com" @@ -41,13 +37,6 @@ def create_file_with_size_in(size, dir) Pathname.new name end -ReplRunner.register_commands(:console) do |config| - config.terminate_command "exit" # the command you use to end the 'rails console' - config.startup_timeout 60 # seconds to boot - config.return_char "\n" # the character that submits the command - config.sync_stdout "STDOUT.sync = true" # force REPL to not buffer standard out -end - if ENV['TRAVIS'] # Don't execute tests against "merge" commits exit 0 if ENV['TRAVIS_PULL_REQUEST'] != 'false' && ENV['TRAVIS_BRANCH'] == 'master' From e1aee0b16fe4b2b7da6927fc135e0c2d2e59b860 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 8 Apr 2020 14:08:34 -0500 Subject: [PATCH 0714/1195] [changelog skip] Clean up paths During the CNB work it was uncovered that there were some behaviors of absolute paths in the `export` file and the profile.d script that were not tested. In looking at these issues some of the code wasn't clear. This is a pure refactor intended to clarify intent. --- lib/language_pack/ruby.rb | 32 +++++++++++++------------------- spec/hatchet/rails5_spec.rb | 6 +++++- spec/hatchet/ruby_spec.rb | 6 +++++- 3 files changed, 23 insertions(+), 21 deletions(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 8335cb4dd..6081e8731 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -208,33 +208,27 @@ def warn_bundler_upgrade # the base PATH environment variable to be used # @return [String] the resulting PATH def default_path(gem_layer_path = ".") - # need to remove bin/ folder since it links + # Need to remove bin/ folder since it links # to the wrong --prefix ruby binstubs # breaking require. This only applies to Ruby 1.9.2 and 1.8.7. - safe_binstubs = binstubs_relative_paths(gem_layer_path) - ["bin", "#{gem_layer_path}/bin"] - paths = [ - ENV["PATH"], - "bin", - system_paths, - ] - paths.unshift("#{slug_vendor_jvm}/bin") if ruby_version.jruby? - paths.unshift(safe_binstubs) - + # + # Because for 1.9.2 and 1.8.7 there is a "build" ruby and a non-"build" Ruby + paths = binstubs_relative_paths(gem_layer_path) + paths << "#{slug_vendor_jvm}/bin" if ruby_version.jruby? + paths << ENV["PATH"] + paths << "$HOME/bin" + paths << "/usr/local/bin:/usr/bin:/bin" paths.join(":") end def binstubs_relative_paths(gem_layer_path = ".") [ - "#{gem_layer_path}/bin", - "#{gem_layer_path}/#{bundler_binstubs_path}", - "#{gem_layer_path}/#{slug_vendor_base}/bin" + "#{gem_layer_path}/#{bundler_binstubs_path}", # Binstubs from bundler, eg. vendor/bundle/bin + "#{gem_layer_path}/#{slug_vendor_base}/bin" # Binstubs from rubygems, eg. vendor/bundle/ruby/2.6.0/bin ] end - def system_paths - "/usr/local/bin:/usr/bin:/bin" - end - + # For example "vendor/bundle/ruby/2.6.0" def self.slug_vendor_base command = %q(ruby -e "require 'rbconfig';puts \"vendor/bundle/#{RUBY_ENGINE}/#{RbConfig::CONFIG['ruby_version']}\"") slug_vendor_base = run_no_pipe(command, user_env: true).chomp @@ -414,7 +408,7 @@ def setup_export(layer = nil) gem_path = "#{build_path}/#{slug_vendor_base}" end set_export_path "GEM_PATH", gem_path, layer - set_export_default "LANG", "en_US.UTF-8", layer + set_export_default "LANG", "en_US.UTF-8", layer # TODO handle jruby if ruby_version.jruby? @@ -436,7 +430,7 @@ def setup_profiled(ruby_layer_path = "$HOME", gem_layer_path = "$HOME") set_env_default "LANG", "en_US.UTF-8" set_env_override "GEM_PATH", "#{gem_layer_path}/#{slug_vendor_base}:$GEM_PATH" - set_env_override "PATH", profiled_path.uniq.join(":") + set_env_override "PATH", profiled_path.join(":") set_env_default "MALLOC_ARENA_MAX", "2" if default_malloc_arena_max? add_to_profiled set_default_web_concurrency if env("SENSIBLE_DEFAULTS") diff --git a/spec/hatchet/rails5_spec.rb b/spec/hatchet/rails5_spec.rb index 529f90812..3e17526c8 100644 --- a/spec/hatchet/rails5_spec.rb +++ b/spec/hatchet/rails5_spec.rb @@ -66,7 +66,11 @@ def worker_task_for_app(app) describe "Rails 5.1" do it "works with webpacker + yarn (js friends)" do - Hatchet::Runner.new("rails51_webpacker").deploy do |app, heroku| + buildpacks = [ + Hatchet::App.default_buildpack, + "https://github.com/sharpstone/force_absolute_paths_buildpack" + ] + Hatchet::Runner.new("rails51_webpacker", buildpacks: buildpacks).deploy do |app, heroku| expect(app.output).to include("Installing yarn") expect(app.output).to include("yarn install") diff --git a/spec/hatchet/ruby_spec.rb b/spec/hatchet/ruby_spec.rb index ca5f4089e..a0066b45c 100644 --- a/spec/hatchet/ruby_spec.rb +++ b/spec/hatchet/ruby_spec.rb @@ -11,7 +11,11 @@ describe "running Ruby from outside the default dir" do it "works" do - Hatchet::Runner.new('cd_ruby', stack: DEFAULT_STACK).deploy do |app| + buildpacks = [ + Hatchet::App.default_buildpack, + "https://github.com/sharpstone/force_absolute_paths_buildpack" + ] + Hatchet::Runner.new('cd_ruby', stack: DEFAULT_STACK, buildpacks: buildpacks).deploy do |app| expect(app.output).to match("cd version ruby 2.5.1") expect(app.run("which ruby").chomp).to eq("/app/bin/ruby") From 2dcce6d6355db8f9427ec35767ec154da4415470 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 13 Apr 2020 16:28:01 -0500 Subject: [PATCH 0715/1195] Use `:default` shorthand for buildpacks in tests Prefer `:default` instead of `Hatchet::App.default_buildpack` in tests. --- Gemfile | 2 +- Gemfile.lock | 34 ++++++++++++++-------------------- spec/hatchet/buildpack_spec.rb | 2 +- spec/hatchet/jvm_spec.rb | 7 +++++-- spec/hatchet/rails5_spec.rb | 4 ++-- spec/hatchet/ruby_spec.rb | 2 +- 6 files changed, 24 insertions(+), 27 deletions(-) diff --git a/Gemfile b/Gemfile index 9836203a0..e3057bd8a 100644 --- a/Gemfile +++ b/Gemfile @@ -15,6 +15,6 @@ group :development, :test do gem "netrc" gem "git", github: "hone/ruby-git", branch: "master" gem 'json', '~> 2.0.2' - gem 'ci-queue', github: 'shopify/ci-queue', branch: 'rspec-log-order' + gem 'ci-queue' gem 'redis' end diff --git a/Gemfile.lock b/Gemfile.lock index c01dea877..d91592a62 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -5,14 +5,6 @@ GIT specs: git (1.2.6) -GIT - remote: https://github.com/shopify/ci-queue.git - revision: 0713fe26a8b0be6290ad109a651b7cf5b242930a - branch: rspec-log-order - specs: - ci-queue (0.16.0) - ansi - GEM remote: https://rubygems.org/ specs: @@ -23,6 +15,8 @@ GEM tzinfo (~> 1.1) zeitwerk (~> 2.2) ansi (1.5.0) + ci-queue (0.17.2) + ansi citrus (3.0.2) concurrent-ruby (1.1.6) diff-lcs (1.3) @@ -50,29 +44,29 @@ GEM moneta (1.0.0) multi_json (1.14.1) netrc (0.11.0) - parallel (1.17.0) - parallel_tests (2.29.1) + parallel (1.19.1) + parallel_tests (2.32.0) parallel platform-api (2.2.0) heroics (~> 0.0.25) moneta (~> 1.0.0) - rake (12.3.2) - redis (4.1.2) + rake (13.0.1) + redis (4.1.3) repl_runner (0.0.3) activesupport rrrretry (1.0.0) - rspec-core (3.8.2) - rspec-support (~> 3.8.0) - rspec-expectations (3.8.4) + rspec-core (3.9.1) + rspec-support (~> 3.9.1) + rspec-expectations (3.9.1) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.8.0) - rspec-retry (0.6.1) + rspec-support (~> 3.9.0) + rspec-retry (0.6.2) rspec-core (> 3.3) - rspec-support (3.8.2) + rspec-support (3.9.2) thor (0.20.3) thread_safe (0.3.6) threaded (0.0.4) - toml-rb (1.1.2) + toml-rb (2.0.1) citrus (~> 3.0, > 3.0) tzinfo (1.2.7) thread_safe (~> 0.1) @@ -82,7 +76,7 @@ PLATFORMS ruby DEPENDENCIES - ci-queue! + ci-queue excon git! heroku_hatchet diff --git a/spec/hatchet/buildpack_spec.rb b/spec/hatchet/buildpack_spec.rb index 1978544a4..9cfa4126d 100644 --- a/spec/hatchet/buildpack_spec.rb +++ b/spec/hatchet/buildpack_spec.rb @@ -4,7 +4,7 @@ it "handles PATH with a newline in it correctly" do buildpacks = [ "https://github.com/sharpstone/export_path_with_newlines_buildpack", - Hatchet::App.default_buildpack, + :default, "https://github.com/heroku/null-buildpack" ] Hatchet::Runner.new("default_ruby", buildpacks: buildpacks).deploy do |app| diff --git a/spec/hatchet/jvm_spec.rb b/spec/hatchet/jvm_spec.rb index b60350cfe..f8369d5b6 100644 --- a/spec/hatchet/jvm_spec.rb +++ b/spec/hatchet/jvm_spec.rb @@ -2,8 +2,11 @@ describe "JvmInstaller" do it "JVM is installed by jvm-common only" do - buildpacks = ["heroku/jvm", - Hatchet::App.default_buildpack] # default is heroku-ruby-buildpack here + buildpacks = [ + "heroku/jvm", + :default # default is heroku-ruby-buildpack here + + ] app = Hatchet::Runner.new("ruby_193_jruby_1_7_27", stack: 'heroku-18', buildpacks: buildpacks) app.setup! diff --git a/spec/hatchet/rails5_spec.rb b/spec/hatchet/rails5_spec.rb index 3e17526c8..94ad52bde 100644 --- a/spec/hatchet/rails5_spec.rb +++ b/spec/hatchet/rails5_spec.rb @@ -42,7 +42,7 @@ def worker_task_for_app(app) "active_storage_local", buildpacks: [ "https://github.com/heroku/heroku-buildpack-activestorage-preview", - Hatchet::App.default_buildpack + :default ] ) app.setup! @@ -67,7 +67,7 @@ def worker_task_for_app(app) describe "Rails 5.1" do it "works with webpacker + yarn (js friends)" do buildpacks = [ - Hatchet::App.default_buildpack, + :default, "https://github.com/sharpstone/force_absolute_paths_buildpack" ] Hatchet::Runner.new("rails51_webpacker", buildpacks: buildpacks).deploy do |app, heroku| diff --git a/spec/hatchet/ruby_spec.rb b/spec/hatchet/ruby_spec.rb index a0066b45c..4de6ec912 100644 --- a/spec/hatchet/ruby_spec.rb +++ b/spec/hatchet/ruby_spec.rb @@ -12,7 +12,7 @@ describe "running Ruby from outside the default dir" do it "works" do buildpacks = [ - Hatchet::App.default_buildpack, + :default, "https://github.com/sharpstone/force_absolute_paths_buildpack" ] Hatchet::Runner.new('cd_ruby', stack: DEFAULT_STACK, buildpacks: buildpacks).deploy do |app| From e49453e9f7f0869356ec62fb9ef809c0854e3a38 Mon Sep 17 00:00:00 2001 From: snyk-bot Date: Sat, 21 Mar 2020 07:12:22 +0000 Subject: [PATCH 0716/1195] fix: Gemfile & Gemfile.lock to reduce vulnerabilities The following vulnerabilities are fixed with an upgrade: - https://snyk.io/vuln/SNYK-RUBY-JSON-560838 --- Gemfile | 2 +- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index e3057bd8a..b0b275268 100644 --- a/Gemfile +++ b/Gemfile @@ -14,7 +14,7 @@ group :development, :test do gem 'rspec-retry' gem "netrc" gem "git", github: "hone/ruby-git", branch: "master" - gem 'json', '~> 2.0.2' + gem 'json', '~> 2.3.0' gem 'ci-queue' gem 'redis' end diff --git a/Gemfile.lock b/Gemfile.lock index d91592a62..fa8b584ac 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -37,7 +37,7 @@ GEM threaded (~> 0) i18n (1.8.2) concurrent-ruby (~> 1.0) - json (2.0.4) + json (2.3.0) minitest (5.14.0) minitest-retry (0.1.9) minitest (>= 5.0) @@ -80,7 +80,7 @@ DEPENDENCIES excon git! heroku_hatchet - json (~> 2.0.2) + json (~> 2.3.0) netrc parallel_tests rake From d8f59287ce27202f28d1d56d46a05f76c5b609b4 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 23 Apr 2020 10:16:15 -0500 Subject: [PATCH 0717/1195] Update Node and Yarn default versions --- CHANGELOG.md | 1 + changelogs/v216/node_yarn.md | 8 ++++++++ lib/language_pack/helpers/nodebin.rb | 4 ++-- 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 changelogs/v216/node_yarn.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 3259b907c..1396f91a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## Master (unreleased) +* Default node version now 12.16.2, yarn is 1.22.4 (https://github.com/heroku/heroku-buildpack-ruby/pull/986) * Gracefully handle unrecognised stacks ([#982](https://github.com/heroku/heroku-buildpack-ruby/pull/982)) ## v215 (4/9/2020) diff --git a/changelogs/v216/node_yarn.md b/changelogs/v216/node_yarn.md new file mode 100644 index 000000000..f8eb7b558 --- /dev/null +++ b/changelogs/v216/node_yarn.md @@ -0,0 +1,8 @@ +## Ruby apps now default to Node version 12.16.2 and Yarn version 1.22.4 + +Applications using the `heroku/ruby` buildpack that do not have a version of Node installed by another buildpack (such as the `heroku/nodejs` buildpack) will now receive: + +- Node version 12.16.2 (was previously 10.15.3) +- Yarn version 1.22.4 (was previously 1.16.0) + +These versions and instructions on how to specify a specific version of these binaries can be found on the [installed binaries section of the Heroku Ruby Support page](https://devcenter.heroku.com/articles/ruby-support#installed-binaries). diff --git a/lib/language_pack/helpers/nodebin.rb b/lib/language_pack/helpers/nodebin.rb index 4d7d4cb00..01ad5b1fe 100644 --- a/lib/language_pack/helpers/nodebin.rb +++ b/lib/language_pack/helpers/nodebin.rb @@ -2,7 +2,7 @@ class LanguagePack::Helpers::Nodebin def self.hardcoded_node_lts - version = "10.15.3" + version = "12.16.2" { "number" => version, "url" => "https://s3.amazonaws.com/heroku-nodebin/node/release/linux-x64/node-v#{version}-linux-x64.tar.gz" @@ -10,7 +10,7 @@ def self.hardcoded_node_lts end def self.hardcoded_yarn - version = "1.16.0" + version = "1.22.4" { "number" => version, "url" => "https://s3.amazonaws.com/heroku-nodebin/yarn/release/yarn-v#{version}.tar.gz" From a4bc1a3074a9c1026e5d8477a6bd8146443b4198 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 6 May 2020 12:17:38 -0500 Subject: [PATCH 0718/1195] CODEOWNERS --- .github/CODEOWNERS | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 000000000..25f6404da --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @heroku/languages From b13291558aa690a45076434a747b310bcde8c263 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 6 May 2020 09:29:22 -0500 Subject: [PATCH 0719/1195] Use Hatchet 6.0.0 It comes with automatic rate throttling from the platform-api. --- Gemfile.lock | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index fa8b584ac..f2756ec1f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -22,15 +22,14 @@ GEM diff-lcs (1.3) erubis (2.7.0) excon (0.73.0) - heroics (0.0.25) + heroics (0.1.1) erubis (~> 2.0) excon moneta multi_json (>= 1.9.2) - heroku_hatchet (5.0.1) + heroku_hatchet (6.0.0) excon (~> 0) - minitest-retry (~> 0.1.9) - platform-api (~> 2) + platform-api (= 3.0.0.pre.1) repl_runner (~> 0.0.3) rrrretry (~> 1) thor (~> 0) @@ -39,18 +38,18 @@ GEM concurrent-ruby (~> 1.0) json (2.3.0) minitest (5.14.0) - minitest-retry (0.1.9) - minitest (>= 5.0) moneta (1.0.0) multi_json (1.14.1) netrc (0.11.0) parallel (1.19.1) parallel_tests (2.32.0) parallel - platform-api (2.2.0) - heroics (~> 0.0.25) + platform-api (3.0.0.pre.1) + heroics (~> 0.1.1) moneta (~> 1.0.0) + rate_throttle_client (~> 0.1.0) rake (13.0.1) + rate_throttle_client (0.1.1) redis (4.1.3) repl_runner (0.0.3) activesupport From 3c8d87fe435abca440de84a75a4f97e246e011eb Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 6 May 2020 09:36:07 -0500 Subject: [PATCH 0720/1195] Update changelog check triggers --- .github/workflows/check_changelog.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check_changelog.yml b/.github/workflows/check_changelog.yml index 64f4f2bd0..bf4868e83 100644 --- a/.github/workflows/check_changelog.yml +++ b/.github/workflows/check_changelog.yml @@ -1,7 +1,8 @@ name: Check Changelog -on: [pull_request] - +on: + pull_request: + types: [opened, reopened, edited] jobs: build: runs-on: ubuntu-latest From e35c3203ab404923ed926a906885a519a990c688 Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 7 May 2020 14:05:07 -0500 Subject: [PATCH 0721/1195] [close #981][changelog skip] Clean up README --- README.md | 111 +----------------------------------------------------- 1 file changed, 1 insertion(+), 110 deletions(-) diff --git a/README.md b/README.md index 9def42bc5..e7d6672b5 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Example Usage: $ ls Gemfile Gemfile.lock - $ heroku create --buildpack https://github.com/heroku/heroku-buildpack-ruby.git + $ heroku create --buildpack heroku/ruby $ git push heroku master ... @@ -34,78 +34,6 @@ Example Usage: The buildpack will detect your app as Ruby if it has a `Gemfile` and `Gemfile.lock` files in the root directory. It will then proceed to run `bundle install` after setting up the appropriate environment for [ruby](http://ruby-lang.org) and [Bundler](https://bundler.io). -#### Bundler - -For non-windows `Gemfile.lock` files, the `--deployment` flag will be used. In the case of windows, the Gemfile.lock will be deleted and Bundler will do a full resolve so native gems are handled properly. The `vendor/bundle` directory is cached between builds to allow for faster `bundle install` times. `bundle clean` is used to ensure no stale gems are stored between builds. - -### Rails 2 - -Example Usage: - - $ ls - app config db doc Gemfile Gemfile.lock lib log public Rakefile README script test tmp vendor - - $ ls config/environment.rb - config/environment.rb - - $ heroku create --buildpack https://github.com/heroku/heroku-buildpack-ruby.git - - $ git push heroku master - ... - -----> Heroku receiving push - -----> Ruby/Rails app detected - -----> Installing dependencies using Bundler version 1.1.rc - ... - -----> Writing config/database.yml to read from DATABASE_URL - -----> Rails plugin injection - Injecting rails_log_stdout - -----> Discovering process types - Procfile declares types -> (none) - Default types for Ruby/Rails -> console, rake, web, worker - -The buildpack will detect your app as a Rails 2 app if it has a `environment.rb` file in the `config` directory. - -#### Rails Log STDOUT -A [rails_log_stdout](http://github.com/ddollar/rails_log_stdout) is installed by default so Rails' logger will log to STDOUT and picked up by Heroku's [logplex](http://github.com/heroku/logplex). - -#### Auto Injecting Plugins - -Any vendored plugin can be stopped from being installed by creating the directory it's installed to in the slug. For instance, to prevent rails_log_stdout plugin from being injected, add `vendor/plugins/rails_log_stdout/.gitkeep` to your git repo. - -### Rails 3 - -Example Usage: - - $ ls - app config config.ru db doc Gemfile Gemfile.lock lib log Procfile public Rakefile README script tmp vendor - - $ ls config/application.rb - config/application.rb - - $ heroku create --buildpack https://github.com/heroku/heroku-buildpack-ruby.git - - $ git push heroku master - -----> Heroku receiving push - -----> Ruby/Rails app detected - -----> Installing dependencies using Bundler version 1.1.rc - Running: bundle install --without development:test --path vendor/bundle --deployment - ... - -----> Writing config/database.yml to read from DATABASE_URL - -----> Preparing app for Rails asset pipeline - Running: rake assets:precompile - -----> Rails plugin injection - Injecting rails_log_stdout - Injecting rails3_serve_static_assets - -----> Discovering process types - Procfile declares types -> web - Default types for Ruby/Rails -> console, rake, worker - -The buildpack will detect your apps as a Rails 3 app if it has an `application.rb` file in the `config` directory. - -#### Assets - -To enable static assets being served on the dyno, [rails3_serve_static_assets](http://github.com/pedro/rails3_serve_static_assets) is installed by default. If the [execjs gem](http://github.com/sstephenson/execjs) is detected then [node.js](http://github.com/joyent/node) will be vendored. The `assets:precompile` rake task will get run if no `public/manifest.yml` is detected. See [this article](http://devcenter.heroku.com/articles/rails31_heroku_cedar) on how rails 3.1 works on cedar. - ## Documentation For more information about using Ruby and buildpacks on Heroku, see these Dev Center articles: @@ -120,30 +48,6 @@ For more information about using Ruby and buildpacks on Heroku, see these Dev Ce To use this buildpack, fork it on Github. Push up changes to your fork, then create a test app with `--buildpack ` and push to it. -To change the vendored binaries for Bundler, [Node.js](http://github.com/joyent/node), and rails plugins, use the rake tasks provided by the `Rakefile`. You'll need an S3-enabled AWS account and a bucket to store your binaries in as well as the [vulcan](http://github.com/heroku/vulcan) gem to build the binaries on heroku. - -For example, you can change the vendored version of Bundler to 1.1.rc. - -First you'll need to build a Heroku-compatible version of Node.js: - - $ export AWS_ID=xxx AWS_SECRET=yyy S3_BUCKET=zzz - $ s3 create $S3_BUCKET - $ rake gem:install[bundler,1.1.rc] - -Open `lib/language_pack/ruby.rb` in your editor, and change the following line: - - BUNDLER_VERSION = "1.11.2" - -Open `lib/language_pack/base.rb` in your editor, and change the following line: - - VENDOR_URL = "https://s3.amazonaws.com/zzz" - -Commit and push the changes to your buildpack to your Github fork, then push your sample app to Heroku to test. You should see: - - -----> Installing dependencies using Bundler version 1.1.rc - -NOTE: You'll need to vendor the plugins, node, Bundler, and libyaml by running the rake tasks for the buildpack to work properly. - ### Testing The tests on this buildpack are written in Rspec to allow the use of @@ -156,19 +60,6 @@ it does not parallelize tests within a test file. To run the tests: clone the re $ bundle exec hatchet install ``` -then go to [hatchet](https://github.com/heroku/hatchet) repo and follow the -instructions to set it up. - -Now run the tests: - -```sh -$ bundle exec parallel_rspec -n 6 spec/ -``` - -If you don't want to run them in parallel you can still: - ```sh $ bundle exec rake spec ``` - -Now go take a nap or do something for a really long time. From 18babb26ac77ec3b2d6236629ceb554136068b1b Mon Sep 17 00:00:00 2001 From: schneems Date: Fri, 8 May 2020 14:07:12 -0500 Subject: [PATCH 0722/1195] [changelog skip] Fix check changelog action --- .github/workflows/check_changelog.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check_changelog.yml b/.github/workflows/check_changelog.yml index bf4868e83..1e9febe54 100644 --- a/.github/workflows/check_changelog.yml +++ b/.github/workflows/check_changelog.yml @@ -2,7 +2,7 @@ name: Check Changelog on: pull_request: - types: [opened, reopened, edited] + types: [opened, reopened, edited, synchronize] jobs: build: runs-on: ubuntu-latest From 65c39f7e0d41bb9a44a9b74c0aafffc66250e487 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 11 May 2020 13:48:28 -0500 Subject: [PATCH 0723/1195] Failing test --- spec/hatchet/ruby_spec.rb | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/spec/hatchet/ruby_spec.rb b/spec/hatchet/ruby_spec.rb index 4de6ec912..e106e4b04 100644 --- a/spec/hatchet/ruby_spec.rb +++ b/spec/hatchet/ruby_spec.rb @@ -9,6 +9,39 @@ end end + describe "exporting path" do + it "puts local bin dir in path" do + before_deploy = Proc.new do + run!("mkdir bin") + File.open("bin/bloop", "w+") do |f| + f.puts(<<~EOF) + #!/usr/bin/env bash + + echo "bloop" + EOF + end + run!("chmod +x bin/bloop") + + File.open("Rakefile", "a") do |f| + f.puts(<<~EOF) + task "run:bloop" do + puts `bloop` + raise "Could not bloop" unless $?.success? + end + EOF + end + end + buildpacks = [ + :default, + "https://github.com/schneems/buildpack-ruby-rake-deploy-tasks" + ] + config = { "DEPLOY_TASKS" => "run:bloop"} + Hatchet::Runner.new('default_ruby', stack: DEFAULT_STACK, buildpacks: buildpacks, config: config, before_deploy: before_deploy).deploy do |app| + expect(app.output).to match("bloop") + end + end + end + describe "running Ruby from outside the default dir" do it "works" do buildpacks = [ From 8413eecb42ce8a99b47194ab9d237093175b915f Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 11 May 2020 12:36:11 -0500 Subject: [PATCH 0724/1195] Fix regression caused in #980 In #980 this value was being added to the export file: ``` /tmp//$HOME/bin ``` > Where is a random value for every run. In codon $HOME is set to `/app` instead of `/tmp/` so this will be expanded to: ``` /tmp///home/bin ``` Which does not exist. This PR expands gets rid of $HOME use except in profile.d and uses an expanded path in the regular buildpack environment. ## Reproduction To reproduce this failure, you can point an app at master current commit: ``` $ heroku buildpacks 1. https://github.com/heroku/heroku-buildpack-ruby#479faabc67d38bf8f1e7f55dd22b512ee78e3294 2. https://github.com/schneems/buildpack-ruby-rake-deploy-tasks#schneems/debug ``` ``` $ heroku config | grep DEPLOY DEPLOY_TASKS: db:migrate ``` ``` $ cat Gemfile.lock | grep railties railties (>= 3.2, < 6.1) railties (>= 4.2.0) railties (>= 4.2.0) railties (>= 3.2) railties (>= 3.1) railties (= 5.2.4.2) railties (5.2.4.2) railties (>= 5.0) railties (>= 4.2) railties (>= 5.2.0) railties (>= 4.0.0) railties (>= 4.0.0) ``` This results in a failure when deploying: ``` remote: -----> Rake app detected remote: PATH: remote: /tmp/build_a711fa6dc6a465c901c1be9eacfd193a/./vendor/bundle/bin:/tmp/build_a711fa6dc6a465c901c1be9eacfd193a/./vendor/bundle/ruby/2.5.0/bin:/tmp/build_a711fa6dc6a465c901c1be9eacfd193a/vendor/ruby-2.5.8/bin:/tmp/tmp.bajvtvlsrP/bin/:/usr/local/bin:/usr/bin:/bin:/tmp/codon/vendor/bin:/tmp/build_a711fa6dc6a465c901c1be9eacfd193a//app/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/bin:/usr/bin:/bin:/tmp/codon/vendor/bin remote: rake aborted! remote: ExecJS::RuntimeUnavailable: Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes. remote: /tmp/build_a711fa6dc6a465c901c1be9eacfd193a/vendor/bundle/ruby/2.5.0/gems/execjs-2.7.0/lib/execjs/runtimes.rb:58:in `autodetect' remote: /tmp/build_a711fa6dc6a465c901c1be9eacfd193a/vendor/bundle/ruby/2.5.0/gems/execjs-2.7.0/lib/execjs.rb:5:in `' remote: /tmp/build_a711fa6dc6a465c901c1be9eacfd193a/vendor/bundle/ruby/2.5.0/gems/execjs-2.7.0/lib/execjs.rb:4:in `' remote: /tmp/build_a711fa6dc6a465c901c1be9eacfd193a/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require' remote: /tmp/build_a711fa6dc6a465c901c1be9eacfd193a/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi' remote: /tmp/build_a711fa6dc6a465c901c1be9eacfd193a/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register' remote: /tmp/build_a711fa6dc6a465c901c1be9eacfd193a/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi' remote: /tmp/build_a711fa6dc6a465c901c1be9eacfd193a/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require' remote: /tmp/build_a711fa6dc6a465c901c1be9eacfd193a/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:291:in `block in require' remote: /tmp/build_a711fa6dc6a465c901c1be9eacfd193a/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:257:in `load_dependency' remote: /tmp/build_a711fa6dc6a465c901c1be9eacfd193a/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:291:in `require' remote: /tmp/build_a711fa6dc6a465c901c1be9eacfd193a/vendor/bundle/ruby/2.5.0/gems/uglifier-4.2.0/lib/uglifier.rb:5:in `' remote: /tmp/build_a711fa6dc6a465c901c1be9eacfd193a/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require' remote: /tmp/build_a711fa6dc6a465c901c1be9eacfd193a/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi' remote: /tmp/build_a711fa6dc6a465c901c1be9eacfd193a/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register' remote: /tmp/build_a711fa6dc6a465c901c1be9eacfd193a/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi' remote: /tmp/build_a711fa6dc6a465c901c1be9eacfd193a/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require' remote: /tmp/build_a711fa6dc6a465c901c1be9eacfd193a/vendor/bundle/ruby/2.5.0/gems/bundler-2.0.2/lib/bundler/runtime.rb:81:in `block (2 levels) in require' remote: /tmp/build_a711fa6dc6a465c901c1be9eacfd193a/vendor/bundle/ruby/2.5.0/gems/bundler-2.0.2/lib/bundler/runtime.rb:76:in `each' remote: /tmp/build_a711fa6dc6a465c901c1be9eacfd193a/vendor/bundle/ruby/2.5.0/gems/bundler-2.0.2/lib/bundler/runtime.rb:76:in `block in require' remote: /tmp/build_a711fa6dc6a465c901c1be9eacfd193a/vendor/bundle/ruby/2.5.0/gems/bundler-2.0.2/lib/bundler/runtime.rb:65:in `each' remote: /tmp/build_a711fa6dc6a465c901c1be9eacfd193a/vendor/bundle/ruby/2.5.0/gems/bundler-2.0.2/lib/bundler/runtime.rb:65:in `require' remote: /tmp/build_a711fa6dc6a465c901c1be9eacfd193a/vendor/bundle/ruby/2.5.0/gems/bundler-2.0.2/lib/bundler.rb:114:in `require' remote: /tmp/build_a711fa6dc6a465c901c1be9eacfd193a/config/application.rb:7:in `' remote: /tmp/build_a711fa6dc6a465c901c1be9eacfd193a/Rakefile:4:in `require_relative' remote: /tmp/build_a711fa6dc6a465c901c1be9eacfd193a/Rakefile:4:in `' remote: /tmp/build_a711fa6dc6a465c901c1be9eacfd193a/vendor/bundle/ruby/2.5.0/gems/rake-13.0.1/exe/rake:27:in `' remote: (See full trace by running task with --trace) remote: ! Push rejected, failed to compile Rake app. remote: remote: ! Push failed remote: Verifying deploy... remote: remote: ! Push rejected to morning-sea-36366. remote: To https://git.heroku.com/morning-sea-36366.git ``` Note the bad path in the debug output: ``` /tmp/build_a711fa6dc6a465c901c1be9eacfd193a//app/bin ``` ## Related - https://github.com/heroku/heroku-buildpack-ruby/pull/987 - Internal Support ticket: https://heroku.support/856187 --- lib/language_pack/ruby.rb | 54 ++++++++++++------------------- lib/language_pack/ruby_version.rb | 4 +++ lib/language_pack/test/rails2.rb | 2 +- lib/language_pack/test/ruby.rb | 4 +-- spec/cnb/basic_local_pack_spec.rb | 15 ++++++--- 5 files changed, 38 insertions(+), 41 deletions(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 6081e8731..665602191 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -98,9 +98,8 @@ def compile warn_bundler_upgrade install_ruby(slug_vendor_ruby, build_ruby_path) install_jvm - setup_language_pack_environment - setup_export - setup_profiled + setup_language_pack_environment(ruby_layer_path: File.expand_path("."), gem_layer_path: File.expand_path(".")) + setup_profiled(ruby_layer_path: "$HOME", gem_layer_path: "$HOME") # $HOME is set to /app at run time allow_git do install_bundler_in_app(slug_vendor_base) load_bundler_cache @@ -113,6 +112,7 @@ def compile config_detect best_practice_warnings warn_outdated_ruby + setup_export cleanup super end @@ -134,9 +134,9 @@ def build ruby_layer.write gem_layer = Layer.new(@layer_dir, "gems", launch: true, cache: true) - setup_language_pack_environment(ruby_layer.path, gem_layer.path) + setup_language_pack_environment(ruby_layer_path: ruby_layer.path, gem_layer_path: gem_layer.path) setup_export(gem_layer) - setup_profiled(ruby_layer.path, gem_layer.path) + setup_profiled(ruby_layer_path: ruby_layer.path, gem_layer_path: gem_layer.path) allow_git do # TODO install bundler in separate layer topic "Loading Bundler Cache" @@ -205,28 +205,6 @@ def warn_bundler_upgrade end end - # the base PATH environment variable to be used - # @return [String] the resulting PATH - def default_path(gem_layer_path = ".") - # Need to remove bin/ folder since it links - # to the wrong --prefix ruby binstubs - # breaking require. This only applies to Ruby 1.9.2 and 1.8.7. - # - # Because for 1.9.2 and 1.8.7 there is a "build" ruby and a non-"build" Ruby - paths = binstubs_relative_paths(gem_layer_path) - paths << "#{slug_vendor_jvm}/bin" if ruby_version.jruby? - paths << ENV["PATH"] - paths << "$HOME/bin" - paths << "/usr/local/bin:/usr/bin:/bin" - paths.join(":") - end - - def binstubs_relative_paths(gem_layer_path = ".") - [ - "#{gem_layer_path}/#{bundler_binstubs_path}", # Binstubs from bundler, eg. vendor/bundle/bin - "#{gem_layer_path}/#{slug_vendor_base}/bin" # Binstubs from rubygems, eg. vendor/bundle/ruby/2.6.0/bin - ] - end # For example "vendor/bundle/ruby/2.6.0" def self.slug_vendor_base @@ -351,7 +329,7 @@ def default_java_mem end # sets up the environment variables for the build process - def setup_language_pack_environment(ruby_layer_path = ".", gem_layer_path = ".") + def setup_language_pack_environment(ruby_layer_path:, gem_layer_path:) instrument 'ruby.setup_language_pack_environment' do if ruby_version.jruby? ENV["PATH"] += ":bin" @@ -383,7 +361,15 @@ def setup_language_pack_environment(ruby_layer_path = ".", gem_layer_path = ".") gem_path = "#{gem_layer_path}/#{slug_vendor_base}" ENV["GEM_PATH"] = gem_path ENV["GEM_HOME"] = gem_path - ENV["PATH"] = default_path(gem_layer_path) + + paths = [] + paths << "#{ruby_layer_path}/bin" unless ruby_version.ruby_192_or_lower? # For Ruby 1.9.2 and lower there is a "build" and non-"build" Ruby + paths << "#{gem_layer_path}/#{bundler_binstubs_path}" # Binstubs from bundler, eg. vendor/bundle/bin + paths << "#{gem_layer_path}/#{slug_vendor_base}/bin" # Binstubs from rubygems, eg. vendor/bundle/ruby/2.6.0/bin + paths << "#{slug_vendor_jvm}/bin" if ruby_version.jruby? + paths << ENV["PATH"] + + ENV["PATH"] = paths.join(":") end end @@ -421,11 +407,13 @@ def setup_export(layer = nil) end # sets up the profile.d script for this buildpack - def setup_profiled(ruby_layer_path = "$HOME", gem_layer_path = "$HOME") + def setup_profiled(ruby_layer_path: , gem_layer_path: ) instrument 'setup_profiled' do - profiled_path = ["$HOME/bin"] - profiled_path << binstubs_relative_paths(gem_layer_path) - profiled_path << "$HOME/vendor/#{@yarn_installer.binary_path}" if has_yarn_binary? + profiled_path = [] + profiled_path << "$HOME/bin" # /app in production + profiled_path << "#{gem_layer_path}/#{bundler_binstubs_path}" # Binstubs from bundler, eg. vendor/bundle/bin + profiled_path << "#{gem_layer_path}/#{slug_vendor_base}/bin" # Binstubs from rubygems, eg. vendor/bundle/ruby/2.6.0/bin + profiled_path << "#{ruby_layer_path}/vendor/#{@yarn_installer.binary_path}" if has_yarn_binary? profiled_path << "$PATH" set_env_default "LANG", "en_US.UTF-8" diff --git a/lib/language_pack/ruby_version.rb b/lib/language_pack/ruby_version.rb index 6bb113632..a74c0dfc1 100644 --- a/lib/language_pack/ruby_version.rb +++ b/lib/language_pack/ruby_version.rb @@ -38,6 +38,10 @@ def initialize(bundler_output, app = {}) @version_without_patchlevel = @version.sub(/-p-?\d+/, '') end + def ruby_192_or_lower? + Gem::Version.new(self.ruby_version) <= Gem::Version.new("1.9.2") + end + # https://github.com/bundler/bundler/issues/4621 def version_for_download if rbx? diff --git a/lib/language_pack/test/rails2.rb b/lib/language_pack/test/rails2.rb index 17cacdd8b..e3aa8444a 100644 --- a/lib/language_pack/test/rails2.rb +++ b/lib/language_pack/test/rails2.rb @@ -1,7 +1,7 @@ #module LanguagePack::Test::Rails2 class LanguagePack::Rails2 # sets up the profile.d script for this buildpack - def setup_profiled + def setup_profiled(ruby_layer_path: , gem_layer_path: ) super set_env_default "RACK_ENV", "test" set_env_default "RAILS_ENV", "test" diff --git a/lib/language_pack/test/ruby.rb b/lib/language_pack/test/ruby.rb index 4f48b740d..9b3097a8a 100644 --- a/lib/language_pack/test/ruby.rb +++ b/lib/language_pack/test/ruby.rb @@ -7,9 +7,9 @@ def compile remove_vendor_bundle install_ruby(slug_vendor_ruby, build_ruby_path) install_jvm - setup_language_pack_environment + setup_language_pack_environment(ruby_layer_path: File.expand_path("."), gem_layer_path: File.expand_path(".")) setup_export - setup_profiled + setup_profiled(ruby_layer_path: "$HOME", gem_layer_path: "$HOME") # $HOME is set to /app at run time allow_git do install_bundler_in_app(slug_vendor_base) load_bundler_cache diff --git a/spec/cnb/basic_local_pack_spec.rb b/spec/cnb/basic_local_pack_spec.rb index 31a73522d..bb7c40bba 100644 --- a/spec/cnb/basic_local_pack_spec.rb +++ b/spec/cnb/basic_local_pack_spec.rb @@ -1,6 +1,5 @@ require_relative '../spec_helper' - class CnbRun attr_accessor :image_name, :output, :repo_path, :buildpack_path, :builder @@ -14,8 +13,7 @@ def initialize(repo_path, builder: "heroku/buildpacks:18", buildpack_path: ) def call command = "pack build #{image_name} --path #{repo_path} --buildpack #{buildpack_path} --builder heroku/buildpacks:18" - @output = `#{command}` - raise "Command #{command.inspect} failed. Output: #{out}" unless $?.success? + @output = run_local!(command) yield self ensure teardown @@ -23,9 +21,10 @@ def call def teardown return unless image_name + repo_name, tag_name = image_name.split(":") - docker_list = run("docker images | grep #{image_name}").chomp - run!("docker rmi #{image_name}") if !docker_list.empty? + docker_list = run_local!("docker images --no-trunc | grep #{repo_name} | grep #{tag_name}").chomp + run_local!("docker rmi #{image_name} --force") if !docker_list.empty? @image_name = nil end @@ -38,6 +37,12 @@ def run!(cmd) raise "Command #{cmd.inspect} failed. Output: #{out}" unless $?.success? out end + + private def run_local!(cmd) + out = `#{cmd}` + raise "Command #{cmd.inspect} failed. Output: #{out}" unless $?.success? + out + end end describe "cnb" do From aab79f014bbf684421e3b6afb5349d7db8cdf7d6 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 13 May 2020 12:33:46 -0500 Subject: [PATCH 0725/1195] Export CNB values later --- lib/language_pack/ruby.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 665602191..455d1fb44 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -135,7 +135,6 @@ def build gem_layer = Layer.new(@layer_dir, "gems", launch: true, cache: true) setup_language_pack_environment(ruby_layer_path: ruby_layer.path, gem_layer_path: gem_layer.path) - setup_export(gem_layer) setup_profiled(ruby_layer_path: ruby_layer.path, gem_layer_path: gem_layer.path) allow_git do # TODO install bundler in separate layer @@ -159,6 +158,7 @@ def build install_binaries run_assets_precompile_rake_task end + setup_export(gem_layer) config_detect best_practice_warnings cleanup @@ -363,7 +363,7 @@ def setup_language_pack_environment(ruby_layer_path:, gem_layer_path:) ENV["GEM_HOME"] = gem_path paths = [] - paths << "#{ruby_layer_path}/bin" unless ruby_version.ruby_192_or_lower? # For Ruby 1.9.2 and lower there is a "build" and non-"build" Ruby + paths << "#{File.expand_path(".")}/bin" unless ruby_version.ruby_192_or_lower? # For Ruby 1.9.2 and lower there is a "build" and non-"build" Ruby paths << "#{gem_layer_path}/#{bundler_binstubs_path}" # Binstubs from bundler, eg. vendor/bundle/bin paths << "#{gem_layer_path}/#{slug_vendor_base}/bin" # Binstubs from rubygems, eg. vendor/bundle/ruby/2.6.0/bin paths << "#{slug_vendor_jvm}/bin" if ruby_version.jruby? From 8c6b955a034fd074632b8704d4c03275658f5adc Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 14 May 2020 14:17:21 -0500 Subject: [PATCH 0726/1195] Add code comment back in --- lib/language_pack/ruby.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 455d1fb44..f5d7a6c1f 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -358,12 +358,15 @@ def setup_language_pack_environment(ruby_layer_path:, gem_layer_path:) ENV[key] ||= value end + paths = [] gem_path = "#{gem_layer_path}/#{slug_vendor_base}" ENV["GEM_PATH"] = gem_path ENV["GEM_HOME"] = gem_path - paths = [] - paths << "#{File.expand_path(".")}/bin" unless ruby_version.ruby_192_or_lower? # For Ruby 1.9.2 and lower there is a "build" and non-"build" Ruby + # Need to remove `./bin` folder since it links to the wrong --prefix ruby binstubs breaking require in Ruby 1.9.2 and 1.8.7. + # Because for 1.9.2 and 1.8.7 there is a "build" ruby and a non-"build" Ruby + paths << "#{File.expand_path(".")}/bin" unless ruby_version.ruby_192_or_lower? + paths << "#{gem_layer_path}/#{bundler_binstubs_path}" # Binstubs from bundler, eg. vendor/bundle/bin paths << "#{gem_layer_path}/#{slug_vendor_base}/bin" # Binstubs from rubygems, eg. vendor/bundle/ruby/2.6.0/bin paths << "#{slug_vendor_jvm}/bin" if ruby_version.jruby? From c48f7c0ae931f36bb7684a7785853baf69ec5cde Mon Sep 17 00:00:00 2001 From: Ed Morley <501702+edmorley@users.noreply.github.com> Date: Sun, 17 May 2020 20:26:19 +0100 Subject: [PATCH 0727/1195] Stop using heroku-buildpack-apt to install git Since the `git` package is already installed on all stacks, so the APT buildpack usage is a no-op. See: https://devcenter.heroku.com/articles/stack-packages Refs W-7579108. --- Aptfile | 1 - app.json | 1 - 2 files changed, 2 deletions(-) delete mode 100644 Aptfile diff --git a/Aptfile b/Aptfile deleted file mode 100644 index 5664e303b..000000000 --- a/Aptfile +++ /dev/null @@ -1 +0,0 @@ -git diff --git a/app.json b/app.json index d6f64eae5..0f309365b 100644 --- a/app.json +++ b/app.json @@ -23,7 +23,6 @@ "test": "bundle exec rspec-queue --max-requeues=3 --timeout 180 --queue $REDIS_URL --exclude-pattern 'cnb/**/*' || { cat log/test_order.log; $(exit 1); }" }, "buildpacks": [ - { "url": "https://github.com/heroku/heroku-buildpack-apt" }, { "url": "https://github.com/heroku/heroku-buildpack-cli.git" }, { "url": "https://github.com/heroku/heroku-buildpack-ruby#v211" } ] From 55ab1cb60cc58e2ede101625de886755ca3fa2cf Mon Sep 17 00:00:00 2001 From: Ed Morley <501702+edmorley@users.noreply.github.com> Date: Sun, 17 May 2020 20:34:36 +0100 Subject: [PATCH 0728/1195] Remove unused rake buildpack:* commands Since buildpack publishing is now performed using the buildpack-registry CLI plugin instead: https://github.com/heroku/heroku-buildpack-cli https://github.com/heroku/languages-team/blob/master/languages/ruby/deploy.md These commands were the last consumers of the `git` and `netrc` gems, so those have been removed as dependencies. Refs W-7579108. --- Gemfile | 2 - Gemfile.lock | 10 --- Rakefile | 211 --------------------------------------------------- 3 files changed, 223 deletions(-) diff --git a/Gemfile b/Gemfile index b0b275268..c9f62d30a 100644 --- a/Gemfile +++ b/Gemfile @@ -12,8 +12,6 @@ group :development, :test do gem "rake" gem "parallel_tests" gem 'rspec-retry' - gem "netrc" - gem "git", github: "hone/ruby-git", branch: "master" gem 'json', '~> 2.3.0' gem 'ci-queue' gem 'redis' diff --git a/Gemfile.lock b/Gemfile.lock index f2756ec1f..e08e5ee1e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,10 +1,3 @@ -GIT - remote: https://github.com/hone/ruby-git.git - revision: 264836fcff3c037d8d8fc44bd770b150b46fdc4e - branch: master - specs: - git (1.2.6) - GEM remote: https://rubygems.org/ specs: @@ -40,7 +33,6 @@ GEM minitest (5.14.0) moneta (1.0.0) multi_json (1.14.1) - netrc (0.11.0) parallel (1.19.1) parallel_tests (2.32.0) parallel @@ -77,10 +69,8 @@ PLATFORMS DEPENDENCIES ci-queue excon - git! heroku_hatchet json (~> 2.3.0) - netrc parallel_tests rake redis diff --git a/Rakefile b/Rakefile index 5e13030a3..e02fb7513 100644 --- a/Rakefile +++ b/Rakefile @@ -4,7 +4,6 @@ require 'hatchet/tasks' ENV["BUILDPACK_LOG_FILE"] ||= "tmp/buildpack.log" S3_BUCKET_NAME = "heroku-buildpack-ruby" -VENDOR_URL = "https://s3.amazonaws.com/#{S3_BUCKET_NAME}" def s3_tools_dir File.expand_path("../support/s3", __FILE__) @@ -87,216 +86,6 @@ task "ruby:manifest" do end end -namespace :buildpack do - require 'netrc' - require 'excon' - require 'json' - require 'time' - require 'cgi' - require 'git' - require 'fileutils' - require 'digest/md5' - require 'securerandom' - - def connection - @connection ||= begin - user, password = Netrc.read["api.heroku.com"] - Excon.new("https://#{CGI.escape(user)}:#{password}@buildkits.heroku.com") - end - end - - def latest_release - @latest_release ||= begin - buildpack_name = "heroku/ruby" - response = connection.get(path: "buildpacks/#{buildpack_name}/revisions") - releases = JSON.parse(response.body) - - # { - # "tar_link": "https://codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/ruby-v84.tgz", - # "created_at": "2013-11-06T18:55:04Z", - # "published_by": "richard@heroku.com", - # "id": 84 - # } - releases.map! do |a| - a["created_at"] = Time.parse(a["created_at"]) - a - end.sort! { |a,b| b["created_at"] <=> a["created_at"] } - releases.first - end - end - - def new_version - @new_version ||= "v#{latest_release["id"] + 1}" - end - - def git - @git ||= Git.open(".") - end - - desc "increment buildpack version" - task :increment do - version_file = './lib/language_pack/version' - require './lib/language_pack' - require version_file - - if LanguagePack::Base::BUILDPACK_VERSION != new_version - stashes = nil - - if git.status.changed.any? - stashes = Git::Stashes.new(git) - stashes.save("WIP") - end - - File.open("#{version_file}.rb", 'w') do |file| - file.puts <<-FILE -require "language_pack/base" - -# This file is automatically generated by rake -module LanguagePack - class LanguagePack::Base - BUILDPACK_VERSION = "#{new_version}" - end -end -FILE - end - - git.add "#{version_file}.rb" - git.commit "bump to #{new_version}" - - stashes.pop if stashes - - puts "Bumped to #{new_version}" - else - puts "Already on #{new_version}" - end - end - - def changelog_entry? - File.read("./CHANGELOG.md").split("\n").any? {|line| line.match(/^## #{new_version}/) } - end - - desc "check if there's a changelog for the new version" - task :changelog do - if changelog_entry? - puts "Changelog for #{new_version} exists" - else - puts "Please add a changelog entry for #{new_version}" - end - end - - def github_remote - @github_remote ||= git.remotes.detect {|remote| remote.url.match(%r{heroku/heroku-buildpack-ruby.git$}) } - - end - - def git_push_master - puts "Pushing master" - git.push(github_remote, 'master', false) - $?.success? - end - - desc "update master branch" - task :git_push_master do - git_push_master - end - - desc "stage a tarball of the buildpack" - task :stage do - Dir.mktmpdir("heroku-buildpack-ruby") do |tmpdir| - Git.clone(File.expand_path("."), 'heroku-buildpack-ruby', path: tmpdir) - Dir.chdir(tmpdir) do - sh "curl #{latest_release["tar_link"]} > ruby.tgz" - - Dir.chdir("heroku-buildpack-ruby") do |buildpack_dir| - $:.unshift File.expand_path("../lib", __FILE__) - require "language_pack/installers/heroku_ruby_installer" - require "language_pack/ruby_version" - - %w(cedar-14 heroku-16).each do |stack| - installer = LanguagePack::Installers::HerokuRubyInstaller.new(stack) - ruby_version = LanguagePack::RubyVersion.new("ruby-#{LanguagePack::RubyVersion::DEFAULT_VERSION_NUMBER}") - installer.fetch_unpack(ruby_version, "vendor/ruby/#{stack}") - end - sh "tar xzf ../ruby.tgz .env" - sh "tar czf ../buildpack.tgz * .env" - end - - @digest = Digest::MD5.hexdigest(File.read("buildpack.tgz")) - end - - filename = "buildpacks/#{@digest}.tgz" - puts "Writing to #{filename}" - FileUtils.mkdir_p("buildpacks/") - FileUtils.cp("#{tmpdir}/buildpack.tgz", filename) - FileUtils.cp("#{tmpdir}/buildpack.tgz", "buildpacks/buildpack.tgz") - end - end - - def multipart_form_data(buildpack_file_path) - body = '' - boundary = SecureRandom.hex(4) - data = File.open(buildpack_file_path) - - data.binmode if data.respond_to?(:binmode) - data.pos = 0 if data.respond_to?(:pos=) - - body << "--#{boundary}" << Excon::CR_NL - body << %{Content-Disposition: form-data; name="buildpack"; filename="#{File.basename(buildpack_file_path)}"} << Excon::CR_NL - body << 'Content-Type: application/x-gtar' << Excon::CR_NL - body << Excon::CR_NL - body << File.read(buildpack_file_path) - body << Excon::CR_NL - body << "--#{boundary}--" << Excon::CR_NL - - { - :headers => { 'Content-Type' => %{multipart/form-data; boundary="#{boundary}"} }, - :body => body - } - end - - task :publish do - buildpack_name = "heroku/ruby" - puts "Publishing #{buildpack_name} buildpack" - - print "Enter your yubikey > " - yubikey = STDIN.gets.chomp - - request_hash = multipart_form_data("buildpacks/buildpack.tgz").merge(path: "/buildpacks/#{buildpack_name}") - request_hash[:headers]["heroku-two-factor-code"] = yubikey - - resp = connection.post(request_hash) - - puts resp.status - puts resp.body - end - - desc "tag a release" - task :tag do - tagged_version = - if @new_version.nil? - "v#{latest_release["id"]}" - else - new_version - end - - git.add_tag(tagged_version) - puts "Created tag #{tagged_version}" - - puts "Pushing tag to remote #{github_remote}" - git.push(github_remote, nil, true) - end - - desc "release a new version of the buildpack" - task :release do - Rake::Task["buildpack:increment"].invoke - raise "Please add a changelog entry for #{new_version}" unless changelog_entry? - raise "Can't push to master" unless git_push_master - Rake::Task["buildpack:stage"].invoke - Rake::Task["buildpack:publish"].invoke - Rake::Task["buildpack:tag"].invoke - end -end - begin require 'rspec/core/rake_task' From 5eecb3c956c2c14adc113a05e86ac71deb9524dd Mon Sep 17 00:00:00 2001 From: Lola Odelola Date: Mon, 18 May 2020 15:31:31 +0100 Subject: [PATCH 0729/1195] Ammend run-on sentence --- lib/language_pack/ruby.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index f5d7a6c1f..2500bd30d 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -519,7 +519,7 @@ def warn_outdated_minor #{@outdated_version_check.suggested_ruby_minor_version} - The latest version will include security and bug fixes, we always recommend + The latest version will include security and bug fixes. We always recommend running the latest version of your minor release. Please upgrade your Ruby version. From 302a9d86ff77614d4b1f872a4308c2d9c4414aaf Mon Sep 17 00:00:00 2001 From: Evan Phoenix Date: Tue, 2 Jun 2020 15:05:04 -0700 Subject: [PATCH 0730/1195] Allow Nolockfile to get to compile phase Nolockfile does not define a number of things that base needs in terms of subclass overrides. By simply changing the parent class, we get reasonable versions of those things and allow the build to get as far as compile, so that the error can be emitted. The error output without this change looks like: ``` [builder] -----> Compiling Ruby/NoLockfile [builder] [builder] ! [builder] ! must subclass [builder] ! [builder] /cnb/buildpacks/heroku_ruby/0.0.1/lib/language_pack/base.rb:65:in `default_addons': must subclass (RuntimeError) [builder] from /cnb/buildpacks/heroku_ruby/0.0.1/lib/language_pack/base.rb:124:in `build_release' [builder] from /cnb/buildpacks/heroku_ruby/0.0.1/lib/language_pack/base.rb:132:in `write_release_toml' [builder] from /cnb/buildpacks/heroku_ruby/0.0.1/lib/language_pack/base.rb:103:in `build' [builder] from /cnb/buildpacks/heroku_ruby/0.0.1/bin/support/ruby_build:26:in `block (2 levels) in
' [builder] from /cnb/buildpacks/heroku_ruby/0.0.1/lib/language_pack/base.rb:190:in `log' [builder] from /cnb/buildpacks/heroku_ruby/0.0.1/bin/support/ruby_build:25:in `block in
' [builder] from /cnb/buildpacks/heroku_ruby/0.0.1/lib/language_pack/instrument.rb:35:in `block in trace' [builder] from /cnb/buildpacks/heroku_ruby/0.0.1/lib/language_pack/instrument.rb:18:in `block (2 levels) in instrument' [builder] from /cnb/buildpacks/heroku_ruby/0.0.1/lib/language_pack/instrument.rb:40:in `yield_with_block_depth' [builder] from /cnb/buildpacks/heroku_ruby/0.0.1/lib/language_pack/instrument.rb:17:in `block in instrument' [builder] from /tmp/tmp.dL7R7BOXyl/lib/ruby/2.6.0/benchmark.rb:308:in `realtime' [builder] from /cnb/buildpacks/heroku_ruby/0.0.1/lib/language_pack/instrument.rb:16:in `instrument' [builder] from /cnb/buildpacks/heroku_ruby/0.0.1/lib/language_pack/instrument.rb:35:in `trace' [builder] from /cnb/buildpacks/heroku_ruby/0.0.1/bin/support/ruby_build:21:in `
' ``` --- lib/language_pack/no_lockfile.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/language_pack/no_lockfile.rb b/lib/language_pack/no_lockfile.rb index 7a52af279..0bee9accb 100644 --- a/lib/language_pack/no_lockfile.rb +++ b/lib/language_pack/no_lockfile.rb @@ -1,7 +1,7 @@ require "language_pack" -require "language_pack/base" +require "language_pack/ruby" -class LanguagePack::NoLockfile < LanguagePack::Base +class LanguagePack::NoLockfile < LanguagePack::Ruby def self.use? !File.exists?("Gemfile.lock") end From 5c96114e4f651ee64a4bd47c9a62683b858148e8 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 2 Jun 2020 20:32:49 -0500 Subject: [PATCH 0731/1195] [changelog skip] Fix CNB tests --- .circleci/config.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a8d33025d..fcf5a55cf 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,13 +1,13 @@ version: 2.1 orbs: - buildpacks: jkutner/buildpacks@0.0.7 + buildpacks: jkutner/buildpacks@0.1.0 ruby: circleci/ruby@0.2.1 jobs: build: machine: true steps: - buildpacks/install-pack: - version: "0.7.0" + version: "0.11.0" - checkout - run: command: | @@ -19,6 +19,7 @@ jobs: gem install bundler -v 2.1.0 bundle install bundle exec rake hatchet:setup_ci + echo "pack version: $(pack --version)" rspec spec/cnb/ workflows: From 3af19b4872ce0e789ab0d9c48beafac3ee6a076e Mon Sep 17 00:00:00 2001 From: Matt Robinson Date: Wed, 3 Jun 2020 10:27:21 -0700 Subject: [PATCH 0732/1195] Switch to using /usr/bin/env bash The main motiviation for switching the shebang is so that I can use https://github.com/edmorley/heroku-buildpack-timestamps But it's generally a good idea to have shebang lines that make scripts portable, even if it is only going to run on heroku --- bin/compile | 2 +- bin/test | 2 +- bin/test-compile | 2 +- support/s3/hmac | 2 +- support/s3/s3 | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/compile b/bin/compile index ddf84f713..a38c4ba54 100755 --- a/bin/compile +++ b/bin/compile @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # The actual compilation code lives in `bin/support/ruby_compile`. This file instead # bootstraps the ruby needed and then executes `bin/support/ruby_compile` diff --git a/bin/test b/bin/test index 4e821c108..82ca8984b 100755 --- a/bin/test +++ b/bin/test @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # The actual `bin/test-compile` code lives in `bin/ruby_test-compile`. This file instead # bootstraps the ruby needed and then executes `bin/ruby_test-compile` diff --git a/bin/test-compile b/bin/test-compile index 5a1529819..79c482e0f 100755 --- a/bin/test-compile +++ b/bin/test-compile @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # The actual `bin/test-compile` code lives in `bin/ruby_test-compile`. This file instead # bootstraps the ruby needed and then executes `bin/ruby_test-compile` diff --git a/support/s3/hmac b/support/s3/hmac index 5aa074a0d..0b2c3502e 100755 --- a/support/s3/hmac +++ b/support/s3/hmac @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Implement HMAC functionality on top of the OpenSSL digest functions. # licensed under the terms of the GNU GPL v2 # Copyright 2007 Victor Lowther diff --git a/support/s3/s3 b/support/s3/s3 index 2b2583e3a..65fd9d2cd 100755 --- a/support/s3/s3 +++ b/support/s3/s3 @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # basic amazon s3 operations # Licensed under the terms of the GNU GPL v2 # Copyright 2007 Victor Lowther From dff146809ddc5f02efb5f401080004eb0e56d00d Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 1 Jun 2020 15:00:09 -0500 Subject: [PATCH 0733/1195] Update HEREDOC to 2.5 syntax to support indenting --- lib/language_pack/ruby.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 2500bd30d..776a9da8f 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -333,10 +333,10 @@ def setup_language_pack_environment(ruby_layer_path:, gem_layer_path:) instrument 'ruby.setup_language_pack_environment' do if ruby_version.jruby? ENV["PATH"] += ":bin" - ENV["JAVA_MEM"] = run(<<-SHELL).chomp -#{set_jvm_max_heap} -echo #{default_java_mem} -SHELL + ENV["JAVA_MEM"] = run(<<~SHELL).chomp + #{set_jvm_max_heap} + echo #{default_java_mem} + SHELL ENV["JRUBY_OPTS"] = env('JRUBY_BUILD_OPTS') || env('JRUBY_OPTS') ENV["JAVA_HOME"] = @jvm_installer.java_home end From c8d10eb11adb1ca68935c68bbc10be68636eeaa9 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 1 Jun 2020 14:59:48 -0500 Subject: [PATCH 0734/1195] [close #1001] Put Yarn first on the path The binstub that Rails generates has a bug in it that prevents calling `yarn install` from any directory other than the app root. We were accidentally handling this when we install yarn (without the nodejs buildpack) since we prepend the yarn path https://github.com/heroku/heroku-buildpack-ruby/blob/af368418f2aef9f455afd7f0b77b3137aa8d38a5/lib/language_pack/ruby.rb#L696. However if the app is using the `heroku/nodejs` then the `bin/yarn` binstub will appear first in the buildpack after the changes in https://github.com/heroku/heroku-buildpack-ruby/commit/8413eecb42ce8a99b47194ab9d237093175b915f. To fix this, we are manually putting yarn first on the path at runtime and build time. While this is a fix to a regression on master, it has never been released. This fix preserves existing behavior with the deployed buildpack. (In which the `bin/yarn` binstub is not being used). --- hatchet.json | 5 +--- hatchet.lock | 6 ++--- lib/language_pack/ruby.rb | 37 +++++++++++++++++++++------- spec/hatchet/node_spec.rb | 49 ++++++++++++++++++++++--------------- spec/hatchet/rails5_spec.rb | 31 ++++++++++++++--------- spec/spec_helper.rb | 1 + 6 files changed, 81 insertions(+), 48 deletions(-) diff --git a/hatchet.json b/hatchet.json index c9ed6dab2..f38eca572 100644 --- a/hatchet.json +++ b/hatchet.json @@ -86,11 +86,8 @@ "heroku": [ "heroku/ruby-getting-started" ], - "multibuildpack": [ - "sharpstone/node_multi" - ], "node": [ - "sharpstone/webpacker_no_execjs" + "sharpstone/minimal_webpacker" ], "ci": [ "sharpstone/rails5_ruby_schema_format", diff --git a/hatchet.lock b/hatchet.lock index 7b7d99b0f..33b580258 100644 --- a/hatchet.lock +++ b/hatchet.lock @@ -33,10 +33,8 @@ - 9ddca7b694875499165eb56adffd3e29b38405c5 - - "./repos/jruby/jruby_naether" - 4a11f8af5a3cca21f3659394e5bbac3cca9b6a2c -- - "./repos/multibuildpack/node_multi" - - c8f822a0cdd3b7ed92f19bd1112bd9e301bc4a5e -- - "./repos/node/webpacker_no_execjs" - - 26792540c924699c69e4c79019b65bc9192586ea +- - "./repos/node/minimal_webpacker" + - bca8b8169c553a0f62f0263b621cf3a5813e4023 - - "./repos/rack/default_ruby" - da748a59340be8b950e7bbbfb32077eb67d70c3c - - "./repos/rack/mri_187_nokogiri" diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 776a9da8f..e4400acb6 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -341,8 +341,6 @@ def setup_language_pack_environment(ruby_layer_path:, gem_layer_path:) ENV["JAVA_HOME"] = @jvm_installer.java_home end setup_ruby_install_env(ruby_layer_path) - ENV["PATH"] += ":#{node_preinstall_bin_path}" if node_js_installed? - ENV["PATH"] += ":#{yarn_preinstall_bin_path}" if !yarn_not_preinstalled? # By default Node can address 1.5GB of memory, a limitation it inherits from # the underlying v8 engine. This can occasionally cause issues during frontend @@ -363,6 +361,10 @@ def setup_language_pack_environment(ruby_layer_path:, gem_layer_path:) ENV["GEM_PATH"] = gem_path ENV["GEM_HOME"] = gem_path + # Rails has a binstub for yarn that doesn't work for all applications + # we need to ensure that yarn comes before local bin dir for that case + paths << yarn_preinstall_bin_path if yarn_preinstalled? + # Need to remove `./bin` folder since it links to the wrong --prefix ruby binstubs breaking require in Ruby 1.9.2 and 1.8.7. # Because for 1.9.2 and 1.8.7 there is a "build" ruby and a non-"build" Ruby paths << "#{File.expand_path(".")}/bin" unless ruby_version.ruby_192_or_lower? @@ -413,10 +415,17 @@ def setup_export(layer = nil) def setup_profiled(ruby_layer_path: , gem_layer_path: ) instrument 'setup_profiled' do profiled_path = [] + + # Rails has a binstub for yarn that doesn't work for all applications + # we need to ensure that yarn comes before local bin dir for that case + if yarn_preinstalled? + profiled_path << yarn_preinstall_bin_path.gsub(File.expand_path("."), "$HOME") + elsif has_yarn_binary? + profiled_path << "#{ruby_layer_path}/vendor/#{@yarn_installer.binary_path}" + end profiled_path << "$HOME/bin" # /app in production profiled_path << "#{gem_layer_path}/#{bundler_binstubs_path}" # Binstubs from bundler, eg. vendor/bundle/bin profiled_path << "#{gem_layer_path}/#{slug_vendor_base}/bin" # Binstubs from rubygems, eg. vendor/bundle/ruby/2.6.0/bin - profiled_path << "#{ruby_layer_path}/vendor/#{@yarn_installer.binary_path}" if has_yarn_binary? profiled_path << "$PATH" set_env_default "LANG", "en_US.UTF-8" @@ -1094,25 +1103,35 @@ def node_preinstall_bin_path @node_preinstall_bin_path = false end end - alias :node_js_installed? :node_preinstall_bin_path + alias :node_js_preinstalled? :node_preinstall_bin_path def node_not_preinstalled? - !node_js_installed? + !node_js_preinstalled? end + # Example: tmp/build_8523f77fb96a956101d00988dfeed9d4/.heroku/yarn/bin/ (without the `yarn` at the end) def yarn_preinstall_bin_path - return @yarn_preinstall_bin_path if defined?(@yarn_preinstall_bin_path) + (yarn_preinstall_binary_path || "").chomp("/yarn") + end + + # Example `tmp/build_8523f77fb96a956101d00988dfeed9d4/.heroku/yarn/bin/yarn` + def yarn_preinstall_binary_path + return @yarn_preinstall_binary_path if defined?(@yarn_preinstall_binary_path) path = run("which yarn").chomp if path && $?.success? - @yarn_preinstall_bin_path = path + @yarn_preinstall_binary_path = path else - @yarn_preinstall_bin_path = false + @yarn_preinstall_binary_path = false end end + def yarn_preinstalled? + yarn_preinstall_binary_path + end + def yarn_not_preinstalled? - !yarn_preinstall_bin_path + !yarn_preinstalled? end def run_assets_precompile_rake_task diff --git a/spec/hatchet/node_spec.rb b/spec/hatchet/node_spec.rb index d8ef276b7..3461adc6e 100644 --- a/spec/hatchet/node_spec.rb +++ b/spec/hatchet/node_spec.rb @@ -1,30 +1,39 @@ require 'spec_helper' -describe "Node" do - it "works with node buildpack" do - Hatchet::Runner.new("node_multi", buildpacks: ["heroku/nodejs", :default]).deploy do |app| - expect(app.output).to match("Node Version in Ruby buildpack is: v4.1.2") - expect(app.run("node -v")).to match("v4.1.2") - end - end +describe "Node and Yarn" do + it "works without the node buildpack" do + buildpacks = [ + :default, + "https://github.com/sharpstone/force_absolute_paths_buildpack" + ] + Hatchet::Runner.new("minimal_webpacker", buildpacks: buildpacks).deploy do |app, heroku| + # https://rubular.com/r/4bkL8fYFTQwt0Q + expect(app.output).to match(/vendor\/yarn-v\d+\.\d+\.\d+\/bin\/yarn is the yarn directory/) + expect(app.output).to_not include(".heroku/yarn/bin/yarn is the yarn directory") - it "node is installed by default without multi buildpack" do - default_node_version = LanguagePack::Helpers::NodeInstaller.new.version - Hatchet::Runner.new("node_multi").deploy do |app| - expect(app.output).to match("Node Version in Ruby buildpack is: v#{default_node_version}") - expect(app.run("node -v")).to match(default_node_version) - end - end + expect(app.output).to include("bin/node is the node directory") + expect(app.output).to_not include(".heroku/node/bin/node is the node directory") - it "doesn't install node without execjs or webpacker" do - Hatchet::Runner.new("default_ruby").deploy do |app| - expect(app.run("node -v")).to match("node: command not found") + expect(app.run("which node")).to match("/app/bin/node") # We put node in bin/node + expect(app.run("which yarn")).to match("/app/vendor/yarn-") # We put yarn in /app/vendor/yarn- end end - it "installs node when webpacker is detected but no execjs" do - Hatchet::Runner.new("webpacker_no_execjs").deploy do |app| - expect(app.output).to match("Installing node-v") + it "works with the node buildpack" do + buildpacks = [ + "heroku/nodejs", + :default, + "https://github.com/sharpstone/force_absolute_paths_buildpack" + ] + + Hatchet::Runner.new("minimal_webpacker", buildpacks: buildpacks).deploy do |app, heroku| + expect(app.output).to include("yarn install") + expect(app.output).to include(".heroku/yarn/bin/yarn is the yarn directory") + expect(app.output).to include(".heroku/node/bin/node is the node directory") + + expect(app.run("which node")).to match("/app/.heroku/node/bin") + expect(app.run("which yarn")).to match("/app/.heroku/yarn/bin") end end end + diff --git a/spec/hatchet/rails5_spec.rb b/spec/hatchet/rails5_spec.rb index 94ad52bde..f04242996 100644 --- a/spec/hatchet/rails5_spec.rb +++ b/spec/hatchet/rails5_spec.rb @@ -64,18 +64,27 @@ def worker_task_for_app(app) end end -describe "Rails 5.1" do - it "works with webpacker + yarn (js friends)" do - buildpacks = [ - :default, - "https://github.com/sharpstone/force_absolute_paths_buildpack" - ] - Hatchet::Runner.new("rails51_webpacker", buildpacks: buildpacks).deploy do |app, heroku| - expect(app.output).to include("Installing yarn") - expect(app.output).to include("yarn install") +describe "Rails 5.1 with webpacker" do + it "calls bin/yarn no matter what is on the path" do + Hatchet::Runner.new("rails51_webpacker").tap do |app| + # We put our version of yarn first on the path ahead of bin/yarn + # however webpacker explicitly calls bin/yarn instead of calling + # `yarn install` + app.before_deploy do + File.open("bin/yarn", "w") do |f| + f.write <<~EOM + #! /usr/bin/env bash - expect(app.run("which -a node")).to match("/app/bin/node") - expect(app.run("which -a yarn")).to match("/app/vendor/yarn-") + echo "Called bin/yarn binstub" + `yarn install` + EOM + end + run("chmod +x bin/yarn") + end + + app.deploy do + expect(app.output).to include("Called bin/yarn binstub") + end end end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index eff331830..49479db68 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -19,6 +19,7 @@ config.default_retry_count = 2 if ENV['IS_RUNNING_ON_CI'] # retry all tests that fail again config.expect_with :rspec do |c| + c.max_formatted_output_length = Float::INFINITY c.syntax = :expect end config.mock_with :nothing From 1a0530da38d0d8fd41ef4e02c2eb93ee03c40c9d Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 9 Jun 2020 15:02:46 -0500 Subject: [PATCH 0735/1195] [changelog skip][close #977] Recommend recent Ruby in warning Previously when we gave people a warning that they were not setting their Ruby version we recommended that they set that version in their Gemfile. Since our default ruby versions are "sticky" it was common that we were recommending very old ruby versions: ``` ###### WARNING: You have not declared a Ruby version in your Gemfile. To set your Ruby version add this line to your Gemfile: ruby '2.4.1' ``` Instead of recommending their current version (Which is also available via the deploy output elsewhere) we are recommending the current default version. So in the previous case where the user was using 2.4.1, our recommended Gemfile in the warning would be `2.6.6`. --- lib/language_pack/ruby.rb | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index e4400acb6..7292ec726 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -565,12 +565,18 @@ def install_ruby(install_path, build_ruby_path = nil) topic "Using Ruby version: #{ruby_version.version_for_download}" if !ruby_version.set - warn(<<-WARNING) -You have not declared a Ruby version in your Gemfile. -To set your Ruby version add this line to your Gemfile: -#{ruby_version.to_gemfile} -# See https://devcenter.heroku.com/articles/ruby-versions for more information. -WARNING + warn(<<~WARNING) + You have not declared a Ruby version in your Gemfile. + + To declare a Ruby version add this line to your Gemfile: + + ``` + ruby "#{LanguagePack::RubyVersion::DEFAULT_VERSION_NUMBER}" + ``` + + For more information see: + https://devcenter.heroku.com/articles/ruby-versions + WARNING end end From 906ddb07e40b5a9d616f831bd9fb10206da82e62 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 9 Jun 2020 15:02:46 -0500 Subject: [PATCH 0736/1195] [changelog skip][close #977] Recommend recent Ruby in warning Previously when we gave people a warning that they were not setting their Ruby version we recommended that they set that version in their Gemfile. Since our default ruby versions are "sticky" it was common that we were recommending very old ruby versions: ``` ###### WARNING: You have not declared a Ruby version in your Gemfile. To set your Ruby version add this line to your Gemfile: ruby '2.4.1' ``` Instead of recommending their current version (Which is also available via the deploy output elsewhere) we are recommending the current default version. So in the previous case where the user was using 2.4.1, our recommended Gemfile in the warning would be `2.6.6`. --- CHANGELOG.md | 1 + lib/language_pack/ruby.rb | 14 ++++++++++++++ lib/language_pack/ruby_version.rb | 7 +++++++ spec/helpers/ruby_version_spec.rb | 16 ++++++++++++++++ 4 files changed, 38 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1396f91a6..dd440ee75 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## Master (unreleased) +* A bug in 2.6.0, 2.6.1, 2.6.3 require a Ruby upgrade, a warning has been added (https://github.com/heroku/heroku-buildpack-ruby/pull/1015) * Default node version now 12.16.2, yarn is 1.22.4 (https://github.com/heroku/heroku-buildpack-ruby/pull/986) * Gracefully handle unrecognised stacks ([#982](https://github.com/heroku/heroku-buildpack-ruby/pull/982)) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index e4400acb6..fed99dd96 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -572,6 +572,20 @@ def install_ruby(install_path, build_ruby_path = nil) # See https://devcenter.heroku.com/articles/ruby-versions for more information. WARNING end + + if ruby_version.warn_ruby_26_bundler? + warn(<<~WARNING, inline: true) + There is a known bundler bug with your version of Ruby + + Your version of Ruby contains a problem with the built-in integration of bundler. If + you encounter a bundler error you need to upgrade your Ruby version. We suggest you upgrade to: + + #{@outdated_version_check.suggested_ruby_minor_version} + + For more information see: + https://devcenter.heroku.com/articles/bundler-version#known-upgrade-issues + WARNING + end end true diff --git a/lib/language_pack/ruby_version.rb b/lib/language_pack/ruby_version.rb index a74c0dfc1..6da6f8d36 100644 --- a/lib/language_pack/ruby_version.rb +++ b/lib/language_pack/ruby_version.rb @@ -38,6 +38,13 @@ def initialize(bundler_output, app = {}) @version_without_patchlevel = @version.sub(/-p-?\d+/, '') end + def warn_ruby_26_bundler? + return false if Gem::Version.new(self.ruby_version) >= Gem::Version.new("2.6.3") + return false if Gem::Version.new(self.ruby_version) < Gem::Version.new("2.6.0") + + return true + end + def ruby_192_or_lower? Gem::Version.new(self.ruby_version) <= Gem::Version.new("1.9.2") end diff --git a/spec/helpers/ruby_version_spec.rb b/spec/helpers/ruby_version_spec.rb index a346c1cd4..6946f397a 100644 --- a/spec/helpers/ruby_version_spec.rb +++ b/spec/helpers/ruby_version_spec.rb @@ -58,6 +58,22 @@ expect(ruby_version.version_for_download).to eq("ruby-2.4.0") end + it "detects Ruby 2.6.0, 2.6.1 and 2.6.2 as needing a warning" do + ruby_version = LanguagePack::RubyVersion.new("ruby-2.6.0") + expect(ruby_version.warn_ruby_26_bundler?).to be true + ruby_version = LanguagePack::RubyVersion.new("ruby-2.6.1") + expect(ruby_version.warn_ruby_26_bundler?).to be true + ruby_version = LanguagePack::RubyVersion.new("ruby-2.6.2") + expect(ruby_version.warn_ruby_26_bundler?).to be true + + ruby_version = LanguagePack::RubyVersion.new("ruby-2.6.3") + expect(ruby_version.warn_ruby_26_bundler?).to be false + ruby_version = LanguagePack::RubyVersion.new("ruby-2.5.3") + expect(ruby_version.warn_ruby_26_bundler?).to be false + ruby_version = LanguagePack::RubyVersion.new("ruby-2.7.1") + expect(ruby_version.warn_ruby_26_bundler?).to be false + end + it "correctly sets ruby version for bundler specified versions" do Hatchet::App.new("mri_193").in_directory_fork do |dir| ruby_version = LanguagePack::RubyVersion.new(@bundler.install.ruby_version, is_new: true) From be4855b45474dcc0d98d2a7efa6ed4c615664b72 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 9 Jun 2020 15:21:12 -0500 Subject: [PATCH 0737/1195] [close #818] Disable spring Spring causes erratic and unpredictable failures, most recently in ticket https://heroku.support/881089. We can avoid these class of problems entirely by disabling the library. Any benefits that spring provide come from repeatedly calling the same command, for example spring would speed up running `rails test` twice. However most commands on Heroku are only run once (`rails server` on boot for example) so using spring on the system would provide little to no realized practical benefit. I feel so strongly about the need to disable spring that I do not want to provide an "escape valve" to disable the behavior of disabling spring. --- CHANGELOG.md | 1 + changelogs/v216/disable_spring.md | 11 +++++++++++ lib/language_pack/ruby.rb | 3 +++ spec/hatchet/rubies_spec.rb | 2 +- 4 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 changelogs/v216/disable_spring.md diff --git a/CHANGELOG.md b/CHANGELOG.md index dd440ee75..1e72385a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## Master (unreleased) * A bug in 2.6.0, 2.6.1, 2.6.3 require a Ruby upgrade, a warning has been added (https://github.com/heroku/heroku-buildpack-ruby/pull/1015) +* The spring library is now disabled by setting the enviornment variable DISABLE_SPRING=1 (https://github.com/heroku/heroku-buildpack-ruby/pull/1017) * Default node version now 12.16.2, yarn is 1.22.4 (https://github.com/heroku/heroku-buildpack-ruby/pull/986) * Gracefully handle unrecognised stacks ([#982](https://github.com/heroku/heroku-buildpack-ruby/pull/982)) diff --git a/changelogs/v216/disable_spring.md b/changelogs/v216/disable_spring.md new file mode 100644 index 000000000..6a72757ba --- /dev/null +++ b/changelogs/v216/disable_spring.md @@ -0,0 +1,11 @@ + ## The spring library will be disabled in all Ruby applications + +The [spring library](https://github.com/rails/spring) is an "application preloader" that is intended to save time between multiple application boots. For example, running the `bin/rails test` command numerous times in a row would be faster with spring. The library accomplishes this performance boost by forking the application after first boot and preserving this fork for future application loads. This behavior has been shown to cause instability and bugs on Heroku. Consequently, all applications using the `heroku/ruby` buildpack will now automatically have spring disabled through the environment variable: + + ``` +DISABLE_SPRING=1 + ``` + +Any benefits that spring provides come from repeatedly calling the same command. However, most commands on Heroku are only run once (`rails server` on boot, for example). As a result, using spring on the system would provide little to no realized practical benefit. + +This behavior is now is documented in the [Heroku Ruby Support page](https://devcenter.heroku.com/articles/ruby-support). diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 37fb1320b..a1aea0c78 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -361,6 +361,8 @@ def setup_language_pack_environment(ruby_layer_path:, gem_layer_path:) ENV["GEM_PATH"] = gem_path ENV["GEM_HOME"] = gem_path + ENV["DISABLE_SPRING"] = "1" + # Rails has a binstub for yarn that doesn't work for all applications # we need to ensure that yarn comes before local bin dir for that case paths << yarn_preinstall_bin_path if yarn_preinstalled? @@ -431,6 +433,7 @@ def setup_profiled(ruby_layer_path: , gem_layer_path: ) set_env_default "LANG", "en_US.UTF-8" set_env_override "GEM_PATH", "#{gem_layer_path}/#{slug_vendor_base}:$GEM_PATH" set_env_override "PATH", profiled_path.join(":") + set_env_override "DISABLE_SPRING", "1" set_env_default "MALLOC_ARENA_MAX", "2" if default_malloc_arena_max? add_to_profiled set_default_web_concurrency if env("SENSIBLE_DEFAULTS") diff --git a/spec/hatchet/rubies_spec.rb b/spec/hatchet/rubies_spec.rb index 6a29daa27..f0ff2836b 100644 --- a/spec/hatchet/rubies_spec.rb +++ b/spec/hatchet/rubies_spec.rb @@ -81,13 +81,13 @@ end end - describe "Upgrading ruby apps" do it "works when changing from default version" do app = Hatchet::Runner.new("default_ruby", stack: DEFAULT_STACK) app.setup! app.deploy do |app| expect(app.run("env | grep MALLOC_ARENA_MAX")).to match("MALLOC_ARENA_MAX=2") + expect(app.run("env | grep DISABLE_SPRING")).to match("DISABLE_SPRING=1") run!(%Q{echo "ruby '2.5.1'" >> Gemfile}) run!("git add -A; git commit -m update-ruby") From 6499ce8b7e8c4e2df90332cc59746217fa620b09 Mon Sep 17 00:00:00 2001 From: schneems Date: Mon, 8 Jun 2020 13:43:09 -0500 Subject: [PATCH 0738/1195] [close #990] Warn on bad shebang line This article explains binstubs and "shebang" lines: https://devcenter.heroku.com/articles/bad-ruby-binstub-shebang. A relatively common problem when generating a binstub is for it to contain a bad shebang line. Here's an example: ``` #!/usr/bin/env ruby2.5 ``` If you've got a binstub with that shebang line in your project and are running on Heroku 18 then your app will be forced to use `ruby2.5` binary no matter what version of Ruby you've specified in the `Gemfile`. This causes very odd behavior and weird, difficult to debug bundler errors. This PR does not fix the problem, but will at least warn anyone with a version number in their ruby shebang line. This behavior was originally: - Introduced: #586 - Rolled back: #623 It was rolled back because it would falsely claim that `#!/usr/bin/env bash` was incorrect also it only protected against a limited set of binstubs. --- CHANGELOG.md | 1 + lib/language_pack/helpers/binstub_check.rb | 64 ++++++++++++++++++++++ lib/language_pack/ruby.rb | 18 +++++- lib/language_pack/test/ruby.rb | 1 + spec/helpers/binstub_check_spec.rb | 43 +++++++++++++++ 5 files changed, 126 insertions(+), 1 deletion(-) create mode 100644 lib/language_pack/helpers/binstub_check.rb create mode 100644 spec/helpers/binstub_check_spec.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e72385a1..ba083dddf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ * A bug in 2.6.0, 2.6.1, 2.6.3 require a Ruby upgrade, a warning has been added (https://github.com/heroku/heroku-buildpack-ruby/pull/1015) * The spring library is now disabled by setting the enviornment variable DISABLE_SPRING=1 (https://github.com/heroku/heroku-buildpack-ruby/pull/1017) +* Warn when a bad "shebang" line in a binstub is detected (https://github.com/heroku/heroku-buildpack-ruby/pull/1014) * Default node version now 12.16.2, yarn is 1.22.4 (https://github.com/heroku/heroku-buildpack-ruby/pull/986) * Gracefully handle unrecognised stacks ([#982](https://github.com/heroku/heroku-buildpack-ruby/pull/982)) diff --git a/lib/language_pack/helpers/binstub_check.rb b/lib/language_pack/helpers/binstub_check.rb new file mode 100644 index 000000000..3a681fa9b --- /dev/null +++ b/lib/language_pack/helpers/binstub_check.rb @@ -0,0 +1,64 @@ +# frozen_string_literal: true + +# This class is designed to check for binstubs for validity +# +# Example: +# +# check = LanguagePack::Helpers::BinstubCheck.new(Dir.pwd, self) +# check.call +class LanguagePack::Helpers::BinstubCheck + attr_reader :bad_binstubs + + def initialize(app_root_dir:, warn_object: ) + @bin_dir = Pathname.new(app_root_dir).join("bin") + @warn_object = warn_object + @bad_binstubs = [] + end + + def call + return unless @bin_dir.directory? + + @bin_dir.entries.each do |basename| + binstub = @bin_dir.join(basename) + next unless binstub.file? + + shebang = binstub.open(&:readline) + + if shebang.match?(/^#!\s*\/usr\/bin\/env\s*ruby(\d.*)$/) # https://rubular.com/r/ozbNEPVInc3sSN + @bad_binstubs << binstub + end + rescue EOFError + end + + warn unless @bad_binstubs.empty? + end + + private def warn + message = <<~EOM + Improperly formatted binstubs detected in your project + + The following file(s) have appear to contain a problematic "shebang" line + + #{@bad_binstubs.map {|binstub| " - bin/#{binstub.basename}" }.join("\n")} + + For example bin/#{@bad_binstubs.first.basename} has the shebang line: + + ``` + #{@bad_binstubs.first.open(&:readline).chomp} + ``` + + It should be: + + ``` + #!/usr/bin/env ruby + ``` + + A malformed shebang line may cause your program to crash. + + For more information about binstubs and "shebang" lines see: + https://devcenter.heroku.com/articles/bad-ruby-binstub-shebang + EOM + + @warn_object.warn(message, inline: true) + end +end diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index a1aea0c78..0dab3a185 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -10,6 +10,7 @@ require "language_pack/helpers/yarn_installer" require "language_pack/helpers/jvm_installer" require "language_pack/helpers/layer" +require "language_pack/helpers/binstub_check" require "language_pack/version" # base Ruby Language Pack. This is for any base ruby app. @@ -96,6 +97,7 @@ def compile Dir.chdir(build_path) remove_vendor_bundle warn_bundler_upgrade + warn_bad_binstubs install_ruby(slug_vendor_ruby, build_ruby_path) install_jvm setup_language_pack_environment(ruby_layer_path: File.expand_path("."), gem_layer_path: File.expand_path(".")) @@ -121,10 +123,11 @@ def compile raise e end + def build new_app? remove_vendor_bundle - + warn_bad_binstubs ruby_layer = Layer.new(@layer_dir, "ruby", launch: true) install_ruby("#{ruby_layer.path}/#{slug_vendor_ruby}") ruby_layer.metadata[:version] = ruby_version.version @@ -174,6 +177,19 @@ def config_detect private + # A bad shebang line looks like this: + # + # ``` + # #!/usr/bin/env ruby2.5 + # ``` + # + # Since `ruby2.5` is not a valid binary name + # + def warn_bad_binstubs + check = LanguagePack::Helpers::BinstubCheck.new(app_root_dir: Dir.pwd, warn_object: self) + check.call + end + def default_malloc_arena_max? return true if @metadata.exists?("default_malloc_arena_max") return @metadata.touch("default_malloc_arena_max") if new_app? diff --git a/lib/language_pack/test/ruby.rb b/lib/language_pack/test/ruby.rb index 9b3097a8a..39ff78d31 100644 --- a/lib/language_pack/test/ruby.rb +++ b/lib/language_pack/test/ruby.rb @@ -5,6 +5,7 @@ def compile new_app? Dir.chdir(build_path) remove_vendor_bundle + warn_bad_binstubs install_ruby(slug_vendor_ruby, build_ruby_path) install_jvm setup_language_pack_environment(ruby_layer_path: File.expand_path("."), gem_layer_path: File.expand_path(".")) diff --git a/spec/helpers/binstub_check_spec.rb b/spec/helpers/binstub_check_spec.rb new file mode 100644 index 000000000..7afea2fc0 --- /dev/null +++ b/spec/helpers/binstub_check_spec.rb @@ -0,0 +1,43 @@ +require_relative "../spec_helper.rb" + +describe LanguagePack::Helpers::BinstubCheck do + it "doesn't error on empty directories" do + Dir.mktmpdir do |dir| + warn_obj = Object.new + check = LanguagePack::Helpers::BinstubCheck.new(app_root_dir: dir, warn_object: warn_obj) + check.call + end + end + + it "checks binstubs and finds bad ones" do + Dir.mktmpdir do |dir| + bin_dir = Pathname.new(dir).join("bin") + bin_dir.mkpath + + # Bad binstub + bin_dir.join("bad_binstub_example").write(<<~EOM) + #!/usr/bin/env ruby2.5 + + nothing else matters + EOM + + # Good binstub + bin_dir.join("good_binstub_example").write(<<~EOM) + #!/usr/bin/env bash + + nothing else matters + EOM + bin_dir.join("good_binstub_example_two").write("#!/usr/bin/env ruby") + + warn_obj = Object.new + def warn_obj.warn(*args, **kwargs); @msg = args.first; end + def warn_obj.msg; @msg; end + + check = LanguagePack::Helpers::BinstubCheck.new(app_root_dir: dir, warn_object: warn_obj) + check.call + + expect(check.bad_binstubs.count).to eq(1) + expect(warn_obj.msg).to include("bin/bad_binstub_example") + end + end +end From 4ae3df8431f180223fbf13d795c0de2d8a8fe8fb Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 11 Jun 2020 12:34:55 -0500 Subject: [PATCH 0739/1195] Revert "Merge pull request #1014 from heroku/schneems/fu-binstubs" This reverts commit aeed0ce5e0977157060c010b502b728480ed2047, reversing changes made to 30184b66c334587de87aea2613f40116a896e6bf. Due to ticket https://heroku.support/885880 Error is: ``` ! ! invalid byte sequence in UTF-8 ! /app/tmp/buildpacks/dir/lib/language_pack/helpers/binstub_check.rb:27:in match?': invalid byte sequence in UTF-8 (ArgumentError) from /app/tmp/buildpacks ``` --- CHANGELOG.md | 1 - lib/language_pack/helpers/binstub_check.rb | 64 ---------------------- lib/language_pack/ruby.rb | 18 +----- lib/language_pack/test/ruby.rb | 1 - spec/helpers/binstub_check_spec.rb | 43 --------------- 5 files changed, 1 insertion(+), 126 deletions(-) delete mode 100644 lib/language_pack/helpers/binstub_check.rb delete mode 100644 spec/helpers/binstub_check_spec.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index ba083dddf..1e72385a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,6 @@ * A bug in 2.6.0, 2.6.1, 2.6.3 require a Ruby upgrade, a warning has been added (https://github.com/heroku/heroku-buildpack-ruby/pull/1015) * The spring library is now disabled by setting the enviornment variable DISABLE_SPRING=1 (https://github.com/heroku/heroku-buildpack-ruby/pull/1017) -* Warn when a bad "shebang" line in a binstub is detected (https://github.com/heroku/heroku-buildpack-ruby/pull/1014) * Default node version now 12.16.2, yarn is 1.22.4 (https://github.com/heroku/heroku-buildpack-ruby/pull/986) * Gracefully handle unrecognised stacks ([#982](https://github.com/heroku/heroku-buildpack-ruby/pull/982)) diff --git a/lib/language_pack/helpers/binstub_check.rb b/lib/language_pack/helpers/binstub_check.rb deleted file mode 100644 index 3a681fa9b..000000000 --- a/lib/language_pack/helpers/binstub_check.rb +++ /dev/null @@ -1,64 +0,0 @@ -# frozen_string_literal: true - -# This class is designed to check for binstubs for validity -# -# Example: -# -# check = LanguagePack::Helpers::BinstubCheck.new(Dir.pwd, self) -# check.call -class LanguagePack::Helpers::BinstubCheck - attr_reader :bad_binstubs - - def initialize(app_root_dir:, warn_object: ) - @bin_dir = Pathname.new(app_root_dir).join("bin") - @warn_object = warn_object - @bad_binstubs = [] - end - - def call - return unless @bin_dir.directory? - - @bin_dir.entries.each do |basename| - binstub = @bin_dir.join(basename) - next unless binstub.file? - - shebang = binstub.open(&:readline) - - if shebang.match?(/^#!\s*\/usr\/bin\/env\s*ruby(\d.*)$/) # https://rubular.com/r/ozbNEPVInc3sSN - @bad_binstubs << binstub - end - rescue EOFError - end - - warn unless @bad_binstubs.empty? - end - - private def warn - message = <<~EOM - Improperly formatted binstubs detected in your project - - The following file(s) have appear to contain a problematic "shebang" line - - #{@bad_binstubs.map {|binstub| " - bin/#{binstub.basename}" }.join("\n")} - - For example bin/#{@bad_binstubs.first.basename} has the shebang line: - - ``` - #{@bad_binstubs.first.open(&:readline).chomp} - ``` - - It should be: - - ``` - #!/usr/bin/env ruby - ``` - - A malformed shebang line may cause your program to crash. - - For more information about binstubs and "shebang" lines see: - https://devcenter.heroku.com/articles/bad-ruby-binstub-shebang - EOM - - @warn_object.warn(message, inline: true) - end -end diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 0dab3a185..a1aea0c78 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -10,7 +10,6 @@ require "language_pack/helpers/yarn_installer" require "language_pack/helpers/jvm_installer" require "language_pack/helpers/layer" -require "language_pack/helpers/binstub_check" require "language_pack/version" # base Ruby Language Pack. This is for any base ruby app. @@ -97,7 +96,6 @@ def compile Dir.chdir(build_path) remove_vendor_bundle warn_bundler_upgrade - warn_bad_binstubs install_ruby(slug_vendor_ruby, build_ruby_path) install_jvm setup_language_pack_environment(ruby_layer_path: File.expand_path("."), gem_layer_path: File.expand_path(".")) @@ -123,11 +121,10 @@ def compile raise e end - def build new_app? remove_vendor_bundle - warn_bad_binstubs + ruby_layer = Layer.new(@layer_dir, "ruby", launch: true) install_ruby("#{ruby_layer.path}/#{slug_vendor_ruby}") ruby_layer.metadata[:version] = ruby_version.version @@ -177,19 +174,6 @@ def config_detect private - # A bad shebang line looks like this: - # - # ``` - # #!/usr/bin/env ruby2.5 - # ``` - # - # Since `ruby2.5` is not a valid binary name - # - def warn_bad_binstubs - check = LanguagePack::Helpers::BinstubCheck.new(app_root_dir: Dir.pwd, warn_object: self) - check.call - end - def default_malloc_arena_max? return true if @metadata.exists?("default_malloc_arena_max") return @metadata.touch("default_malloc_arena_max") if new_app? diff --git a/lib/language_pack/test/ruby.rb b/lib/language_pack/test/ruby.rb index 39ff78d31..9b3097a8a 100644 --- a/lib/language_pack/test/ruby.rb +++ b/lib/language_pack/test/ruby.rb @@ -5,7 +5,6 @@ def compile new_app? Dir.chdir(build_path) remove_vendor_bundle - warn_bad_binstubs install_ruby(slug_vendor_ruby, build_ruby_path) install_jvm setup_language_pack_environment(ruby_layer_path: File.expand_path("."), gem_layer_path: File.expand_path(".")) diff --git a/spec/helpers/binstub_check_spec.rb b/spec/helpers/binstub_check_spec.rb deleted file mode 100644 index 7afea2fc0..000000000 --- a/spec/helpers/binstub_check_spec.rb +++ /dev/null @@ -1,43 +0,0 @@ -require_relative "../spec_helper.rb" - -describe LanguagePack::Helpers::BinstubCheck do - it "doesn't error on empty directories" do - Dir.mktmpdir do |dir| - warn_obj = Object.new - check = LanguagePack::Helpers::BinstubCheck.new(app_root_dir: dir, warn_object: warn_obj) - check.call - end - end - - it "checks binstubs and finds bad ones" do - Dir.mktmpdir do |dir| - bin_dir = Pathname.new(dir).join("bin") - bin_dir.mkpath - - # Bad binstub - bin_dir.join("bad_binstub_example").write(<<~EOM) - #!/usr/bin/env ruby2.5 - - nothing else matters - EOM - - # Good binstub - bin_dir.join("good_binstub_example").write(<<~EOM) - #!/usr/bin/env bash - - nothing else matters - EOM - bin_dir.join("good_binstub_example_two").write("#!/usr/bin/env ruby") - - warn_obj = Object.new - def warn_obj.warn(*args, **kwargs); @msg = args.first; end - def warn_obj.msg; @msg; end - - check = LanguagePack::Helpers::BinstubCheck.new(app_root_dir: dir, warn_object: warn_obj) - check.call - - expect(check.bad_binstubs.count).to eq(1) - expect(warn_obj.msg).to include("bin/bad_binstub_example") - end - end -end From f0919d25c9c75f2e4f20f88ad41d2de8103f7007 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Mon, 22 Jun 2020 14:08:03 -0500 Subject: [PATCH 0740/1195] v216 release for monday (#1023) --- CHANGELOG.md | 2 ++ lib/language_pack/version.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e72385a1..6f3e2f373 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Master (unreleased) +## v216 (5/22/2020) + * A bug in 2.6.0, 2.6.1, 2.6.3 require a Ruby upgrade, a warning has been added (https://github.com/heroku/heroku-buildpack-ruby/pull/1015) * The spring library is now disabled by setting the enviornment variable DISABLE_SPRING=1 (https://github.com/heroku/heroku-buildpack-ruby/pull/1017) * Default node version now 12.16.2, yarn is 1.22.4 (https://github.com/heroku/heroku-buildpack-ruby/pull/986) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index f16cf5fc5..354c3e2a4 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v214" + BUILDPACK_VERSION = "v216" end end From 125191fdf57bf80f0cebf1f2d6009f77be6ae99a Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Tue, 23 Jun 2020 15:33:30 -0500 Subject: [PATCH 0741/1195] Handle binary binstubs (#1021) * Revert "Merge pull request #1020 from heroku/schneems/revert-bad-shebang-check" This reverts commit da07466ec623aa4312c9f07df1777f93b780b156, reversing changes made to aeed0ce5e0977157060c010b502b728480ed2047. * Handle binary binstubs Logic was added to check the "shebang" lines of binstubs. This was then reverted due to a bug #1019. This commit fixes this error by checking if a shebang line can be considered UTF-8 for purposes of comparison before we compare it. In the process I also refactored the code so that the logic around working with the binstub file is in BinstubWrapper. I added a test for the `BinstubWrapper#binary?` method as well as a higher level test that runs the whole check against the directory that contains the `which ruby` binary. * Document v216 rollback in git This deploy was rolled back due to #1005 --- CHANGELOG.md | 6 +- .../{v216 => unreleased}/disable_spring.md | 0 changelogs/{v216 => unreleased}/node_yarn.md | 0 lib/language_pack/helpers/binstub_check.rb | 71 +++++++++++++++++ lib/language_pack/helpers/binstub_wrapper.rb | 61 ++++++++++++++ lib/language_pack/ruby.rb | 18 ++++- lib/language_pack/test/ruby.rb | 1 + spec/helpers/binstub_check_spec.rb | 79 +++++++++++++++++++ 8 files changed, 233 insertions(+), 3 deletions(-) rename changelogs/{v216 => unreleased}/disable_spring.md (100%) rename changelogs/{v216 => unreleased}/node_yarn.md (100%) create mode 100644 lib/language_pack/helpers/binstub_check.rb create mode 100644 lib/language_pack/helpers/binstub_wrapper.rb create mode 100644 spec/helpers/binstub_check_spec.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f3e2f373..653679e20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,14 @@ ## Master (unreleased) -## v216 (5/22/2020) - * A bug in 2.6.0, 2.6.1, 2.6.3 require a Ruby upgrade, a warning has been added (https://github.com/heroku/heroku-buildpack-ruby/pull/1015) * The spring library is now disabled by setting the enviornment variable DISABLE_SPRING=1 (https://github.com/heroku/heroku-buildpack-ruby/pull/1017) +* Warn when a bad "shebang" line in a binstub is detected (https://github.com/heroku/heroku-buildpack-ruby/pull/1014) * Default node version now 12.16.2, yarn is 1.22.4 (https://github.com/heroku/heroku-buildpack-ruby/pull/986) * Gracefully handle unrecognised stacks ([#982](https://github.com/heroku/heroku-buildpack-ruby/pull/982)) +## v216 (rolled back) + + ## v215 (4/9/2020) * Fix bundler cache not being used in CI builds (https://github.com/heroku/heroku-buildpack-ruby/pull/978) diff --git a/changelogs/v216/disable_spring.md b/changelogs/unreleased/disable_spring.md similarity index 100% rename from changelogs/v216/disable_spring.md rename to changelogs/unreleased/disable_spring.md diff --git a/changelogs/v216/node_yarn.md b/changelogs/unreleased/node_yarn.md similarity index 100% rename from changelogs/v216/node_yarn.md rename to changelogs/unreleased/node_yarn.md diff --git a/lib/language_pack/helpers/binstub_check.rb b/lib/language_pack/helpers/binstub_check.rb new file mode 100644 index 000000000..da7774114 --- /dev/null +++ b/lib/language_pack/helpers/binstub_check.rb @@ -0,0 +1,71 @@ +# frozen_string_literal: true + +require 'language_pack/helpers/binstub_wrapper' +# This class is designed to check for binstubs for validity +# +# Example: +# +# check = LanguagePack::Helpers::BinstubCheck.new(app_root_dir: Dir.pwd, warn_object: self) +# check.call +class LanguagePack::Helpers::BinstubCheck + attr_reader :bad_binstubs + + def initialize(app_root_dir:, warn_object: ) + @bin_dir = Pathname.new(app_root_dir).join("bin") + @warn_object = warn_object + @bad_binstubs = [] + end + + # Checks all binstubs in the directory for a + # bad shebang line. If any are present + # a warning is created on the passed in `warn_object` + def call + return unless @bin_dir.directory? + + each_binstub do |binstub| + @bad_binstubs << binstub if binstub.bad_shebang? + end + + warn unless @bad_binstubs.empty? + end + + # Iterates and yields each binstub in a directory + # as a BinstubWrapper + private def each_binstub + @bin_dir.entries.each do |basename| + binstub = LanguagePack::Helpers::BinstubWrapper.new(@bin_dir.join(basename)) + + next unless binstub.file? # Needed since "." and ".." are returned by Pathname#entries + yield binstub + end + end + + private def warn + message = <<~EOM + Improperly formatted binstubs detected in your project + + The following file(s) have appear to contain a problematic "shebang" line + + #{@bad_binstubs.map {|binstub| " - bin/#{binstub.basename}" }.join("\n")} + + For example bin/#{@bad_binstubs.first.basename} has the shebang line: + + ``` + #{@bad_binstubs.first.open(&:readline).chomp} + ``` + + It should be: + + ``` + #!/usr/bin/env ruby + ``` + + A malformed shebang line may cause your program to crash. + + For more information about binstubs and "shebang" lines see: + https://devcenter.heroku.com/articles/bad-ruby-binstub-shebang + EOM + + @warn_object.warn(message, inline: true) + end +end diff --git a/lib/language_pack/helpers/binstub_wrapper.rb b/lib/language_pack/helpers/binstub_wrapper.rb new file mode 100644 index 000000000..4d9082365 --- /dev/null +++ b/lib/language_pack/helpers/binstub_wrapper.rb @@ -0,0 +1,61 @@ +# frozen_string_literal: true +# +# This is a helper class, it wraps a pathname object +# and adds helper methods used to pull out the first line of the file ("the shebang") +# as well as determining if the file is binary or not. +# +# binstub = BinstubWrapper.new(Pathname.new(Dir.pwd).join("bin/rails")) +# binstub.file? # => true +# binstub.binary? #=> false +# binstub.bad_shebang? #=> false +class LanguagePack::Helpers::BinstubWrapper < SimpleDelegator + def initialize(string_or_pathname) + @binstub = Pathname.new(string_or_pathname) + super @binstub + end + + # Returns false if the shebang line has a ruby binary + # that is not simply "ruby" or "ruby.exe" + # + # Example: + # + # bin_dir = Pathname.new(Dir.pwd).join("bin") + # binstub = BinstubWrapper.new(bin_dir.join("rails_good")) + # binstub.shebang # => "#!/usr/bin/env ruby\n" + # binstub.bad_shebang? # => false + # + # binstub = BinstubWrapper.new(bin_dir.join("rails_bad")) + # binstub.shebang # => "#!/usr/bin/env ruby2.5\n" + # binstub.bad_shebang? # => true + def bad_shebang? + return false if binary? + + shebang.match?(/^#!\s*\/usr\/bin\/env\s*ruby(\d.*)$/) # https://rubular.com/r/ozbNEPVInc3sSN + end + + # The first line of a binstub contains the "shebang" line + # that tells the operating system how to execute the file + # for example: + # + # binstub = BinstubWrapper.new(Pathname.new(Dir.pwd).join("bin/rails")) + # binstub.shebang # => "#!/usr/bin/env ruby\n" + def shebang + @shebang ||= begin + @binstub.open(&:readline) + rescue EOFError + "" + end + end + + # Binary files (may) not have valid UTF-8 encoding. In order to + # compare a shebang line, we must first check if the shebang + # line is binary or not. To do that, we can see if it is not valid + # UTF-8 + def binary? + !valid_utf8? + end + + def valid_utf8? + shebang.force_encoding("UTF-8").valid_encoding? + end +end diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index a1aea0c78..0dab3a185 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -10,6 +10,7 @@ require "language_pack/helpers/yarn_installer" require "language_pack/helpers/jvm_installer" require "language_pack/helpers/layer" +require "language_pack/helpers/binstub_check" require "language_pack/version" # base Ruby Language Pack. This is for any base ruby app. @@ -96,6 +97,7 @@ def compile Dir.chdir(build_path) remove_vendor_bundle warn_bundler_upgrade + warn_bad_binstubs install_ruby(slug_vendor_ruby, build_ruby_path) install_jvm setup_language_pack_environment(ruby_layer_path: File.expand_path("."), gem_layer_path: File.expand_path(".")) @@ -121,10 +123,11 @@ def compile raise e end + def build new_app? remove_vendor_bundle - + warn_bad_binstubs ruby_layer = Layer.new(@layer_dir, "ruby", launch: true) install_ruby("#{ruby_layer.path}/#{slug_vendor_ruby}") ruby_layer.metadata[:version] = ruby_version.version @@ -174,6 +177,19 @@ def config_detect private + # A bad shebang line looks like this: + # + # ``` + # #!/usr/bin/env ruby2.5 + # ``` + # + # Since `ruby2.5` is not a valid binary name + # + def warn_bad_binstubs + check = LanguagePack::Helpers::BinstubCheck.new(app_root_dir: Dir.pwd, warn_object: self) + check.call + end + def default_malloc_arena_max? return true if @metadata.exists?("default_malloc_arena_max") return @metadata.touch("default_malloc_arena_max") if new_app? diff --git a/lib/language_pack/test/ruby.rb b/lib/language_pack/test/ruby.rb index 9b3097a8a..39ff78d31 100644 --- a/lib/language_pack/test/ruby.rb +++ b/lib/language_pack/test/ruby.rb @@ -5,6 +5,7 @@ def compile new_app? Dir.chdir(build_path) remove_vendor_bundle + warn_bad_binstubs install_ruby(slug_vendor_ruby, build_ruby_path) install_jvm setup_language_pack_environment(ruby_layer_path: File.expand_path("."), gem_layer_path: File.expand_path(".")) diff --git a/spec/helpers/binstub_check_spec.rb b/spec/helpers/binstub_check_spec.rb new file mode 100644 index 000000000..612051306 --- /dev/null +++ b/spec/helpers/binstub_check_spec.rb @@ -0,0 +1,79 @@ +require_relative "../spec_helper.rb" + +describe LanguagePack::Helpers::BinstubCheck do + def get_ruby_path! + out = `which ruby`.chomp + raise "command `which ruby` failed with output: #{out}" unless $?.success? + + return Pathname.new(out) + end + + def get_ruby_bin_dir! + ruby_bin_dir = get_ruby_path!.join("..") + raise "#{ruby_bin_dir} is not a directory" unless File.directory?(ruby_bin_dir) + + return ruby_bin_dir + end + + it "can determine if a file is binary or not" do + binstub = LanguagePack::Helpers::BinstubWrapper.new(get_ruby_path!) + + expect(binstub.bad_shebang?).to be_falsey + expect(binstub.binary?).to be_truthy + + Tempfile.create("foo.txt") do |f| + f.write("foo") + f.close + binstub = LanguagePack::Helpers::BinstubWrapper.new(f.path) + + expect(binstub.bad_shebang?).to be_falsey + expect(binstub.binary?).to be_falsey + end + end + + it "doesn't error on empty directories" do + Dir.mktmpdir do |dir| + warn_obj = Object.new + check = LanguagePack::Helpers::BinstubCheck.new(app_root_dir: dir, warn_object: warn_obj) + check.call + end + end + + it "does not raise an error when running against a directory with a binary file in it" do + ruby_bin_dir = get_ruby_bin_dir! + check = LanguagePack::Helpers::BinstubCheck.new(app_root_dir: ruby_bin_dir, warn_object: Object.new) + check.call + end + + it "checks binstubs and finds bad ones" do + Dir.mktmpdir do |dir| + bin_dir = Pathname.new(dir).join("bin") + bin_dir.mkpath + + # Bad binstub + bin_dir.join("bad_binstub_example").write(<<~EOM) + #!/usr/bin/env ruby2.5 + + nothing else matters + EOM + + # Good binstub + bin_dir.join("good_binstub_example").write(<<~EOM) + #!/usr/bin/env bash + + nothing else matters + EOM + bin_dir.join("good_binstub_example_two").write("#!/usr/bin/env ruby") + + warn_obj = Object.new + def warn_obj.warn(*args, **kwargs); @msg = args.first; end + def warn_obj.msg; @msg; end + + check = LanguagePack::Helpers::BinstubCheck.new(app_root_dir: dir, warn_object: warn_obj) + check.call + + expect(check.bad_binstubs.count).to eq(1) + expect(warn_obj.msg).to include("bin/bad_binstub_example") + end + end +end From 50690f61cb742c6975e9e9da0c4a0ac903940425 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Mon, 29 Jun 2020 09:25:17 -0500 Subject: [PATCH 0742/1195] [close #1027][changelog skip] Fix frozen string error (#1028) Since the `binstub_wrapper` is using the magic frozen comment any string literals will be immutable. The `force_encoding` method apparently mutates the string so this raises an error. By always returning a mutable string we can avoid this situation. --- lib/language_pack/helpers/binstub_wrapper.rb | 2 +- spec/helpers/binstub_check_spec.rb | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/language_pack/helpers/binstub_wrapper.rb b/lib/language_pack/helpers/binstub_wrapper.rb index 4d9082365..702229c9c 100644 --- a/lib/language_pack/helpers/binstub_wrapper.rb +++ b/lib/language_pack/helpers/binstub_wrapper.rb @@ -43,7 +43,7 @@ def shebang @shebang ||= begin @binstub.open(&:readline) rescue EOFError - "" + String.new("") end end diff --git a/spec/helpers/binstub_check_spec.rb b/spec/helpers/binstub_check_spec.rb index 612051306..a5987e149 100644 --- a/spec/helpers/binstub_check_spec.rb +++ b/spec/helpers/binstub_check_spec.rb @@ -15,6 +15,16 @@ def get_ruby_bin_dir! return ruby_bin_dir end + it "handles empty binstubs" do + Tempfile.create("foo.txt") do |f| + expect { Pathname.new(f).open(&:readline) }.to raise_error(EOFError) + + binstub = LanguagePack::Helpers::BinstubWrapper.new(f.path) + expect(binstub.bad_shebang?).to be_falsey + expect(binstub.binary?).to be_falsey + end + end + it "can determine if a file is binary or not" do binstub = LanguagePack::Helpers::BinstubWrapper.new(get_ruby_path!) From 96fd735f78e18650fcc39d2aa9176bbe08662749 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Mon, 6 Jul 2020 09:35:40 -0500 Subject: [PATCH 0743/1195] Document v217 release in master (#1030) I've done something a bit funny with this release. The default branch is very far ahead of what was released in v215. There's some bugs preventing a release, but a release of stack support is blocking other work. There's two ways to release that work: - Revert everything on default branch back to v215 and then re-apply the patches we need for stack support, cut a release from master, then un-revert everything that was reverted. - Pros: The release will come from a point in time in the default branch. - Cons there's a lot of hoops to jump through. Mistakes might get made, it is messy. - Keep default branch separate from the code released in v217. All commits to the v217 branch are cherry-picked from master/main, the only difference is we're re-writing history to not have the rest of the features. - Pros: The default branch commits stay clean, there's no reverting and then un-reverting - Cons: The release v217 is being made from a branch which might be confusing in the future. --- CHANGELOG.md | 3 +++ lib/language_pack/version.rb | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 653679e20..01a77fe67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ * The spring library is now disabled by setting the enviornment variable DISABLE_SPRING=1 (https://github.com/heroku/heroku-buildpack-ruby/pull/1017) * Warn when a bad "shebang" line in a binstub is detected (https://github.com/heroku/heroku-buildpack-ruby/pull/1014) * Default node version now 12.16.2, yarn is 1.22.4 (https://github.com/heroku/heroku-buildpack-ruby/pull/986) + + ## v217 (7/2/2020) + * Gracefully handle unrecognised stacks ([#982](https://github.com/heroku/heroku-buildpack-ruby/pull/982)) ## v216 (rolled back) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 354c3e2a4..47260f040 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v216" + BUILDPACK_VERSION = "v217" end end From 80305b9e405ececd7213e9b86f97a0259ff5c511 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Tue, 7 Jul 2020 09:36:29 -0500 Subject: [PATCH 0744/1195] [close #1029] Remove default bin/rake binstub (#1031) After v216 was released there were several failures reported in #1029 and #1005 these are both related to `bin/` being put first on the path consistently in build and run time. After investigation it was uncovered that `bin/rake` was a file we're putting in that location if the customer does not check in a `bin/rake` binstub. This file is generated by compiling a Ruby binary: ``` $ curl -O https://heroku-buildpack-ruby.s3.amazonaws.com/heroku-18/ruby-2.7.1.tgz $ tar -xzf ruby-2.7.1.tgz bin/ $ cat bin/rake #!/bin/sh # -*- ruby -*- # This file was generated by RubyGems. # # The application 'rake' is installed as part of a gem, and # this file is here to facilitate running it. # _=_\ =begin bindir="${0%/*}" exec "$bindir/ruby" "-x" "$0" "$@" =end #!/usr/bin/env ruby require 'rubygems' version = ">= 0.a" str = ARGV.first if str str = str.b[/\A_(.*)_\z/, 1] if str and Gem::Version.correct?(str) version = str ARGV.shift end end if Gem.respond_to?(:activate_bin_path) load Gem.activate_bin_path('rake', 'rake', version) else gem "rake", version load Gem.bin_path("rake", "rake", version) end ``` v216 release caused two related issues due to having `bin/rake first on the PATH. ## Bad shebang lines Issue #1005 is related to having bad shebang lines: ``` $ cat bin/rake | head -n 1 #!/app/vendor/ruby-2.3.8/bin/ruby ``` This was fixed by modifying our compilation code in: https://github.com/heroku/docker-heroku-ruby-builder/pull/5 ## Bundler not loaded Issue #1029 occurs because the code in `bin/rake` that is generated from compiling Ruby is not bundler aware. It does not load bundler. As a result: - Git based gems do not work with the Ruby compiled `bin/rake` - Referencing code from bundler like `Bundler.setup` does not work because it's not yet required This behavior is described in detail in this comment: https://github.com/heroku/heroku-buildpack-ruby/issues/1025#issuecomment-653102430 The short version is: Without putting `bin/` first on the path at build time then the binstub generated by bundler in the location `vendor/bundle/bin/` takes precedence and this code (since it is generated by bundler) is bundler aware. When `bin/` was moved to be first in the path, this behavior broke. ## Fix implementation This fix for #1029 works by not putting the Ruby compiled `bin/rake` on in the customer's `bin/` folder. We keep `bin/` first in the path so if a customer is checking in a binstub their binstub will be used. If they are not checking in a binstub then the bundler generated version of `vendor/bundle/bin/` will be used. This fix also would have superseded the work to fix #1005 and not required re-compiling dozens of binaries, but this bug was found and diagnosed after #1005 was reported. ## Known risks The one risk with this approach is that anyone relying on running `rake assets:precompile` at build time but they're not using Rake in their Gemfile will no longer work. I believe this is not a common case, and it's best practice to have a specific version of Rake in the Gemfile.lock. --- CHANGELOG.md | 1 + hatchet.lock | 4 +- .../installers/ruby_installer.rb | 11 +++ spec/hatchet/ruby_spec.rb | 69 ++++++++++++++++++- spec/hatchet/stack_spec.rb | 4 +- 5 files changed, 83 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 01a77fe67..6d7a68b86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## Master (unreleased) +* The rake binstub generated from compiling Ruby will no longer be placed in the local `bin/rake` location (https://github.com/heroku/heroku-buildpack-ruby/pull/1031) * A bug in 2.6.0, 2.6.1, 2.6.3 require a Ruby upgrade, a warning has been added (https://github.com/heroku/heroku-buildpack-ruby/pull/1015) * The spring library is now disabled by setting the enviornment variable DISABLE_SPRING=1 (https://github.com/heroku/heroku-buildpack-ruby/pull/1017) * Warn when a bad "shebang" line in a binstub is detected (https://github.com/heroku/heroku-buildpack-ruby/pull/1014) diff --git a/hatchet.lock b/hatchet.lock index 33b580258..5ea69b65d 100644 --- a/hatchet.lock +++ b/hatchet.lock @@ -4,7 +4,7 @@ - - "./repos/bundler/bundle-ruby-version-not-in-lockfile" - 5c8219d8bbdc8faa6a98781867b9fce25a6f2abb - - "./repos/bundler/git_gemspec" - - 19fc9a51a5c36c81c926bf8e16d07399e0e514aa + - 7755e19caf122e1373bce73ffe9b333e9411d732 - - "./repos/bundler/no_lockfile" - 1947ce9a9c276d5df1c323b2ad78d1d85c7ab4c0 - - "./repos/bundler/nokogiri_160" @@ -36,7 +36,7 @@ - - "./repos/node/minimal_webpacker" - bca8b8169c553a0f62f0263b621cf3a5813e4023 - - "./repos/rack/default_ruby" - - da748a59340be8b950e7bbbfb32077eb67d70c3c + - master - - "./repos/rack/mri_187_nokogiri" - 3fcce9c85bf560dba285cc385ae9845729195826 - - "./repos/rack/mri_192" diff --git a/lib/language_pack/installers/ruby_installer.rb b/lib/language_pack/installers/ruby_installer.rb index a96c48126..08714631e 100644 --- a/lib/language_pack/installers/ruby_installer.rb +++ b/lib/language_pack/installers/ruby_installer.rb @@ -32,6 +32,17 @@ def setup_binstubs(install_dir) Dir["#{install_dir}/bin/*"].each do |vendor_bin| # for Ruby 2.6.0+ don't symlink the Bundler bin so our shim works next if vendor_bin.include?("bundle") + + # The bin/rake binstub generated when compiling ruby does not load bundler + # which can cause unexpected failures. Deleting this binstub allows two things: + # + # - If the app includes a custom binstub allows it to be used + # - If the app does not include a custom binstub, then it will fall back to vendor/bundle/bin/rake + # which is generated by bundler + # + # Discussion: https://github.com/heroku/heroku-buildpack-ruby/issues/1025#issuecomment-653102430 + next if vendor_bin.include?("rake") + if install_pathname.absolute? run("ln -s #{vendor_bin} #{DEFAULT_BIN_DIR}") else diff --git a/spec/hatchet/ruby_spec.rb b/spec/hatchet/ruby_spec.rb index e106e4b04..3d543a3c5 100644 --- a/spec/hatchet/ruby_spec.rb +++ b/spec/hatchet/ruby_spec.rb @@ -1,6 +1,71 @@ require_relative '../spec_helper' describe "Ruby apps" do + + # https://github.com/heroku/heroku-buildpack-ruby/issues/1025 + describe "bin/rake binstub" do + it "loads git gems at build time when executing `rake`" do + Hatchet::Runner.new("git_gemspec").tap do |app| + app.before_deploy do + File.open("Rakefile", "w+") do |f| + f.puts(<<~EOF) + task "assets:precompile" do + require 'mini_histogram' + puts "successfully loaded git gem" + end + EOF + end + end + app.deploy do + expect(app.output).to match("successfully loaded git gem") + expect(app.run("rake assets:precompile")).to match("successfully loaded git gem") + end + end + end + + it "loads bundler into memory" do + Hatchet::Runner.new("default_ruby").tap do |app| + app.before_deploy do + File.open("Rakefile", "w+") do |f| + f.puts(<<~EOF) + task "assets:precompile" do + puts Bundler.methods + + puts "bundler loaded in rake context" + end + EOF + end + end + app.deploy do + expect(app.output).to match("bundler loaded in rake context") + expect(app.run("rake assets:precompile")).to match("bundler loaded in rake context") + end + end + end + + it "loads custom rake binstub" do + Hatchet::Runner.new("default_ruby").tap do |app| + app.before_deploy do + FileUtils.mkdir_p("bin") + + File.open("bin/rake", "w+") do |f| + f.puts(<<~EOF) + #!/usr/bin/env ruby + + puts "rake assets:precompile" # Needed to trigger the `rake -P` task detection + puts "custom rake binstub called" + EOF + end + FileUtils.chmod("+x", "bin/rake") + end + app.deploy do + expect(app.output).to match("custom rake binstub called") + expect(app.run("rake")).to match("custom rake binstub called") + end + end + end + end + describe "bad ruby version" do it "gives a helpful error" do Hatchet::Runner.new('ruby_version_does_not_exist', allow_failure: true, stack: DEFAULT_STACK).deploy do |app| @@ -12,7 +77,7 @@ describe "exporting path" do it "puts local bin dir in path" do before_deploy = Proc.new do - run!("mkdir bin") + FileUtils.mkdir_p("bin") File.open("bin/bloop", "w+") do |f| f.puts(<<~EOF) #!/usr/bin/env bash @@ -20,7 +85,7 @@ echo "bloop" EOF end - run!("chmod +x bin/bloop") + FileUtils.chmod("+x", "bin/bloop") File.open("Rakefile", "a") do |f| f.puts(<<~EOF) diff --git a/spec/hatchet/stack_spec.rb b/spec/hatchet/stack_spec.rb index 0e77f0a73..cb2d8cfbb 100644 --- a/spec/hatchet/stack_spec.rb +++ b/spec/hatchet/stack_spec.rb @@ -9,7 +9,7 @@ app.push! - expect(app.output).to match("Installing rack 1.5.0") + expect(app.output).to match("Installing rack") expect(app.output).to match("Changing stack") end end @@ -22,7 +22,7 @@ app.push! puts app.output - expect(app.output).to match("Using rack 1.5.0") + expect(app.output).to match("Using rack") end end end From a11d41828c4cfdad3ad94d8450b73254d95d102e Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Mon, 13 Jul 2020 10:28:27 -0500 Subject: [PATCH 0745/1195] v218 for Monday release (#1034) --- CHANGELOG.md | 2 ++ lib/language_pack/version.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d7a68b86..e661460f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Master (unreleased) +## v218 (7/13/2020) + * The rake binstub generated from compiling Ruby will no longer be placed in the local `bin/rake` location (https://github.com/heroku/heroku-buildpack-ruby/pull/1031) * A bug in 2.6.0, 2.6.1, 2.6.3 require a Ruby upgrade, a warning has been added (https://github.com/heroku/heroku-buildpack-ruby/pull/1015) * The spring library is now disabled by setting the enviornment variable DISABLE_SPRING=1 (https://github.com/heroku/heroku-buildpack-ruby/pull/1017) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 47260f040..5fa99aa2d 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v217" + BUILDPACK_VERSION = "v218" end end From 4a8ddfe9df21a773ea110d950fdb5ea7d35803dc Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Wed, 15 Jul 2020 11:29:29 -0500 Subject: [PATCH 0746/1195] [changelog skip] Move unreleased changelogs (#1035) v218 is released, these are no longer "unreleased". --- changelogs/unreleased/.gitkeep | 0 changelogs/{unreleased => v218}/disable_spring.md | 0 changelogs/{unreleased => v218}/node_yarn.md | 0 3 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 changelogs/unreleased/.gitkeep rename changelogs/{unreleased => v218}/disable_spring.md (100%) rename changelogs/{unreleased => v218}/node_yarn.md (100%) diff --git a/changelogs/unreleased/.gitkeep b/changelogs/unreleased/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/changelogs/unreleased/disable_spring.md b/changelogs/v218/disable_spring.md similarity index 100% rename from changelogs/unreleased/disable_spring.md rename to changelogs/v218/disable_spring.md diff --git a/changelogs/unreleased/node_yarn.md b/changelogs/v218/node_yarn.md similarity index 100% rename from changelogs/unreleased/node_yarn.md rename to changelogs/v218/node_yarn.md From 766e419250fb87725b3e052bb5ca0ed6dec19d18 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Wed, 15 Jul 2020 13:40:08 -0500 Subject: [PATCH 0747/1195] [close #934] Skip rake task if it does not exist (#1036) * [close #934] Skip rake task if it does not exist If the `assets:clean` task does not exist, don't call it. * Add test to assert `assets:clean` is called --- CHANGELOG.md | 2 ++ lib/language_pack/rails4.rb | 15 +++++++++------ spec/hatchet/rails5_spec.rb | 3 +++ spec/hatchet/rails6_spec.rb | 8 ++++++++ 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e661460f6..76a7f06d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Master (unreleased) +* Rake task "assets:clean" will not get called if it does not exist (https://github.com/heroku/heroku-buildpack-ruby/pull/1018) + ## v218 (7/13/2020) * The rake binstub generated from compiling Ruby will no longer be placed in the local `bin/rake` location (https://github.com/heroku/heroku-buildpack-ruby/pull/1031) diff --git a/lib/language_pack/rails4.rb b/lib/language_pack/rails4.rb index d60bd3772..703343a6f 100644 --- a/lib/language_pack/rails4.rb +++ b/lib/language_pack/rails4.rb @@ -82,7 +82,7 @@ def run_assets_precompile_rake_task end precompile = rake.task("assets:precompile") - return true unless precompile.is_defined? + return true if precompile.not_defined? topic("Preparing app for Rails asset pipeline") @@ -95,12 +95,15 @@ def run_assets_precompile_rake_task log "assets_precompile", :status => "success" puts "Asset precompilation completed (#{"%.2f" % precompile.time}s)" - puts "Cleaning assets" - rake.task("assets:clean").invoke(env: rake_env) + clean_task = rake.task("assets:clean") + if clean_task.task_defined? + puts "Cleaning assets" + clean_task.invoke(env: rake_env) - cleanup_assets_cache - @cache.store public_assets_folder - @cache.store default_assets_cache + cleanup_assets_cache + @cache.store public_assets_folder + @cache.store default_assets_cache + end else precompile_fail(precompile.output) end diff --git a/spec/hatchet/rails5_spec.rb b/spec/hatchet/rails5_spec.rb index f04242996..aa660b65f 100644 --- a/spec/hatchet/rails5_spec.rb +++ b/spec/hatchet/rails5_spec.rb @@ -84,6 +84,9 @@ def worker_task_for_app(app) app.deploy do expect(app.output).to include("Called bin/yarn binstub") + + expect(app.output).to match("rake assets:precompile") + expect(app.output).to match("rake assets:clean") end end end diff --git a/spec/hatchet/rails6_spec.rb b/spec/hatchet/rails6_spec.rb index 2400531f2..0ca1b6f40 100644 --- a/spec/hatchet/rails6_spec.rb +++ b/spec/hatchet/rails6_spec.rb @@ -11,10 +11,18 @@ it "deploys and serves web requests via puma" do before_deploy = Proc.new do run! "echo 'web: bundle exec puma -t 5:5 -p ${PORT:-3000} -e ${RACK_ENV:-development}' > Procfile" + + # Test Clean task does not get called if it does not exist + # This file will only have the `assets:precompile` task in it, but not `assets:clean` + run! %Q{echo 'task "assets:precompile" do ; end' > Rakefile} end Hatchet::Runner.new('rails6-basic', before_deploy: before_deploy).deploy do |app| expect(app.output).to match("Fetching railties 6") + + expect(app.output).to match("rake assets:precompile") + expect(app.output).to_not match("rake assets:clean") + expect(web_boot_status(app)).to_not eq("crashed") end end From 3174095d37b14e00af2c1c5af23c3d62b43751cb Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Thu, 16 Jul 2020 09:07:45 -0500 Subject: [PATCH 0748/1195] CNB: make the gems layer accessible to subsequent buildpacks #1033 (#1037) * make gem_layer accessible to subsequent buildpacks * changelog * Test gem layer is exported Co-authored-by: Kamal Nasser --- CHANGELOG.md | 1 + lib/language_pack/ruby.rb | 2 +- spec/cnb/basic_local_pack_spec.rb | 67 ++++++++++++++++++++++++++++--- 3 files changed, 63 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 76a7f06d4..053e8c3fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## Master (unreleased) * Rake task "assets:clean" will not get called if it does not exist (https://github.com/heroku/heroku-buildpack-ruby/pull/1018) +* CNB: Fix the `gems` layer not being made accessible by subsequent buildpacks (https://github.com/heroku/heroku-buildpack-ruby/pull/1033) ## v218 (7/13/2020) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 0dab3a185..10284d5c3 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -136,7 +136,7 @@ def build ruby_layer.metadata[:engine_version] = ruby_version.engine_version ruby_layer.write - gem_layer = Layer.new(@layer_dir, "gems", launch: true, cache: true) + gem_layer = Layer.new(@layer_dir, "gems", launch: true, cache: true, build: true) setup_language_pack_environment(ruby_layer_path: ruby_layer.path, gem_layer_path: gem_layer.path) setup_profiled(ruby_layer_path: ruby_layer.path, gem_layer_path: gem_layer.path) allow_git do diff --git a/spec/cnb/basic_local_pack_spec.rb b/spec/cnb/basic_local_pack_spec.rb index bb7c40bba..d1d97b3ff 100644 --- a/spec/cnb/basic_local_pack_spec.rb +++ b/spec/cnb/basic_local_pack_spec.rb @@ -3,16 +3,20 @@ class CnbRun attr_accessor :image_name, :output, :repo_path, :buildpack_path, :builder - def initialize(repo_path, builder: "heroku/buildpacks:18", buildpack_path: ) + def initialize(repo_path, builder: "heroku/buildpacks:18", buildpack_paths: ) @repo_path = repo_path @image_name = "heroku-buildpack-ruby-tests:#{SecureRandom.hex}" @builder = builder - @buildpack_path = buildpack_path + @buildpack_paths = Array.new(buildpack_paths) @build_output = "" end def call - command = "pack build #{image_name} --path #{repo_path} --buildpack #{buildpack_path} --builder heroku/buildpacks:18" + command = String.new("pack build #{image_name} --path #{repo_path} --builder heroku/buildpacks:18") + @buildpack_paths.each do |path| + command << " --buildpack #{path}" + end + @output = run_local!(command) yield self ensure @@ -23,7 +27,7 @@ def teardown return unless image_name repo_name, tag_name = image_name.split(":") - docker_list = run_local!("docker images --no-trunc | grep #{repo_name} | grep #{tag_name}").chomp + docker_list = `docker images --no-trunc | grep #{repo_name} | grep #{tag_name}`.chomp run_local!("docker rmi #{image_name} --force") if !docker_list.empty? @image_name = nil end @@ -47,7 +51,7 @@ def run!(cmd) describe "cnb" do it "locally runs default_ruby app" do - CnbRun.new(hatchet_path("rack/default_ruby"), buildpack_path: buildpack_path).call do |app| + CnbRun.new(hatchet_path("rack/default_ruby"), buildpack_paths: [buildpack_path]).call do |app| expect(app.output).to match("Compiling Ruby/Rack") run_out = app.run!("ruby -v") @@ -55,8 +59,59 @@ def run!(cmd) end end + it "uses multiple buildpacks" do + Dir.mktmpdir do |second_buildpack_dir| + FileUtils.mkdir_p("#{second_buildpack_dir}/bin") + + File.open("#{second_buildpack_dir}/buildpack.toml", "w") do |f| + f.write <<~EOM + # Buildpack API version + api = "0.2" + + # Buildpack ID and metadata + [buildpack] + id = "com.examples.buildpacks.test_ruby_export" + version = "0.0.1" + name = "Test Ruby Export Buildpack" + + # Stacks that the buildpack will work with + [[stacks]] + id = "heroku-18" + + [[stacks]] + id = "org.cloudfoundry.stacks.cflinuxfs3" + EOM + end + File.open("#{second_buildpack_dir}/bin/detect", "w") do |f| + f.write <<~EOM + #! /usr/bin/env bash + + exit 0 + EOM + end + + File.open("#{second_buildpack_dir}/bin/build", "w") do |f| + f.write <<~EOM + #! /usr/bin/env bash + + echo "Which gem: $(which gem)" + exit 0 + EOM + end + FileUtils.chmod("+x", "#{second_buildpack_dir}/bin/detect") + FileUtils.chmod("+x", "#{second_buildpack_dir}/bin/build") + + CnbRun.new(hatchet_path("rack/default_ruby"), buildpack_paths: [buildpack_path, second_buildpack_dir]).call do |app| + expect(app.output).to match("Compiling Ruby/Rack") + + expect(app.output).to match("com.examples.buildpacks.test_ruby_export") + expect(app.output).to match("Which gem: /workspace/bin/gem") + end + end + end + it "locally runs rails getting started" do - CnbRun.new(hatchet_path("heroku/ruby-getting-started"), buildpack_path: buildpack_path).call do |app| + CnbRun.new(hatchet_path("heroku/ruby-getting-started"), buildpack_paths: [buildpack_path]).call do |app| expect(app.output).to match("Compiling Ruby/Rails") run_out = app.run!("ruby -v") From 1486bdd34f4d110cfe13ba515db3678ec082c544 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Fri, 24 Jul 2020 09:30:11 -0500 Subject: [PATCH 0749/1195] [changelog skip] Bring back rake task (#1038) Deleted in https://github.com/heroku/heroku-buildpack-ruby/commit/55ab1cb60cc58e2ede101625de886755ca3fa2cf --- Rakefile | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/Rakefile b/Rakefile index e02fb7513..33ce63cf7 100644 --- a/Rakefile +++ b/Rakefile @@ -56,6 +56,42 @@ def install_gem(gem_name, version) end end +namespace :buildpack do + desc "stage a tarball of the buildpack" + task :tarball do + + Dir.mktmpdir("heroku-buildpack-ruby") do |tmpdir| + sh "git clone https://github.com/heroku/heroku-buildpack-ruby #{tmpdir}/heroku-buildpack-ruby" + + Dir.chdir(tmpdir) do + Dir.chdir("heroku-buildpack-ruby") do |buildpack_dir| + $:.unshift File.expand_path("../lib", __FILE__) + require "language_pack/installers/heroku_ruby_installer" + require "language_pack/ruby_version" + require "language_pack/version" + + %w(cedar-14 heroku-16 heroku-18).each do |stack| + installer = LanguagePack::Installers::HerokuRubyInstaller.new(stack) + ruby_version = LanguagePack::RubyVersion.new("ruby-#{LanguagePack::RubyVersion::DEFAULT_VERSION_NUMBER}") + installer.fetch_unpack(ruby_version, "vendor/ruby/#{stack}") + end + + sh "tar czf ../buildpack.tgz *" + end + + @digest = Digest::MD5.hexdigest(File.read("buildpack.tgz")) + end + + + filename = "buildpacks/heroku-buildpack-ruby-#{LanguagePack::Base::BUILDPACK_VERSION}.tgz" + puts "Writing to #{filename}" + + FileUtils.mkdir_p("buildpacks/") + FileUtils.cp("#{tmpdir}/buildpack.tgz", filename) + end + end +end + desc "update plugins" task "plugins:update" do vendor_plugin "https://github.com/heroku/rails_log_stdout.git", "legacy" From 61b8ebd2611dcc80d4a119f847a0fffcdee3103a Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Mon, 27 Jul 2020 15:23:37 -0500 Subject: [PATCH 0750/1195] [changelog skip] s/master/main/ (#1042) --- CHANGELOG.md | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 053e8c3fe..3d724fc52 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## Master (unreleased) +# Main (unreleased) * Rake task "assets:clean" will not get called if it does not exist (https://github.com/heroku/heroku-buildpack-ruby/pull/1018) * CNB: Fix the `gems` layer not being made accessible by subsequent buildpacks (https://github.com/heroku/heroku-buildpack-ruby/pull/1033) diff --git a/README.md b/README.md index e7d6672b5..0b6ef1413 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Example Usage: $ heroku create --buildpack heroku/ruby - $ git push heroku master + $ git push heroku main ... -----> Heroku receiving push -----> Fetching custom buildpack From 35463d0715ffd59bce292675f8a965725e6ba9f0 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Tue, 11 Aug 2020 13:22:18 -0500 Subject: [PATCH 0751/1195] [changelog skip] Update to Hatchet 7.0.0 (#1045) --- Gemfile.lock | 29 ++++++----------------------- app.json | 2 +- 2 files changed, 7 insertions(+), 24 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index e08e5ee1e..5931e2fce 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,50 +1,37 @@ GEM remote: https://rubygems.org/ specs: - activesupport (6.0.2.2) - concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (>= 0.7, < 2) - minitest (~> 5.1) - tzinfo (~> 1.1) - zeitwerk (~> 2.2) ansi (1.5.0) ci-queue (0.17.2) ansi citrus (3.0.2) - concurrent-ruby (1.1.6) diff-lcs (1.3) erubis (2.7.0) - excon (0.73.0) + excon (0.76.0) heroics (0.1.1) erubis (~> 2.0) excon moneta multi_json (>= 1.9.2) - heroku_hatchet (6.0.0) + heroku_hatchet (7.0.0) excon (~> 0) - platform-api (= 3.0.0.pre.1) - repl_runner (~> 0.0.3) + platform-api (~> 3) rrrretry (~> 1) thor (~> 0) threaded (~> 0) - i18n (1.8.2) - concurrent-ruby (~> 1.0) json (2.3.0) - minitest (5.14.0) moneta (1.0.0) - multi_json (1.14.1) + multi_json (1.15.0) parallel (1.19.1) parallel_tests (2.32.0) parallel - platform-api (3.0.0.pre.1) + platform-api (3.0.0) heroics (~> 0.1.1) moneta (~> 1.0.0) rate_throttle_client (~> 0.1.0) rake (13.0.1) - rate_throttle_client (0.1.1) + rate_throttle_client (0.1.2) redis (4.1.3) - repl_runner (0.0.3) - activesupport rrrretry (1.0.0) rspec-core (3.9.1) rspec-support (~> 3.9.1) @@ -55,13 +42,9 @@ GEM rspec-core (> 3.3) rspec-support (3.9.2) thor (0.20.3) - thread_safe (0.3.6) threaded (0.0.4) toml-rb (2.0.1) citrus (~> 3.0, > 3.0) - tzinfo (1.2.7) - thread_safe (~> 0.1) - zeitwerk (2.3.0) PLATFORMS ruby diff --git a/app.json b/app.json index 0f309365b..e1ec3778e 100644 --- a/app.json +++ b/app.json @@ -9,7 +9,7 @@ "env": { "HATCHET_RETRIES": "3", "IS_RUNNING_ON_CI": "true", - "HATCHET_APP_LIMIT": "80", + "HATCHET_APP_LIMIT": "100", "BUILDPACK_LOG_FILE": "tmp/buildpack.log" }, "formation": { From 0449897f249bacc66f57c62e891dd847a40daaba Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Tue, 18 Aug 2020 13:17:08 -0500 Subject: [PATCH 0752/1195] [close #943] Use Bundler env vars for config (#1039) * [close #943] Use Bundler env vars for config Starting with Bundler 2.x deprecation warnings started appearing noting that flags will no longer persist config when running `bundle install`: ``` Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment [DEPRECATED] The `--deployment` flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use `bundle config set deployment 'true'`, and stop using this flag [DEPRECATED] The `--path` flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use `bundle config set path 'vendor/bundle'`, and stop using this flag [DEPRECATED] The `--without` flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use `bundle config set without 'development:test'`, and stop using this flag [DEPRECATED] The --binstubs option will be removed in favor of `bundle binstubs` ``` This is generally a confusing part of running bundler locally where someone on a team might try running `--bundle_without` once and then be confused at future behavior. To support persisting values, we can use the bundler env vars that start with `BUNDLE_`. These will be set at: - Build time - exported for other buildpacks - Runtime In addition, they're being shown in the `bundle install` output so if a developer gets a failure on Heroku they can copy and paste the command to test locally. * Comment on BUNDLE_DEPLOYMENT The code makes it difficult to see what the conditions where this would be empty are. This comment makes that condition more clear. --- CHANGELOG.md | 1 + lib/language_pack/rails4.rb | 6 -- lib/language_pack/ruby.rb | 122 ++++++++++++++++++++------------- lib/language_pack/test/ruby.rb | 11 ++- spec/hatchet/node_spec.rb | 7 +- spec/hatchet/ruby_spec.rb | 4 +- 6 files changed, 92 insertions(+), 59 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d724fc52..12d0c3a4c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Main (unreleased) +* Persistent bundler config is now being set using the `BUNDLE_*` env vars (https://github.com/heroku/heroku-buildpack-ruby/pull/1039) * Rake task "assets:clean" will not get called if it does not exist (https://github.com/heroku/heroku-buildpack-ruby/pull/1018) * CNB: Fix the `gems` layer not being made accessible by subsequent buildpacks (https://github.com/heroku/heroku-buildpack-ruby/pull/1033) diff --git a/lib/language_pack/rails4.rb b/lib/language_pack/rails4.rb index 703343a6f..86e11b6fd 100644 --- a/lib/language_pack/rails4.rb +++ b/lib/language_pack/rails4.rb @@ -30,12 +30,6 @@ def default_process_types end end - def build_bundler(default_bundle_without) - instrument "rails4.build_bundler" do - super - end - end - def compile instrument "rails4.compile" do super diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 10284d5c3..0d384b15a 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -100,12 +100,16 @@ def compile warn_bad_binstubs install_ruby(slug_vendor_ruby, build_ruby_path) install_jvm - setup_language_pack_environment(ruby_layer_path: File.expand_path("."), gem_layer_path: File.expand_path(".")) - setup_profiled(ruby_layer_path: "$HOME", gem_layer_path: "$HOME") # $HOME is set to /app at run time + setup_language_pack_environment( + ruby_layer_path: File.expand_path("."), + gem_layer_path: File.expand_path("."), + bundle_path: "vendor/bundle", + bundle_default_without: "development:test" + ) allow_git do install_bundler_in_app(slug_vendor_base) load_bundler_cache - build_bundler(bundle_path: "vendor/bundle", default_bundle_without: "development:test") + build_bundler post_bundler create_database_yml install_binaries @@ -114,6 +118,7 @@ def compile config_detect best_practice_warnings warn_outdated_ruby + setup_profiled(ruby_layer_path: "$HOME", gem_layer_path: "$HOME") # $HOME is set to /app at run time setup_export cleanup super @@ -137,8 +142,12 @@ def build ruby_layer.write gem_layer = Layer.new(@layer_dir, "gems", launch: true, cache: true, build: true) - setup_language_pack_environment(ruby_layer_path: ruby_layer.path, gem_layer_path: gem_layer.path) - setup_profiled(ruby_layer_path: ruby_layer.path, gem_layer_path: gem_layer.path) + setup_language_pack_environment( + ruby_layer_path: ruby_layer.path, + gem_layer_path: gem_layer.path, + bundle_path: "#{gem_layer.path}/vendor/bundle", + bundle_default_without: "development:test" + ) allow_git do # TODO install bundler in separate layer topic "Loading Bundler Cache" @@ -146,7 +155,7 @@ def build valid_bundler_cache?(gem_layer.path, gem_layer.metadata) end install_bundler_in_app("#{gem_layer.path}/#{slug_vendor_base}") - build_bundler(bundle_path: "#{gem_layer.path}/vendor/bundle", default_bundle_without: "development:test") + build_bundler # TODO post_bundler might need to be done in a new layer bundler.clean gem_layer.metadata[:gems] = Digest::SHA2.hexdigest(File.read("Gemfile.lock")) @@ -161,6 +170,7 @@ def build install_binaries run_assets_precompile_rake_task end + setup_profiled(ruby_layer_path: ruby_layer.path, gem_layer_path: gem_layer.path) setup_export(gem_layer) config_detect best_practice_warnings @@ -345,7 +355,7 @@ def default_java_mem end # sets up the environment variables for the build process - def setup_language_pack_environment(ruby_layer_path:, gem_layer_path:) + def setup_language_pack_environment(ruby_layer_path:, gem_layer_path:, bundle_path:, bundle_default_without:) instrument 'ruby.setup_language_pack_environment' do if ruby_version.jruby? ENV["PATH"] += ":bin" @@ -393,6 +403,11 @@ def setup_language_pack_environment(ruby_layer_path:, gem_layer_path:) paths << ENV["PATH"] ENV["PATH"] = paths.join(":") + + ENV["BUNDLE_WITHOUT"] = env("BUNDLE_WITHOUT") || bundle_default_without + ENV["BUNDLE_PATH"] = bundle_path + ENV["BUNDLE_BIN"] = bundler_binstubs_path + ENV["BUNDLE_DEPLOYMENT"] = "1" end end @@ -426,6 +441,11 @@ def setup_export(layer = nil) set_export_default "JAVA_OPTS", default_java_opts set_export_default "JRUBY_OPTS", default_jruby_opts end + + set_export_default "BUNDLE_PATH", ENV["BUNDLE_PATH"], layer + set_export_default "BUNDLE_WITHOUT", ENV["BUNDLE_WITHOUT"], layer + set_export_default "BUNDLE_BIN", ENV["BUNDLE_BIN"], layer + set_export_default "BUNDLE_DEPLOYMENT", ENV["BUNDLE_DEPLOYMENT"], layer if ENV["BUNDLE_DEPLOYMENT"] # Unset on windows since we delete the Gemfile.lock end end @@ -461,6 +481,11 @@ def setup_profiled(ruby_layer_path: , gem_layer_path: ) set_env_default "JAVA_OPTS", default_java_opts set_env_default "JRUBY_OPTS", default_jruby_opts end + + set_env_default "BUNDLE_PATH", ENV["BUNDLE_PATH"] + set_env_default "BUNDLE_WITHOUT", ENV["BUNDLE_WITHOUT"] + set_env_default "BUNDLE_BIN", ENV["BUNDLE_BIN"] + set_env_default "BUNDLE_DEPLOYMENT", ENV["BUNDLE_DEPLOYMENT"] if ENV["BUNDLE_DEPLOYMENT"] # Unset on windows since we delete the Gemfile.lock end end @@ -839,44 +864,47 @@ def write_bundler_shim(path) end # runs bundler to install the dependencies - def build_bundler(bundle_path:, default_bundle_without:) + def build_bundler instrument 'ruby.build_bundler' do log("bundle") do - bundle_without = env("BUNDLE_WITHOUT") || default_bundle_without - bundle_bin = "bundle" - bundle_command = "#{bundle_bin} install --without #{bundle_without} --path #{bundle_path} --binstubs #{bundler_binstubs_path}" - bundle_command << " -j4" - if File.exist?("#{Dir.pwd}/.bundle/config") - warn(<<-WARNING, inline: true) -You have the `.bundle/config` file checked into your repository - It contains local state like the location of the installed bundle - as well as configured git local gems, and other settings that should -not be shared between multiple checkouts of a single repo. Please -remove the `.bundle/` folder from your repo and add it to your `.gitignore` file. -https://devcenter.heroku.com/articles/bundler-configuration -WARNING + warn(<<~WARNING, inline: true) + You have the `.bundle/config` file checked into your repository + It contains local state like the location of the installed bundle + as well as configured git local gems, and other settings that should + not be shared between multiple checkouts of a single repo. Please + remove the `.bundle/` folder from your repo and add it to your `.gitignore` file. + + https://devcenter.heroku.com/articles/bundler-configuration + WARNING end if bundler.windows_gemfile_lock? - warn(<<-WARNING, inline: true) -Removing `Gemfile.lock` because it was generated on Windows. -Bundler will do a full resolve so native gems are handled properly. -This may result in unexpected gem versions being used in your app. -In rare occasions Bundler may not be able to resolve your dependencies at all. -https://devcenter.heroku.com/articles/bundler-windows-gemfile -WARNING - log("bundle", "has_windows_gemfile_lock") + File.unlink("Gemfile.lock") - else - # using --deployment is preferred if we can - bundle_command += " --deployment" + ENV.delete("BUNDLE_DEPLOYMENT") + + warn(<<~WARNING, inline: true) + Removing `Gemfile.lock` because it was generated on Windows. + Bundler will do a full resolve so native gems are handled properly. + This may result in unexpected gem versions being used in your app. + In rare occasions Bundler may not be able to resolve your dependencies at all. + + https://devcenter.heroku.com/articles/bundler-windows-gemfile + WARNING end + bundle_command = String.new("") + bundle_command << "BUNDLE_WITHOUT=#{ENV["BUNDLE_WITHOUT"]} " + bundle_command << "BUNDLE_PATH=#{ENV["BUNDLE_PATH"]} " + bundle_command << "BUNDLE_BIN=#{ENV["BUNDLE_BIN"]} " + bundle_command << "BUNDLE_DEPLOYMENT=#{ENV["BUNDLE_DEPLOYMENT"]} " if ENV["BUNDLE_DEPLOYMENT"] # Unset on windows since we delete the Gemfile.lock + bundle_command << "bundle install -j4" + topic("Installing dependencies using bundler #{bundler.version}") - bundler_output = "" + bundler_output = String.new("") bundle_time = nil env_vars = {} Dir.mktmpdir("libyaml-") do |tmpdir| @@ -918,9 +946,9 @@ def build_bundler(bundle_path:, default_bundle_without:) instrument "ruby.bundle_clean" do # Only show bundle clean output when not using default cache if load_default_cache? - run("#{bundle_bin} clean > /dev/null", user_env: true, env: env_vars) + run("bundle clean > /dev/null", user_env: true, env: env_vars) else - pipe("#{bundle_bin} clean", out: "2> /dev/null", user_env: true, env: env_vars) + pipe("bundle clean", out: "2> /dev/null", user_env: true, env: env_vars) end end @bundler_cache.store @@ -934,28 +962,28 @@ def build_bundler(bundle_path:, default_bundle_without:) puts "Bundler Output: #{bundler_output}" if bundler_output.match(/An error occurred while installing sqlite3/) mcount "fail.sqlite3" - error_message += <<-ERROR + error_message += <<~ERROR -Detected sqlite3 gem which is not supported on Heroku: -https://devcenter.heroku.com/articles/sqlite3 + Detected sqlite3 gem which is not supported on Heroku: + https://devcenter.heroku.com/articles/sqlite3 ERROR end if bundler_output.match(/but your Gemfile specified/) mcount "fail.ruby_version_mismatch" - error_message += <<-ERROR + error_message += <<~ERROR -Detected a mismatch between your Ruby version installed and -Ruby version specified in Gemfile or Gemfile.lock. You can -correct this by running: + Detected a mismatch between your Ruby version installed and + Ruby version specified in Gemfile or Gemfile.lock. You can + correct this by running: - $ bundle update --ruby - $ git add Gemfile.lock - $ git commit -m "update ruby version" + $ bundle update --ruby + $ git add Gemfile.lock + $ git commit -m "update ruby version" -If this does not solve the issue please see this documentation: + If this does not solve the issue please see this documentation: -https://devcenter.heroku.com/articles/ruby-versions#your-ruby-version-is-x-but-your-gemfile-specified-y + https://devcenter.heroku.com/articles/ruby-versions#your-ruby-version-is-x-but-your-gemfile-specified-y ERROR end diff --git a/lib/language_pack/test/ruby.rb b/lib/language_pack/test/ruby.rb index 39ff78d31..19cb97fd2 100644 --- a/lib/language_pack/test/ruby.rb +++ b/lib/language_pack/test/ruby.rb @@ -8,18 +8,23 @@ def compile warn_bad_binstubs install_ruby(slug_vendor_ruby, build_ruby_path) install_jvm - setup_language_pack_environment(ruby_layer_path: File.expand_path("."), gem_layer_path: File.expand_path(".")) + setup_language_pack_environment( + ruby_layer_path: File.expand_path("."), + gem_layer_path: File.expand_path("."), + bundle_path: "vendor/bundle", + bundle_default_without: "development" + ) setup_export - setup_profiled(ruby_layer_path: "$HOME", gem_layer_path: "$HOME") # $HOME is set to /app at run time allow_git do install_bundler_in_app(slug_vendor_base) load_bundler_cache - build_bundler(bundle_path: "vendor/bundle", default_bundle_without: "development") + build_bundler post_bundler create_database_yml install_binaries prepare_tests end + setup_profiled(ruby_layer_path: "$HOME", gem_layer_path: "$HOME") # $HOME is set to /app at run time super end end diff --git a/spec/hatchet/node_spec.rb b/spec/hatchet/node_spec.rb index 3461adc6e..7d58b22d2 100644 --- a/spec/hatchet/node_spec.rb +++ b/spec/hatchet/node_spec.rb @@ -6,7 +6,9 @@ :default, "https://github.com/sharpstone/force_absolute_paths_buildpack" ] - Hatchet::Runner.new("minimal_webpacker", buildpacks: buildpacks).deploy do |app, heroku| + config = {FORCE_ABSOLUTE_PATHS_BUILDPACK_IGNORE_PATHS: "BUNDLE_PATH"} + + Hatchet::Runner.new("minimal_webpacker", buildpacks: buildpacks, config: config).deploy do |app, heroku| # https://rubular.com/r/4bkL8fYFTQwt0Q expect(app.output).to match(/vendor\/yarn-v\d+\.\d+\.\d+\/bin\/yarn is the yarn directory/) expect(app.output).to_not include(".heroku/yarn/bin/yarn is the yarn directory") @@ -25,8 +27,9 @@ :default, "https://github.com/sharpstone/force_absolute_paths_buildpack" ] + config = {FORCE_ABSOLUTE_PATHS_BUILDPACK_IGNORE_PATHS: "BUNDLE_PATH"} - Hatchet::Runner.new("minimal_webpacker", buildpacks: buildpacks).deploy do |app, heroku| + Hatchet::Runner.new("minimal_webpacker", buildpacks: buildpacks, config: config).deploy do |app, heroku| expect(app.output).to include("yarn install") expect(app.output).to include(".heroku/yarn/bin/yarn is the yarn directory") expect(app.output).to include(".heroku/node/bin/node is the node directory") diff --git a/spec/hatchet/ruby_spec.rb b/spec/hatchet/ruby_spec.rb index 3d543a3c5..1fc7b4f74 100644 --- a/spec/hatchet/ruby_spec.rb +++ b/spec/hatchet/ruby_spec.rb @@ -113,7 +113,9 @@ :default, "https://github.com/sharpstone/force_absolute_paths_buildpack" ] - Hatchet::Runner.new('cd_ruby', stack: DEFAULT_STACK, buildpacks: buildpacks).deploy do |app| + config = {FORCE_ABSOLUTE_PATHS_BUILDPACK_IGNORE_PATHS: "BUNDLE_PATH"} + + Hatchet::Runner.new('cd_ruby', stack: DEFAULT_STACK, buildpacks: buildpacks, config: config).deploy do |app| expect(app.output).to match("cd version ruby 2.5.1") expect(app.run("which ruby").chomp).to eq("/app/bin/ruby") From 858adcbe3a53997192be9f12aa475c109fc490e9 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Wed, 19 Aug 2020 11:15:58 -0500 Subject: [PATCH 0753/1195] Revert "[close #943] Use Bundler env vars for config (#1039)" (#1047) This reverts commit 0449897f249bacc66f57c62e891dd847a40daaba. --- CHANGELOG.md | 1 - lib/language_pack/rails4.rb | 6 ++ lib/language_pack/ruby.rb | 122 +++++++++++++-------------------- lib/language_pack/test/ruby.rb | 11 +-- spec/hatchet/node_spec.rb | 7 +- spec/hatchet/ruby_spec.rb | 4 +- 6 files changed, 59 insertions(+), 92 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 12d0c3a4c..3d724fc52 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,5 @@ # Main (unreleased) -* Persistent bundler config is now being set using the `BUNDLE_*` env vars (https://github.com/heroku/heroku-buildpack-ruby/pull/1039) * Rake task "assets:clean" will not get called if it does not exist (https://github.com/heroku/heroku-buildpack-ruby/pull/1018) * CNB: Fix the `gems` layer not being made accessible by subsequent buildpacks (https://github.com/heroku/heroku-buildpack-ruby/pull/1033) diff --git a/lib/language_pack/rails4.rb b/lib/language_pack/rails4.rb index 86e11b6fd..703343a6f 100644 --- a/lib/language_pack/rails4.rb +++ b/lib/language_pack/rails4.rb @@ -30,6 +30,12 @@ def default_process_types end end + def build_bundler(default_bundle_without) + instrument "rails4.build_bundler" do + super + end + end + def compile instrument "rails4.compile" do super diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 0d384b15a..10284d5c3 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -100,16 +100,12 @@ def compile warn_bad_binstubs install_ruby(slug_vendor_ruby, build_ruby_path) install_jvm - setup_language_pack_environment( - ruby_layer_path: File.expand_path("."), - gem_layer_path: File.expand_path("."), - bundle_path: "vendor/bundle", - bundle_default_without: "development:test" - ) + setup_language_pack_environment(ruby_layer_path: File.expand_path("."), gem_layer_path: File.expand_path(".")) + setup_profiled(ruby_layer_path: "$HOME", gem_layer_path: "$HOME") # $HOME is set to /app at run time allow_git do install_bundler_in_app(slug_vendor_base) load_bundler_cache - build_bundler + build_bundler(bundle_path: "vendor/bundle", default_bundle_without: "development:test") post_bundler create_database_yml install_binaries @@ -118,7 +114,6 @@ def compile config_detect best_practice_warnings warn_outdated_ruby - setup_profiled(ruby_layer_path: "$HOME", gem_layer_path: "$HOME") # $HOME is set to /app at run time setup_export cleanup super @@ -142,12 +137,8 @@ def build ruby_layer.write gem_layer = Layer.new(@layer_dir, "gems", launch: true, cache: true, build: true) - setup_language_pack_environment( - ruby_layer_path: ruby_layer.path, - gem_layer_path: gem_layer.path, - bundle_path: "#{gem_layer.path}/vendor/bundle", - bundle_default_without: "development:test" - ) + setup_language_pack_environment(ruby_layer_path: ruby_layer.path, gem_layer_path: gem_layer.path) + setup_profiled(ruby_layer_path: ruby_layer.path, gem_layer_path: gem_layer.path) allow_git do # TODO install bundler in separate layer topic "Loading Bundler Cache" @@ -155,7 +146,7 @@ def build valid_bundler_cache?(gem_layer.path, gem_layer.metadata) end install_bundler_in_app("#{gem_layer.path}/#{slug_vendor_base}") - build_bundler + build_bundler(bundle_path: "#{gem_layer.path}/vendor/bundle", default_bundle_without: "development:test") # TODO post_bundler might need to be done in a new layer bundler.clean gem_layer.metadata[:gems] = Digest::SHA2.hexdigest(File.read("Gemfile.lock")) @@ -170,7 +161,6 @@ def build install_binaries run_assets_precompile_rake_task end - setup_profiled(ruby_layer_path: ruby_layer.path, gem_layer_path: gem_layer.path) setup_export(gem_layer) config_detect best_practice_warnings @@ -355,7 +345,7 @@ def default_java_mem end # sets up the environment variables for the build process - def setup_language_pack_environment(ruby_layer_path:, gem_layer_path:, bundle_path:, bundle_default_without:) + def setup_language_pack_environment(ruby_layer_path:, gem_layer_path:) instrument 'ruby.setup_language_pack_environment' do if ruby_version.jruby? ENV["PATH"] += ":bin" @@ -403,11 +393,6 @@ def setup_language_pack_environment(ruby_layer_path:, gem_layer_path:, bundle_pa paths << ENV["PATH"] ENV["PATH"] = paths.join(":") - - ENV["BUNDLE_WITHOUT"] = env("BUNDLE_WITHOUT") || bundle_default_without - ENV["BUNDLE_PATH"] = bundle_path - ENV["BUNDLE_BIN"] = bundler_binstubs_path - ENV["BUNDLE_DEPLOYMENT"] = "1" end end @@ -441,11 +426,6 @@ def setup_export(layer = nil) set_export_default "JAVA_OPTS", default_java_opts set_export_default "JRUBY_OPTS", default_jruby_opts end - - set_export_default "BUNDLE_PATH", ENV["BUNDLE_PATH"], layer - set_export_default "BUNDLE_WITHOUT", ENV["BUNDLE_WITHOUT"], layer - set_export_default "BUNDLE_BIN", ENV["BUNDLE_BIN"], layer - set_export_default "BUNDLE_DEPLOYMENT", ENV["BUNDLE_DEPLOYMENT"], layer if ENV["BUNDLE_DEPLOYMENT"] # Unset on windows since we delete the Gemfile.lock end end @@ -481,11 +461,6 @@ def setup_profiled(ruby_layer_path: , gem_layer_path: ) set_env_default "JAVA_OPTS", default_java_opts set_env_default "JRUBY_OPTS", default_jruby_opts end - - set_env_default "BUNDLE_PATH", ENV["BUNDLE_PATH"] - set_env_default "BUNDLE_WITHOUT", ENV["BUNDLE_WITHOUT"] - set_env_default "BUNDLE_BIN", ENV["BUNDLE_BIN"] - set_env_default "BUNDLE_DEPLOYMENT", ENV["BUNDLE_DEPLOYMENT"] if ENV["BUNDLE_DEPLOYMENT"] # Unset on windows since we delete the Gemfile.lock end end @@ -864,47 +839,44 @@ def write_bundler_shim(path) end # runs bundler to install the dependencies - def build_bundler + def build_bundler(bundle_path:, default_bundle_without:) instrument 'ruby.build_bundler' do log("bundle") do + bundle_without = env("BUNDLE_WITHOUT") || default_bundle_without + bundle_bin = "bundle" + bundle_command = "#{bundle_bin} install --without #{bundle_without} --path #{bundle_path} --binstubs #{bundler_binstubs_path}" + bundle_command << " -j4" + if File.exist?("#{Dir.pwd}/.bundle/config") - warn(<<~WARNING, inline: true) - You have the `.bundle/config` file checked into your repository - It contains local state like the location of the installed bundle - as well as configured git local gems, and other settings that should - not be shared between multiple checkouts of a single repo. Please - remove the `.bundle/` folder from your repo and add it to your `.gitignore` file. - - https://devcenter.heroku.com/articles/bundler-configuration - WARNING + warn(<<-WARNING, inline: true) +You have the `.bundle/config` file checked into your repository + It contains local state like the location of the installed bundle + as well as configured git local gems, and other settings that should +not be shared between multiple checkouts of a single repo. Please +remove the `.bundle/` folder from your repo and add it to your `.gitignore` file. +https://devcenter.heroku.com/articles/bundler-configuration +WARNING end if bundler.windows_gemfile_lock? - log("bundle", "has_windows_gemfile_lock") + warn(<<-WARNING, inline: true) +Removing `Gemfile.lock` because it was generated on Windows. +Bundler will do a full resolve so native gems are handled properly. +This may result in unexpected gem versions being used in your app. +In rare occasions Bundler may not be able to resolve your dependencies at all. +https://devcenter.heroku.com/articles/bundler-windows-gemfile +WARNING + log("bundle", "has_windows_gemfile_lock") File.unlink("Gemfile.lock") - ENV.delete("BUNDLE_DEPLOYMENT") - - warn(<<~WARNING, inline: true) - Removing `Gemfile.lock` because it was generated on Windows. - Bundler will do a full resolve so native gems are handled properly. - This may result in unexpected gem versions being used in your app. - In rare occasions Bundler may not be able to resolve your dependencies at all. - - https://devcenter.heroku.com/articles/bundler-windows-gemfile - WARNING + else + # using --deployment is preferred if we can + bundle_command += " --deployment" end - bundle_command = String.new("") - bundle_command << "BUNDLE_WITHOUT=#{ENV["BUNDLE_WITHOUT"]} " - bundle_command << "BUNDLE_PATH=#{ENV["BUNDLE_PATH"]} " - bundle_command << "BUNDLE_BIN=#{ENV["BUNDLE_BIN"]} " - bundle_command << "BUNDLE_DEPLOYMENT=#{ENV["BUNDLE_DEPLOYMENT"]} " if ENV["BUNDLE_DEPLOYMENT"] # Unset on windows since we delete the Gemfile.lock - bundle_command << "bundle install -j4" - topic("Installing dependencies using bundler #{bundler.version}") - bundler_output = String.new("") + bundler_output = "" bundle_time = nil env_vars = {} Dir.mktmpdir("libyaml-") do |tmpdir| @@ -946,9 +918,9 @@ def build_bundler instrument "ruby.bundle_clean" do # Only show bundle clean output when not using default cache if load_default_cache? - run("bundle clean > /dev/null", user_env: true, env: env_vars) + run("#{bundle_bin} clean > /dev/null", user_env: true, env: env_vars) else - pipe("bundle clean", out: "2> /dev/null", user_env: true, env: env_vars) + pipe("#{bundle_bin} clean", out: "2> /dev/null", user_env: true, env: env_vars) end end @bundler_cache.store @@ -962,28 +934,28 @@ def build_bundler puts "Bundler Output: #{bundler_output}" if bundler_output.match(/An error occurred while installing sqlite3/) mcount "fail.sqlite3" - error_message += <<~ERROR + error_message += <<-ERROR - Detected sqlite3 gem which is not supported on Heroku: - https://devcenter.heroku.com/articles/sqlite3 +Detected sqlite3 gem which is not supported on Heroku: +https://devcenter.heroku.com/articles/sqlite3 ERROR end if bundler_output.match(/but your Gemfile specified/) mcount "fail.ruby_version_mismatch" - error_message += <<~ERROR + error_message += <<-ERROR - Detected a mismatch between your Ruby version installed and - Ruby version specified in Gemfile or Gemfile.lock. You can - correct this by running: +Detected a mismatch between your Ruby version installed and +Ruby version specified in Gemfile or Gemfile.lock. You can +correct this by running: - $ bundle update --ruby - $ git add Gemfile.lock - $ git commit -m "update ruby version" + $ bundle update --ruby + $ git add Gemfile.lock + $ git commit -m "update ruby version" - If this does not solve the issue please see this documentation: +If this does not solve the issue please see this documentation: - https://devcenter.heroku.com/articles/ruby-versions#your-ruby-version-is-x-but-your-gemfile-specified-y +https://devcenter.heroku.com/articles/ruby-versions#your-ruby-version-is-x-but-your-gemfile-specified-y ERROR end diff --git a/lib/language_pack/test/ruby.rb b/lib/language_pack/test/ruby.rb index 19cb97fd2..39ff78d31 100644 --- a/lib/language_pack/test/ruby.rb +++ b/lib/language_pack/test/ruby.rb @@ -8,23 +8,18 @@ def compile warn_bad_binstubs install_ruby(slug_vendor_ruby, build_ruby_path) install_jvm - setup_language_pack_environment( - ruby_layer_path: File.expand_path("."), - gem_layer_path: File.expand_path("."), - bundle_path: "vendor/bundle", - bundle_default_without: "development" - ) + setup_language_pack_environment(ruby_layer_path: File.expand_path("."), gem_layer_path: File.expand_path(".")) setup_export + setup_profiled(ruby_layer_path: "$HOME", gem_layer_path: "$HOME") # $HOME is set to /app at run time allow_git do install_bundler_in_app(slug_vendor_base) load_bundler_cache - build_bundler + build_bundler(bundle_path: "vendor/bundle", default_bundle_without: "development") post_bundler create_database_yml install_binaries prepare_tests end - setup_profiled(ruby_layer_path: "$HOME", gem_layer_path: "$HOME") # $HOME is set to /app at run time super end end diff --git a/spec/hatchet/node_spec.rb b/spec/hatchet/node_spec.rb index 7d58b22d2..3461adc6e 100644 --- a/spec/hatchet/node_spec.rb +++ b/spec/hatchet/node_spec.rb @@ -6,9 +6,7 @@ :default, "https://github.com/sharpstone/force_absolute_paths_buildpack" ] - config = {FORCE_ABSOLUTE_PATHS_BUILDPACK_IGNORE_PATHS: "BUNDLE_PATH"} - - Hatchet::Runner.new("minimal_webpacker", buildpacks: buildpacks, config: config).deploy do |app, heroku| + Hatchet::Runner.new("minimal_webpacker", buildpacks: buildpacks).deploy do |app, heroku| # https://rubular.com/r/4bkL8fYFTQwt0Q expect(app.output).to match(/vendor\/yarn-v\d+\.\d+\.\d+\/bin\/yarn is the yarn directory/) expect(app.output).to_not include(".heroku/yarn/bin/yarn is the yarn directory") @@ -27,9 +25,8 @@ :default, "https://github.com/sharpstone/force_absolute_paths_buildpack" ] - config = {FORCE_ABSOLUTE_PATHS_BUILDPACK_IGNORE_PATHS: "BUNDLE_PATH"} - Hatchet::Runner.new("minimal_webpacker", buildpacks: buildpacks, config: config).deploy do |app, heroku| + Hatchet::Runner.new("minimal_webpacker", buildpacks: buildpacks).deploy do |app, heroku| expect(app.output).to include("yarn install") expect(app.output).to include(".heroku/yarn/bin/yarn is the yarn directory") expect(app.output).to include(".heroku/node/bin/node is the node directory") diff --git a/spec/hatchet/ruby_spec.rb b/spec/hatchet/ruby_spec.rb index 1fc7b4f74..3d543a3c5 100644 --- a/spec/hatchet/ruby_spec.rb +++ b/spec/hatchet/ruby_spec.rb @@ -113,9 +113,7 @@ :default, "https://github.com/sharpstone/force_absolute_paths_buildpack" ] - config = {FORCE_ABSOLUTE_PATHS_BUILDPACK_IGNORE_PATHS: "BUNDLE_PATH"} - - Hatchet::Runner.new('cd_ruby', stack: DEFAULT_STACK, buildpacks: buildpacks, config: config).deploy do |app| + Hatchet::Runner.new('cd_ruby', stack: DEFAULT_STACK, buildpacks: buildpacks).deploy do |app| expect(app.output).to match("cd version ruby 2.5.1") expect(app.run("which ruby").chomp).to eq("/app/bin/ruby") From 563093886445a8e15d3d5d4994c38841baed6ee9 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Fri, 28 Aug 2020 09:25:48 -0500 Subject: [PATCH 0754/1195] [changelog skip] Update hatchet (#1048) --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 5931e2fce..a20823c73 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -13,7 +13,7 @@ GEM excon moneta multi_json (>= 1.9.2) - heroku_hatchet (7.0.0) + heroku_hatchet (7.1.0) excon (~> 0) platform-api (~> 3) rrrretry (~> 1) From bb91b65c3db1db698ba71b528293255864427874 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Fri, 28 Aug 2020 14:52:20 -0500 Subject: [PATCH 0755/1195] [changelog skip] Dependabot (#1051) --- .github/dependabot.yml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..372a5b30f --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,8 @@ +version: 2 +updates: + - package-ecosystem: "bundler" + directory: "/" + schedule: + interval: "weekly" + labels: + - "dependencies" From 0555f61b6b5f586689fdf7defe79b429144ba3ca Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Fri, 28 Aug 2020 17:19:48 -0500 Subject: [PATCH 0756/1195] [changelog skip] Limit dependabot concurrency (#1058) Dependabot sent me 5 concurrent PRs which caused rate throttling to kick in and caused all my tests to go over their time limit and fail. This PR limits dependabot to 1 PR at a time. To avoid this problem in the future. --- .github/dependabot.yml | 1 + Gemfile | 2 +- Gemfile.lock | 24 +++++++++++------------- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 372a5b30f..5921c9525 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -2,6 +2,7 @@ version: 2 updates: - package-ecosystem: "bundler" directory: "/" + open-pull-requests-limit: 1 # Limit concurrent CI runs from executing schedule: interval: "weekly" labels: diff --git a/Gemfile b/Gemfile index c9f62d30a..e2337aeae 100644 --- a/Gemfile +++ b/Gemfile @@ -12,7 +12,7 @@ group :development, :test do gem "rake" gem "parallel_tests" gem 'rspec-retry' - gem 'json', '~> 2.3.0' + gem 'json' gem 'ci-queue' gem 'redis' end diff --git a/Gemfile.lock b/Gemfile.lock index a20823c73..b9b6534d0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,11 +1,9 @@ GEM remote: https://rubygems.org/ specs: - ansi (1.5.0) - ci-queue (0.17.2) - ansi + ci-queue (0.20.5) citrus (3.0.2) - diff-lcs (1.3) + diff-lcs (1.4.4) erubis (2.7.0) excon (0.76.0) heroics (0.1.1) @@ -19,11 +17,11 @@ GEM rrrretry (~> 1) thor (~> 0) threaded (~> 0) - json (2.3.0) + json (2.3.1) moneta (1.0.0) multi_json (1.15.0) - parallel (1.19.1) - parallel_tests (2.32.0) + parallel (1.19.2) + parallel_tests (3.2.0) parallel platform-api (3.0.0) heroics (~> 0.1.1) @@ -31,16 +29,16 @@ GEM rate_throttle_client (~> 0.1.0) rake (13.0.1) rate_throttle_client (0.1.2) - redis (4.1.3) + redis (4.2.1) rrrretry (1.0.0) - rspec-core (3.9.1) - rspec-support (~> 3.9.1) - rspec-expectations (3.9.1) + rspec-core (3.9.2) + rspec-support (~> 3.9.3) + rspec-expectations (3.9.2) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.9.0) rspec-retry (0.6.2) rspec-core (> 3.3) - rspec-support (3.9.2) + rspec-support (3.9.3) thor (0.20.3) threaded (0.0.4) toml-rb (2.0.1) @@ -53,7 +51,7 @@ DEPENDENCIES ci-queue excon heroku_hatchet - json (~> 2.3.0) + json parallel_tests rake redis From 655e246657e329db524177d410e4ae4aaf8cc141 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Thu, 3 Sep 2020 10:41:31 -0500 Subject: [PATCH 0757/1195] Fix gem installation location bug with Bundler env vars (#1052) * Revert "Revert "[close #943] Use Bundler env vars for config (#1039)" (#1047)" This reverts commit 858adcbe3a53997192be9f12aa475c109fc490e9. * Fix gem installation location bug with Bundler env vars When the move from bundler flags to bundler env vars was first merged in an issue was reported #1046 , this lead to an investigation and bug report to bundler https://github.com/rubygems/rubygems/issues/3890 which lead to some older issues/prs: - rubygems/bundler#3552 - rubygems/bundler#6628 The issue is that global configuration and local configuration results in different behavior when installing and using some features in bundler, notedly the ability to specify install path. Due to this change, when the switch to bundler environment variables happened, it caused the size of some applications' slugs to increase dramatically, this was because the gems were essentially being installed twice. The issue appears to not be in Bundler 2.1.4 so we're bumping the version for 2.x series. In the 1.x series an environment variable `BUNDLE_GLOBAL_PATH_APPENDS_RUBY_SCOPE=1` can be used to force the desired behavior. # This is the commit message #2: Co-authored-by: Ed Morley <501702+edmorley@users.noreply.github.com> Co-authored-by: Ed Morley <501702+edmorley@users.noreply.github.com> --- CHANGELOG.md | 2 + changelogs/unreleased/bundler-214.md | 3 + changelogs/unreleased/bundler-env-vars.md | 20 +++ lib/language_pack/helpers/bundler_wrapper.rb | 9 +- lib/language_pack/rails4.rb | 6 - lib/language_pack/ruby.rb | 126 ++++++++++++------- lib/language_pack/test/ruby.rb | 11 +- spec/hatchet/bundler_spec.rb | 59 +++++++-- spec/hatchet/node_spec.rb | 7 +- spec/hatchet/ruby_spec.rb | 4 +- 10 files changed, 178 insertions(+), 69 deletions(-) create mode 100644 changelogs/unreleased/bundler-214.md create mode 100644 changelogs/unreleased/bundler-env-vars.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d724fc52..e794a512c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Main (unreleased) +* Bundler 2.x is now 2.1.4 (https://github.com/heroku/heroku-buildpack-ruby/pull/1052) +* Persistent bundler config is now being set using the `BUNDLE_*` env vars (https://github.com/heroku/heroku-buildpack-ruby/pull/1039) * Rake task "assets:clean" will not get called if it does not exist (https://github.com/heroku/heroku-buildpack-ruby/pull/1018) * CNB: Fix the `gems` layer not being made accessible by subsequent buildpacks (https://github.com/heroku/heroku-buildpack-ruby/pull/1033) diff --git a/changelogs/unreleased/bundler-214.md b/changelogs/unreleased/bundler-214.md new file mode 100644 index 000000000..4b5afc212 --- /dev/null +++ b/changelogs/unreleased/bundler-214.md @@ -0,0 +1,3 @@ +## Ruby apps with Bundler 2.x now receive version 2.1.4 + +The [Ruby Buildpack](https://devcenter.heroku.com/articles/ruby-support#libraries) now includes Bundler 2.1.4. Applications specifying Bundler 2.x in their `Gemfile.lock` will now receive bundler: 2.1.4. diff --git a/changelogs/unreleased/bundler-env-vars.md b/changelogs/unreleased/bundler-env-vars.md new file mode 100644 index 000000000..df51681c6 --- /dev/null +++ b/changelogs/unreleased/bundler-env-vars.md @@ -0,0 +1,20 @@ +## Ruby applications now configure bundler with environment variables instead of flags + +Previously the Ruby buildpack ran bundler installation with flags: + +``` +Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment +[DEPRECATED] The `--deployment` flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use `bundle config set deployment 'true'`, and stop using this flag +[DEPRECATED] The `--path` flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use `bundle config set path 'vendor/bundle'`, and stop using this flag +[DEPRECATED] The `--without` flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use `bundle config set without 'development:test'`, and stop using this flag +[DEPRECATED] The --binstubs option will be removed in favor of `bundle binstubs` +``` + +In order to remove deprecations from Bundler 2.x, Ruby applications now run bundler installation with environment variables instead: + +``` +Running: BUNDLE_WITHOUT=development:test BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 bundle install -j4 +``` + +This behavior is documented in the [Heroku Ruby Support page](https://devcenter.heroku.com/articles/ruby-support). + diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index 7a4e46b37..9ca42c9ba 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -37,7 +37,7 @@ class LanguagePack::Helpers::BundlerWrapper BLESSED_BUNDLER_VERSIONS = {} BLESSED_BUNDLER_VERSIONS["1"] = "1.17.3" - BLESSED_BUNDLER_VERSIONS["2"] = "2.0.2" + BLESSED_BUNDLER_VERSIONS["2"] = "2.1.4" BUNDLED_WITH_REGEX = /^BUNDLED WITH$(\r?\n) (?\d+)\.\d+\.\d+/m class GemfileParseError < BuildpackError @@ -161,6 +161,13 @@ def lockfile_parser @lockfile_parser ||= parse_gemfile_lock end + # Some bundler versions have different behavior + # if config is global versus local. These versions need + # the environment variable BUNDLE_GLOBAL_PATH_APPENDS_RUBY_SCOPE=1 + def needs_ruby_global_append_path? + Gem::Version.new(@version) < Gem::Version.new("2.1.4") + end + private def fetch_bundler instrument 'fetch_bundler' do diff --git a/lib/language_pack/rails4.rb b/lib/language_pack/rails4.rb index 703343a6f..86e11b6fd 100644 --- a/lib/language_pack/rails4.rb +++ b/lib/language_pack/rails4.rb @@ -30,12 +30,6 @@ def default_process_types end end - def build_bundler(default_bundle_without) - instrument "rails4.build_bundler" do - super - end - end - def compile instrument "rails4.compile" do super diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 10284d5c3..0583c0a0d 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -100,12 +100,16 @@ def compile warn_bad_binstubs install_ruby(slug_vendor_ruby, build_ruby_path) install_jvm - setup_language_pack_environment(ruby_layer_path: File.expand_path("."), gem_layer_path: File.expand_path(".")) - setup_profiled(ruby_layer_path: "$HOME", gem_layer_path: "$HOME") # $HOME is set to /app at run time + setup_language_pack_environment( + ruby_layer_path: File.expand_path("."), + gem_layer_path: File.expand_path("."), + bundle_path: "vendor/bundle", + bundle_default_without: "development:test" + ) allow_git do install_bundler_in_app(slug_vendor_base) load_bundler_cache - build_bundler(bundle_path: "vendor/bundle", default_bundle_without: "development:test") + build_bundler post_bundler create_database_yml install_binaries @@ -114,6 +118,7 @@ def compile config_detect best_practice_warnings warn_outdated_ruby + setup_profiled(ruby_layer_path: "$HOME", gem_layer_path: "$HOME") # $HOME is set to /app at run time setup_export cleanup super @@ -137,8 +142,12 @@ def build ruby_layer.write gem_layer = Layer.new(@layer_dir, "gems", launch: true, cache: true, build: true) - setup_language_pack_environment(ruby_layer_path: ruby_layer.path, gem_layer_path: gem_layer.path) - setup_profiled(ruby_layer_path: ruby_layer.path, gem_layer_path: gem_layer.path) + setup_language_pack_environment( + ruby_layer_path: ruby_layer.path, + gem_layer_path: gem_layer.path, + bundle_path: "#{gem_layer.path}/vendor/bundle", + bundle_default_without: "development:test" + ) allow_git do # TODO install bundler in separate layer topic "Loading Bundler Cache" @@ -146,7 +155,7 @@ def build valid_bundler_cache?(gem_layer.path, gem_layer.metadata) end install_bundler_in_app("#{gem_layer.path}/#{slug_vendor_base}") - build_bundler(bundle_path: "#{gem_layer.path}/vendor/bundle", default_bundle_without: "development:test") + build_bundler # TODO post_bundler might need to be done in a new layer bundler.clean gem_layer.metadata[:gems] = Digest::SHA2.hexdigest(File.read("Gemfile.lock")) @@ -161,6 +170,7 @@ def build install_binaries run_assets_precompile_rake_task end + setup_profiled(ruby_layer_path: ruby_layer.path, gem_layer_path: gem_layer.path) setup_export(gem_layer) config_detect best_practice_warnings @@ -345,7 +355,7 @@ def default_java_mem end # sets up the environment variables for the build process - def setup_language_pack_environment(ruby_layer_path:, gem_layer_path:) + def setup_language_pack_environment(ruby_layer_path:, gem_layer_path:, bundle_path:, bundle_default_without:) instrument 'ruby.setup_language_pack_environment' do if ruby_version.jruby? ENV["PATH"] += ":bin" @@ -393,6 +403,12 @@ def setup_language_pack_environment(ruby_layer_path:, gem_layer_path:) paths << ENV["PATH"] ENV["PATH"] = paths.join(":") + + ENV["BUNDLE_WITHOUT"] = env("BUNDLE_WITHOUT") || bundle_default_without + ENV["BUNDLE_PATH"] = bundle_path + ENV["BUNDLE_BIN"] = bundler_binstubs_path + ENV["BUNDLE_DEPLOYMENT"] = "1" + ENV["BUNDLE_GLOBAL_PATH_APPENDS_RUBY_SCOPE"] = "1" if bundler.needs_ruby_global_append_path? end end @@ -426,6 +442,12 @@ def setup_export(layer = nil) set_export_default "JAVA_OPTS", default_java_opts set_export_default "JRUBY_OPTS", default_jruby_opts end + + set_export_default "BUNDLE_PATH", ENV["BUNDLE_PATH"], layer + set_export_default "BUNDLE_WITHOUT", ENV["BUNDLE_WITHOUT"], layer + set_export_default "BUNDLE_BIN", ENV["BUNDLE_BIN"], layer + set_export_default "BUNDLE_GLOBAL_PATH_APPENDS_RUBY_SCOPE", ENV["BUNDLE_GLOBAL_PATH_APPENDS_RUBY_SCOPE"], layer if bundler.needs_ruby_global_append_path? + set_export_default "BUNDLE_DEPLOYMENT", ENV["BUNDLE_DEPLOYMENT"], layer if ENV["BUNDLE_DEPLOYMENT"] # Unset on windows since we delete the Gemfile.lock end end @@ -461,6 +483,12 @@ def setup_profiled(ruby_layer_path: , gem_layer_path: ) set_env_default "JAVA_OPTS", default_java_opts set_env_default "JRUBY_OPTS", default_jruby_opts end + + set_env_default "BUNDLE_PATH", ENV["BUNDLE_PATH"] + set_env_default "BUNDLE_WITHOUT", ENV["BUNDLE_WITHOUT"] + set_env_default "BUNDLE_BIN", ENV["BUNDLE_BIN"] + set_env_default "BUNDLE_GLOBAL_PATH_APPENDS_RUBY_SCOPE", ENV["BUNDLE_GLOBAL_PATH_APPENDS_RUBY_SCOPE"] if bundler.needs_ruby_global_append_path? + set_env_default "BUNDLE_DEPLOYMENT", ENV["BUNDLE_DEPLOYMENT"] if ENV["BUNDLE_DEPLOYMENT"] # Unset on windows since we delete the Gemfile.lock end end @@ -839,44 +867,48 @@ def write_bundler_shim(path) end # runs bundler to install the dependencies - def build_bundler(bundle_path:, default_bundle_without:) + def build_bundler instrument 'ruby.build_bundler' do log("bundle") do - bundle_without = env("BUNDLE_WITHOUT") || default_bundle_without - bundle_bin = "bundle" - bundle_command = "#{bundle_bin} install --without #{bundle_without} --path #{bundle_path} --binstubs #{bundler_binstubs_path}" - bundle_command << " -j4" - if File.exist?("#{Dir.pwd}/.bundle/config") - warn(<<-WARNING, inline: true) -You have the `.bundle/config` file checked into your repository - It contains local state like the location of the installed bundle - as well as configured git local gems, and other settings that should -not be shared between multiple checkouts of a single repo. Please -remove the `.bundle/` folder from your repo and add it to your `.gitignore` file. -https://devcenter.heroku.com/articles/bundler-configuration -WARNING + warn(<<~WARNING, inline: true) + You have the `.bundle/config` file checked into your repository + It contains local state like the location of the installed bundle + as well as configured git local gems, and other settings that should + not be shared between multiple checkouts of a single repo. Please + remove the `.bundle/` folder from your repo and add it to your `.gitignore` file. + + https://devcenter.heroku.com/articles/bundler-configuration + WARNING end if bundler.windows_gemfile_lock? - warn(<<-WARNING, inline: true) -Removing `Gemfile.lock` because it was generated on Windows. -Bundler will do a full resolve so native gems are handled properly. -This may result in unexpected gem versions being used in your app. -In rare occasions Bundler may not be able to resolve your dependencies at all. -https://devcenter.heroku.com/articles/bundler-windows-gemfile -WARNING - log("bundle", "has_windows_gemfile_lock") + File.unlink("Gemfile.lock") - else - # using --deployment is preferred if we can - bundle_command += " --deployment" + ENV.delete("BUNDLE_DEPLOYMENT") + + warn(<<~WARNING, inline: true) + Removing `Gemfile.lock` because it was generated on Windows. + Bundler will do a full resolve so native gems are handled properly. + This may result in unexpected gem versions being used in your app. + In rare occasions Bundler may not be able to resolve your dependencies at all. + + https://devcenter.heroku.com/articles/bundler-windows-gemfile + WARNING end + bundle_command = String.new("") + bundle_command << "BUNDLE_WITHOUT=#{ENV["BUNDLE_WITHOUT"]} " + bundle_command << "BUNDLE_PATH=#{ENV["BUNDLE_PATH"]} " + bundle_command << "BUNDLE_BIN=#{ENV["BUNDLE_BIN"]} " + bundle_command << "BUNDLE_DEPLOYMENT=#{ENV["BUNDLE_DEPLOYMENT"]} " if ENV["BUNDLE_DEPLOYMENT"] # Unset on windows since we delete the Gemfile.lock + bundle_command << "BUNDLE_GLOBAL_PATH_APPENDS_RUBY_SCOPE=#{ENV["BUNDLE_GLOBAL_PATH_APPENDS_RUBY_SCOPE"]} " if bundler.needs_ruby_global_append_path? + bundle_command << "bundle install -j4" + topic("Installing dependencies using bundler #{bundler.version}") - bundler_output = "" + bundler_output = String.new("") bundle_time = nil env_vars = {} Dir.mktmpdir("libyaml-") do |tmpdir| @@ -918,9 +950,9 @@ def build_bundler(bundle_path:, default_bundle_without:) instrument "ruby.bundle_clean" do # Only show bundle clean output when not using default cache if load_default_cache? - run("#{bundle_bin} clean > /dev/null", user_env: true, env: env_vars) + run("bundle clean > /dev/null", user_env: true, env: env_vars) else - pipe("#{bundle_bin} clean", out: "2> /dev/null", user_env: true, env: env_vars) + pipe("bundle clean", out: "2> /dev/null", user_env: true, env: env_vars) end end @bundler_cache.store @@ -934,28 +966,28 @@ def build_bundler(bundle_path:, default_bundle_without:) puts "Bundler Output: #{bundler_output}" if bundler_output.match(/An error occurred while installing sqlite3/) mcount "fail.sqlite3" - error_message += <<-ERROR + error_message += <<~ERROR -Detected sqlite3 gem which is not supported on Heroku: -https://devcenter.heroku.com/articles/sqlite3 + Detected sqlite3 gem which is not supported on Heroku: + https://devcenter.heroku.com/articles/sqlite3 ERROR end if bundler_output.match(/but your Gemfile specified/) mcount "fail.ruby_version_mismatch" - error_message += <<-ERROR + error_message += <<~ERROR -Detected a mismatch between your Ruby version installed and -Ruby version specified in Gemfile or Gemfile.lock. You can -correct this by running: + Detected a mismatch between your Ruby version installed and + Ruby version specified in Gemfile or Gemfile.lock. You can + correct this by running: - $ bundle update --ruby - $ git add Gemfile.lock - $ git commit -m "update ruby version" + $ bundle update --ruby + $ git add Gemfile.lock + $ git commit -m "update ruby version" -If this does not solve the issue please see this documentation: + If this does not solve the issue please see this documentation: -https://devcenter.heroku.com/articles/ruby-versions#your-ruby-version-is-x-but-your-gemfile-specified-y + https://devcenter.heroku.com/articles/ruby-versions#your-ruby-version-is-x-but-your-gemfile-specified-y ERROR end diff --git a/lib/language_pack/test/ruby.rb b/lib/language_pack/test/ruby.rb index 39ff78d31..19cb97fd2 100644 --- a/lib/language_pack/test/ruby.rb +++ b/lib/language_pack/test/ruby.rb @@ -8,18 +8,23 @@ def compile warn_bad_binstubs install_ruby(slug_vendor_ruby, build_ruby_path) install_jvm - setup_language_pack_environment(ruby_layer_path: File.expand_path("."), gem_layer_path: File.expand_path(".")) + setup_language_pack_environment( + ruby_layer_path: File.expand_path("."), + gem_layer_path: File.expand_path("."), + bundle_path: "vendor/bundle", + bundle_default_without: "development" + ) setup_export - setup_profiled(ruby_layer_path: "$HOME", gem_layer_path: "$HOME") # $HOME is set to /app at run time allow_git do install_bundler_in_app(slug_vendor_base) load_bundler_cache - build_bundler(bundle_path: "vendor/bundle", default_bundle_without: "development") + build_bundler post_bundler create_database_yml install_binaries prepare_tests end + setup_profiled(ruby_layer_path: "$HOME", gem_layer_path: "$HOME") # $HOME is set to /app at run time super end end diff --git a/spec/hatchet/bundler_spec.rb b/spec/hatchet/bundler_spec.rb index 469806e28..c9e1f554f 100644 --- a/spec/hatchet/bundler_spec.rb +++ b/spec/hatchet/bundler_spec.rb @@ -1,18 +1,59 @@ require 'spec_helper' describe "Bundler" do - it "deploys with version 2.x" do - before_deploy = Proc.new do - run!(%Q{echo "ruby '2.5.7'" >> Gemfile}) - run!(%Q{printf "\nBUNDLED WITH\n 2.0.1\n" >> Gemfile.lock}) + it "deploys with version 2.x with Ruby 2.5" do + ruby_version = "2.5.7" + abi_version = ruby_version.dup + abi_version[-1] = "0" # turn 2.5.7 into 2.5.0 + pending("Must enable HATCHET_EXPENSIVE_MODE") unless ENV["HATCHET_EXPENSIVE_MODE"] + + Hatchet::Runner.new("default_ruby", run_multi: true).tap do |app| + app.before_deploy do + run!(%Q{echo "ruby '#{ruby_version}'" >> Gemfile}) + run!(%Q{printf "\nBUNDLED WITH\n 2.0.1\n" >> Gemfile.lock}) + end + app.deploy do + expect(app.output).to match("Installing dependencies using bundler 2.") + expect(app.output).to_not match("BUNDLE_GLOBAL_PATH_APPENDS_RUBY_SCOPE=1") + + # Double deploy problem with Ruby 2.5.5 + app.commit! + app.push! + + app.run_multi("ls vendor/bundle/ruby/#{abi_version}/gems") do |ls_output| + expect(ls_output).to match("rake-") + end + + app.run_multi("which -a rake") do |which_rake| + expect(which_rake).to include("/app/vendor/bundle/bin/rake") + expect(which_rake).to include("/app/vendor/bundle/ruby/#{abi_version}/bin/rake") + end + end end + end + + it "deploys with version 1.x" do + abi_version = LanguagePack::RubyVersion::DEFAULT_VERSION_NUMBER + abi_version[-1] = "0" # turn 2.6.6 into 2.6.0 + pending("Must enable HATCHET_EXPENSIVE_MODE") unless ENV["HATCHET_EXPENSIVE_MODE"] + + Hatchet::Runner.new("default_ruby", run_multi: true).tap do |app| + app.before_deploy do + run!(%Q{printf "\nBUNDLED WITH\n 1.0.1\n" >> Gemfile.lock}) + end + app.deploy do + expect(app.output).to match("Installing dependencies using bundler 1.") + expect(app.output).to match("BUNDLE_GLOBAL_PATH_APPENDS_RUBY_SCOPE=1") - Hatchet::Runner.new("default_ruby", before_deploy: before_deploy).deploy do |app| - expect(app.output).to match("Installing dependencies using bundler 2.") + app.run_multi("ls vendor/bundle/ruby/#{abi_version}/gems") do |ls_output| + expect(ls_output).to match("rake-") + end - # Double deploy problem with Ruby 2.5.5 - run!(%Q{git commit --allow-empty -m 'Deploying again'}) - app.push! + app.run_multi("which -a rake") do |which_rake| + expect(which_rake).to include("/app/vendor/bundle/bin/rake") + expect(which_rake).to include("/app/vendor/bundle/ruby/#{abi_version}/bin/rake") + end + end end end end diff --git a/spec/hatchet/node_spec.rb b/spec/hatchet/node_spec.rb index 3461adc6e..7d58b22d2 100644 --- a/spec/hatchet/node_spec.rb +++ b/spec/hatchet/node_spec.rb @@ -6,7 +6,9 @@ :default, "https://github.com/sharpstone/force_absolute_paths_buildpack" ] - Hatchet::Runner.new("minimal_webpacker", buildpacks: buildpacks).deploy do |app, heroku| + config = {FORCE_ABSOLUTE_PATHS_BUILDPACK_IGNORE_PATHS: "BUNDLE_PATH"} + + Hatchet::Runner.new("minimal_webpacker", buildpacks: buildpacks, config: config).deploy do |app, heroku| # https://rubular.com/r/4bkL8fYFTQwt0Q expect(app.output).to match(/vendor\/yarn-v\d+\.\d+\.\d+\/bin\/yarn is the yarn directory/) expect(app.output).to_not include(".heroku/yarn/bin/yarn is the yarn directory") @@ -25,8 +27,9 @@ :default, "https://github.com/sharpstone/force_absolute_paths_buildpack" ] + config = {FORCE_ABSOLUTE_PATHS_BUILDPACK_IGNORE_PATHS: "BUNDLE_PATH"} - Hatchet::Runner.new("minimal_webpacker", buildpacks: buildpacks).deploy do |app, heroku| + Hatchet::Runner.new("minimal_webpacker", buildpacks: buildpacks, config: config).deploy do |app, heroku| expect(app.output).to include("yarn install") expect(app.output).to include(".heroku/yarn/bin/yarn is the yarn directory") expect(app.output).to include(".heroku/node/bin/node is the node directory") diff --git a/spec/hatchet/ruby_spec.rb b/spec/hatchet/ruby_spec.rb index 3d543a3c5..1fc7b4f74 100644 --- a/spec/hatchet/ruby_spec.rb +++ b/spec/hatchet/ruby_spec.rb @@ -113,7 +113,9 @@ :default, "https://github.com/sharpstone/force_absolute_paths_buildpack" ] - Hatchet::Runner.new('cd_ruby', stack: DEFAULT_STACK, buildpacks: buildpacks).deploy do |app| + config = {FORCE_ABSOLUTE_PATHS_BUILDPACK_IGNORE_PATHS: "BUNDLE_PATH"} + + Hatchet::Runner.new('cd_ruby', stack: DEFAULT_STACK, buildpacks: buildpacks, config: config).deploy do |app| expect(app.output).to match("cd version ruby 2.5.1") expect(app.run("which ruby").chomp).to eq("/app/bin/ruby") From 4b06367f519b5fce11a959c68a945e5dcfa7d36f Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Mon, 14 Sep 2020 16:23:06 -0500 Subject: [PATCH 0758/1195] =?UTF-8?q?[changelog=20skip]=20=E2=9C=82?= =?UTF-8?q?=EF=B8=8F=20Hatchet#setup!=20(#1061)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Originally the Hatchet#setup! method only created an app and set config. Now it's responsible for also mutating files if there's a before_deploy action and for creating a git directory if using a non-git path. Originally calling `setup!` was necessary before calling `deploy` if you wanted to do something like set config on an app before deploy. It was necessary because the Hatchet::Runner.new interface did not have a `config:` interface. That's no longer the case, so it's not needed. Using this outside of the repo is dangerous. We should probably make it a private API. But...first lets remove it from our existing buildpacks. While nothing in the ruby buildpack currently accidentally modifies the existing disk, it's purely by accident. If we were to copy and paste a test and modify it, it's possible that could change. Let's remove all use of `Hatchet#setup!` to be safe. --- Gemfile.lock | 2 +- spec/hatchet/jvm_spec.rb | 5 +---- spec/hatchet/rails23_spec.rb | 3 +-- spec/hatchet/rails3_spec.rb | 4 +--- spec/hatchet/rails5_spec.rb | 5 ++--- spec/hatchet/rubies_spec.rb | 8 -------- spec/hatchet/ruby_spec.rb | 5 +---- spec/hatchet/stack_spec.rb | 6 ++---- 8 files changed, 9 insertions(+), 29 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index b9b6534d0..eacdf9047 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GEM excon moneta multi_json (>= 1.9.2) - heroku_hatchet (7.1.0) + heroku_hatchet (7.1.3) excon (~> 0) platform-api (~> 3) rrrretry (~> 1) diff --git a/spec/hatchet/jvm_spec.rb b/spec/hatchet/jvm_spec.rb index f8369d5b6..d33b745b4 100644 --- a/spec/hatchet/jvm_spec.rb +++ b/spec/hatchet/jvm_spec.rb @@ -7,10 +7,7 @@ :default # default is heroku-ruby-buildpack here ] - app = Hatchet::Runner.new("ruby_193_jruby_1_7_27", stack: 'heroku-18', buildpacks: buildpacks) - app.setup! - - app.deploy do |app| + Hatchet::Runner.new("ruby_193_jruby_1_7_27", stack: 'heroku-18', buildpacks: buildpacks).deploy do |app| expect(app.output).to match("Using pre-installed JDK") expect(app.run("java -version")).to match("1.8.0") sleep 3 diff --git a/spec/hatchet/rails23_spec.rb b/spec/hatchet/rails23_spec.rb index 10fdce199..5120dd231 100644 --- a/spec/hatchet/rails23_spec.rb +++ b/spec/hatchet/rails23_spec.rb @@ -2,8 +2,7 @@ describe "Rails 2.3.x" do it "should deploy on ruby 1.9.3 on cedar-14" do - app = Hatchet::Runner.new('rails23_mri_193', stack: "cedar-14").setup! - app.deploy do |app, heroku| + Hatchet::Runner.new('rails23_mri_193', stack: "cedar-14").deploy do |app| # assert deploy is successful end end diff --git a/spec/hatchet/rails3_spec.rb b/spec/hatchet/rails3_spec.rb index c6b684c72..8bf795e12 100644 --- a/spec/hatchet/rails3_spec.rb +++ b/spec/hatchet/rails3_spec.rb @@ -2,9 +2,7 @@ describe "Rails 3.x" do it "should deploy on ruby 1.9.3" do - app = Hatchet::Runner.new("rails3_mri_193", stack: "cedar-14") - app.setup! - app.deploy do |app, heroku| + Hatchet::Runner.new("rails3_mri_193", stack: "cedar-14").deploy do |app, heroku| expect(app.output).to include("Asset precompilation completed") expect(app.output).to match("WARNING") diff --git a/spec/hatchet/rails5_spec.rb b/spec/hatchet/rails5_spec.rb index aa660b65f..8c3e50082 100644 --- a/spec/hatchet/rails5_spec.rb +++ b/spec/hatchet/rails5_spec.rb @@ -43,10 +43,9 @@ def worker_task_for_app(app) buildpacks: [ "https://github.com/heroku/heroku-buildpack-activestorage-preview", :default - ] + ], + config: {'HEROKU_DEBUG_RAILS_RUNNER' => 'true'} ) - app.setup! - app.set_config('HEROKU_DEBUG_RAILS_RUNNER' => 'true') app.deploy do |app, heroku| expect(app.output).to_not match('binary dependencies required') expect(app.output).to match('config.active_storage.service') diff --git a/spec/hatchet/rubies_spec.rb b/spec/hatchet/rubies_spec.rb index f0ff2836b..0932281b4 100644 --- a/spec/hatchet/rubies_spec.rb +++ b/spec/hatchet/rubies_spec.rb @@ -3,7 +3,6 @@ describe "Ruby Versions on cedar-14" do it "should allow patchlevels" do app = Hatchet::Runner.new('mri_193_p547', stack: "cedar-14") - app.setup! app.deploy do |app| version = '1.9.3p547' expect(app.output).to match("ruby-1.9.3-p547") @@ -13,7 +12,6 @@ it "should deploy ruby 1.9.2 properly" do app = Hatchet::Runner.new('mri_192', stack: "cedar-14") - app.setup! app.deploy do |app| version = '1.9.2' expect(app.output).to match(version) @@ -23,7 +21,6 @@ it "should deploy ruby 1.9.3 properly" do app = Hatchet::Runner.new('mri_193', stack: "cedar-14") - app.setup! app.deploy do |app| version = '1.9.3' expect(app.output).to match(version) @@ -33,7 +30,6 @@ it "should deploy ruby 2.0.0 properly" do app = Hatchet::Runner.new('mri_200', stack: "cedar-14") - app.setup! app.deploy do |app| version = '2.0.0' expect(app.output).to match(version) @@ -45,7 +41,6 @@ it "should deploy jruby 1.7.16.1 (jdk 7) properly on cedar-14 with sys props file" do app = Hatchet::Runner.new("ruby_193_jruby_17161_jdk7", stack: "cedar-14") - app.setup! app.deploy do |app| expect(app.output).to match("Installing JVM: openjdk-7") expect(app.output).not_to include("OpenJDK 64-Bit Server VM warning") @@ -56,7 +51,6 @@ describe "Ruby versions" do it "should deploy jdk 8 on heroku-18 by default" do app = Hatchet::Runner.new("ruby_193_jruby_1_7_27", stack: "heroku-18") - app.setup! app.deploy do |app| expect(app.output).to match("Installing JVM: openjdk-8") expect(app.output).to match("JRUBY_OPTS is: -Xcompile.invokedynamic=false") @@ -73,7 +67,6 @@ it "should deploy jruby with the naether gem" do app = Hatchet::Runner.new("jruby_naether", stack: DEFAULT_STACK) - app.setup! app.deploy do |app| expect(app.output).to match("Installing naether") expect(app.output).not_to include("An error occurred while installing naether") @@ -84,7 +77,6 @@ describe "Upgrading ruby apps" do it "works when changing from default version" do app = Hatchet::Runner.new("default_ruby", stack: DEFAULT_STACK) - app.setup! app.deploy do |app| expect(app.run("env | grep MALLOC_ARENA_MAX")).to match("MALLOC_ARENA_MAX=2") expect(app.run("env | grep DISABLE_SPRING")).to match("DISABLE_SPRING=1") diff --git a/spec/hatchet/ruby_spec.rb b/spec/hatchet/ruby_spec.rb index 1fc7b4f74..7f73ffa10 100644 --- a/spec/hatchet/ruby_spec.rb +++ b/spec/hatchet/ruby_spec.rb @@ -200,10 +200,7 @@ describe "Rack" do it "should not overwrite already set environment variables" do custom_env = "FFFUUUUUUU" - app = Hatchet::Runner.new("default_ruby") - app.setup! - app.set_config("RACK_ENV" => custom_env) - expect(app.run("env")).to match(custom_env) + app = Hatchet::Runner.new("default_ruby", config: {"RACK_ENV" => custom_env}) app.deploy do |app| expect(app.run("env")).to match(custom_env) diff --git a/spec/hatchet/stack_spec.rb b/spec/hatchet/stack_spec.rb index cb2d8cfbb..554922684 100644 --- a/spec/hatchet/stack_spec.rb +++ b/spec/hatchet/stack_spec.rb @@ -2,8 +2,7 @@ describe "Stack Changes" do xit "should reinstall gems on stack change" do - app = Hatchet::Runner.new('default_ruby', stack: "heroku-18").setup! - app.deploy do |app, heroku| + Hatchet::Runner.new('default_ruby', stack: "heroku-18").deploy do |app| app.update_stack("heroku-16") run!('git commit --allow-empty -m "heroku-16 migrate"') @@ -15,8 +14,7 @@ end it "should not reinstall gems if the stack did not change" do - app = Hatchet::Runner.new('default_ruby', stack: "heroku-16").setup! - app.deploy do |app, heroku| + Hatchet::Runner.new('default_ruby', stack: "heroku-16").deploy do |app| app.update_stack("heroku-16") run!(%Q{git commit --allow-empty -m "cedar migrate"}) From 326fa02e8ca4741a5757342c4952aaec7ec7b3c4 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Mon, 21 Sep 2020 10:20:14 -0500 Subject: [PATCH 0759/1195] [changelog skip] Skip changelog of dependabot (#1063) Currently dependabot PRs are failing our check changelog script: https://github.com/heroku/heroku-buildpack-ruby/pull/1062 (Click on the red "x" to see status). With this PR this check will be skipped. --- .github/dependabot.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 5921c9525..ec0ff9009 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -7,3 +7,5 @@ updates: interval: "weekly" labels: - "dependencies" + commit_message: + prefix: "[changelog skip]" From 412488dd79ddbe5c41821145c19e5f121a247c5b Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Tue, 22 Sep 2020 13:17:35 -0500 Subject: [PATCH 0760/1195] [changelog skip] (#1067) It's `commit-message` and not `commit_message`. It would be lovely if dependabot could warn on this before the file gets changed and merged. https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates#commit-message --- .github/dependabot.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index ec0ff9009..65be5b932 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -7,5 +7,5 @@ updates: interval: "weekly" labels: - "dependencies" - commit_message: + commit-message: prefix: "[changelog skip]" From cbe100933b1e50953f0da35aafc50374ae2a31f9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 28 Sep 2020 10:30:19 -0500 Subject: [PATCH 0761/1195] Bump parallel_tests from 3.2.0 to 3.3.0 (#1070) Bumps [parallel_tests](https://github.com/grosser/parallel_tests) from 3.2.0 to 3.3.0. - [Release notes](https://github.com/grosser/parallel_tests/releases) - [Changelog](https://github.com/grosser/parallel_tests/blob/master/CHANGELOG.md) - [Commits](https://github.com/grosser/parallel_tests/compare/v3.2.0...v3.3.0) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index eacdf9047..29532183e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -21,7 +21,7 @@ GEM moneta (1.0.0) multi_json (1.15.0) parallel (1.19.2) - parallel_tests (3.2.0) + parallel_tests (3.3.0) parallel platform-api (3.0.0) heroics (~> 0.1.1) From 20acb451105cdce8aed0c767f9b2d9a70e9aaf50 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Wed, 30 Sep 2020 14:35:52 -0500 Subject: [PATCH 0762/1195] Fix dependabot? (#1071) Dependabot caps the message prefix to 15 characters: ![](https://www.dropbox.com/s/gebohhtdfj54izq/Screen%20Shot%202020-09-28%20at%204.08.15%20PM.png?raw=1) This PR allows will skip the changelog check if one of the labels is "dependencies". --- .github/dependabot.yml | 2 -- .github/workflows/check_changelog.yml | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 65be5b932..5921c9525 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -7,5 +7,3 @@ updates: interval: "weekly" labels: - "dependencies" - commit-message: - prefix: "[changelog skip]" diff --git a/.github/workflows/check_changelog.yml b/.github/workflows/check_changelog.yml index 1e9febe54..7d1814e75 100644 --- a/.github/workflows/check_changelog.yml +++ b/.github/workflows/check_changelog.yml @@ -5,6 +5,7 @@ on: types: [opened, reopened, edited, synchronize] jobs: build: + if: !contains(github.event.issue.labels.*.name, "dependencies") runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 From 745cd2a4b5d347050f9edce44e7056d8e9e4c2ec Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 30 Sep 2020 15:13:41 -0500 Subject: [PATCH 0763/1195] Bump rspec-core from 3.9.2 to 3.9.3 (#1074) Bumps [rspec-core](https://github.com/rspec/rspec-core) from 3.9.2 to 3.9.3. - [Release notes](https://github.com/rspec/rspec-core/releases) - [Changelog](https://github.com/rspec/rspec-core/blob/main/Changelog.md) - [Commits](https://github.com/rspec/rspec-core/compare/v3.9.2...v3.9.3) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 29532183e..8480cd130 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -31,7 +31,7 @@ GEM rate_throttle_client (0.1.2) redis (4.2.1) rrrretry (1.0.0) - rspec-core (3.9.2) + rspec-core (3.9.3) rspec-support (~> 3.9.3) rspec-expectations (3.9.2) diff-lcs (>= 1.2.0, < 2.0) From 5f99bf126fa8ea01657ffc6d6daeca06cb52fe23 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Wed, 30 Sep 2020 15:23:26 -0500 Subject: [PATCH 0764/1195] [changelog skip] Promote tag to release and vendor CNB (#1044) * [changelog skip] Promote tag to release and vendor CNB When a tag is created, this action will build a vendored version of the Ruby buildpack for CNB, create a release from the tag, and then attach the tarball of the buildpack to the release. To cut a new release run: ``` $ git tag v219 && git push --tags ``` * Move tarball logic to class for testing Logic in the rake file is not tested. I want to start porting code over to custom classes that can be tested. Then we can use those classes with a minimal interface in the rakefile. It won't guarantee there are no regressions, but it will give much more confidence when modifying the logic. In addition to moving this logic over to a custom class. The logic is changed so that it's tarballing contents from disk instead of from git remote so it can be fired from GitHub actions. * Add `rake buildpack:release` command This command will run checks to ensure that the local copy is the same as the copy on GitHub. It then creates and pushes a tag to GitHub, then uses the heroku buildpack CLI to deploy the change. Currently the process for deploying a buildpack involves manually making a tag, then calling the cli. This allows us to turn that into a one step process that we can add guards to (for instance checking changelog contents). The majority of the logic for this rake task is in a custom class that is tested. --- .github/workflows/release_cnb.yml | 55 ++++++++++++ Rakefile | 59 ++++++------- lib/rake/deploy_check.rb | 131 +++++++++++++++++++++++++++ lib/rake/tarballer.rb | 52 +++++++++++ spec/rake/deploy_check_spec.rb | 141 ++++++++++++++++++++++++++++++ spec/rake/tarballer_spec.rb | 30 +++++++ spec/spec_helper.rb | 1 + 7 files changed, 439 insertions(+), 30 deletions(-) create mode 100644 .github/workflows/release_cnb.yml create mode 100644 lib/rake/deploy_check.rb create mode 100644 lib/rake/tarballer.rb create mode 100644 spec/rake/deploy_check_spec.rb create mode 100644 spec/rake/tarballer_spec.rb diff --git a/.github/workflows/release_cnb.yml b/.github/workflows/release_cnb.yml new file mode 100644 index 000000000..40a134464 --- /dev/null +++ b/.github/workflows/release_cnb.yml @@ -0,0 +1,55 @@ +name: Release CNB + +on: [push] # Could use to push tags + +jobs: + build: + if: startsWith(github.ref, 'refs/tags/') + runs-on: ubuntu-latest + steps: + - name: Setup Ruby + uses: ruby/setup-ruby@v1.40.0 + with: + ruby-version: 2.6.6 + - uses: actions/checkout@v2 + - name: bundle install + run: bundle install --jobs 4 --retry 3 + - name: build tar file + run: bundle exec rake buildpack:tarball + - uses: actions/upload-artifact@v2 + with: + name: buildpack.tgz + path: buildpacks/* + + release: + if: startsWith(github.ref, 'refs/tags/') + needs: build + runs-on: ubuntu-latest + steps: + - name: 'Get Version' + run: | + [[ $GITHUB_REF =~ ^refs\/tags\/(.*)$ ]] && version=${BASH_REMATCH[1]} + echo "::set-env name=VERSION::$version" + - name: 'Download list binary' + uses: actions/download-artifact@v2 + with: + name: buildpack.tgz + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ env.VERSION }} + release_name: ${{ env.VERSION }} + draft: false + prerelease: false + - name: Upload Release Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: heroku-buildpack-ruby-${{ env.VERSION }}.tgz + asset_name: heroku-buildpack-ruby-${{ env.VERSION }}.tgz + asset_content_type: application/gzip diff --git a/Rakefile b/Rakefile index 33ce63cf7..3ad5c5880 100644 --- a/Rakefile +++ b/Rakefile @@ -1,8 +1,16 @@ +# CAREFUL! Changes made to this file aren't tested +# +# If you need new functionality, consider putting it in lib/rake +# and also adding tests, then calling that code from here +# require "fileutils" require "tmpdir" require 'hatchet/tasks' ENV["BUILDPACK_LOG_FILE"] ||= "tmp/buildpack.log" +require_relative 'lib/rake/deploy_check' +require_relative 'lib/rake/tarballer' + S3_BUCKET_NAME = "heroku-buildpack-ruby" def s3_tools_dir @@ -57,38 +65,29 @@ def install_gem(gem_name, version) end namespace :buildpack do - desc "stage a tarball of the buildpack" - task :tarball do - - Dir.mktmpdir("heroku-buildpack-ruby") do |tmpdir| - sh "git clone https://github.com/heroku/heroku-buildpack-ruby #{tmpdir}/heroku-buildpack-ruby" - - Dir.chdir(tmpdir) do - Dir.chdir("heroku-buildpack-ruby") do |buildpack_dir| - $:.unshift File.expand_path("../lib", __FILE__) - require "language_pack/installers/heroku_ruby_installer" - require "language_pack/ruby_version" - require "language_pack/version" - - %w(cedar-14 heroku-16 heroku-18).each do |stack| - installer = LanguagePack::Installers::HerokuRubyInstaller.new(stack) - ruby_version = LanguagePack::RubyVersion.new("ruby-#{LanguagePack::RubyVersion::DEFAULT_VERSION_NUMBER}") - installer.fetch_unpack(ruby_version, "vendor/ruby/#{stack}") - end - - sh "tar czf ../buildpack.tgz *" - end - - @digest = Digest::MD5.hexdigest(File.read("buildpack.tgz")) + desc "releases the next version of the buildpack" + task :release do + deploy = DeployCheck.new(github: "heroku/heroku-buildpack-ruby") + puts "Attempting to deploy #{deploy.next_version}, overwrite with RELEASE_VERSION env var" + deploy.check! + + if deploy.push_tag? + sh("git tag -f ", deploy.next_version) do |out, status| + raise "Could not `git tag -f #{deploy.version}`: #{out}" unless status.success? + end + sh("git push --tags") do |out, status| + raise "Could not `git push --tags`: #{out}" unless status.success? end - - - filename = "buildpacks/heroku-buildpack-ruby-#{LanguagePack::Base::BUILDPACK_VERSION}.tgz" - puts "Writing to #{filename}" - - FileUtils.mkdir_p("buildpacks/") - FileUtils.cp("#{tmpdir}/buildpack.tgz", filename) end + + command = "heroku buildpacks:publish heroku/ruby #{deploy.next_version}" + puts "Releasing to heroku: `#{command}`" + exec(command) + end + desc "stage a tarball of the buildpack, this runs on github actions to deploy CNB" + task :tarball do + tarballer = Tarballer.new(name: "heroku-buildpack-ruby", directory: __dir__) + tarballer.call end end diff --git a/lib/rake/deploy_check.rb b/lib/rake/deploy_check.rb new file mode 100644 index 000000000..0aa6d7cbd --- /dev/null +++ b/lib/rake/deploy_check.rb @@ -0,0 +1,131 @@ +# A class for checking if a local copy of a repo can be tagged for a deploy +# +# Example: +# +# deploy = DeployCheck.new(github: "heroku/heroku-buildpack-ruby") +# deploy.check! # Checks that current main branch matches what's on github +# +# It also can pull tag versions and determine the next sequential version automatically: +# +# deploy.next_version # => "v999" # Assuming the last version was v998 +# +# It can determine status of tags +# +# deploy.push_tags? #=> false +# +class DeployCheck + attr_reader :github_url + + def initialize(github: , next_version: ENV["RELEASE_VERSION"]) + @github = github + @github_url = "https://github.com/#{github}" + @next_version = next_version + @remote_tag_array = nil + end + + def check! + check_version! + check_unstaged! + check_branch! + check_changelog! + check_sync! + end + + def push_tag? + return true if !tag_exists_on_remote? + return false if remote_tag_matches? + + # Tag exists, but is not the same commit, raise an error + raise <<~EOM + The tag you're pushing (#{next_version}) to #{@github} already exists and does not have the same SHA. + You must resolve this manually. + EOM + end + + # Returns tuthy value if the remote contains the next version already + def tag_exists_on_remote? + remote_tag_array.include?(next_version) + end + + # Returns a truthy value if the remote tag SHA matches the current local sha + def remote_tag_matches?(remote_sha: remote_commit_sha(next_version), local_sha: local_commit) + remote_sha == local_sha + end + + # Raises an error if there are unstaged modifications + def check_unstaged! + run!("git diff --quiet HEAD") do + raise "Must have all changes committed. There are unstaged commits locally" + end + end + + # Raises an error if not on the designated branch + def check_branch!(name = "main") + out = run("git rev-parse --abbrev-ref HEAD") + raise "Must be on main branch. Branch: #{out}" unless out == name + end + + # Raises an error if the changelog does not have an entry with the designated version + def check_changelog! + if !File.read("CHANGELOG.md").include?("## #{next_version}") + raise "Expected CHANGELOG.md to include #{next_version} but it did not" + end + end + + # Raises an error if the local sha does not match the remote sha + def check_sync!(local_sha: local_commit_sha, remote_sha: remote_commit_sha) + return if remote_sha == local_sha + + raise <<~EOM + Must be in-sync with #{@github}. Local comit: #{local_sha.inspect} #{@github}: #{remote_sha.inspect} + "Make sure that you've pulled: `git pull --rebase #{@github_url} main` + EOM + end + + def check_version! + version = next_version + + raise "Must look like a version: #{version}. Must start with `v` and include only digits" unless version.match?(/^v\d+$/) + end + + def local_commit_sha + run!("git rev-parse HEAD") + end + + def remote_commit_sha(branch_or_tag = "main") + run!("git ls-remote #{@github_url} #{branch_or_tag}").split("\t").first + end + + def run(cmd) + `#{cmd}`.strip + end + + def next_version + @next_version || "v#{next_version_number}" + end + + def remote_tag_array + @remote_tag_array ||= begin + cmd = String.new("") + cmd << "git ls-remote --tags #{@github_url}" + cmd << "| awk '{print $2}' | cut -d '/' -f 3 | cut -d '^' -f 1" + run!(cmd).each_line.map(&:strip).select {|line| line.strip.match?(/^v\d+$/) } # https://rubular.com/r/8eFB9r8nOVrM7H + end + end + + private def next_version_number + integer_tag_array = remote_tag_array.map {|line| line.sub(/^v/, '').to_i }.sort # Ascending order + integer_tag_array.last.next + end + + def run!(cmd) + out = run(cmd) + return out if $?.success? + + if block_given? + yield out, $? + else + raise "Command #{cmd} expected to return successfully did not: #{out}" + end + end +end diff --git a/lib/rake/tarballer.rb b/lib/rake/tarballer.rb new file mode 100644 index 000000000..b0efc1565 --- /dev/null +++ b/lib/rake/tarballer.rb @@ -0,0 +1,52 @@ +require 'fileutils' +require 'pathname' + +$:.unshift File.join(__dir__, "..") # put lib on the path +require "language_pack/installers/heroku_ruby_installer" +require "language_pack/ruby_version" +require "language_pack/version" + +# This class takes a target directory (such as the buildpack) +# and tars it up so it's in a form ready to be run +# +# In addition to TAR logic it also vendors ruby versions so +# they don't need to be pulled at runtime +class Tarballer + STACKS = %W{cedar-14 heroku-16 heroku-18} + + def initialize(name: , directory: , io: STDOUT) + @name = name + @source_directory = Pathname.new(directory) + @version = LanguagePack::Base::BUILDPACK_VERSION + @dest_directory = @source_directory.join("buildpacks") + @dest_directory.mkpath + @io = io + end + + def call(stacks: STACKS) + Dir.mktmpdir do |tmpdir_base| + tmp_dir = Pathname.new(tmpdir_base).join(@name) + run! "cp -r #{@source_directory} #{tmp_dir}" + + Dir.chdir(tmp_dir) do |buildpack_dir| + stacks.each do |stack| + installer = LanguagePack::Installers::HerokuRubyInstaller.new(stack) + ruby_version = LanguagePack::RubyVersion.new("ruby-#{LanguagePack::RubyVersion::DEFAULT_VERSION_NUMBER}") + installer.fetch_unpack(ruby_version, "vendor/ruby/#{stack}") + end + run! "tar czf #{tmp_dir.join('.buildpack.tgz')} *" + end + + tar_destination = @dest_directory.join("heroku-buildpack-ruby-#{@version}.tgz") + @io.puts "Writing to #{tar_destination}" + + FileUtils.cp(tmp_dir.join('.buildpack.tgz'), tar_destination) + end + end + + private def run!(cmd) + out = `#{cmd}` + raise "Command: #{cmd} was expected to succeed but it did not. Output: #{out}" unless $?.success? + out + end +end diff --git a/spec/rake/deploy_check_spec.rb b/spec/rake/deploy_check_spec.rb new file mode 100644 index 000000000..52ff41c16 --- /dev/null +++ b/spec/rake/deploy_check_spec.rb @@ -0,0 +1,141 @@ +require "spec_helper" +require "rake/deploy_check" + +describe "A helper class for deploying" do + describe "tests that hit github" do + it "know remote tags" do + deploy = DeployCheck.new(github: "heroku/heroku-buildpack-ruby") + expect(deploy.remote_tag_array.class).to eq(Array) + expect(deploy.remote_tag_array).to include("v218") + end + + it "remote sha" do + deploy = DeployCheck.new(github: "sharpstone/do_not_delete_or_modify") + expect(deploy.remote_commit_sha).to eq("3a9ff6433a05560acfd06dda03a11605a96ae133") + end + + it "local_commit_sha" do + Dir.mktmpdir do |dir| + Dir.chdir(dir) do + run!("git clone https://github.com/sharpstone/default_ruby #{dir} 2>&1 && cd #{dir} && git checkout 6e642963acec0ff64af51bd6fba8db3c4176ed6e 2>&1 && git checkout -b mybranch 2>&1") + deploy = DeployCheck.new(github: "heroku/heroku-buildpack-ruby") + expect(deploy.local_commit_sha).to eq("6e642963acec0ff64af51bd6fba8db3c4176ed6e") + end + end + end + end + + describe "tests that do NOT hit github" do + it "checks multiple things" do + deploy = DeployCheck.new(github: "heroku/heroku-buildpack-ruby") + deploy.instance_variable_set("@methods_called", []) + + def deploy.check_version!; @methods_called << :check_version! ;end + def deploy.check_unstaged!; @methods_called << :check_unstaged! ;end + def deploy.check_branch!; @methods_called << :check_branch! ;end + def deploy.check_changelog!; @methods_called << :check_changelog! ;end + def deploy.check_sync!; @methods_called << :check_sync! ;end + + deploy.check! + + methods_called = deploy.instance_variable_get("@methods_called") + expect(methods_called).to include(:check_version!) + expect(methods_called).to include(:check_unstaged!) + expect(methods_called).to include(:check_branch!) + expect(methods_called).to include(:check_changelog!) + expect(methods_called).to include(:check_sync!) + end + + it "checks version" do + ["v123abc", "123", "V123"].each do |bad_version| + deploy = DeployCheck.new(github: "heroku/heroku-buildpack-ruby", next_version: bad_version) + expect { + deploy.check_version! + }.to raise_error(/Must look like a version/) + end + end + + it "checks local sha and remote sha match" do + deploy = DeployCheck.new(github: "heroku/heroku-buildpack-ruby") + expect { + deploy.check_sync!(local_sha: "a", remote_sha: "not a") + }.to raise_error(/Must be in-sync/) + + deploy = DeployCheck.new(github: "heroku/heroku-buildpack-ruby") + deploy.check_sync!( + local_sha: "cbe100933b1e50953f0da35aafc50374ae2a31f9", + remote_sha: "cbe100933b1e50953f0da35aafc50374ae2a31f9" + ) + end + + it "github url" do + deploy = DeployCheck.new(github: "heroku/heroku-buildpack-ruby") + expect(deploy.github_url).to eq("https://github.com/heroku/heroku-buildpack-ruby") + end + + it "knows the next version" do + deploy = DeployCheck.new(github: "heroku/heroku-buildpack-ruby", next_version: "v123") + + def deploy.remote_tag_array; [ "v123" ] ; end + + expect(deploy.tag_exists_on_remote?).to be_truthy + + deploy = DeployCheck.new(github: "heroku/heroku-buildpack-ruby", next_version: "v124") + + def deploy.remote_tag_array; [ "v123" ] ; end + + expect(deploy.tag_exists_on_remote?).to be_falsey + end + + it "checks remote tags for existance" do + deploy = DeployCheck.new(github: "heroku/heroku-buildpack-ruby") + + def deploy.remote_tag_array; [ "v123" ] ; end + + expect(deploy.next_version).to eq("v124") + end + + it "checks unstaged" do + Dir.mktmpdir do |dir| + Dir.chdir(dir) do + deploy = DeployCheck.new(github: "heroku/heroku-buildpack-ruby") + run!("echo 'blerg' >> foo.txt") + run!("git init .; git add . ; git commit -m first") + deploy.check_unstaged! + + run!("echo 'foo' >> foo.txt") + expect { deploy.check_unstaged! }.to raise_error(/Must have all changes committed/) + end + end + end + + it "checks branch" do + Dir.mktmpdir do |dir| + Dir.chdir(dir) do + deploy = DeployCheck.new(github: "heroku/heroku-buildpack-ruby") + run!("echo 'blerg' >> foo.txt") + run!("git init .; git add . ; git commit -m first") + run!("git checkout -B main") + deploy.check_branch! + + expect { deploy.check_branch!("not_main") }.to raise_error(/Must be on main branch/) + end + end + end + + it "checks CHANGELOG" do + Dir.mktmpdir do |dir| + Dir.chdir(dir) do + deploy = DeployCheck.new(github: "heroku/heroku-buildpack-ruby", next_version: "v999") + run!("touch CHANGELOG.md") + expect { + deploy.check_changelog! + }.to raise_error(/Expected CHANGELOG.md to include v999/) + + run!("echo '## v999' >> CHANGELOG.md") + deploy.check_changelog! + end + end + end + end +end diff --git a/spec/rake/tarballer_spec.rb b/spec/rake/tarballer_spec.rb new file mode 100644 index 000000000..89a982e5d --- /dev/null +++ b/spec/rake/tarballer_spec.rb @@ -0,0 +1,30 @@ +require "spec_helper" +require "rake/tarballer" + +def real_entries(dir) + Dir.entries(dir) - [".", ".."] +end + +describe "tarballer" do + it "blerg" do + Dir.mktmpdir do |dir| + dir = Pathname.new(dir) + run!("echo 'foo' >> #{dir}/foo.txt") + run!("mkdir -p #{dir}/vendor/ruby") + + tarballer = Tarballer.new(name: 'heroku-buildpack-ruby', directory: dir, io: StringIO.new) + tarballer.call(stacks: ["heroku-18"]) + + # Test tar generated + tgz_name = "heroku-buildpack-ruby-#{LanguagePack::Base::BUILDPACK_VERSION}.tgz" + buildpacks_dir = real_entries("#{dir}/buildpacks") + expect(buildpacks_dir).to include(tgz_name) + + # Test tar contents + tgz_file = dir.join("buildpacks", tgz_name) + tar_contents = run!("tar -tvf #{tgz_file}").strip + expect(tar_contents).to include("vendor/ruby/heroku-18/bin/gem") + expect(tar_contents).to include("foo.txt") + end + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 49479db68..22688d3ac 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,6 +1,7 @@ require 'rspec/core' require 'hatchet' require 'fileutils' +require 'stringio' require 'hatchet' require 'rspec/retry' require 'language_pack' From 9fc56552cc7d6132721c158f720341c4df248390 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Mon, 5 Oct 2020 11:03:08 -0500 Subject: [PATCH 0765/1195] [close #1072] Don't install bundler twice on CI (#1073) * Upgrade Hatchet * Failing test * Memoize slug_vendor_base class method call Shelling out is comparatively expensive and this gets called several times. It's already memoized at the instance level (which calls the class). This commit memoizes the class call as well. * Allow calling puts on non-strings When debugging its common to do something like: ```ruby puts variable ``` And unless it's a string this method will trigger an exception: ``` NoMethodError (undefined method `each_line' for []:Array) ``` This commit ensures all variables passed in to puts will be strings before calling `each_line` on them. * [close #1072] Don't install bundler twice on CI When we compile an app for CI, if the user does not specify a test command than the bin/support/ruby_test gets called. This file automatically detects the test framework the user is likely using and calls the appropriate command (such as `bin/rspec`). The problem is that the logic in this file relies on determining what gems the customer's application has. To detect gems we need access to the bundler's source code because we use bundler internals for parsing the Gemfile.lock. A copy of bundler is already installed on the system from the prior `bin/test-compile` call, but...it's located on disk at the "slug_vendor_base" which is based off of the customer's ruby version, for example: ``` vendor/bundle/ruby/2.6.0 ``` So in order to detect gems, we need access to bundler, to access bundler we need to put the customer's ruby binary on the PATH. This was previously being done here: ``` # The `ruby_test-compile` program installs a version of Ruby for the # user's application. It needs the propper `PATH`, where ever Ruby is installed # we always add a symlink to the `bin/ruby` file so that is always valid. # We calculate the gem path the same way we do when compiling. LanguagePack::ShellHelpers.user_env_hash["PATH"] = "#{build_dir}/bin:#{bundler.bundler_path}/bin:#{ENV["PATH"]}" ``` I moved adding the users `app/bin` to the PATH up to the top of the script. Now that requirement is set, I worked on getting rid of the double bundler installation. In this line: ``` bundler.install ``` It will check to see if a copy of bundler is already installed, the problem is: due to the circular dependency on using bundler to find a customer's Ruby version and then using Ruby to determine where in the customer's app bundler will live, this defaults to a tmp directory. In regular `bin/compile` this is great, we then later move the bundler to the right spot. In this case, we can just tell it the location of where we previously installed bundler in the app: ```ruby bundler = LanguagePack::Helpers::BundlerWrapper.new( gemfile_path: "#{build_dir}/Gemfile", bundler_path: LanguagePack::Ruby.slug_vendor_base # This was previously installed by bin/support/ruby_test-compile ) ``` > In the `slug_vendor_base` With this change bundler checks that directory, sees its non-empty and then skips downloading bundler for a second time. ## Retro This logic is very difficult to reason about. We could make it simpler by removing the requirement that the customer's Ruby version is used to determine the directory of where bundler lives. I don't know what tight coupling might exist between this file location and other actions. For instance when we bundle install we specify a path of `vendor/bundle` and the path we install bundler into is in `vendor/bundle/ruby/` For a first attempt I would put it in a completely separate directory. Other buildpacks use `.heroku` we could put it in `.heroku/ruby/bundler` and then we wouldn't need to calculate the location. If that raises coupling issues with other parts of this project (likely) then I could iterate again. * Fix hatchet deprecation ``` ENV HATCHET_BUILDPACK_BASE is not set. It currently defaults to the ruby buildpack. In the future this env var will be required ``` --- CHANGELOG.md | 1 + Gemfile.lock | 2 +- bin/support/ruby_test | 30 +++++++++++++------- lib/language_pack/helpers/bundler_wrapper.rb | 8 ++++++ lib/language_pack/ruby.rb | 11 +++---- lib/language_pack/shell_helpers.rb | 2 +- spec/hatchet/ci_spec.rb | 3 ++ spec/spec_helper.rb | 2 ++ 8 files changed, 42 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e794a512c..5cf9ae712 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Main (unreleased) +* Fix double installation of bundler on CI runs when no test script is specified (https://github.com/heroku/heroku-buildpack-ruby/pull/1073) * Bundler 2.x is now 2.1.4 (https://github.com/heroku/heroku-buildpack-ruby/pull/1052) * Persistent bundler config is now being set using the `BUNDLE_*` env vars (https://github.com/heroku/heroku-buildpack-ruby/pull/1039) * Rake task "assets:clean" will not get called if it does not exist (https://github.com/heroku/heroku-buildpack-ruby/pull/1018) diff --git a/Gemfile.lock b/Gemfile.lock index 8480cd130..133bca93c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GEM excon moneta multi_json (>= 1.9.2) - heroku_hatchet (7.1.3) + heroku_hatchet (7.3.0) excon (~> 0) platform-api (~> 3) rrrretry (~> 1) diff --git a/bin/support/ruby_test b/bin/support/ruby_test index 977e9b8e1..6ecdab8f5 100755 --- a/bin/support/ruby_test +++ b/bin/support/ruby_test @@ -29,26 +29,36 @@ def execute_command(command) pipe(command, :user_env => true, :output_object => Kernel) end +def user_env_hash + LanguagePack::ShellHelpers.user_env_hash +end + # $ bin/test BUILD_DIR ENV_DIR ARTIFACT_DIR build_dir, env_dir, _ = ARGV LanguagePack::ShellHelpers.initialize_env(env_dir) +Dir.chdir(build_dir) + +# The `ruby_test-compile` program installs a version of Ruby for the +# user's application. It needs the propper `PATH`, where ever Ruby is installed +# otherwise we end up using the buildpack's version of Ruby +# +# This is needed here because LanguagePack::Ruby.slug_vendor_base shells out to the user's ruby binary +user_env_hash["PATH"] = "#{build_dir}/bin:#{ENV["PATH"]}" bundler = LanguagePack::Helpers::BundlerWrapper.new( - gemfile_path: "#{build_dir}/Gemfile" + gemfile_path: "#{build_dir}/Gemfile", + bundler_path: LanguagePack::Ruby.slug_vendor_base # This was previously installed by bin/support/ruby_test-compile ) -# The `ruby_test-compile` program installs a version of Ruby for the -# user's application. It needs the propper `PATH`, where ever Ruby is installed -# we always add a symlink to the `bin/ruby` file so that is always valid. -# We calculate the gem path the same way we do when compiling. -LanguagePack::ShellHelpers.user_env_hash["PATH"] = "#{build_dir}/bin:#{bundler.bundler_path}/bin:#{ENV["PATH"]}" -LanguagePack::ShellHelpers.user_env_hash["GEM_PATH"] = LanguagePack::Ruby.slug_vendor_base +# - Add bundler's bin directory to the PATH +# - Always make sure `$HOME/bin` is first on the path +user_env_hash["PATH"] = "#{build_dir}/bin:#{bundler.bundler_path}/bin:#{user_env_hash["PATH"]}" +user_env_hash["GEM_PATH"] = LanguagePack::Ruby.slug_vendor_base -# load bundler +# - Sets BUNDLE_GEMFILE +# - Loads bundler's internal Gemfile.lock parser so we can use `bundler.has_gem?` bundler.install -Dir.chdir(build_dir) - execute_test( if bundler.has_gem?("rspec-core") if File.exist?("bin/rspec") diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index 9ca42c9ba..364f7c2c9 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -176,6 +176,14 @@ def fetch_bundler topic("Installing bundler #{@version}") bundler_version_escape_valve! + # Install directory structure (as of Bundler 2.1.4): + # - cache + # - bin + # - gems + # - specifications + # - build_info + # - extensions + # - doc FileUtils.mkdir_p(bundler_path) Dir.chdir(bundler_path) do @fetcher.fetch_untar(@bundler_tar) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 0583c0a0d..7551c970b 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -231,13 +231,14 @@ def warn_bundler_upgrade end end - # For example "vendor/bundle/ruby/2.6.0" def self.slug_vendor_base - command = %q(ruby -e "require 'rbconfig';puts \"vendor/bundle/#{RUBY_ENGINE}/#{RbConfig::CONFIG['ruby_version']}\"") - slug_vendor_base = run_no_pipe(command, user_env: true).chomp - error "Problem detecting bundler vendor directory: #{@slug_vendor_base}" unless $?.success? - return slug_vendor_base + @slug_vendor_base ||= begin + command = %q(ruby -e "require 'rbconfig';puts \"vendor/bundle/#{RUBY_ENGINE}/#{RbConfig::CONFIG['ruby_version']}\"") + out = run_no_pipe(command, user_env: true).chomp + error "Problem detecting bundler vendor directory: #{out}" unless $?.success? + out + end end # the relative path to the bundler directory of gems diff --git a/lib/language_pack/shell_helpers.rb b/lib/language_pack/shell_helpers.rb index a7c4f2c09..00fe81dac 100644 --- a/lib/language_pack/shell_helpers.rb +++ b/lib/language_pack/shell_helpers.rb @@ -243,7 +243,7 @@ def topic(message) # (indented by 6 spaces) # @param [String] message to be displayed def puts(message) - message.each_line do |line| + message.to_s.each_line do |line| if line.end_with?("\n".freeze) print " #{line}" else diff --git a/spec/hatchet/ci_spec.rb b/spec/hatchet/ci_spec.rb index 775e7fb40..473ab270b 100644 --- a/spec/hatchet/ci_spec.rb +++ b/spec/hatchet/ci_spec.rb @@ -4,6 +4,9 @@ it "Does not cause the double ruby rainbow bug" do Hatchet::Runner.new("heroku-ci-json-example").run_ci do |test_run| expect(test_run.status).to eq(:succeeded) + + install_bundler_count = test_run.output.scan("Installing bundler").count + expect(install_bundler_count).to eq(1), "Expected output to only install bundler once but was found #{install_bundler_count} times. output:\n#{test_run.output}" end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 22688d3ac..21007b31b 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -7,6 +7,8 @@ require 'language_pack' require 'language_pack/shell_helpers' +ENV["HATCHET_BUILDPACK_BASE"] = "https://github.com/heroku/heroku-buildpack-ruby" + ENV['RACK_ENV'] = 'test' DEFAULT_STACK = 'heroku-18' From 87584f4026cfdcab19d3640b188d9a93d64fc51e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 5 Oct 2020 13:52:24 -0500 Subject: [PATCH 0766/1195] Bump redis from 4.2.1 to 4.2.2 (#1075) Bumps [redis](https://github.com/redis/redis-rb) from 4.2.1 to 4.2.2. - [Release notes](https://github.com/redis/redis-rb/releases) - [Changelog](https://github.com/redis/redis-rb/blob/master/CHANGELOG.md) - [Commits](https://github.com/redis/redis-rb/compare/v4.2.1...v4.2.2) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 133bca93c..19fde27f8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -29,7 +29,7 @@ GEM rate_throttle_client (~> 0.1.0) rake (13.0.1) rate_throttle_client (0.1.2) - redis (4.2.1) + redis (4.2.2) rrrretry (1.0.0) rspec-core (3.9.3) rspec-support (~> 3.9.3) From 23377f54328fdd6a93d2c739378893d8cd7d8987 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Tue, 6 Oct 2020 13:14:26 -0500 Subject: [PATCH 0767/1195] [changelog skip] v219 (#1076) --- CHANGELOG.md | 2 ++ lib/language_pack/version.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5cf9ae712..5a3fb0640 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Main (unreleased) +## v219 (8/6/2020) + * Fix double installation of bundler on CI runs when no test script is specified (https://github.com/heroku/heroku-buildpack-ruby/pull/1073) * Bundler 2.x is now 2.1.4 (https://github.com/heroku/heroku-buildpack-ruby/pull/1052) * Persistent bundler config is now being set using the `BUNDLE_*` env vars (https://github.com/heroku/heroku-buildpack-ruby/pull/1039) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 5fa99aa2d..bd21094ae 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v218" + BUILDPACK_VERSION = "v219" end end From da4f0cf61f0feff8bf7208e77259af2aeeab8134 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Tue, 6 Oct 2020 14:16:54 -0500 Subject: [PATCH 0768/1195] [changelog skip] Fix git tagging (#1077) I'm not sure why but passing in `deploy.next_version` as an argument to `sh` isn't working as expected. Instead I'm just sending in one full command. Also there was a bug in the raise because I was referencing `version` instead of `next_version`. That is now fixed. --- Rakefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Rakefile b/Rakefile index 3ad5c5880..58989ef66 100644 --- a/Rakefile +++ b/Rakefile @@ -72,8 +72,8 @@ namespace :buildpack do deploy.check! if deploy.push_tag? - sh("git tag -f ", deploy.next_version) do |out, status| - raise "Could not `git tag -f #{deploy.version}`: #{out}" unless status.success? + sh("git tag -f #{deploy.next_version}") do |out, status| + raise "Could not `git tag -f #{deploy.next_version}`: #{out}" unless status.success? end sh("git push --tags") do |out, status| raise "Could not `git push --tags`: #{out}" unless status.success? From 0dc6f1aadd2614c7ba9f310f8c2a3187c84d18a5 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Wed, 7 Oct 2020 11:39:55 -0500 Subject: [PATCH 0769/1195] [changelog skip] Move changelogs to correct dir (#1078) We should consider automating a check for this. We could see when the version file is touched and force there to always be a `vxxx` changelog directory that matches --- changelogs/{unreleased => v219}/bundler-214.md | 0 changelogs/{unreleased => v219}/bundler-env-vars.md | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename changelogs/{unreleased => v219}/bundler-214.md (100%) rename changelogs/{unreleased => v219}/bundler-env-vars.md (100%) diff --git a/changelogs/unreleased/bundler-214.md b/changelogs/v219/bundler-214.md similarity index 100% rename from changelogs/unreleased/bundler-214.md rename to changelogs/v219/bundler-214.md diff --git a/changelogs/unreleased/bundler-env-vars.md b/changelogs/v219/bundler-env-vars.md similarity index 100% rename from changelogs/unreleased/bundler-env-vars.md rename to changelogs/v219/bundler-env-vars.md From 6b27d65d6229744048e3f37e8bcd52d0fd38468a Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Wed, 7 Oct 2020 11:58:00 -0500 Subject: [PATCH 0770/1195] This was reported to generate a failure: (#1081) ``` $ be rspec ./spec/hatchet/bundler_spec.rb[1:2] ./spec/helpers/ruby_version_spec.rb[1:6] ``` Log: https://dashboard.heroku.com/pipelines/ac057663-170b-4bdd-99d0-87560eb3a570/tests/1182 Output: ``` 1) RubyVersion correctly sets default ruby versions Failure/Error: Hatchet::App.new("default_ruby").in_directory_fork do |dir| ruby_version = LanguagePack::RubyVersion.new(@bundler.install.ruby_version, is_new: true) version_number = LanguagePack::RubyVersion::DEFAULT_VERSION_NUMBER version = LanguagePack::RubyVersion::DEFAULT_VERSION expect(ruby_version.version_without_patchlevel).to eq(version) expect(ruby_version.engine_version).to eq(version_number) expect(ruby_version.to_gemfile).to eq("ruby '#{version_number}'") expect(ruby_version.engine).to eq(:ruby) expect(ruby_version.default?).to eq(true) end RuntimeError: /app/vendor/bundle/ruby/2.6.0/gems/rspec-support-3.9.3/lib/rspec/support.rb:97:in `block in ': (RSpec::Expectations::ExpectationNotMetError) expected: "2.6.0" got: "2.6.6" (compared using ==) from /app/vendor/bundle/ruby/2.6.0/gems/rspec-support-3.9.3/lib/rspec/support.rb:106:in `notify_failure' from /app/vendor/bundle/ruby/2.6.0/gems/rspec-expectations-3.9.2/lib/rspec/expectations/fail_with.rb:35:in `fail_with' from /app/vendor/bundle/ruby/2.6.0/gems/rspec-expectations-3.9.2/lib/rspec/expectations/handler.rb:38:in `handle_failure' from /app/vendor/bundle/ruby/2.6.0/gems/rspec-expectations-3.9.2/lib/rspec/expectations/handler.rb:50:in `block in handle_matcher' from /app/vendor/bundle/ruby/2.6.0/gems/rspec-expectations-3.9.2/lib/rspec/expectations/handler.rb:27:in `with_matcher' from /app/vendor/bundle/ruby/2.6.0/gems/rspec-expectations-3.9.2/lib/rspec/expectations/handler.rb:48:in `handle_matcher' from /app/vendor/bundle/ruby/2.6.0/gems/rspec-expectations-3.9.2/lib/rspec/expectations/expectation_target.rb:65:in `to' from /app/spec/helpers/ruby_version_spec.rb:95:in `block (3 levels) in ' from /app/vendor/bundle/ruby/2.6.0/gems/heroku_hatchet-7.3.0/lib/hatchet/app.rb:395:in `block (3 levels) in in_directory_fork' from /app/vendor/bundle/ruby/2.6.0/gems/heroku_hatchet-7.3.0/lib/hatchet/app.rb:377:in `block (2 levels) in in_directory' from /app/vendor/bundle/ruby/2.6.0/gems/heroku_hatchet-7.3.0/lib/hatchet/app.rb:375:in `chdir' from /app/vendor/bundle/ruby/2.6.0/gems/heroku_hatchet-7.3.0/lib/hatchet/app.rb:375:in `block in in_directory' from /app/vendor/ruby-2.6.6/lib/ruby/2.6.0/tmpdir.rb:93:in `mktmpdir' from /app/vendor/bundle/ruby/2.6.0/gems/heroku_hatchet-7.3.0/lib/hatchet/app.rb:373:in `in_directory' from /app/vendor/bundle/ruby/2.6.0/gems/heroku_hatchet-7.3.0/lib/hatchet/app.rb:394:in `block (2 levels) in in_directory_fork' from /app/vendor/bundle/ruby/2.6.0/gems/heroku_hatchet-7.3.0/lib/hatchet/app.rb:389:in `fork' from /app/vendor/bundle/ruby/2.6.0/gems/heroku_hatchet-7.3.0/lib/hatchet/app.rb:389:in `block in in_directory_fork' from /app/vendor/ruby-2.6.6/lib/ruby/2.6.0/tempfile.rb:336:in `create' from /app/vendor/bundle/ruby/2.6.0/gems/heroku_hatchet-7.3.0/lib/hatchet/app.rb:388:in `in_directory_fork' from /app/spec/helpers/ruby_version_spec.rb:90:in `block (2 levels) in ' from /app/vendor/bundle/ruby/2.6.0/gems/rspec-core-3.9.3/lib/rspec/core/example.rb:262:in `instance_exec' from /app/vendor/bundle/ruby/2.6.0/gems/rspec-core-3.9.3/lib/rspec/core/example.rb:262:in `block in run' ``` It only fails with this test order though. Also from the output: ``` 7 examples, 1 failure Failed examples: rspec ./spec/helpers/ruby_version_spec.rb:89 # RubyVersion correctly sets default ruby versions ./spec/hatchet/bundler_spec.rb[1:2] ./spec/helpers/ruby_version_spec.rb[1:6] ./spec/hatchet/rails5_spec.rb[1:2:2] ./spec/helpers/shell_spec.rb[1:4:1] ./spec/helpers/download_presence_spec.rb[1:5] ./spec/hatchet/buildpack_spec.rb[1:1] ./spec/hatchet/rubies_spec.rb[1:4] ``` This was failing because the bundler_spec test was accidentally mutating the version string constant. This PR freezes the constant strings and duplicates the constant before mutation. --- lib/language_pack/ruby_version.rb | 8 ++++---- spec/hatchet/bundler_spec.rb | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/language_pack/ruby_version.rb b/lib/language_pack/ruby_version.rb index 6da6f8d36..eabe54c26 100644 --- a/lib/language_pack/ruby_version.rb +++ b/lib/language_pack/ruby_version.rb @@ -12,10 +12,10 @@ def initialize(output = "") end end - DEFAULT_VERSION_NUMBER = "2.6.6" - DEFAULT_VERSION = "ruby-#{DEFAULT_VERSION_NUMBER}" - LEGACY_VERSION_NUMBER = "1.9.2" - LEGACY_VERSION = "ruby-#{LEGACY_VERSION_NUMBER}" + DEFAULT_VERSION_NUMBER = "2.6.6".freeze + DEFAULT_VERSION = "ruby-#{DEFAULT_VERSION_NUMBER}".freeze + LEGACY_VERSION_NUMBER = "1.9.2".freeze + LEGACY_VERSION = "ruby-#{LEGACY_VERSION_NUMBER}".freeze RUBY_VERSION_REGEX = %r{ (?\d+\.\d+\.\d+){0} (?p-?\d+){0} diff --git a/spec/hatchet/bundler_spec.rb b/spec/hatchet/bundler_spec.rb index c9e1f554f..c9bf9d4ed 100644 --- a/spec/hatchet/bundler_spec.rb +++ b/spec/hatchet/bundler_spec.rb @@ -33,7 +33,7 @@ end it "deploys with version 1.x" do - abi_version = LanguagePack::RubyVersion::DEFAULT_VERSION_NUMBER + abi_version = LanguagePack::RubyVersion::DEFAULT_VERSION_NUMBER.dup abi_version[-1] = "0" # turn 2.6.6 into 2.6.0 pending("Must enable HATCHET_EXPENSIVE_MODE") unless ENV["HATCHET_EXPENSIVE_MODE"] From 140fe678b2cc26bb6a54377628164d25f64ca0ad Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Wed, 7 Oct 2020 12:52:23 -0500 Subject: [PATCH 0771/1195] Allow support for BUNDLE_WITHOUT with spaces (#1083) In v218 we switched from configuring bundler via flags to env vars. It turns out that bundler supports defining an `--without` value with a space in it, but it does not support BUNDLE_WITHOUT with a space in it: ``` $ bundle install --without foo bar $ bundle config | grep without -a1 without Set for your local app (/private/tmp/40a4b42d7e884ebf62a1f85a3c5abd38/.bundle/config): [:foo, :bar] ``` But: ``` $ BUNDLE_WITHOUT="foo bar" bundle config | grep without -a1 without Set via BUNDLE_WITHOUT: [:"foo bar"] ``` > Note in this example it is showing `:"foo bar"` as one group instead of two values. To fix this, we can reproduce the bundler logic of replacing a space with a colon https://github.com/rubygems/rubygems/blob/ce27b98272d5c37ebf45b2b1b66894699ae47d58/bundler/lib/bundler/cli/install.rb#L151. Related ticket: https://heroku.support/924687 --- CHANGELOG.md | 2 ++ lib/language_pack/ruby.rb | 7 ++++++- spec/hatchet/bundler_spec.rb | 9 +++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a3fb0640..c8a6d0c22 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Main (unreleased) +* BUNDLE_WITHOUT now accommodates values with single spaces (https://github.com/heroku/heroku-buildpack-ruby/pull/1083) + ## v219 (8/6/2020) * Fix double installation of bundler on CI runs when no test script is specified (https://github.com/heroku/heroku-buildpack-ruby/pull/1073) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 7551c970b..8c93c5973 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -406,6 +406,11 @@ def setup_language_pack_environment(ruby_layer_path:, gem_layer_path:, bundle_pa ENV["PATH"] = paths.join(":") ENV["BUNDLE_WITHOUT"] = env("BUNDLE_WITHOUT") || bundle_default_without + if ENV["BUNDLE_WITHOUT"].include?(' ') + ENV["BUNDLE_WITHOUT"] = ENV["BUNDLE_WITHOUT"].tr(' ', ':') + + warn("Your BUNDLE_WITHOUT contains a space, we are converting it to a colon `:` BUNDLE_WITHOUT=#{ENV["BUNDLE_WITHOUT"]}", inline: true) + end ENV["BUNDLE_PATH"] = bundle_path ENV["BUNDLE_BIN"] = bundler_binstubs_path ENV["BUNDLE_DEPLOYMENT"] = "1" @@ -900,7 +905,7 @@ def build_bundler end bundle_command = String.new("") - bundle_command << "BUNDLE_WITHOUT=#{ENV["BUNDLE_WITHOUT"]} " + bundle_command << "BUNDLE_WITHOUT='#{ENV["BUNDLE_WITHOUT"]}' " bundle_command << "BUNDLE_PATH=#{ENV["BUNDLE_PATH"]} " bundle_command << "BUNDLE_BIN=#{ENV["BUNDLE_BIN"]} " bundle_command << "BUNDLE_DEPLOYMENT=#{ENV["BUNDLE_DEPLOYMENT"]} " if ENV["BUNDLE_DEPLOYMENT"] # Unset on windows since we delete the Gemfile.lock diff --git a/spec/hatchet/bundler_spec.rb b/spec/hatchet/bundler_spec.rb index c9bf9d4ed..5e4856b0e 100644 --- a/spec/hatchet/bundler_spec.rb +++ b/spec/hatchet/bundler_spec.rb @@ -1,6 +1,15 @@ require 'spec_helper' describe "Bundler" do + it "can be configured with BUNDLE_WITHOUT env var with spaces in it" do + Hatchet::Runner.new("default_ruby", config: {"BUNDLE_WITHOUT" => "foo bar baz"}).tap do |app| + app.deploy do + expect(app.output).to match("BUNDLE_WITHOUT='foo:bar:baz'") + expect(app.output).to match("Your BUNDLE_WITHOUT contains a space") + end + end + end + it "deploys with version 2.x with Ruby 2.5" do ruby_version = "2.5.7" abi_version = ruby_version.dup From 8b313b3a595c696fd49c7826cddc3592afd1aee8 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Wed, 7 Oct 2020 14:21:28 -0500 Subject: [PATCH 0772/1195] v220 (#1084) --- CHANGELOG.md | 2 ++ lib/language_pack/version.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c8a6d0c22..311dee588 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Main (unreleased) +## v220 (8/7/2020) + * BUNDLE_WITHOUT now accommodates values with single spaces (https://github.com/heroku/heroku-buildpack-ruby/pull/1083) ## v219 (8/6/2020) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index bd21094ae..c9be561ef 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v219" + BUILDPACK_VERSION = "v220" end end From b3983a5335c21ae8b516ea9fdabbce8ff4215d17 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Wed, 7 Oct 2020 16:36:07 -0500 Subject: [PATCH 0773/1195] [changelog skip] Prefer String#strip to #chomp (#1085) When manipulating the results of a shell result, it's common to want to remove the newline. ``` puts `ruby -v`.inspect # => "ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-darwin19]\n" ``` This is commonly done by calling `chomp`. However there are some situations that are suspected to sometimes (but not always) contain two extra lines being tracked in https://github.com/heroku/hatchet/issues/120 ## Chomp fails - https://dashboard.heroku.com/pipelines/ac057663-170b-4bdd-99d0-87560eb3a570/tests/1195 - https://dashboard.heroku.com/pipelines/ac057663-170b-4bdd-99d0-87560eb3a570/tests/1197 - Maybe there are multiple newlines in the original string. We can switch to strip instead of chomp. This PR replaces all uses of `chomp` that are intended to strip off trailing newlines with strip ```ruby puts "/hello\n\n".chomp.inspect # => "/hello\n" puts "/hello\n\n".strip.inspect # => "/hello" ``` It's not a perfect replacement, because `strip` also removes other whitespace characters and it modifies the beginning and end of the string. That being said, the ability to remove multiple newlines or any excess whitespace is the behavior we want. --- lib/language_pack/helpers/binstub_check.rb | 2 +- lib/language_pack/helpers/bundler_wrapper.rb | 2 +- lib/language_pack/metadata.rb | 2 +- lib/language_pack/rails41.rb | 2 +- lib/language_pack/ruby.rb | 42 ++++++++++---------- lib/language_pack/test/rails2.rb | 2 +- spec/cnb/basic_local_pack_spec.rb | 4 +- spec/hatchet/ruby_spec.rb | 2 +- spec/helpers/binstub_check_spec.rb | 2 +- 9 files changed, 30 insertions(+), 30 deletions(-) diff --git a/lib/language_pack/helpers/binstub_check.rb b/lib/language_pack/helpers/binstub_check.rb index da7774114..4f4a49137 100644 --- a/lib/language_pack/helpers/binstub_check.rb +++ b/lib/language_pack/helpers/binstub_check.rb @@ -51,7 +51,7 @@ def call For example bin/#{@bad_binstubs.first.basename} has the shebang line: ``` - #{@bad_binstubs.first.open(&:readline).chomp} + #{@bad_binstubs.first.open(&:readline).strip} ``` It should be: diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index 364f7c2c9..e728d66f0 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -152,7 +152,7 @@ def ruby_version if output.match(/No ruby version specified/) "" else - output.chomp.sub('(', '').sub(')', '').sub(/(p-?\d+)/, ' \1').split.join('-') + output.strip.sub('(', '').sub(')', '').sub(/(p-?\d+)/, ' \1').split.join('-') end end end diff --git a/lib/language_pack/metadata.rb b/lib/language_pack/metadata.rb index ccbce4f88..56ab27e53 100644 --- a/lib/language_pack/metadata.rb +++ b/lib/language_pack/metadata.rb @@ -21,7 +21,7 @@ def []=(key, value) def read(key) full_key = "#{FOLDER}/#{key}" - File.read(full_key).chomp if exists?(key) + File.read(full_key).strip if exists?(key) end def exists?(key) diff --git a/lib/language_pack/rails41.rb b/lib/language_pack/rails41.rb index 871c428d9..2d8ae1b54 100644 --- a/lib/language_pack/rails41.rb +++ b/lib/language_pack/rails41.rb @@ -34,7 +34,7 @@ def app_secret @app_secret ||= begin if @metadata.exists?(key) - @metadata.read(key).chomp + @metadata.read(key).strip else secret = SecureRandom.hex(64) @metadata.write(key, secret) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 8c93c5973..1395790e8 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -160,8 +160,8 @@ def build bundler.clean gem_layer.metadata[:gems] = Digest::SHA2.hexdigest(File.read("Gemfile.lock")) gem_layer.metadata[:stack] = @stack - gem_layer.metadata[:ruby_version] = run_stdout(%q(ruby -v)).chomp - gem_layer.metadata[:rubygems_version] = run_stdout(%q(gem -v)).chomp + gem_layer.metadata[:ruby_version] = run_stdout(%q(ruby -v)).strip + gem_layer.metadata[:rubygems_version] = run_stdout(%q(gem -v)).strip gem_layer.metadata[:buildpack_version] = BUILDPACK_VERSION gem_layer.write @@ -217,7 +217,7 @@ def stack_not_14_not_16? end def warn_bundler_upgrade - old_bundler_version = @metadata.read("bundler_version").chomp if @metadata.exists?("bundler_version") + old_bundler_version = @metadata.read("bundler_version").strip if @metadata.exists?("bundler_version") if old_bundler_version && old_bundler_version != bundler.version warn(<<-WARNING, inline: true) @@ -235,7 +235,7 @@ def warn_bundler_upgrade def self.slug_vendor_base @slug_vendor_base ||= begin command = %q(ruby -e "require 'rbconfig';puts \"vendor/bundle/#{RUBY_ENGINE}/#{RbConfig::CONFIG['ruby_version']}\"") - out = run_no_pipe(command, user_env: true).chomp + out = run_no_pipe(command, user_env: true).strip error "Problem detecting bundler vendor directory: #{out}" unless $?.success? out end @@ -275,7 +275,7 @@ def ruby_version new_app = !File.exist?("vendor/heroku") last_version_file = "buildpack_ruby_version" last_version = nil - last_version = @metadata.read(last_version_file).chomp if @metadata.exists?(last_version_file) + last_version = @metadata.read(last_version_file).strip if @metadata.exists?(last_version_file) @ruby_version = LanguagePack::RubyVersion.new(bundler.ruby_version, is_new: new_app, @@ -360,7 +360,7 @@ def setup_language_pack_environment(ruby_layer_path:, gem_layer_path:, bundle_pa instrument 'ruby.setup_language_pack_environment' do if ruby_version.jruby? ENV["PATH"] += ":bin" - ENV["JAVA_MEM"] = run(<<~SHELL).chomp + ENV["JAVA_MEM"] = run(<<~SHELL).strip #{set_jvm_max_heap} echo #{default_java_mem} SHELL @@ -798,7 +798,7 @@ def load_default_cache instrument "ruby.load_default_cache" do if false # load_default_cache? puts "New app detected loading default bundler cache" - patchlevel = run("ruby -e 'puts RUBY_PATCHLEVEL'").chomp + patchlevel = run("ruby -e 'puts RUBY_PATCHLEVEL'").strip cache_name = "#{LanguagePack::RubyVersion::DEFAULT_VERSION}-p#{patchlevel}-default-cache" @fetchers[:buildpack].fetch_untar("#{cache_name}.tgz") end @@ -1017,7 +1017,7 @@ def post_bundler def syck_hack instrument "ruby.syck_hack" do syck_hack_file = File.expand_path(File.join(File.dirname(__FILE__), "../../vendor/syck_hack")) - rv = run_stdout('ruby -e "puts RUBY_VERSION"').chomp + rv = run_stdout('ruby -e "puts RUBY_VERSION"').strip # < 1.9.3 includes syck, so we need to use the syck hack if Gem::Version.new(rv) < Gem::Version.new("1.9.3") "-r#{syck_hack_file}" @@ -1171,7 +1171,7 @@ def node_preinstall_bin_path return @node_preinstall_bin_path if defined?(@node_preinstall_bin_path) legacy_path = "#{Dir.pwd}/#{NODE_BP_PATH}" - path = run("which node").chomp + path = run("which node").strip if path && $?.success? @node_preinstall_bin_path = path elsif run("#{legacy_path}/node -v") && $?.success? @@ -1195,7 +1195,7 @@ def yarn_preinstall_bin_path def yarn_preinstall_binary_path return @yarn_preinstall_binary_path if defined?(@yarn_preinstall_binary_path) - path = run("which yarn").chomp + path = run("which yarn").strip if path && $?.success? @yarn_preinstall_binary_path = path else @@ -1252,8 +1252,8 @@ def bundler_cache end def valid_bundler_cache?(path, metadata) - full_ruby_version = run_stdout(%q(ruby -v)).chomp - rubygems_version = run_stdout(%q(gem -v)).chomp + full_ruby_version = run_stdout(%q(ruby -v)).strip + rubygems_version = run_stdout(%q(gem -v)).strip old_rubygems_version = nil old_rubygems_version = metadata[:ruby_version] @@ -1291,7 +1291,7 @@ def valid_bundler_cache?(path, metadata) # fix for https://github.com/heroku/heroku-buildpack-ruby/issues/86 if (!metadata.include?(:rubygems_version) || (old_rubygems_version == "2.0.0" && old_rubygems_version != rubygems_version)) && - metadata.include?(:ruby_version) && metadata[:ruby_version].chomp.include?("ruby 2.0.0p0") + metadata.include?(:ruby_version) && metadata[:ruby_version].strip.include?("ruby 2.0.0p0") return [false, "Updating to rubygems #{rubygems_version}. Clearing bundler cache."] end @@ -1329,8 +1329,8 @@ def load_bundler_cache instrument "ruby.load_bundler_cache" do cache.load "vendor" - full_ruby_version = run_stdout(%q(ruby -v)).chomp - rubygems_version = run_stdout(%q(gem -v)).chomp + full_ruby_version = run_stdout(%q(ruby -v)).strip + rubygems_version = run_stdout(%q(gem -v)).strip heroku_metadata = "vendor/heroku" old_rubygems_version = nil ruby_version_cache = "ruby_version" @@ -1342,8 +1342,8 @@ def load_bundler_cache # bundle clean does not remove binstubs FileUtils.rm_rf("vendor/bundler/bin") - old_rubygems_version = @metadata.read(ruby_version_cache).chomp if @metadata.exists?(ruby_version_cache) - old_stack = @metadata.read(stack_cache).chomp if @metadata.exists?(stack_cache) + old_rubygems_version = @metadata.read(ruby_version_cache).strip if @metadata.exists?(ruby_version_cache) + old_stack = @metadata.read(stack_cache).strip if @metadata.exists?(stack_cache) old_stack ||= DEFAULT_LEGACY_STACK stack_change = old_stack != @stack @@ -1366,9 +1366,9 @@ def load_bundler_cache elsif !@metadata.include?(buildpack_version_cache) && @metadata.exists?(ruby_version_cache) puts "Broken cache detected. Purging build cache." purge_bundler_cache - elsif (@bundler_cache.exists? || @bundler_cache.old?) && @metadata.exists?(ruby_version_cache) && full_ruby_version != @metadata.read(ruby_version_cache).chomp + elsif (@bundler_cache.exists? || @bundler_cache.old?) && @metadata.exists?(ruby_version_cache) && full_ruby_version != @metadata.read(ruby_version_cache).strip puts "Ruby version change detected. Clearing bundler cache." - puts "Old: #{@metadata.read(ruby_version_cache).chomp}" + puts "Old: #{@metadata.read(ruby_version_cache).strip}" puts "New: #{full_ruby_version}" purge_bundler_cache end @@ -1382,7 +1382,7 @@ def load_bundler_cache # fix for https://github.com/heroku/heroku-buildpack-ruby/issues/86 if (!@metadata.exists?(rubygems_version_cache) || (old_rubygems_version == "2.0.0" && old_rubygems_version != rubygems_version)) && - @metadata.exists?(ruby_version_cache) && @metadata.read(ruby_version_cache).chomp.include?("ruby 2.0.0p0") + @metadata.exists?(ruby_version_cache) && @metadata.read(ruby_version_cache).strip.include?("ruby 2.0.0p0") puts "Updating to rubygems #{rubygems_version}. Clearing bundler cache." purge_bundler_cache end @@ -1403,7 +1403,7 @@ def load_bundler_cache # recompile gems for libyaml 0.1.7 update if @metadata.exists?(buildpack_version_cache) && (bv = @metadata.read(buildpack_version_cache).sub('v', '').to_i) && bv != 0 && bv <= 147 && - (@metadata.exists?(ruby_version_cache) && @metadata.read(ruby_version_cache).chomp.match(/ruby 2\.1\.(9|10)/) || + (@metadata.exists?(ruby_version_cache) && @metadata.read(ruby_version_cache).strip.match(/ruby 2\.1\.(9|10)/) || bundler.has_gem?("psych") ) puts "Need to recompile gems for CVE-2014-2014-9130. Clearing bundler cache." diff --git a/lib/language_pack/test/rails2.rb b/lib/language_pack/test/rails2.rb index e3aa8444a..71e2fa766 100644 --- a/lib/language_pack/test/rails2.rb +++ b/lib/language_pack/test/rails2.rb @@ -61,7 +61,7 @@ def db_prepare_test_rake_tasks if schema_load.not_defined? && structure_load.not_defined? result = detect_schema_format - case result.lines.last.chomp + case result.lines.last.strip when "ruby" schema_load = rake.task("db:schema:load") when "sql" # currently not a possible edge case, we think diff --git a/spec/cnb/basic_local_pack_spec.rb b/spec/cnb/basic_local_pack_spec.rb index d1d97b3ff..7ed8afa52 100644 --- a/spec/cnb/basic_local_pack_spec.rb +++ b/spec/cnb/basic_local_pack_spec.rb @@ -27,13 +27,13 @@ def teardown return unless image_name repo_name, tag_name = image_name.split(":") - docker_list = `docker images --no-trunc | grep #{repo_name} | grep #{tag_name}`.chomp + docker_list = `docker images --no-trunc | grep #{repo_name} | grep #{tag_name}`.strip run_local!("docker rmi #{image_name} --force") if !docker_list.empty? @image_name = nil end def run(cmd) - `docker run #{image_name} '#{cmd}'`.chomp + `docker run #{image_name} '#{cmd}'`.strip end def run!(cmd) diff --git a/spec/hatchet/ruby_spec.rb b/spec/hatchet/ruby_spec.rb index 7f73ffa10..0e9b4fbae 100644 --- a/spec/hatchet/ruby_spec.rb +++ b/spec/hatchet/ruby_spec.rb @@ -118,7 +118,7 @@ Hatchet::Runner.new('cd_ruby', stack: DEFAULT_STACK, buildpacks: buildpacks, config: config).deploy do |app| expect(app.output).to match("cd version ruby 2.5.1") - expect(app.run("which ruby").chomp).to eq("/app/bin/ruby") + expect(app.run("which ruby").strip).to eq("/app/bin/ruby") end end end diff --git a/spec/helpers/binstub_check_spec.rb b/spec/helpers/binstub_check_spec.rb index a5987e149..37d2e0c1f 100644 --- a/spec/helpers/binstub_check_spec.rb +++ b/spec/helpers/binstub_check_spec.rb @@ -2,7 +2,7 @@ describe LanguagePack::Helpers::BinstubCheck do def get_ruby_path! - out = `which ruby`.chomp + out = `which ruby`.strip raise "command `which ruby` failed with output: #{out}" unless $?.success? return Pathname.new(out) From 8df06ee62fa59983524b3249e46ca652dc7afd63 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Fri, 9 Oct 2020 10:01:08 -0500 Subject: [PATCH 0774/1195] [close #1069] Remove Active Storage warnings (#1087) There are two active storage warnings: - Warn when storage is set to :local - Warn when ffmpeg is not present on the system ## Warn when storage is set to :local The goal here was to prevent people from accidentally uploading assets only to find out that they disappear every 24 hours after the dyno resets. While that's still a problem now, the default value is `:local` when you generate a new project. That means just because someone has this set to be local does not mean they're using active storage. That also means that this generates a useless warning message and clutters their deploy. This PR removes that warning ## Warn when ffmpeg is not present on the system If popper and ffmpeg are not on the system then Rails cannot generate previews for PDFs and videos which is a feature of active storage. To help, we added a warning if you're using active storage but don't have these dependencies. Unfortunately, we can't tell if you're actually using these features or not, so there's no easy way to disable this warning if they are not needed. In general these warnings cause a lot of clutter and confusion. --- CHANGELOG.md | 2 ++ lib/language_pack/rails5.rb | 59 ------------------------------------- spec/hatchet/rails5_spec.rb | 30 ++----------------- 3 files changed, 4 insertions(+), 87 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 311dee588..943cb7453 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Main (unreleased) +* Remove excessive Active Storage warnings (https://github.com/heroku/heroku-buildpack-ruby/pull/1087) + ## v220 (8/7/2020) * BUNDLE_WITHOUT now accommodates values with single spaces (https://github.com/heroku/heroku-buildpack-ruby/pull/1083) diff --git a/lib/language_pack/rails5.rb b/lib/language_pack/rails5.rb index fd85e9155..514b3a013 100644 --- a/lib/language_pack/rails5.rb +++ b/lib/language_pack/rails5.rb @@ -30,63 +30,4 @@ def default_config_vars def install_plugins # do not install plugins, do not call super, do not warn end - - def config_detect - super - @local_storage_config = @rails_runner.detect("active_storage.service") - end - - def best_practice_warnings - super - return unless bundler.has_gem?("activestorage") - return unless File.exist?("config/storage.yml") - - warn_local_storage if local_storage? - warn_no_ffmpeg if needs_ffmpeg? - end - - private - def has_ffmpeg? - run("which ffmpeg") - return $?.success? - end - - def needs_ffmpeg? - !has_ffmpeg? - end - - def local_storage? - return false unless @local_storage_config.success? - @local_storage_config.did_match?("local") - end - - def warn_local_storage - mcount("warn.activestorage.local_storage") - warn(<<-WARNING) -You set your `config.active_storage.service` to :local in production. -If you are uploading files to this app, they will not persist after the app -is restarted, on one-off dynos, or if the app has multiple dynos. -Heroku applications have an ephemeral file system. To -persist uploaded files, please use a service such as S3 and update your Rails -configuration. - -For more information can be found in this article: - https://devcenter.heroku.com/articles/active-storage-on-heroku - -WARNING - end - - def warn_no_ffmpeg - mcount("warn.activestorage.no_binaries.stack-#{stack}") - mcount("warn.activestorage.no_binaries.all") - warn(<<-WARNING) -We detected that some binary dependencies required to -use all the preview features of Active Storage are not -present on this system. - -For more information please see: - https://devcenter.heroku.com/articles/active-storage-on-heroku - -WARNING - end end diff --git a/spec/hatchet/rails5_spec.rb b/spec/hatchet/rails5_spec.rb index 8c3e50082..ac8a8bdb0 100644 --- a/spec/hatchet/rails5_spec.rb +++ b/spec/hatchet/rails5_spec.rb @@ -28,35 +28,9 @@ def worker_task_for_app(app) .detect { |h| h["type"] == "worker" } end - describe "active storage" do - it "non-local storage warnings" do - Hatchet::Runner.new("active_storage_non_local").deploy do |app, heroku| - expect(app.output).to match('binary dependencies required') - expect(app.output).to_not match('config.active_storage.service') - expect(app.output).to_not match(/\$ rails runner/) - end - end - - it "local storage warnings" do - app = Hatchet::Runner.new( - "active_storage_local", - buildpacks: [ - "https://github.com/heroku/heroku-buildpack-activestorage-preview", - :default - ], - config: {'HEROKU_DEBUG_RAILS_RUNNER' => 'true'} - ) - app.deploy do |app, heroku| - expect(app.output).to_not match('binary dependencies required') - expect(app.output).to match('config.active_storage.service') - expect(app.output).to match('config.assets.compile = true') - expect(app.output).to match(/\$ rails runner/) - end - end - end - it "blocks bads sprockets config with bad version" do - Hatchet::Runner.new("sprockets_asset_compile_true", allow_failure: true).deploy do |app, heroku| + Hatchet::Runner.new("sprockets_asset_compile_true", allow_failure: true, config: {'HEROKU_DEBUG_RAILS_RUNNER' => 'true'}).deploy do |app, heroku| + expect(app.output).to match("heroku.detecting.config.for.assets.compile=true") expect(app.output).to match('A security vulnerability has been detected') expect(app.output).to match('version "3.7.2"') end From 10e3987733ce1096c6077418d9c1d372d4e8fde4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Oct 2020 09:01:37 -0500 Subject: [PATCH 0775/1195] Bump heroku_hatchet from 7.3.0 to 7.3.3 (#1092) Bumps [heroku_hatchet](https://github.com/heroku/hatchet) from 7.3.0 to 7.3.3. - [Release notes](https://github.com/heroku/hatchet/releases) - [Changelog](https://github.com/heroku/hatchet/blob/main/CHANGELOG.md) - [Commits](https://github.com/heroku/hatchet/compare/v7.3.0...v7.3.3) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 19fde27f8..84c8adb62 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,11 +11,11 @@ GEM excon moneta multi_json (>= 1.9.2) - heroku_hatchet (7.3.0) + heroku_hatchet (7.3.3) excon (~> 0) platform-api (~> 3) rrrretry (~> 1) - thor (~> 0) + thor (~> 1) threaded (~> 0) json (2.3.1) moneta (1.0.0) @@ -39,7 +39,7 @@ GEM rspec-retry (0.6.2) rspec-core (> 3.3) rspec-support (3.9.3) - thor (0.20.3) + thor (1.0.1) threaded (0.0.4) toml-rb (2.0.1) citrus (~> 3.0, > 3.0) From ddffadaed69d73c791f049749159fe453dea99db Mon Sep 17 00:00:00 2001 From: Ed Morley <501702+edmorley@users.noreply.github.com> Date: Thu, 22 Oct 2020 16:06:41 +0100 Subject: [PATCH 0776/1195] Add Heroku-20 to the download presence check (#1093) Since Heroku-20 is now in public beta, so it's fine for the buildpack to reference it in build output. See: https://devcenter.heroku.com/changelog-items/1937 Closes W-8250744. --- CHANGELOG.md | 1 + lib/language_pack/helpers/download_presence.rb | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 943cb7453..7cfd7f149 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Main (unreleased) * Remove excessive Active Storage warnings (https://github.com/heroku/heroku-buildpack-ruby/pull/1087) +* Add Heroku-20 to the download presence check (https://github.com/heroku/heroku-buildpack-ruby/pull/1093) ## v220 (8/7/2020) diff --git a/lib/language_pack/helpers/download_presence.rb b/lib/language_pack/helpers/download_presence.rb index 9f9430ad6..1392b22ad 100644 --- a/lib/language_pack/helpers/download_presence.rb +++ b/lib/language_pack/helpers/download_presence.rb @@ -8,7 +8,7 @@ # # download = LanguagePack::Helpers::DownloadPresence.new( # 'ruby-1.9.3.tgz', -# stacks: ['cedar-14', 'heroku-16', 'heroku-18'] +# stacks: ['cedar-14', 'heroku-16', 'heroku-18', 'heroku-20'] # ) # # download.call @@ -16,7 +16,7 @@ # puts download.exists? #=> true # puts download.valid_stack_list #=> ['cedar-14'] class LanguagePack::Helpers::DownloadPresence - STACKS = ['cedar-14', 'heroku-16', 'heroku-18'] + STACKS = ['cedar-14', 'heroku-16', 'heroku-18', 'heroku-20'] def initialize(path, stacks: STACKS) @path = path From 6232c2493a2b3411ef2e5714d3938d31bae07ba5 Mon Sep 17 00:00:00 2001 From: Ben Symonds Date: Thu, 22 Oct 2020 16:14:16 +0100 Subject: [PATCH 0777/1195] Fix typo "eligable" -> "eligible" (#1091) Co-authored-by: Richard Schneeman --- lib/language_pack/ruby.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 1395790e8..19c936ddd 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -545,7 +545,7 @@ def warn_outdated_eol Your current Ruby version no longer receives security updates from Ruby Core and may have serious vulnerabilities. While you will continue to be able to deploy on Heroku with this Ruby version you must upgrade - to a non-EOL version to be eligable to receive support. + to a non-EOL version to be eligible to receive support. Upgrade your Ruby version as soon as possible. From 38cb9c1e8e16fd09cdf2086387fe9a1882d920de Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Thu, 22 Oct 2020 10:24:08 -0500 Subject: [PATCH 0778/1195] v221 (#1094) --- CHANGELOG.md | 2 ++ lib/language_pack/version.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7cfd7f149..5f59d8712 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Main (unreleased) +## v221 (10/22/2020) + * Remove excessive Active Storage warnings (https://github.com/heroku/heroku-buildpack-ruby/pull/1087) * Add Heroku-20 to the download presence check (https://github.com/heroku/heroku-buildpack-ruby/pull/1093) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index c9be561ef..8220860ea 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v220" + BUILDPACK_VERSION = "v221" end end From ff7927dc5f93d89a45683895ac157d739bfbb2f1 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Mon, 2 Nov 2020 13:38:34 -0600 Subject: [PATCH 0779/1195] Support Heroku-20 with Ruby CNB (#1096) https://gus.lightning.force.com/lightning/r/ADM_Work__c/a07B0000008hLxlIAE/view --- CHANGELOG.md | 4 ++++ buildpack.toml | 3 +++ lib/language_pack/version.rb | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f59d8712..15ed5d639 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Main (unreleased) +## v222 (11/02/2020) + +* CNB support for Heroku-20 (https://github.com/heroku/heroku-buildpack-ruby/pull/1096) + ## v221 (10/22/2020) * Remove excessive Active Storage warnings (https://github.com/heroku/heroku-buildpack-ruby/pull/1087) diff --git a/buildpack.toml b/buildpack.toml index f4dd8f587..bdabea153 100644 --- a/buildpack.toml +++ b/buildpack.toml @@ -31,3 +31,6 @@ ruby_version = "2.6.6" [[stacks]] id = "heroku-18" + +[[stacks]] +id = "heroku-20" diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 8220860ea..f1b0ed6fd 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v221" + BUILDPACK_VERSION = "v222" end end From bba6fa8119b4b946aca35c45db6446373e75cb62 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Fri, 15 Jan 2021 09:41:16 -0600 Subject: [PATCH 0780/1195] Remove cedar-14 specs (#1109) --- hatchet.lock | 6 ++--- spec/cnb/basic_local_pack_spec.rb | 2 +- spec/hatchet/bundler_spec.rb | 2 +- spec/hatchet/rails23_spec.rb | 2 ++ spec/hatchet/rails3_spec.rb | 2 ++ spec/hatchet/rails5_spec.rb | 9 +++++-- spec/hatchet/rubies_spec.rb | 40 ++----------------------------- spec/hatchet/ruby_spec.rb | 2 +- 8 files changed, 19 insertions(+), 46 deletions(-) diff --git a/hatchet.lock b/hatchet.lock index 5ea69b65d..67f314cff 100644 --- a/hatchet.lock +++ b/hatchet.lock @@ -16,7 +16,7 @@ - - "./repos/ci/activerecord_rake_tasks_does_not_exist" - a6b711be6921cf7a0aa4e31269c37965799ea110 - - "./repos/ci/ci_fails_ruby_default_bundler" - - 43cbf196245957be6242b1e1bc56b8f1bfa00004 + - a99cfbe3395bbd4539d5984b73d61771243b6208 - - "./repos/ci/heroku-ci-json-example" - 4e5410a7381f486ba3df7739e02e52f32fdd4dda - - "./repos/ci/rails5_ruby_schema_format" @@ -30,7 +30,7 @@ - - "./repos/ci/ruby_no_rails_test" - 3916137106d59b008b67d738abe6a1438f8fbde6 - - "./repos/heroku/ruby-getting-started" - - 9ddca7b694875499165eb56adffd3e29b38405c5 + - c300328cd71f7a903fc2701b53ddc99af711b7e0 - - "./repos/jruby/jruby_naether" - 4a11f8af5a3cca21f3659394e5bbac3cca9b6a2c - - "./repos/node/minimal_webpacker" @@ -86,7 +86,7 @@ - - "./repos/rails52/sprockets_asset_compile_true" - 98c6675cf97059278709cf75030e28063e0228d2 - - "./repos/rails6/rails6-basic" - - b633fb14a58880bc21ccec4918af454fd5423843 + - 3b404ac714a16877781b7bf69f1b8a308df6c92f - - "./repos/rake/asset_precompile_fail" - 16f7834331d6bb3fc5c284130b14eb1ff74d99d5 - - "./repos/rake/asset_precompile_not_found" diff --git a/spec/cnb/basic_local_pack_spec.rb b/spec/cnb/basic_local_pack_spec.rb index 7ed8afa52..2c792be1b 100644 --- a/spec/cnb/basic_local_pack_spec.rb +++ b/spec/cnb/basic_local_pack_spec.rb @@ -115,7 +115,7 @@ def run!(cmd) expect(app.output).to match("Compiling Ruby/Rails") run_out = app.run!("ruby -v") - expect(run_out).to match("2.4.4") + expect(run_out).to match("2.6.6") end end end diff --git a/spec/hatchet/bundler_spec.rb b/spec/hatchet/bundler_spec.rb index 5e4856b0e..3b57a2791 100644 --- a/spec/hatchet/bundler_spec.rb +++ b/spec/hatchet/bundler_spec.rb @@ -16,7 +16,7 @@ abi_version[-1] = "0" # turn 2.5.7 into 2.5.0 pending("Must enable HATCHET_EXPENSIVE_MODE") unless ENV["HATCHET_EXPENSIVE_MODE"] - Hatchet::Runner.new("default_ruby", run_multi: true).tap do |app| + Hatchet::Runner.new("default_ruby", run_multi: true, stack: "heroku-18").tap do |app| app.before_deploy do run!(%Q{echo "ruby '#{ruby_version}'" >> Gemfile}) run!(%Q{printf "\nBUNDLED WITH\n 2.0.1\n" >> Gemfile.lock}) diff --git a/spec/hatchet/rails23_spec.rb b/spec/hatchet/rails23_spec.rb index 5120dd231..e9b4d6342 100644 --- a/spec/hatchet/rails23_spec.rb +++ b/spec/hatchet/rails23_spec.rb @@ -2,6 +2,8 @@ describe "Rails 2.3.x" do it "should deploy on ruby 1.9.3 on cedar-14" do + pending("Rails LTS support") + Hatchet::Runner.new('rails23_mri_193', stack: "cedar-14").deploy do |app| # assert deploy is successful end diff --git a/spec/hatchet/rails3_spec.rb b/spec/hatchet/rails3_spec.rb index 8bf795e12..23c6b5d9c 100644 --- a/spec/hatchet/rails3_spec.rb +++ b/spec/hatchet/rails3_spec.rb @@ -2,6 +2,8 @@ describe "Rails 3.x" do it "should deploy on ruby 1.9.3" do + pending("Rails LTS license") + Hatchet::Runner.new("rails3_mri_193", stack: "cedar-14").deploy do |app, heroku| expect(app.output).to include("Asset precompilation completed") diff --git a/spec/hatchet/rails5_spec.rb b/spec/hatchet/rails5_spec.rb index ac8a8bdb0..33b286294 100644 --- a/spec/hatchet/rails5_spec.rb +++ b/spec/hatchet/rails5_spec.rb @@ -2,7 +2,7 @@ describe "Rails 5" do it "works" do - Hatchet::Runner.new("rails5").deploy do |app, heroku| + Hatchet::Runner.new("rails5", stack: "heroku-18").deploy do |app, heroku| # Test BUNDLE_DISABLE_VERSION_CHECK works expect(app.output).not_to include("The latest bundler is") @@ -29,7 +29,12 @@ def worker_task_for_app(app) end it "blocks bads sprockets config with bad version" do - Hatchet::Runner.new("sprockets_asset_compile_true", allow_failure: true, config: {'HEROKU_DEBUG_RAILS_RUNNER' => 'true'}).deploy do |app, heroku| + Hatchet::Runner.new( + "sprockets_asset_compile_true", + stack: "heroku-18", + allow_failure: true, + config: {'HEROKU_DEBUG_RAILS_RUNNER' => 'true'} + ).deploy do |app, heroku| expect(app.output).to match("heroku.detecting.config.for.assets.compile=true") expect(app.output).to match('A security vulnerability has been detected') expect(app.output).to match('version "3.7.2"') diff --git a/spec/hatchet/rubies_spec.rb b/spec/hatchet/rubies_spec.rb index 0932281b4..666a50a26 100644 --- a/spec/hatchet/rubies_spec.rb +++ b/spec/hatchet/rubies_spec.rb @@ -1,45 +1,9 @@ require_relative '../spec_helper' describe "Ruby Versions on cedar-14" do - it "should allow patchlevels" do - app = Hatchet::Runner.new('mri_193_p547', stack: "cedar-14") - app.deploy do |app| - version = '1.9.3p547' - expect(app.output).to match("ruby-1.9.3-p547") - expect(app.run('ruby -v')).to match(version) - end - end - - it "should deploy ruby 1.9.2 properly" do - app = Hatchet::Runner.new('mri_192', stack: "cedar-14") - app.deploy do |app| - version = '1.9.2' - expect(app.output).to match(version) - expect(app.run('ruby -v')).to match(version) - end - end - - it "should deploy ruby 1.9.3 properly" do - app = Hatchet::Runner.new('mri_193', stack: "cedar-14") - app.deploy do |app| - version = '1.9.3' - expect(app.output).to match(version) - expect(app.run('ruby -v')).to match(version) - end - end - - it "should deploy ruby 2.0.0 properly" do - app = Hatchet::Runner.new('mri_200', stack: "cedar-14") - app.deploy do |app| - version = '2.0.0' - expect(app.output).to match(version) - expect(app.run('ruby -v')).to match(version) - - expect(app.output).to match("devcenter.heroku.com/articles/ruby-default-web-server") - end - end - it "should deploy jruby 1.7.16.1 (jdk 7) properly on cedar-14 with sys props file" do + pending("Port this to a more recent stack") + app = Hatchet::Runner.new("ruby_193_jruby_17161_jdk7", stack: "cedar-14") app.deploy do |app| expect(app.output).to match("Installing JVM: openjdk-7") diff --git a/spec/hatchet/ruby_spec.rb b/spec/hatchet/ruby_spec.rb index 0e9b4fbae..d5aad4519 100644 --- a/spec/hatchet/ruby_spec.rb +++ b/spec/hatchet/ruby_spec.rb @@ -140,7 +140,7 @@ describe "2.5.0" do it "works" do - Hatchet::Runner.new("ruby_25").deploy do |app| + Hatchet::Runner.new("ruby_25", stack: "heroku-18").deploy do |app| expect(app.output).to include("There is a more recent Ruby version available") end end From 60b558686112febdaf3d7f111fca70f127556f59 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Fri, 15 Jan 2021 09:58:08 -0600 Subject: [PATCH 0781/1195] Handle BUNDLED WITH deletion in windows (#1108) Windows Gemfile.lock uses `\r\n` instead of `\n` for newlines which can cause issues when matching regex. We are using regex to strip out BUNDLED WITH and were not previously handling windows Gemfile.lock by mistake. There is other code that reads in the major version of BUNDLED WITH and it uses a read mode of `rt` which solves the problem. The solution is to change this other location to also use a read mode of `rt`: ``` irb(main):009:0> !!File.read("./spec/fixtures/windows_lockfile/Gemfile.lock").match(/^BUNDLED WITH$(\r?\n) (?\d+)\.\d+\.\d+/m) => false irb(main):010:0> !!File.read("./spec/fixtures/windows_lockfile/Gemfile.lock", mode: 'rt').match(/^BUNDLED WITH$(\r?\n) (?\d+)\.\d+ \.\d+/m) => true ``` The test now also assert the desired behavior of removing BUNDLED WITH occurs. --- CHANGELOG.md | 2 ++ lib/language_pack/helpers/bundler_wrapper.rb | 15 ++++++++------- spec/fixtures/windows_lockfile/Gemfile | 0 spec/helpers/bundler_wrapper_spec.rb | 19 +++++++++++++++++-- 4 files changed, 27 insertions(+), 9 deletions(-) create mode 100644 spec/fixtures/windows_lockfile/Gemfile diff --git a/CHANGELOG.md b/CHANGELOG.md index 15ed5d639..d2d9b781b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Main (unreleased) +* Fix Gemfile.lock read bug from preventing propper removal of BUNDLED WITH declaration () + ## v222 (11/02/2020) * CNB support for Heroku-20 (https://github.com/heroku/heroku-buildpack-ruby/pull/1096) diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index e728d66f0..fef24a91e 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -168,6 +168,14 @@ def needs_ruby_global_append_path? Gem::Version.new(@version) < Gem::Version.new("2.1.4") end + def bundler_version_escape_valve! + topic("Removing BUNDLED WITH version in the Gemfile.lock") + contents = File.read(@gemfile_lock_path, mode: "rt") + File.open(@gemfile_lock_path, "w") do |f| + f.write contents.sub(/^BUNDLED WITH$(\r?\n) (?\d+)\.\d+\.\d+/m, '') + end + end + private def fetch_bundler instrument 'fetch_bundler' do @@ -222,11 +230,4 @@ def detect_bundler_version_and_dir_name! end end - def bundler_version_escape_valve! - topic("Removing BUNDLED WITH version in the Gemfile.lock") - contents = File.read("Gemfile.lock") - File.open("Gemfile.lock", "w") do |f| - f.write contents.sub(/^BUNDLED WITH$(\r?\n) (?\d+)\.\d+\.\d+/m, '') - end - end end diff --git a/spec/fixtures/windows_lockfile/Gemfile b/spec/fixtures/windows_lockfile/Gemfile new file mode 100644 index 000000000..e69de29bb diff --git a/spec/helpers/bundler_wrapper_spec.rb b/spec/helpers/bundler_wrapper_spec.rb index d26b1154d..3803fe57d 100644 --- a/spec/helpers/bundler_wrapper_spec.rb +++ b/spec/helpers/bundler_wrapper_spec.rb @@ -20,9 +20,24 @@ end it "handles windows BUNDLED WITH" do - wrapper = LanguagePack::Helpers::BundlerWrapper.new(gemfile_path: fixture_path("windows_lockfile/Gemfile")) + Dir.mktmpdir do |dir| + tmp_dir = Pathname(dir) + FileUtils.cp_r(fixture_path("windows_lockfile/."), tmp_dir) - expect(wrapper.version).to eq(LanguagePack::Helpers::BundlerWrapper::BLESSED_BUNDLER_VERSIONS["2"]) + tmp_gemfile_path = tmp_dir.join("Gemfile") + tmp_gemfile_lock_path = tmp_dir.join("Gemfile.lock") + + expect(tmp_gemfile_lock_path.read).to match("BUNDLED") + + wrapper = LanguagePack::Helpers::BundlerWrapper.new(gemfile_path: tmp_gemfile_path ) + + expect(wrapper.version).to eq(LanguagePack::Helpers::BundlerWrapper::BLESSED_BUNDLER_VERSIONS["2"]) + + def wrapper.topic(*args); end # Silence output in tests + wrapper.bundler_version_escape_valve! + + expect(tmp_gemfile_lock_path.read).to_not match("BUNDLED") + end end it "detects windows gemfiles" do From 5d5a70e3a4a7d09f34d7c4d723bed6346f8af65b Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Tue, 19 Jan 2021 14:52:31 -0600 Subject: [PATCH 0782/1195] Fail detection with a CNB-friendly exit code (#1112) * Fail detection with a CNB-friendly exit code * Links in the changelog Co-authored-by: Kamal Nasser --- CHANGELOG.md | 3 ++- bin/detect | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d2d9b781b..99b005686 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Main (unreleased) -* Fix Gemfile.lock read bug from preventing propper removal of BUNDLED WITH declaration () +* Fix Gemfile.lock read bug from preventing propper removal of BUNDLED WITH declaration (https://github.com/heroku/heroku-buildpack-ruby/pull/1108) +* Fail detection with a CNB-friendly exit code (https://github.com/heroku/heroku-buildpack-ruby/pull/1111) ## v222 (11/02/2020) diff --git a/bin/detect b/bin/detect index 6f72d4790..3f2d3afd8 100755 --- a/bin/detect +++ b/bin/detect @@ -16,5 +16,5 @@ if [ -f "$APP_DIR/Gemfile" ]; then exit 0 else echo "no" - exit 1 + exit 100 fi From b5b04e3a96dd9283141a658422e35df7dd0fb56d Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Fri, 22 Jan 2021 11:22:58 -0600 Subject: [PATCH 0783/1195] v223 (#1114) --- CHANGELOG.md | 2 ++ lib/language_pack/version.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 99b005686..27f31dbec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Main (unreleased) +## v223 (1/22/2021) + * Fix Gemfile.lock read bug from preventing propper removal of BUNDLED WITH declaration (https://github.com/heroku/heroku-buildpack-ruby/pull/1108) * Fail detection with a CNB-friendly exit code (https://github.com/heroku/heroku-buildpack-ruby/pull/1111) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index f1b0ed6fd..68ade4843 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v222" + BUILDPACK_VERSION = "v223" end end From 1f5997236bd50fb5a8d7e5c30791d28afeb1a9a4 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Thu, 28 Jan 2021 10:52:06 -0600 Subject: [PATCH 0784/1195] Rails 2, 3, and 4 LTS tests (#1115) * Rails 2 LTS support * Rails 3 LTS The current Rails 3 LTS release does not work with Heroku Postgres and it makes a connection to the DB on boot, so I've deleted the Rakefile. Asserting behavior against the rest of the app is better than nothing. If it gets fixed from makandra later it can be re-visited. * Rails 4 LTS tests * Use Ruby 2.7.2 for Rails LTS tests * Clean up hatchet apps --- hatchet.json | 45 +++---------- hatchet.lock | 62 +++++------------- spec/hatchet/ci_spec.rb | 6 -- spec/hatchet/rails23_spec.rb | 14 +++-- spec/hatchet/rails3_spec.rb | 67 +++++++------------- spec/hatchet/rails4_spec.rb | 94 ++++++++++------------------ spec/helpers/bundler_wrapper_spec.rb | 6 -- spec/helpers/ruby_version_spec.rb | 12 ---- spec/spec_helper.rb | 4 ++ 9 files changed, 91 insertions(+), 219 deletions(-) diff --git a/hatchet.json b/hatchet.json index f38eca572..a42cf1e30 100644 --- a/hatchet.json +++ b/hatchet.json @@ -20,8 +20,6 @@ "ruby": [ "sharpstone/ruby_version_does_not_exist", "sharpstone/cd_ruby", - "sharpstone/mri_187", - "sharpstone/mri_193_p547", "sharpstone/ruby_193_jruby_173", "sharpstone/ruby_193_jruby_176", "sharpstone/ruby_193_jruby_1_7_27", @@ -44,43 +42,16 @@ "sharpstone/mri_193", "sharpstone/mri_200" ], - "rails2": [ - "sharpstone/rails23_mri_193" - ], - "rails3": [ - "sharpstone/rails3_mri_193", - "sharpstone/railties3_mri_193", - "sharpstone/rails3_12factor", - "sharpstone/rails3_one_plugin", - "sharpstone/rails3_runtime_assets", - "sharpstone/rails3-fail-assets-compile", - "sharpstone/rails3-fail-rakefile" - ], - "rails4": [ - "sharpstone/rails4-manifest", - "sharpstone/rails3-to-4-no-bin", + "rails_versions": [ + "sharpstone/rails_lts_23_default_ruby", + "sharpstone/rails3_default_ruby", "sharpstone/rails4_windows_mri193", - "sharpstone/rails4-fail-assets-compile" - ], - "rails41": [ - "sharpstone/rails41_scaffold" - ], - "rails42": [ - "sharpstone/rails42_scaffold", - "sharpstone/rails42_sprockets3_manifest" - ], - "rails5": [ - "sharpstone/rails5" - ], - "rails51": [ - "schneems/rails51_webpacker" - ], - "rails52": [ + "sharpstone/rails42_default_ruby", + "sharpstone/rails5", + "schneems/rails51_webpacker", "sharpstone/active_storage_non_local", "sharpstone/active_storage_local", - "sharpstone/sprockets_asset_compile_true" - ], - "rails6": [ + "sharpstone/sprockets_asset_compile_true", "sharpstone/rails6-basic" ], "heroku": [ @@ -93,8 +64,6 @@ "sharpstone/rails5_ruby_schema_format", "sharpstone/heroku-ci-json-example", "sharpstone/rails5_sql_schema_format", - "sharpstone/rails_31_ruby_schema_format", - "sharpstone/rails_31_sql_schema_format", "sharpstone/ruby_no_rails_test", "sharpstone/activerecord_rake_tasks_does_not_exist", "sharpstone/ci_fails_ruby_default_bundler" diff --git a/hatchet.lock b/hatchet.lock index 67f314cff..07afb37c4 100644 --- a/hatchet.lock +++ b/hatchet.lock @@ -23,10 +23,6 @@ - d76be86c66ae8f45ec611fb2c4d8eb3adac0ad4b - - "./repos/ci/rails5_sql_schema_format" - df48237c57f89bb3629937ae6b1d6af070100ed3 -- - "./repos/ci/rails_31_ruby_schema_format" - - 76dacc65e0483c7c0b659504d8d56e6cfaee4bf1 -- - "./repos/ci/rails_31_sql_schema_format" - - 540ec776eff3111ad9bb01af204c62725c94a11d - - "./repos/ci/ruby_no_rails_test" - 3916137106d59b008b67d738abe6a1438f8fbde6 - - "./repos/heroku/ruby-getting-started" @@ -45,48 +41,26 @@ - 2e9ed455517c57b0dc953f54fbf9fef641c7aadb - - "./repos/rack/mri_200" - f9922cbd9c6f44fdded54912f66038db37cb4b8f -- - "./repos/rails2/rails23_mri_193" - - 557f7ba7a9347ebe0dd2038dda7e7a97b2582525 -- - "./repos/rails3/rails3-fail-assets-compile" - - 0a2496b162fee373cbd484466abfcac1792510a1 -- - "./repos/rails3/rails3-fail-rakefile" - - 85ee71f73a50067ca99163aa3bb23865a1df4c8f -- - "./repos/rails3/rails3_12factor" - - 9aebcf9adccd007e178f71aa49f85ee1a203fc4d -- - "./repos/rails3/rails3_mri_193" - - 88c5d0d067cfd11e4452633994a85b04627ae8c7 -- - "./repos/rails3/rails3_one_plugin" - - 4f6ee83f2b977d4c939890ede9f11319ab8fd67c -- - "./repos/rails3/rails3_runtime_assets" - - 6f71613db2ba4e25c82d5986f43e419ed9b2e4b0 -- - "./repos/rails3/railties3_mri_193" - - 8cc041cffb9f5635017aa118d16688491f794e91 -- - "./repos/rails4/rails3-to-4-no-bin" - - 3fd6e84f5d8eaaadb6d95aeb1f367f62da28cc62 -- - "./repos/rails4/rails4-fail-assets-compile" - - 7f65fbb04ca49be526906a1b0d9155cd24941b8e -- - "./repos/rails4/rails4-manifest" - - b700f4683f601f102ab4b65a7e5052e40f2b4def -- - "./repos/rails4/rails4_windows_mri193" +- - "./repos/rails_versions/active_storage_local" + - e2119af6ddd4bc21fda9bc7da6401e7aa256e38d +- - "./repos/rails_versions/active_storage_non_local" + - cba59b7559f1f806684b65654228d44fcda91a82 +- - "./repos/rails_versions/rails3_default_ruby" + - a6b44db674c0d3538633989295e2cfd5e8e1ba0d +- - "./repos/rails_versions/rails42_default_ruby" + - dfa0f0133dafa62064968ea2efb6432f54350138 +- - "./repos/rails_versions/rails4_windows_mri193" - f4c7b6209835050468bbb87827acf652b8f4d8ce -- - "./repos/rails41/rails41_scaffold" - - d98e9ccee771b3745f1ab1936a697a05229392df -- - "./repos/rails42/rails42_scaffold" - - 5da1259651bf29b80af2bb27789422def02be5a8 -- - "./repos/rails42/rails42_sprockets3_manifest" - - 4ea4b080599b4394bdf6753a7b392d9ed6b844a7 -- - "./repos/rails5/rails5" +- - "./repos/rails_versions/rails5" - 1680c5da829e03ffb9345187971a13e5109d86a6 -- - "./repos/rails51/rails51_webpacker" +- - "./repos/rails_versions/rails51_webpacker" - 75c5c4f21b1d88fc3b8edf60b3f871df3ad70208 -- - "./repos/rails52/active_storage_local" - - e2119af6ddd4bc21fda9bc7da6401e7aa256e38d -- - "./repos/rails52/active_storage_non_local" - - cba59b7559f1f806684b65654228d44fcda91a82 -- - "./repos/rails52/sprockets_asset_compile_true" - - 98c6675cf97059278709cf75030e28063e0228d2 -- - "./repos/rails6/rails6-basic" +- - "./repos/rails_versions/rails6-basic" - 3b404ac714a16877781b7bf69f1b8a308df6c92f +- - "./repos/rails_versions/rails_lts_23_default_ruby" + - 7178b2f97d3b2b3170b390d997dcb212dd52cd30 +- - "./repos/rails_versions/sprockets_asset_compile_true" + - 98c6675cf97059278709cf75030e28063e0228d2 - - "./repos/rake/asset_precompile_fail" - 16f7834331d6bb3fc5c284130b14eb1ff74d99d5 - - "./repos/rake/asset_precompile_not_found" @@ -113,10 +87,6 @@ - f79860bc2866449fe065484f1542aaadd3f7cfd2 - - "./repos/ruby/libpq_connection_error" - c211c245f09d8335a520cd7a0b5360897d4988eb -- - "./repos/ruby/mri_187" - - 43cecfacbedda64f09310a4408ce73c5dc3a9c44 -- - "./repos/ruby/mri_193_p547" - - 39f4753b620f9ff427c547fd19f04c89f8441f6f - - "./repos/ruby/ruby_193_bad_patch_cedar_14" - 6948c1460c596f08c4642d616ae73a45dc0ae51a - - "./repos/ruby/ruby_193_jruby_17161_jdk7" diff --git a/spec/hatchet/ci_spec.rb b/spec/hatchet/ci_spec.rb index 473ab270b..832db823e 100644 --- a/spec/hatchet/ci_spec.rb +++ b/spec/hatchet/ci_spec.rb @@ -22,12 +22,6 @@ end end - it "Works with Rails 3.1 ruby schema apps" do - Hatchet::Runner.new("rails_31_ruby_schema_format").run_ci do |test_run| - expect(test_run.output).to match("db:schema:load completed") - end - end - it "Works with a vanilla ruby app" do Hatchet::Runner.new("ruby_no_rails_test").run_ci do |test_run| # Test no whitespace in front of output diff --git a/spec/hatchet/rails23_spec.rb b/spec/hatchet/rails23_spec.rb index e9b4d6342..9c198e1da 100644 --- a/spec/hatchet/rails23_spec.rb +++ b/spec/hatchet/rails23_spec.rb @@ -1,11 +1,17 @@ require_relative '../spec_helper' describe "Rails 2.3.x" do - it "should deploy on ruby 1.9.3 on cedar-14" do - pending("Rails LTS support") + it "should deploy" do + skip("Need RAILS_LTS_CREDS env var set") unless ENV["RAILS_LTS_CREDS"] - Hatchet::Runner.new('rails23_mri_193', stack: "cedar-14").deploy do |app| - # assert deploy is successful + Hatchet::Runner.new('rails_lts_23_default_ruby', config: rails_lts_config).tap do |app| + app.before_deploy do + Pathname("Gemfile").write("ruby '2.7.2'", mode: "a") + end + + app.deploy do + # assert deploy is successful + end end end end diff --git a/spec/hatchet/rails3_spec.rb b/spec/hatchet/rails3_spec.rb index 23c6b5d9c..e4c9faf50 100644 --- a/spec/hatchet/rails3_spec.rb +++ b/spec/hatchet/rails3_spec.rb @@ -1,51 +1,28 @@ require_relative '../spec_helper' describe "Rails 3.x" do - it "should deploy on ruby 1.9.3" do - pending("Rails LTS license") - - Hatchet::Runner.new("rails3_mri_193", stack: "cedar-14").deploy do |app, heroku| - expect(app.output).to include("Asset precompilation completed") - - expect(app.output).to match("WARNING") - expect(app.output).to match("Add 'rails_12factor' gem to your Gemfile to skip plugin injection") - - ls = app.run("ls vendor/plugins") - expect(ls).to match("rails3_serve_static_assets") - expect(ls).to match("rails_log_stdout") - end - end - - it "should not have warnings when using the rails_12factor gem" do - Hatchet::Runner.new("rails3_12factor").deploy do |app, heroku| - expect(app.output).not_to match("Add 'rails_12factor' gem to your Gemfile to skip plugin injection") - - # https://github.com/heroku/heroku-buildpack-ruby/issues/525 - env = app.run("env") - expect(env).not_to match("RAILS_GROUPS") - end - end - - it "should only display the correct plugin warning" do - Hatchet::Runner.new("rails3_one_plugin").deploy do |app, heroku| - expect(app.output).not_to match("rails_log_stdout") - expect(app.output).to match("rails3_serve_static_assets") - expect(app.output).to match("Add 'rails_12factor' gem to your Gemfile to skip plugin injection") - end - end - - - it "fails if rake tasks cannot be detected" do - Hatchet::Runner.new("rails3-fail-rakefile", allow_failure: true).deploy do |app| - expect(app.output).to include("raising so the rake task will not load") - expect(app).not_to be_deployed - end - end - - it "fails compile if assets:precompile fails" do - Hatchet::Runner.new("rails3-fail-assets-compile", allow_failure: true).deploy do |app, heroku| - expect(app.output).to include("raising on assets:precompile on purpose") - expect(app).not_to be_deployed + it "should deploy and inject plugins" do + skip("Need RAILS_LTS_CREDS env var set") unless ENV["RAILS_LTS_CREDS"] + + Hatchet::Runner.new("rails3_default_ruby", config: rails_lts_config).tap do |app| + app.before_deploy do + Pathname("Gemfile").write("ruby '2.7.2'", mode: "a") + end + + app.deploy do + # Rails 3 doesn't work with Postgres 8+ out of the box and Rails + # LTS hasn't patched this yet. We're skipping asset compilation for now + # by deleting the Rakefile + # + # expect(app.output).to include("Asset precompilation completed") + + expect(app.output).to match("WARNING") + expect(app.output).to match("Add 'rails_12factor' gem to your Gemfile to skip plugin injection") + + ls = app.run("ls vendor/plugins") + expect(ls).to match("rails3_serve_static_assets") + expect(ls).to match("rails_log_stdout") + end end end end diff --git a/spec/hatchet/rails4_spec.rb b/spec/hatchet/rails4_spec.rb index 1b6facc54..de55b67f4 100644 --- a/spec/hatchet/rails4_spec.rb +++ b/spec/hatchet/rails4_spec.rb @@ -1,81 +1,51 @@ require_relative '../spec_helper' describe "Rails 4.x" do - it "set RAILS_SERVE_STATIC_FILES" do - Hatchet::Runner.new("rails42_scaffold").deploy do |app, heroku| - output = app.run("rails runner 'puts ENV[%Q{RAILS_SERVE_STATIC_FILES}].present?'") - expect(output).to match(/true/) - end - end - it "should be able to run a migration without heroku specific database.yml" do - Hatchet::Runner.new("rails41_scaffold").deploy do |app, heroku| - expect(app.output).not_to include("Writing config/database.yml to read from DATABASE_URL") - expect(app.run("rake db:migrate")).to include("20140218165801 CreatePeople") - end - end - - it "should not overwrite existing files with cached files" do - string = SecureRandom.hex(13) - new_string = SecureRandom.hex(13) + skip("Need RAILS_LTS_CREDS env var set") unless ENV["RAILS_LTS_CREDS"] - Hatchet::Runner.new("rails41_scaffold").deploy do |app, heroku| - # First Deploy - run!(%Q{mkdir public/assets}) - run!(%Q{echo #{string} > public/assets/file.txt}) - run!(%Q{git add -A; git commit -m 'adding file.txt'}) - app.push! + Hatchet::Runner.new("rails42_default_ruby", config: rails_lts_config).tap do |app| + app.before_deploy do + Pathname("Gemfile").write("ruby '2.7.2'", mode: "a") + end + app.deploy do + # it Don't over-write database.yml + expect(app.output).not_to include("Writing config/database.yml to read from DATABASE_URL") - # Second Deploy - run!(%Q{echo #{new_string} > public/assets/file.txt}) - run!(%Q{git add -A; git commit -m 'updating file.txt'}) - app.push! - - # Asserts - result = app.run('cat public/assets/file.txt') - expect(result).not_to match(string) - expect(result).to match(new_string) + # it sets RAILS_SERVE_STATIC_FILES env var + output = app.run("rails runner 'puts ENV[%Q{RAILS_SERVE_STATIC_FILES}].present?'") + expect(output).to match(/true/) + end end end - it "should detect rails successfully" do - Hatchet::App.new('rails4-manifest').in_directory_fork do - expect(LanguagePack::Rails4.use?).to eq(true) - end - Hatchet::App.new('rails4-manifest').in_directory_fork do - expect(LanguagePack::Rails3.use?).to eq(false) - end - end + it "should skip asset compilation when deployed with NEW manifest file" do + skip("Need RAILS_LTS_CREDS env var set") unless ENV["RAILS_LTS_CREDS"] - it "should skip asset compilation when deployed with manifest file" do - Hatchet::Runner.new("rails4-manifest").deploy do |app, heroku| - expect(app.output).to include("Detected manifest file, assuming assets were compiled locally") - expect(app.output).not_to match("Include 'rails_12factor' gem to enable all platform features") - end - end + Hatchet::Runner.new("rails42_default_ruby", config: rails_lts_config).tap do |app| + app.before_deploy do + Pathname("Gemfile").write("ruby '2.7.2'", mode: "a") + Pathname("public/assets/manifest-ccf61eade4793995271564a4767ce6b6.json").tap {|p| p.dirname.mkpath; FileUtils.touch(p) } + end - it "detects new manifest file (sprockets 3.x: .sprockets-manifest-.json) Rails 4.2" do - Hatchet::Runner.new("rails42_sprockets3_manifest").deploy do |app, heroku| - expect(app.output).to include("Detected manifest file, assuming assets were compiled locally") + app.deploy do + expect(app.output).to include("Detected manifest file, assuming assets were compiled locally") + end end end - it "upgraded from 3 to 4.2 missing ./bin still works" do - Hatchet::Runner.new("rails3-to-4-no-bin").deploy do |app, heroku| - expect(app.output).to include("Asset precompilation completed") + it "should skip asset compilation when deployed with OLD manifest file" do + skip("Need RAILS_LTS_CREDS env var set") unless ENV["RAILS_LTS_CREDS"] - expect(app.output).to match("WARNING") - expect(app.output).to match("Include 'rails_12factor' gem to enable all platform features") - - output = app.run("rails runner 'puts %Q{hello} + %Q{world}'") - expect(output).to match('helloworld') - end - end + Hatchet::Runner.new("rails42_default_ruby", config: rails_lts_config).tap do |app| + app.before_deploy do + Pathname("Gemfile").write("ruby '2.7.2'", mode: "a") + Pathname("public/assets/.sprockets-manifest-040763ccc5036260c52c6adcf77d73f7.json").tap {|p| p.dirname.mkpath; FileUtils.touch(p) } + end - it "fails compile if assets:precompile fails rails 4.2" do - Hatchet::Runner.new("rails4-fail-assets-compile", allow_failure: true).deploy do |app, heroku| - expect(app.output).to include("raising on assets:precompile on purpose") - expect(app).not_to be_deployed + app.deploy do + expect(app.output).to include("Detected manifest file, assuming assets were compiled locally") + end end end end diff --git a/spec/helpers/bundler_wrapper_spec.rb b/spec/helpers/bundler_wrapper_spec.rb index 3803fe57d..d20fcc9f5 100644 --- a/spec/helpers/bundler_wrapper_spec.rb +++ b/spec/helpers/bundler_wrapper_spec.rb @@ -66,12 +66,6 @@ def wrapper.topic(*args); end # Silence output in tests end end - it "handles MRI patchlevel gemfiles" do - Hatchet::App.new("mri_193_p547").in_directory_fork do |dir| - expect(@bundler.ruby_version).to eq("ruby-1.9.3-p547") - end - end - it "handles app with output in their Gemfile" do Hatchet::App.new("problem_gemfile_version").in_directory_fork do |dir| run!(%{echo '\nputs "some output"\n' >> Gemfile}) diff --git a/spec/helpers/ruby_version_spec.rb b/spec/helpers/ruby_version_spec.rb index 6946f397a..1fe2eff89 100644 --- a/spec/helpers/ruby_version_spec.rb +++ b/spec/helpers/ruby_version_spec.rb @@ -38,18 +38,6 @@ end end - it "correctly handles patch levels" do - Hatchet::App.new("mri_193_p547").in_directory_fork do |dir| - ruby_version = LanguagePack::RubyVersion.new(@bundler.install.ruby_version, is_new: true) - version_number = "1.9.3" - version = "ruby-#{version_number}" - expect(ruby_version.version_without_patchlevel).to eq(version) - expect(ruby_version.patchlevel).to eq("p547") - expect(ruby_version.engine_version).to eq(version_number) - expect(ruby_version.engine).to eq(:ruby) - end - end - it "does not include patchlevels when the patchlevel is negative for download" do ruby_version = LanguagePack::RubyVersion.new("ruby-2.0.0-p-1") expect(ruby_version.version_for_download).to eq("ruby-2.0.0") diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 21007b31b..84b3a4e74 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -54,6 +54,10 @@ def fixture_path(path) Pathname.new(__FILE__).join("../fixtures").expand_path.join(path) end +def rails_lts_config + { 'BUNDLE_GEMS__RAILSLTS__COM' => ENV["RAILS_LTS_CREDS"] } +end + def hatchet_path(path = "") Pathname.new(__FILE__).join("../../repos").expand_path.join(path) end From bcae21a4c9fdb9b33451a6f73c284e9334f10e50 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Thu, 4 Feb 2021 09:17:53 -0600 Subject: [PATCH 0785/1195] Fix YAML formatting (#1116) --- .github/workflows/check_changelog.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check_changelog.yml b/.github/workflows/check_changelog.yml index 7d1814e75..0fd96b05c 100644 --- a/.github/workflows/check_changelog.yml +++ b/.github/workflows/check_changelog.yml @@ -5,7 +5,8 @@ on: types: [opened, reopened, edited, synchronize] jobs: build: - if: !contains(github.event.issue.labels.*.name, "dependencies") + if: | + !contains(github.event.pull_request.labels.*.name, 'dependencies') runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 From 648a14986020ae6c681dbbba0895fe6bb542d5fd Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Thu, 11 Feb 2021 10:25:23 -0600 Subject: [PATCH 0786/1195] Use jvm buildpack to install JRuby dependencies (#1119) * Use jvm buildpack to install JRuby dependencies Currently, the jvm logic is duplicated in this buildpack and the jvm buildpack. By using the JVM buildpack we can reduce duplication and increase consistency across the Heroku platform. * Use named variables instead of bash args Previously the function compile_buildpack_v2 directly uses $1, $2, and $3. This change updates this function to instead use named local variables. In addition, there was a typo in the output to the user. --- CHANGELOG.md | 2 + bin/compile | 20 +++ bin/support/bash_functions.sh | 109 +++++++++++++++ bin/test-compile | 20 +++ .../unreleased/jvm_installer_default.md | 13 ++ hatchet.json | 1 - hatchet.lock | 2 - lib/language_pack/helpers/jvm_installer.rb | 120 ---------------- lib/language_pack/ruby.rb | 76 ---------- lib/language_pack/test/ruby.rb | 1 - spec/hatchet/jvm_spec.rb | 17 --- spec/hatchet/rubies_spec.rb | 48 +++++-- spec/helpers/bundler_wrapper_spec.rb | 32 +++-- spec/helpers/jvm_installer_spec.rb | 92 ------------- spec/helpers/ruby_version_spec.rb | 130 ++++++++++-------- spec/spec_helper.rb | 4 + spec/unit/bash_functions_spec.rb | 123 +++++++++++++++++ 17 files changed, 419 insertions(+), 391 deletions(-) create mode 100644 changelogs/unreleased/jvm_installer_default.md delete mode 100644 lib/language_pack/helpers/jvm_installer.rb delete mode 100644 spec/hatchet/jvm_spec.rb delete mode 100644 spec/helpers/jvm_installer_spec.rb create mode 100644 spec/unit/bash_functions_spec.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index 27f31dbec..e1305f3a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Main (unreleased) +* Ruby buildpack now relies on the JVM buildpack to install java for Jruby apps (https://github.com/heroku/heroku-buildpack-ruby/pull/1119) + ## v223 (1/22/2021) * Fix Gemfile.lock read bug from preventing propper removal of BUNDLED WITH declaration (https://github.com/heroku/heroku-buildpack-ruby/pull/1108) diff --git a/bin/compile b/bin/compile index a38c4ba54..e3c85c27e 100755 --- a/bin/compile +++ b/bin/compile @@ -2,10 +2,30 @@ # The actual compilation code lives in `bin/support/ruby_compile`. This file instead # bootstraps the ruby needed and then executes `bin/support/ruby_compile` +BUILD_DIR=$1 +CACHE_DIR=$2 +ENV_DIR=$3 BIN_DIR=$(cd $(dirname $0); pwd) BUILDPACK_DIR=$(dirname $BIN_DIR) source "$BIN_DIR/support/bash_functions.sh" heroku_buildpack_ruby_install_ruby "$BIN_DIR" "$BUILDPACK_DIR" +if detect_needs_java "$BUILD_DIR"; then + cat < Installing Java + +EOM + + compile_buildpack_v2 "$BUILD_DIR" "$CACHE_DIR" "$ENV_DIR" "https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/jvm.tgz" "heroku/jvm" +fi + $heroku_buildpack_ruby_dir/bin/ruby $BIN_DIR/support/ruby_compile $@ diff --git a/bin/support/bash_functions.sh b/bin/support/bash_functions.sh index c6a9ce98f..4bc4a70e5 100755 --- a/bin/support/bash_functions.sh +++ b/bin/support/bash_functions.sh @@ -1,3 +1,15 @@ +#!/usr/bin/env bash + +curl_retry_on_18() { + local ec=18; + local attempts=0; + while (( ec == 18 && attempts++ < 3 )); do + curl "$@" # -C - would return code 33 if unsupported by server + ec=$? + done + return $ec +} + # This function will install a version of Ruby onto the # system for the buidlpack to use. It coordinates download # and setting appropriate env vars for execution @@ -44,3 +56,100 @@ heroku_buildpack_ruby_install_ruby() export PATH=$heroku_buildpack_ruby_dir/bin/:$PATH unset GEM_PATH } + +which_java() +{ + which java > /dev/null +} + +# Detects if a given Gemfile.lock has jruby in it +# $ cat Gemfile.lock | grep jruby # => ruby 2.5.7p001 (jruby 9.2.13.0) +detect_needs_java() +{ + local app_dir=$1 + local gemfile_lock="$app_dir/Gemfile.lock" + # local needs_jruby=0 + local skip_java_install=1 + + if which_java; then + return $skip_java_install + fi + grep "(jruby " "$gemfile_lock" --quiet +} + +# Runs another buildpack against the build dir +# +# Example: +# +# compile_buildpack_v2 "$build_dir" "$cache_dir" "$env_dir" "https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/nodejs.tgz" "heroku/nodejs" +# +compile_buildpack_v2() +{ + local build_dir=$1 + local cache_dir=$2 + local env_dir=$3 + local buildpack=$4 + local name=$5 + + local dir + local url + local branch + + dir=$(mktemp -t buildpackXXXXX) + rm -rf "$dir" + + url=${buildpack%#*} + branch=${buildpack#*#} + + if [ "$branch" == "$url" ]; then + branch="" + fi + + if [ "$url" != "" ]; then + echo "-----> Downloading Buildpack: ${name}" + + if [[ "$url" =~ \.tgz$ ]] || [[ "$url" =~ \.tgz\? ]]; then + mkdir -p "$dir" + curl_retry_on_18 -s "$url" | tar xvz -C "$dir" >/dev/null 2>&1 + else + git clone "$url" "$dir" >/dev/null 2>&1 + fi + cd "$dir" || return + + if [ "$branch" != "" ]; then + git checkout "$branch" >/dev/null 2>&1 + fi + + # we'll get errors later if these are needed and don't exist + chmod -f +x "$dir/bin/{detect,compile,release}" || true + + framework=$("$dir"/bin/detect "$build_dir") + + # shellcheck disable=SC2181 + if [ $? == 0 ]; then + echo "-----> Detected Framework: $framework" + "$dir"/bin/compile "$build_dir" "$cache_dir" "$env_dir" + + # shellcheck disable=SC2181 + if [ $? != 0 ]; then + exit 1 + fi + + # check if the buildpack left behind an environment for subsequent ones + if [ -e "$dir/export" ]; then + set +u # http://redsymbol.net/articles/unofficial-bash-strict-mode/#sourcing-nonconforming-document + # shellcheck disable=SC1090 + source "$dir/export" + set -u # http://redsymbol.net/articles/unofficial-bash-strict-mode/#sourcing-nonconforming-document + fi + + if [ -x "$dir/bin/release" ]; then + "$dir"/bin/release "$build_dir" > "$1"/last_pack_release.out + fi + else + echo "Couldn't detect any framework for this buildpack. Exiting." + exit 1 + fi + fi +} + diff --git a/bin/test-compile b/bin/test-compile index 79c482e0f..1c996c15a 100755 --- a/bin/test-compile +++ b/bin/test-compile @@ -2,10 +2,30 @@ # The actual `bin/test-compile` code lives in `bin/ruby_test-compile`. This file instead # bootstraps the ruby needed and then executes `bin/ruby_test-compile` +BUILD_DIR=$1 +CACHE_DIR=$2 +ENV_DIR=$3 BIN_DIR=$(cd $(dirname $0); pwd) BUILDPACK_DIR=$(dirname $BIN_DIR) source "$BIN_DIR/support/bash_functions.sh" heroku_buildpack_ruby_install_ruby "$BIN_DIR" "$BUILDPACK_DIR" +if detect_needs_java "$BUILD_DIR"; then + cat < Installing Java + +EOM + + compile_buildpack_v2 "$BUILD_DIR" "$CACHE_DIR" "$ENV_DIR" "https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/jvm.tgz" "heroku/jvm" +fi + $heroku_buildpack_ruby_dir/bin/ruby $BIN_DIR/support/ruby_test-compile $@ diff --git a/changelogs/unreleased/jvm_installer_default.md b/changelogs/unreleased/jvm_installer_default.md new file mode 100644 index 000000000..742cf721c --- /dev/null +++ b/changelogs/unreleased/jvm_installer_default.md @@ -0,0 +1,13 @@ +## JVM support for JRuby apps is now provided by the `heroku/jvm` buildpack + +JRuby applications require the JVM to run. Before this change, the JVM for JRuby apps was provided by the `heroku/ruby` buildpack for JRuby applications. + +Now the custom JVM installation logic in the `heroku/ruby` buildpack has been removed, and instead, the `heroku/jvm` buildpack will be called directly by the Ruby buildpack. + +Instead of relying on this functionality, it is recommended to manually require the `heroku/jvm` buildpack for your application: + +``` +$ heroku buildpacks:add heroku/jvm --index=1 +``` + +For more information on JRuby support, see the [Heroku Ruby Support page](https://devcenter.heroku.com/articles/ruby-support). diff --git a/hatchet.json b/hatchet.json index a42cf1e30..df02f33e2 100644 --- a/hatchet.json +++ b/hatchet.json @@ -22,7 +22,6 @@ "sharpstone/cd_ruby", "sharpstone/ruby_193_jruby_173", "sharpstone/ruby_193_jruby_176", - "sharpstone/ruby_193_jruby_1_7_27", "sharpstone/ruby_193_jruby_17161_jdk7", "sharpstone/ruby_193_bad_patch_cedar_14", "sharpstone/ruby_25", diff --git a/hatchet.lock b/hatchet.lock index 07afb37c4..0a94efcd8 100644 --- a/hatchet.lock +++ b/hatchet.lock @@ -95,8 +95,6 @@ - a08e8b2cc61d08bd611accaa455dbcbfff80f831 - - "./repos/ruby/ruby_193_jruby_176" - 9fcbc184cb386abc8784e9935d52d403e35c532c -- - "./repos/ruby/ruby_193_jruby_1_7_27" - - 06d5e86180ff0e5b6894f823736cd649dcfebed4 - - "./repos/ruby/ruby_25" - 0cb3df80d55b61e9417f2ac00adb06e15ae37982 - - "./repos/ruby/ruby_version_does_not_exist" diff --git a/lib/language_pack/helpers/jvm_installer.rb b/lib/language_pack/helpers/jvm_installer.rb deleted file mode 100644 index f4d1ac71c..000000000 --- a/lib/language_pack/helpers/jvm_installer.rb +++ /dev/null @@ -1,120 +0,0 @@ -require "language_pack/shell_helpers" - -class LanguagePack::Helpers::JvmInstaller - include LanguagePack::ShellHelpers - - SYS_PROPS_FILE = "system.properties" - JVM_BUCKET = "https://lang-jvm.s3.amazonaws.com" - JVM_BASE_URL = "#{JVM_BUCKET}/jdk" - JVM_1_9_PATH = "openjdk1.9-latest.tar.gz" - JVM_1_8_PATH = "openjdk1.8-latest.tar.gz" - JVM_1_7_PATH = "openjdk1.7-latest.tar.gz" - JVM_1_7_25_PATH = "openjdk1.7.0_25.tar.gz" - JVM_1_6_PATH = "openjdk1.6-latest.tar.gz" - - PG_CONFIG_JAR = "pgconfig.jar" - - PREINSTALLED_JDK_DIR = ".jdk" - - def initialize(slug_vendor_jvm, stack) - @vendor_dir = slug_vendor_jvm - @stack = stack - @fetcher = LanguagePack::Fetcher.new(JVM_BASE_URL, stack) - @pg_config_jar_fetcher = LanguagePack::Fetcher.new(JVM_BUCKET) - end - - def java_home - if preinstalled_jdk? - PREINSTALLED_JDK_DIR - else - @vendor_dir - end - end - - def preinstalled_jdk? - Dir.exist?(PREINSTALLED_JDK_DIR) - end - - def system_properties - props = {} - File.read(SYS_PROPS_FILE).split("\n").each do |line| - key = line.split("=").first - val = line.split("=").last - props[key] = val - end if File.exists?(SYS_PROPS_FILE) - props - end - - def install(jruby_version, forced = false) - if preinstalled_jdk? - topic "Using pre-installed JDK" - return - end - - jvm_version = system_properties['java.runtime.version'] - case jvm_version - when "1.9", "9" - fetch_env_untar('JDK_URL_1_9') || fetch_untar(JVM_1_9_PATH, "openjdk-9") - when "1.7", "7" - fetch_env_untar('JDK_URL_1_7') || fetch_untar(JVM_1_7_PATH, "openjdk-7") - when "1.6", "6" - fetch_env_untar('JDK_URL_1_6') || fetch_untar(JVM_1_6_PATH, "openjdk-6") - when "1.8", "8", nil - if @stack == "cedar" - if forced || Gem::Version.new(jruby_version) >= Gem::Version.new("1.7.4") - fetch_untar(JVM_1_7_PATH, "openjdk-7") - else - fetch_untar(JVM_1_7_25_PATH) - end - else - fetch_env_untar('JDK_URL_1_8') || fetch_untar(JVM_1_8_PATH, "openjdk-8") - end - else - fetch_untar("openjdk#{jvm_version}.tar.gz", "openjdk-#{jvm_version}") - end - - bin_dir = "bin" - FileUtils.mkdir_p bin_dir - Dir["#{@vendor_dir}/bin/*"].each do |bin| - run("ln -s ../#{bin} #{bin_dir}") - end - - install_pgconfig_jar - end - - def fetch_untar(jvm_path, jvm_version=nil) - topic "Installing JVM: #{jvm_version || jvm_path}" - - FileUtils.mkdir_p(@vendor_dir) - Dir.chdir(@vendor_dir) do - @fetcher.fetch_untar(jvm_path) - end - rescue LanguagePack::Fetcher::FetchError - error < default_java_opts, "JRUBY_OPTS" => default_jruby_opts }) : vars end @@ -99,7 +96,6 @@ def compile warn_bundler_upgrade warn_bad_binstubs install_ruby(slug_vendor_ruby, build_ruby_path) - install_jvm setup_language_pack_environment( ruby_layer_path: File.expand_path("."), gem_layer_path: File.expand_path("."), @@ -255,12 +251,6 @@ def slug_vendor_ruby "vendor/#{ruby_version.version_without_patchlevel}" end - # the relative path to the vendored jvm - # @return [String] resulting path - def slug_vendor_jvm - "vendor/jvm" - end - # the absolute path of the build ruby to use during the buildpack # @return [String] resulting path def build_ruby_path @@ -284,40 +274,6 @@ def ruby_version end end - # default JAVA_OPTS - # return [String] string of JAVA_OPTS - def default_java_opts - "-Dfile.encoding=UTF-8" - end - - def set_jvm_max_heap - <<-EOF -limit=$(ulimit -u) -case $limit in -512) # 2X, private-s: memory.limit_in_bytes=1073741824 - echo "$opts -Xmx671m -XX:CICompilerCount=2" - ;; -16384) # perf-m, private-m: memory.limit_in_bytes=2684354560 - echo "$opts -Xmx2g" - ;; -32768) # perf-l, private-l: memory.limit_in_bytes=15032385536 - echo "$opts -Xmx12g" - ;; -*) # Free, Hobby, 1X: memory.limit_in_bytes=536870912 - echo "$opts -Xmx300m -Xss512k -XX:CICompilerCount=2" - ;; -esac -EOF - end - - def set_java_mem - <<-EOF -if ! [[ "${JAVA_OPTS}" == *-Xmx* ]]; then - export JAVA_MEM=${JAVA_MEM:--Xmx${JVM_MAX_HEAP:-384}m} -fi -EOF - end - def set_default_web_concurrency <<-EOF case $(ulimit -u) in @@ -349,23 +305,12 @@ def default_jruby_opts "-Xcompile.invokedynamic=false" end - # default Java Xmx - # return [String] string of Java Xmx - def default_java_mem - "-Xmx${JVM_MAX_HEAP:-384}m" - end - # sets up the environment variables for the build process def setup_language_pack_environment(ruby_layer_path:, gem_layer_path:, bundle_path:, bundle_default_without:) instrument 'ruby.setup_language_pack_environment' do if ruby_version.jruby? ENV["PATH"] += ":bin" - ENV["JAVA_MEM"] = run(<<~SHELL).strip - #{set_jvm_max_heap} - echo #{default_java_mem} - SHELL ENV["JRUBY_OPTS"] = env('JRUBY_BUILD_OPTS') || env('JRUBY_OPTS') - ENV["JAVA_HOME"] = @jvm_installer.java_home end setup_ruby_install_env(ruby_layer_path) @@ -400,7 +345,6 @@ def setup_language_pack_environment(ruby_layer_path:, gem_layer_path:, bundle_pa paths << "#{gem_layer_path}/#{bundler_binstubs_path}" # Binstubs from bundler, eg. vendor/bundle/bin paths << "#{gem_layer_path}/#{slug_vendor_base}/bin" # Binstubs from rubygems, eg. vendor/bundle/ruby/2.6.0/bin - paths << "#{slug_vendor_jvm}/bin" if ruby_version.jruby? paths << ENV["PATH"] ENV["PATH"] = paths.join(":") @@ -443,9 +387,6 @@ def setup_export(layer = nil) # TODO handle jruby if ruby_version.jruby? - add_to_export set_jvm_max_heap - add_to_export set_java_mem - set_export_default "JAVA_OPTS", default_java_opts set_export_default "JRUBY_OPTS", default_jruby_opts end @@ -484,9 +425,6 @@ def setup_profiled(ruby_layer_path: , gem_layer_path: ) # TODO handle JRUBY if ruby_version.jruby? - add_to_profiled set_jvm_max_heap - add_to_profiled set_java_mem - set_env_default "JAVA_OPTS", default_java_opts set_env_default "JRUBY_OPTS", default_jruby_opts end @@ -693,15 +631,6 @@ def new_app? @new_app ||= !File.exist?("vendor/heroku") end - # vendors JVM into the slug for JRuby - def install_jvm(forced = false) - instrument 'ruby.install_jvm' do - if ruby_version.jruby? || forced - @jvm_installer.install(ruby_version.engine_version, forced) - end - end - end - # find the ruby install path for its binstubs during build # @return [String] resulting path or empty string if ruby is not vendored def ruby_install_binstub_path(ruby_layer_path = ".") @@ -719,10 +648,6 @@ def ruby_install_binstub_path(ruby_layer_path = ".") def setup_ruby_install_env(ruby_layer_path = ".") instrument 'ruby.setup_ruby_install_env' do ENV["PATH"] = "#{File.expand_path(ruby_install_binstub_path(ruby_layer_path))}:#{ENV["PATH"]}" - - if ruby_version.jruby? - ENV['JAVA_OPTS'] = default_java_opts - end end end @@ -937,7 +862,6 @@ def build_bundler env_vars["RUBYOPT"] = syck_hack env_vars["NOKOGIRI_USE_SYSTEM_LIBRARIES"] = "true" env_vars["BUNDLE_DISABLE_VERSION_CHECK"] = "true" - env_vars["JAVA_HOME"] = noshellescape("#{pwd}/$JAVA_HOME") if ruby_version.jruby? env_vars["BUNDLER_LIB_PATH"] = "#{bundler_path}" if ruby_version.ruby_version == "1.8.7" env_vars["BUNDLE_DISABLE_VERSION_CHECK"] = "true" diff --git a/lib/language_pack/test/ruby.rb b/lib/language_pack/test/ruby.rb index 19cb97fd2..73d3351c7 100644 --- a/lib/language_pack/test/ruby.rb +++ b/lib/language_pack/test/ruby.rb @@ -7,7 +7,6 @@ def compile remove_vendor_bundle warn_bad_binstubs install_ruby(slug_vendor_ruby, build_ruby_path) - install_jvm setup_language_pack_environment( ruby_layer_path: File.expand_path("."), gem_layer_path: File.expand_path("."), diff --git a/spec/hatchet/jvm_spec.rb b/spec/hatchet/jvm_spec.rb deleted file mode 100644 index d33b745b4..000000000 --- a/spec/hatchet/jvm_spec.rb +++ /dev/null @@ -1,17 +0,0 @@ -require 'spec_helper' - -describe "JvmInstaller" do - it "JVM is installed by jvm-common only" do - buildpacks = [ - "heroku/jvm", - :default # default is heroku-ruby-buildpack here - - ] - Hatchet::Runner.new("ruby_193_jruby_1_7_27", stack: 'heroku-18', buildpacks: buildpacks).deploy do |app| - expect(app.output).to match("Using pre-installed JDK") - expect(app.run("java -version")).to match("1.8.0") - sleep 3 - expect(app.run("ls .jdk/jre/lib/ext")).to match("pgconfig.jar") - end - end -end diff --git a/spec/hatchet/rubies_spec.rb b/spec/hatchet/rubies_spec.rb index 666a50a26..49b2ec815 100644 --- a/spec/hatchet/rubies_spec.rb +++ b/spec/hatchet/rubies_spec.rb @@ -13,19 +13,45 @@ end describe "Ruby versions" do - it "should deploy jdk 8 on heroku-18 by default" do - app = Hatchet::Runner.new("ruby_193_jruby_1_7_27", stack: "heroku-18") - app.deploy do |app| - expect(app.output).to match("Installing JVM: openjdk-8") - expect(app.output).to match("JRUBY_OPTS is: -Xcompile.invokedynamic=false") - expect(app.output).not_to include("OpenJDK 64-Bit Server VM warning") + it "should deploy jdk on heroku-20" do + Hatchet::Runner.new("default_ruby", stack: "heroku-20").tap do |app| + app.before_deploy do |app| + Pathname("Gemfile.lock").write(<<~EOM) + GEM + remote: https://rubygems.org/ + specs: + rack (2.2.2) + rake (13.0.1) - run!('git commit -am "redeploy" --allow-empty') - app.set_config("JRUBY_BUILD_OPTS" => "--dev") - app.push! - expect(app.output).to match("JRUBY_OPTS is: --dev") + PLATFORMS + java + + DEPENDENCIES + rack + rake + + + RUBY VERSION + ruby 2.5.7p0 (jruby 9.2.13.0) + EOM + + Pathname("Rakefile").write(<<~'EOM') + task "assets:precompile" do + puts "JRUBY_OPTS is: #{ENV['JRUBY_OPTS']}" + end + EOM + end + + app.deploy do + expect(app.output).to match("JRUBY_OPTS is: -Xcompile.invokedynamic=false") + + app.set_config("JRUBY_BUILD_OPTS" => "--dev") + app.commit! + app.push! + expect(app.output).to match("JRUBY_OPTS is: --dev") - expect(app.run("ls vendor/jvm/jre/lib/ext")).to match("pgconfig.jar") + expect(app.run("ls .jdk/jre/lib/ext/")).to match("pgconfig.jar") + end end end diff --git a/spec/helpers/bundler_wrapper_spec.rb b/spec/helpers/bundler_wrapper_spec.rb index d20fcc9f5..279b4f617 100644 --- a/spec/helpers/bundler_wrapper_spec.rb +++ b/spec/helpers/bundler_wrapper_spec.rb @@ -42,34 +42,44 @@ def wrapper.topic(*args); end # Silence output in tests it "detects windows gemfiles" do Hatchet::App.new("rails4_windows_mri193").in_directory_fork do |dir| - expect(@bundler.install.windows_gemfile_lock?).to be_truthy + Bundler.with_unbundled_env do + expect(@bundler.install.windows_gemfile_lock?).to be_truthy + end end end describe "when executing bundler" do - before do - @bundler.install - end - it "handles apps with ruby versions locked in Gemfile.lock" do Hatchet::App.new("problem_gemfile_version").in_directory_fork do |dir| - expect(@bundler.ruby_version).to eq("ruby-2.5.1-p0") + Bundler.with_unbundled_env do + @bundler.install - ruby_version = LanguagePack::RubyVersion.new(@bundler.ruby_version, is_new: true) - expect(ruby_version.version_for_download).to eq("ruby-2.5.1") + expect(@bundler.ruby_version).to eq("ruby-2.5.1-p0") + + ruby_version = LanguagePack::RubyVersion.new(@bundler.ruby_version, is_new: true) + expect(ruby_version.version_for_download).to eq("ruby-2.5.1") + end end end it "handles JRuby pre gemfiles" do Hatchet::App.new("jruby-minimal").in_directory_fork do |dir| - expect(@bundler.ruby_version).to eq("ruby-2.3.1-p0-jruby-9.1.7.0") + Bundler.with_unbundled_env do + @bundler.install + + expect(@bundler.ruby_version).to eq("ruby-2.3.1-p0-jruby-9.1.7.0") + end end end it "handles app with output in their Gemfile" do Hatchet::App.new("problem_gemfile_version").in_directory_fork do |dir| - run!(%{echo '\nputs "some output"\n' >> Gemfile}) - expect(@bundler.ruby_version).to eq("ruby-2.5.1-p0") + Bundler.with_unbundled_env do + @bundler.install + + run!(%{echo '\nputs "some output"\n' >> Gemfile}) + expect(@bundler.ruby_version).to eq("ruby-2.5.1-p0") + end end end end diff --git a/spec/helpers/jvm_installer_spec.rb b/spec/helpers/jvm_installer_spec.rb deleted file mode 100644 index 7a4d806b3..000000000 --- a/spec/helpers/jvm_installer_spec.rb +++ /dev/null @@ -1,92 +0,0 @@ -require 'spec_helper' - -describe "JvmInstall" do - - it "downloads custom JDK" do - Dir.mktmpdir do |dir| - Dir.chdir(dir) do - begin - ENV['JDK_URL_1_8'] = "http://lang-jvm.s3.amazonaws.com/jdk/openjdk1.8.0_51-cedar14.tar.gz" - - jvm_installer = LanguagePack::Helpers::JvmInstaller.new(dir, "heroku-16") - jvm_installer.install("9.0.1.0") - - expect(`ls bin`).to match("java") - expect(`cat release 2>&1`).to match("1.8.0_51") - ensure - ENV['JDK_URL_1_8'] = nil - end - end - end - end - - it "downloads standard JDK 7" do - Dir.mktmpdir do |dir| - Dir.chdir(dir) do - File.open('system.properties', 'w') { |f| f.write("java.runtime.version=1.7") } - - jvm_installer = LanguagePack::Helpers::JvmInstaller.new(dir, "heroku-16") - jvm_installer.install("9.0.1.0") - - expect(`ls bin`).to match("java") - expect(`cat release 2>&1`).not_to match("1.8.0") - expect(`cat release 2>&1`).to match("1.7.0") - end - end - end - - it "downloads standard JDK 9" do - Dir.mktmpdir do |dir| - Dir.chdir(dir) do - File.open('system.properties', 'w') { |f| f.write("java.runtime.version=1.9") } - - jvm_installer = LanguagePack::Helpers::JvmInstaller.new(dir, "heroku-16") - jvm_installer.install("9.0.1.0") - - expect(`ls bin`).to match("java") - expect(`cat release 2>&1`).not_to match("1.8.0") - expect(`cat release 2>&1`).to match("9") - end - end - end - - it "downloads previous JDK version" do - Dir.mktmpdir do |dir| - Dir.chdir(dir) do - File.open('system.properties', 'w') { |f| f.write("java.runtime.version=1.8.0_51") } - - jvm_installer = LanguagePack::Helpers::JvmInstaller.new(dir, "cedar-14") - jvm_installer.install("9.0.1.0") - - expect(`ls bin`).to match("java") - expect(`cat release 2>&1`).to match("1.8.0_51") - end - end - end - - it "downloads default JDK" do - Dir.mktmpdir do |dir| - Dir.chdir(dir) do - jvm_installer = LanguagePack::Helpers::JvmInstaller.new(dir, "heroku-16") - jvm_installer.install("9.0.1.0") - - expect(`ls bin`).to match("java") - expect(`cat release 2>&1`).not_to match("1.8.0_51") - expect(`cat release 2>&1`).to match("1.8.0") - expect(`ls #{dir}/jre/lib/ext`).to match("pgconfig.jar") - end - end - end - - it "fails download gracefully" do - Dir.mktmpdir do |dir| - Dir.chdir(dir) do - File.open('system.properties', 'w') { |f| f.write("java.runtime.version=foobar") } - - jvm_installer = LanguagePack::Helpers::JvmInstaller.new(dir, "heroku-16") - - expect{ jvm_installer.install("9.0.1.0") }.to raise_error(BuildpackError) - end - end - end -end diff --git a/spec/helpers/ruby_version_spec.rb b/spec/helpers/ruby_version_spec.rb index 1fe2eff89..46a8d28cb 100644 --- a/spec/helpers/ruby_version_spec.rb +++ b/spec/helpers/ruby_version_spec.rb @@ -17,25 +17,23 @@ end it "knows the next logical version" do - Hatchet::App.new("ruby_25").in_directory_fork do |dir| - ruby_version = LanguagePack::RubyVersion.new(@bundler.install.ruby_version, is_new: true) - version_number = "2.5.0" - version = "ruby-#{version_number}" - - expect(ruby_version.version_without_patchlevel).to eq(version) - expect(ruby_version.next_logical_version).to eq("ruby-2.5.1") - expect(ruby_version.next_logical_version).to eq("ruby-2.5.1") - expect(ruby_version.next_logical_version(2)).to eq("ruby-2.5.2") - expect(ruby_version.next_logical_version(20)).to eq("ruby-2.5.20") - - # Minor version - expect(ruby_version.next_minor_version).to eq("ruby-2.6.0") - expect(ruby_version.next_minor_version(2)).to eq("ruby-2.7.0") - - # Major Version - expect(ruby_version.next_major_version).to eq("ruby-3.0.0") - expect(ruby_version.next_major_version(2)).to eq("ruby-4.0.0") - end + version_number = "2.5.0" + ruby_version = LanguagePack::RubyVersion.new("ruby-#{version_number}-p0", is_new: true) + version = "ruby-#{version_number}" + + expect(ruby_version.version_without_patchlevel).to eq(version) + expect(ruby_version.next_logical_version).to eq("ruby-2.5.1") + expect(ruby_version.next_logical_version).to eq("ruby-2.5.1") + expect(ruby_version.next_logical_version(2)).to eq("ruby-2.5.2") + expect(ruby_version.next_logical_version(20)).to eq("ruby-2.5.20") + + # Minor version + expect(ruby_version.next_minor_version).to eq("ruby-2.6.0") + expect(ruby_version.next_minor_version(2)).to eq("ruby-2.7.0") + + # Major Version + expect(ruby_version.next_major_version).to eq("ruby-3.0.0") + expect(ruby_version.next_major_version(2)).to eq("ruby-4.0.0") end it "does not include patchlevels when the patchlevel is negative for download" do @@ -64,66 +62,76 @@ it "correctly sets ruby version for bundler specified versions" do Hatchet::App.new("mri_193").in_directory_fork do |dir| - ruby_version = LanguagePack::RubyVersion.new(@bundler.install.ruby_version, is_new: true) - version_number = "1.9.3" - version = "ruby-#{version_number}" - expect(ruby_version.version_without_patchlevel).to eq(version) - expect(ruby_version.engine_version).to eq(version_number) - expect(ruby_version.to_gemfile).to eq("ruby '#{version_number}'") - expect(ruby_version.engine).to eq(:ruby) + Bundler.with_unbundled_env do + ruby_version = LanguagePack::RubyVersion.new(@bundler.install.ruby_version, is_new: true) + version_number = "1.9.3" + version = "ruby-#{version_number}" + expect(ruby_version.version_without_patchlevel).to eq(version) + expect(ruby_version.engine_version).to eq(version_number) + expect(ruby_version.to_gemfile).to eq("ruby '#{version_number}'") + expect(ruby_version.engine).to eq(:ruby) + end end end it "correctly sets default ruby versions" do Hatchet::App.new("default_ruby").in_directory_fork do |dir| - ruby_version = LanguagePack::RubyVersion.new(@bundler.install.ruby_version, is_new: true) - version_number = LanguagePack::RubyVersion::DEFAULT_VERSION_NUMBER - version = LanguagePack::RubyVersion::DEFAULT_VERSION - expect(ruby_version.version_without_patchlevel).to eq(version) - expect(ruby_version.engine_version).to eq(version_number) - expect(ruby_version.to_gemfile).to eq("ruby '#{version_number}'") - expect(ruby_version.engine).to eq(:ruby) - expect(ruby_version.default?).to eq(true) + Bundler.with_unbundled_env do + ruby_version = LanguagePack::RubyVersion.new(@bundler.install.ruby_version, is_new: true) + version_number = LanguagePack::RubyVersion::DEFAULT_VERSION_NUMBER + version = LanguagePack::RubyVersion::DEFAULT_VERSION + expect(ruby_version.version_without_patchlevel).to eq(version) + expect(ruby_version.engine_version).to eq(version_number) + expect(ruby_version.to_gemfile).to eq("ruby '#{version_number}'") + expect(ruby_version.engine).to eq(:ruby) + expect(ruby_version.default?).to eq(true) + end end end it "correctly sets default legacy version" do Hatchet::App.new("default_ruby").in_directory_fork do |dir| - ruby_version = LanguagePack::RubyVersion.new(@bundler.install.ruby_version, is_new: false) - version_number = LanguagePack::RubyVersion::LEGACY_VERSION_NUMBER - version = LanguagePack::RubyVersion::LEGACY_VERSION - expect(ruby_version.version_without_patchlevel).to eq(version) - expect(ruby_version.engine_version).to eq(version_number) - expect(ruby_version.to_gemfile).to eq("ruby '#{version_number}'") - expect(ruby_version.engine).to eq(:ruby) + Bundler.with_unbundled_env do + ruby_version = LanguagePack::RubyVersion.new(@bundler.install.ruby_version, is_new: false) + version_number = LanguagePack::RubyVersion::LEGACY_VERSION_NUMBER + version = LanguagePack::RubyVersion::LEGACY_VERSION + expect(ruby_version.version_without_patchlevel).to eq(version) + expect(ruby_version.engine_version).to eq(version_number) + expect(ruby_version.to_gemfile).to eq("ruby '#{version_number}'") + expect(ruby_version.engine).to eq(:ruby) + end end end it "detects Ruby 2.0.0" do Hatchet::App.new("mri_200").in_directory_fork do |dir| - ruby_version = LanguagePack::RubyVersion.new(@bundler.install.ruby_version, is_new: true) - version_number = "2.0.0" - version = "ruby-#{version_number}" - expect(ruby_version.version_without_patchlevel).to eq(version) - expect(ruby_version.engine_version).to eq(version_number) - expect(ruby_version.to_gemfile).to eq("ruby '#{version_number}'") - expect(ruby_version.engine).to eq(:ruby) + Bundler.with_unbundled_env do + ruby_version = LanguagePack::RubyVersion.new(@bundler.install.ruby_version, is_new: true) + version_number = "2.0.0" + version = "ruby-#{version_number}" + expect(ruby_version.version_without_patchlevel).to eq(version) + expect(ruby_version.engine_version).to eq(version_number) + expect(ruby_version.to_gemfile).to eq("ruby '#{version_number}'") + expect(ruby_version.engine).to eq(:ruby) + end end end it "detects non mri engines" do Hatchet::App.new("ruby_193_jruby_173").in_directory_fork do |dir| - ruby_version = LanguagePack::RubyVersion.new(@bundler.install.ruby_version, is_new: true) - version_number = "1.9.3" - engine_version = "1.7.3" - engine = :jruby - version = "ruby-#{version_number}-#{engine}-#{engine_version}" - to_gemfile = "ruby '#{version_number}', :engine => '#{engine}', :engine_version => '#{engine_version}'" - expect(ruby_version.version_without_patchlevel).to eq(version) - expect(ruby_version.engine_version).to eq(engine_version) - expect(ruby_version.to_gemfile).to eq(to_gemfile) - expect(ruby_version.engine).to eq(engine) + Bundler.with_unbundled_env do + ruby_version = LanguagePack::RubyVersion.new(@bundler.install.ruby_version, is_new: true) + version_number = "1.9.3" + engine_version = "1.7.3" + engine = :jruby + version = "ruby-#{version_number}-#{engine}-#{engine_version}" + to_gemfile = "ruby '#{version_number}', :engine => '#{engine}', :engine_version => '#{engine_version}'" + expect(ruby_version.version_without_patchlevel).to eq(version) + expect(ruby_version.engine_version).to eq(engine_version) + expect(ruby_version.to_gemfile).to eq(to_gemfile) + expect(ruby_version.engine).to eq(engine) + end end end @@ -131,8 +139,10 @@ bundle_error_msg = "Zomg der was a problem in da gemfile" error_klass = LanguagePack::Helpers::BundlerWrapper::GemfileParseError Hatchet::App.new("bad_gemfile_on_platform").in_directory_fork do |dir| - @bundler = LanguagePack::Helpers::BundlerWrapper.new().install - expect { LanguagePack::RubyVersion.new(@bundler.ruby_version) }.to raise_error(error_klass, /#{Regexp.escape(bundle_error_msg)}/) + Bundler.with_unbundled_env do + @bundler = LanguagePack::Helpers::BundlerWrapper.new().install + expect { LanguagePack::RubyVersion.new(@bundler.ruby_version) }.to raise_error(error_klass, /#{Regexp.escape(bundle_error_msg)}/) + end end end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 84b3a4e74..70d6ddd7e 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -80,3 +80,7 @@ def wait_for_dyno_boot(app, ps_name = "web", sleep_val = 1) def web_boot_status(app) wait_for_dyno_boot(app)["state"] end + +def root_dir + Pathname(__dir__).join("..") +end diff --git a/spec/unit/bash_functions_spec.rb b/spec/unit/bash_functions_spec.rb new file mode 100644 index 000000000..5226e656d --- /dev/null +++ b/spec/unit/bash_functions_spec.rb @@ -0,0 +1,123 @@ +require 'spec_helper' + +describe "Bash functions" do + it "Detects jruby in the Gemfile.lock" do + Dir.mktmpdir do |dir| + dir = Pathname(dir) + dir.join("Gemfile.lock").write <<~EOM + RUBY VERSION + ruby 2.5.7p001 (jruby 9.2.13.0) + EOM + + + out = exec_with_bash_functions <<~EOM + which_java() + { + return 1 + } + + if detect_needs_java "#{dir}"; then + echo "jruby detected" + else + echo "nope" + fi + EOM + + expect(out).to eq("jruby detected") + + dir.join("Gemfile.lock").write <<~EOM + EOM + + out = exec_with_bash_functions <<~EOM + which_java() + { + return 1 + } + + if detect_needs_java "#{dir}"; then + echo "jruby detected" + else + echo "nope" + fi + EOM + + expect(out).to eq("nope") + end + end + + it "Detects java for jruby detection" do + Dir.mktmpdir do |dir| + dir = Pathname(dir) + dir.join("Gemfile.lock").write <<~EOM + RUBY VERSION + ruby 2.5.7p001 (jruby 9.2.13.0) + EOM + + out = exec_with_bash_functions <<~EOM + which_java() + { + return 0 + } + + if detect_needs_java "#{dir}"; then + echo "jruby detected" + else + echo "already installed" + fi + EOM + + expect(out).to eq("already installed") + end + end + + + def bash_functions_file + root_dir.join("bin", "support", "bash_functions.sh") + end + + def exec_with_bash_functions(code, stack: "heroku-18") + contents = <<~EOM + #! /usr/bin/env bash + set -eu + + STACK="#{stack}" + + #{bash_functions_file.read} + + #{code} + EOM + + file = Tempfile.new + file.write(contents) + file.close + FileUtils.chmod("+x", file.path) + + out = nil + success = false + begin + Timeout.timeout(60) do + out = `#{file.path} 2>&1`.strip + success = $?.success? + end + rescue Timeout::Error + out = "Command timed out" + success = false + end + unless success + message = <<~EOM + Contents: + + #{contents.lines.map.with_index { |line, number| " #{number.next} #{line.chomp}"}.join("\n") } + + Expected running script to succeed, but it did not + + Output: + + #{out} + EOM + + raise message + end + out + end +end From 3dab1a3a0f4ec4955366d005eb16a06df4c02c57 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Wed, 24 Feb 2021 14:27:49 -0600 Subject: [PATCH 0787/1195] v224 (#1128) --- CHANGELOG.md | 2 ++ changelogs/v224/.gitkeep | 0 changelogs/{unreleased => v224}/jvm_installer_default.md | 0 lib/language_pack/version.rb | 2 +- 4 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/v224/.gitkeep rename changelogs/{unreleased => v224}/jvm_installer_default.md (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index e1305f3a7..30cd5ea3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Main (unreleased) +## v224 (2/25/2021) + * Ruby buildpack now relies on the JVM buildpack to install java for Jruby apps (https://github.com/heroku/heroku-buildpack-ruby/pull/1119) ## v223 (1/22/2021) diff --git a/changelogs/v224/.gitkeep b/changelogs/v224/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/changelogs/unreleased/jvm_installer_default.md b/changelogs/v224/jvm_installer_default.md similarity index 100% rename from changelogs/unreleased/jvm_installer_default.md rename to changelogs/v224/jvm_installer_default.md diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 68ade4843..47a96ab45 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v223" + BUILDPACK_VERSION = "v224" end end From 18900862f9e2ba66a39fba47ed4e94f3639b4f25 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Thu, 25 Feb 2021 10:31:55 -0600 Subject: [PATCH 0788/1195] Update buildpack tests (#1131) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The heroku-16 stack is deprecated. With heroku-20 tests were failing: ``` -----> Building on the Heroku-20 stack -----> Fetching https://github.com/heroku/heroku-buildpack-cli.git buildpack... buildpack downloaded -----> Fetching https://github.com/heroku/heroku-buildpack-ruby#v211 buildpack... buildpack downloaded -----> heroku-cli app detected === Fetching and vendoring Heroku CLI into slug === Installing profile.d script › Warning: Our terms of service have changed: › https://dashboard.heroku.com/terms-of-service heroku/7.49.0 linux-x64 node-v12.16.2 === Heroku CLI installation done -----> Ruby app detected Failed to download a Ruby executable for bootstrapping! This is most likely a temporary internal error. If the problem persists, make sure that you are not running a custom or forked version of the Heroku Ruby buildpack which may need updating. /tmp/buildpacks/b2f3365577702f34ed6e4203939f02452cc3ab33/bin/test-compile: line 11: /tmp/tmp.KitelDjTSM/bin/ruby: No such file or directory ``` This commit ensures we're testing against the latest buildpack release instead of a very old tag. In addition, we're dropping building cedar-14 and adding the download url to the above error message. --- app.json | 2 +- bin/support/download_ruby | 2 ++ buildpack.toml | 3 --- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app.json b/app.json index e1ec3778e..ab7affa4f 100644 --- a/app.json +++ b/app.json @@ -24,7 +24,7 @@ }, "buildpacks": [ { "url": "https://github.com/heroku/heroku-buildpack-cli.git" }, - { "url": "https://github.com/heroku/heroku-buildpack-ruby#v211" } + { "url": "heroku/ruby" } ] } } diff --git a/bin/support/download_ruby b/bin/support/download_ruby index 9b4f74bd1..0fe10bb94 100755 --- a/bin/support/download_ruby +++ b/bin/support/download_ruby @@ -41,6 +41,8 @@ cat< Date: Thu, 25 Feb 2021 11:29:23 -0600 Subject: [PATCH 0789/1195] [close #1126] Update bundler to 2.2.11 (#1132) Bundler < 2.2.10 has "Source Priority" vulnerability #1126. This PR updates bundler to the latest version (2.2.11). --- CHANGELOG.md | 2 ++ changelogs/unreleased/bundler_2_2_11.md | 3 +++ lib/language_pack/helpers/bundler_wrapper.rb | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 changelogs/unreleased/bundler_2_2_11.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 30cd5ea3f..be4c048f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Main (unreleased) +* Bundler 2.x is now 2.2.11 (https://github.com/heroku/heroku-buildpack-ruby/pull/1132) + ## v224 (2/25/2021) * Ruby buildpack now relies on the JVM buildpack to install java for Jruby apps (https://github.com/heroku/heroku-buildpack-ruby/pull/1119) diff --git a/changelogs/unreleased/bundler_2_2_11.md b/changelogs/unreleased/bundler_2_2_11.md new file mode 100644 index 000000000..0abae2143 --- /dev/null +++ b/changelogs/unreleased/bundler_2_2_11.md @@ -0,0 +1,3 @@ +## Ruby apps with Bundler 2.x now receive version 2.2.11 + +The [Ruby Buildpack](https://devcenter.heroku.com/articles/ruby-support#libraries) now includes Bundler 2.2.11. Applications specifying Bundler 2.x in their `Gemfile.lock` will now receive this version of bundler. diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index fef24a91e..d4a61219f 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -37,7 +37,7 @@ class LanguagePack::Helpers::BundlerWrapper BLESSED_BUNDLER_VERSIONS = {} BLESSED_BUNDLER_VERSIONS["1"] = "1.17.3" - BLESSED_BUNDLER_VERSIONS["2"] = "2.1.4" + BLESSED_BUNDLER_VERSIONS["2"] = "2.2.11" BUNDLED_WITH_REGEX = /^BUNDLED WITH$(\r?\n) (?\d+)\.\d+\.\d+/m class GemfileParseError < BuildpackError From 359aeac0472889ad1037c411ea2a08a764a5224e Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Thu, 25 Feb 2021 12:37:18 -0600 Subject: [PATCH 0790/1195] Release v225 (#1133) --- CHANGELOG.md | 4 +++- changelogs/{unreleased => v225}/bundler_2_2_11.md | 0 lib/language_pack/version.rb | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) rename changelogs/{unreleased => v225}/bundler_2_2_11.md (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index be4c048f6..425613a68 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,10 @@ # Main (unreleased) +## v225 (2/25/2021) + * Bundler 2.x is now 2.2.11 (https://github.com/heroku/heroku-buildpack-ruby/pull/1132) -## v224 (2/25/2021) +## v224 (2/24/2021) * Ruby buildpack now relies on the JVM buildpack to install java for Jruby apps (https://github.com/heroku/heroku-buildpack-ruby/pull/1119) diff --git a/changelogs/unreleased/bundler_2_2_11.md b/changelogs/v225/bundler_2_2_11.md similarity index 100% rename from changelogs/unreleased/bundler_2_2_11.md rename to changelogs/v225/bundler_2_2_11.md diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 47a96ab45..96ad793f2 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v224" + BUILDPACK_VERSION = "v225" end end From 945a03e7cd86777ffdcfa46e1a460439251084cc Mon Sep 17 00:00:00 2001 From: Manuel Fuchs Date: Thu, 4 Mar 2021 16:39:02 +0100 Subject: [PATCH 0791/1195] Add CNB release scripts (#1136) --- .../scripts/release-workflow-package-push.sh | 44 +++++++++ .../scripts/release-workflow-prepare-pr.sh | 94 +++++++++++++++++++ .github/workflows/release.yml | 69 ++++++++++++++ buildpack.toml | 9 +- 4 files changed, 215 insertions(+), 1 deletion(-) create mode 100755 .github/scripts/release-workflow-package-push.sh create mode 100755 .github/scripts/release-workflow-prepare-pr.sh create mode 100644 .github/workflows/release.yml diff --git a/.github/scripts/release-workflow-package-push.sh b/.github/scripts/release-workflow-package-push.sh new file mode 100755 index 000000000..1b2fd8087 --- /dev/null +++ b/.github/scripts/release-workflow-package-push.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash +set -euo pipefail + +# This script is an integral part of the release workflow: .github/workflows/release.yml +# It requires the following environment variables to function correctly: +# +# REQUESTED_BUILDPACK_ID - The ID of the buildpack to package and push to the container registry. + +while IFS="" read -r -d "" buildpack_toml_path; do + buildpack_id="$(yj -t <"${buildpack_toml_path}" | jq -r .buildpack.id)" + buildpack_version="$(yj -t <"${buildpack_toml_path}" | jq -r .buildpack.version)" + buildpack_docker_repository="$(yj -t <"${buildpack_toml_path}" | jq -r .metadata.release.docker.repository)" + buildpack_path=$(dirname "${buildpack_toml_path}") + buildpack_build_path="${buildpack_path}" + + if [[ $buildpack_id == "${REQUESTED_BUILDPACK_ID}" ]]; then + # Some buildpacks require a build step before packaging. If we detect a build.sh script, we execute it and + # modify the buildpack_build_path variable to point to the directory with the built buildpack instead. + if [[ -f "${buildpack_path}/build.sh" ]]; then + echo "Buildpack has build script, executing..." + "${buildpack_path}/build.sh" + echo "Build finished!" + + buildpack_build_path="${buildpack_path}/target" + fi + + image_name="${buildpack_docker_repository}:${buildpack_version}" + pack package-buildpack --config "${buildpack_build_path}/package.toml" --publish "${image_name}" + + # We might have local changes after building and/or shimming the buildpack. To ensure scripts down the pipeline + # work with a clean state, we reset all local changes here. + git reset --hard + git clean -fdx + + echo "::set-output name=id::${buildpack_id}" + echo "::set-output name=version::${buildpack_version}" + echo "::set-output name=path::${buildpack_path}" + echo "::set-output name=address::${buildpack_docker_repository}@$(crane digest "${image_name}")" + exit 0 + fi +done < <(find . -name buildpack.toml -print0) + +echo "Could not find requested buildpack with id ${REQUESTED_BUILDPACK_ID}!" +exit 1 diff --git a/.github/scripts/release-workflow-prepare-pr.sh b/.github/scripts/release-workflow-prepare-pr.sh new file mode 100755 index 000000000..59cd9c960 --- /dev/null +++ b/.github/scripts/release-workflow-prepare-pr.sh @@ -0,0 +1,94 @@ +#!/usr/bin/env bash +set -euo pipefail + +released_buildpack_id="${1:?}" +released_buildpack_version="${2:?}" +released_buildpack_image_address="${3:?}" + +released_buildpack_next_version=$( + echo "${released_buildpack_version}" | awk -F. -v OFS=. '{ $NF=sprintf("%d\n", ($NF+1)); printf $0 }' +) + +function escape_for_sed() { + echo "${1:?}" | sed 's/[]\/\[\.]/\\&/g' +} + +function is_meta_buildpack_with_dependency() { + local -r buildpack_toml_path="${1:?}" + local -r buildpack_id="${2:?}" + + yj -t <"${buildpack_toml_path}" | jq -e "[.order[]?.group[]?.id | select(. == \"${buildpack_id}\")] | length > 0" >/dev/null +} + +function package_toml_contains_image_address_root() { + local -r package_toml_path="${1:?}" + local -r image_address_root="${2:?}" + + yj -t <"${package_toml_path}" | jq -e "[.dependencies[].uri | select(startswith(\"${image_address_root}\"))] | length > 0" >/dev/null +} + +# This is the heading we're looking for when updating CHANGELOG.md files +unreleased_heading=$(escape_for_sed "## [Unreleased]") + +while IFS="" read -r -d "" buildpack_toml_path; do + buildpack_id="$(yj -t <"${buildpack_toml_path}" | jq -r .buildpack.id)" + buildpack_path="$(dirname "${buildpack_toml_path}")" + buildpack_package_toml_path="${buildpack_path}/package.toml" + buildpack_changelog_path="${buildpack_path}/CHANGELOG.md" + + jq_filter="." + + # Update the released buildpack itself + if [[ "${buildpack_id}" == "${released_buildpack_id}" ]]; then + if [[ -f "${buildpack_changelog_path}" ]]; then + new_version_heading=$(escape_for_sed "## [${released_buildpack_version}] $(date +%Y/%m/%d)") + sed -i "s/${unreleased_heading}/${unreleased_heading}\n\n${new_version_heading}/" "${buildpack_changelog_path}" + fi + + jq_filter=".buildpack.version = \"${released_buildpack_next_version}\"" + + # Update meta-buildpacks that have the released buildpack as a dependency + elif is_meta_buildpack_with_dependency "${buildpack_toml_path}" "${released_buildpack_id}"; then + # There are two cases of meta-buildpacks that reference the released buildpack: + # + # 1. The released buildpack is referenced by a local path. In this case, we need to update the reference to + # the next version, not the released version. + # 2. The released buildpack is referenced by a Docker address. In this case, we need to update the reference + # to the released version instead. + target_version_for_meta_buildpack="${released_buildpack_next_version}" + + released_buildpack_image_address_root="${released_buildpack_image_address%@*}" + if package_toml_contains_image_address_root "${buildpack_package_toml_path}" "${released_buildpack_image_address_root}"; then + target_version_for_meta_buildpack="${released_buildpack_version}" + + package_toml_filter=".dependencies[].uri |= if startswith(\"${released_buildpack_image_address_root}\") then \"${released_buildpack_image_address}\" else . end" + updated_package_toml=$(yj -t <"${buildpack_package_toml_path}" | jq "${package_toml_filter}" | yj -jt) + echo "${updated_package_toml}" >"${buildpack_package_toml_path}" + fi + + if [[ -f "${buildpack_changelog_path}" ]]; then + upgrade_entry=$( + escape_for_sed "* Upgraded \`${released_buildpack_id}\` to \`${target_version_for_meta_buildpack}\`" + ) + + sed -i "s/${unreleased_heading}/${unreleased_heading}\n${upgrade_entry}/" "${buildpack_changelog_path}" + fi + + jq_filter=$( + cat <<-EOF + .order |= map(.group |= map( + if .id == "${released_buildpack_id}" then + .version |= "${target_version_for_meta_buildpack}" + else + . + end + )) + EOF + ) + fi + + # Write the filtered buildpack.toml to disk... + updated=$(yj -t <"${buildpack_toml_path}" | jq "${jq_filter}" | yj -jt) + echo "${updated}" >"${buildpack_toml_path}" + +done < <(find . -name buildpack.toml -print0) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..b223cb98e --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,69 @@ +name: Release Buildpack +on: + workflow_dispatch: + inputs: + requested_buildpack_id: + description: "Buildpack ID" + required: true + +jobs: + release: + name: Release ${{ github.event.inputs.requested_buildpack_id }} + runs-on: ubuntu-20.04 # ubuntu-latest currently resolves to 18.04 which does not have aws-cli 2.x yet + env: + REQUESTED_BUILDPACK_ID: ${{ github.event.inputs.requested_buildpack_id }} + steps: + - id: checkout + name: "Checkout code" + uses: actions/checkout@v2 + - id: setup-pack + name: "Setup pack" + uses: buildpacks/github-actions/setup-pack@v4.0.0 + - id: login + name: "Login to public ECR" + uses: docker/login-action@v1 + with: + registry: public.ecr.aws + username: ${{ secrets.AWS_ACCESS_KEY_ID }} + password: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + env: + AWS_REGION: us-east-1 + - id: package + name: "Package buildpack and publish to container registry" + run: ./.github/scripts/release-workflow-package-push.sh + shell: bash + - id: add-registry-entry + name: "Request Registry Entry" + uses: docker://ghcr.io/buildpacks/actions/registry/request-add-entry:4.0.0 + with: + token: ${{ secrets.PUBLIC_REPO_TOKEN }} + id: ${{ steps.package.outputs.id }} + version: ${{ steps.package.outputs.version }} + address: ${{ steps.package.outputs.address }} + - id: create_release + name: Create Release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ steps.package.outputs.id }}_${{ steps.package.outputs.version }} + release_name: ${{ steps.package.outputs.id }} ${{ steps.package.outputs.version }} + body: | + Find the changelog here: [CHANGELOG](${{ steps.package.outputs.path }}/CHANGELOG.md) + Docker: `docker pull ${{ steps.package.outputs.address }}` + draft: false + prerelease: false + - id: prepare-pr + name: "Prepare PR with version bumps and CHANGELOG updates" + run: ./.github/scripts/release-workflow-prepare-pr.sh "${{ steps.package.outputs.id }}" "${{ steps.package.outputs.version }}" "docker://${{ steps.package.outputs.address }}" + shell: bash + - name: Create Pull Request + uses: peter-evans/create-pull-request@v3 + with: + title: "Post-release updates: ${{ steps.package.outputs.id }} ${{ steps.package.outputs.version }}" + commit-message: "Post-release updates: ${{ steps.package.outputs.id }} ${{ steps.package.outputs.version }}" + branch-suffix: "random" + labels: "automation" + body: | + Automated pull-request to update buildpack versions and changelogs + after releasing version `${{ steps.package.outputs.version }}` of `${{ steps.package.outputs.id }}`. diff --git a/buildpack.toml b/buildpack.toml index 7ceeb9ebc..b4b572839 100644 --- a/buildpack.toml +++ b/buildpack.toml @@ -2,7 +2,7 @@ api = "0.2" [buildpack] id = "heroku/ruby" -version = "0.0.1" +version = "0.1.0" name = "Ruby" ruby_version = "2.6.6" @@ -31,3 +31,10 @@ id = "heroku-18" [[stacks]] id = "heroku-20" + +[metadata] + +[metadata.release] + +[metadata.release.docker] +repository = "public.ecr.aws/r2f9u0w4/heroku-ruby-buildpack" From c15a41c035db69a3c1a8a3aeb3dd517f41aafccb Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Thu, 4 Mar 2021 10:04:41 -0600 Subject: [PATCH 0792/1195] Add package.toml (#1137) This is needed for the new CNB release workflow. --- package.toml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 package.toml diff --git a/package.toml b/package.toml new file mode 100644 index 000000000..54b0d2e45 --- /dev/null +++ b/package.toml @@ -0,0 +1,2 @@ +[buildpack] +uri = "." From 77021deb9c82a56e3eecb935676b18ef136bbd14 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 4 Mar 2021 10:51:44 -0600 Subject: [PATCH 0793/1195] Post-release updates: heroku/ruby 0.1.0 (#1138) Co-authored-by: schneems --- buildpack.toml | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/buildpack.toml b/buildpack.toml index b4b572839..f6d94ebdb 100644 --- a/buildpack.toml +++ b/buildpack.toml @@ -2,29 +2,31 @@ api = "0.2" [buildpack] id = "heroku/ruby" -version = "0.1.0" +version = "0.1.1" name = "Ruby" ruby_version = "2.6.6" - [publish.Ignore] - files = [ - "spec/" - ] - - [[publish.Vendor]] - # get tokens for logging build tokens - url = "https://codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/ruby.tgz" - dir = "." - files = ["./.env"] - [[publish.Vendor]] - url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-16/ruby-2.6.6.tgz" - dir = "vendor/ruby/heroku-16" - [[publish.Vendor]] - url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-18/ruby-2.6.6.tgz" - dir = "vendor/ruby/heroku-18" - [[publish.Vendor]] - url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-20/ruby-2.6.6.tgz" - dir = "vendor/ruby/heroku-20" +[publish] + +[publish.Ignore] +files = ["spec/"] + +[[publish.Vendor]] +url = "https://codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/ruby.tgz" +dir = "." +files = ["./.env"] + +[[publish.Vendor]] +url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-16/ruby-2.6.6.tgz" +dir = "vendor/ruby/heroku-16" + +[[publish.Vendor]] +url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-18/ruby-2.6.6.tgz" +dir = "vendor/ruby/heroku-18" + +[[publish.Vendor]] +url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-20/ruby-2.6.6.tgz" +dir = "vendor/ruby/heroku-20" [[stacks]] id = "heroku-18" From a09bc9b2c7fedc31dcaa27e42724936586cb021a Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Wed, 10 Mar 2021 14:06:59 -0600 Subject: [PATCH 0794/1195] Use correct method name in script #1129 (#1129) There's a bug in the release script: ``` $ be rake buildpack:release Attempting to deploy v224, overwrite with RELEASE_VERSION env var rake aborted! NameError: undefined local variable or method `local_commit' for # Did you mean? local_commit_sha /Users/rschneeman/Documents/projects/work/heroku-buildpack-ruby/lib/rake/deploy_check.rb:51:in `remote_tag_matches?' /Users/rschneeman/Documents/projects/work/heroku-buildpack-ruby/lib/rake/deploy_check.rb:36:in `push_tag?' /Users/rschneeman/Documents/projects/work/heroku-buildpack-ruby/Rakefile:74:in `block (2 levels) in ' /Users/rschneeman/.gem/ruby/2.6.6/gems/rake-13.0.1/exe/rake:27:in `' /Users/rschneeman/.gem/ruby/2.6.6/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:63:in `load' /Users/rschneeman/.gem/ruby/2.6.6/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:63:in `kernel_load' /Users/rschneeman/.gem/ruby/2.6.6/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:28:in `run' /Users/rschneeman/.gem/ruby/2.6.6/gems/bundler-2.1.4/lib/bundler/cli.rb:476:in `exec' /Users/rschneeman/.gem/ruby/2.6.6/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run' /Users/rschneeman/.gem/ruby/2.6.6/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command' /Users/rschneeman/.gem/ruby/2.6.6/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor.rb:399:in `dispatch' /Users/rschneeman/.gem/ruby/2.6.6/gems/bundler-2.1.4/lib/bundler/cli.rb:30:in `dispatch' /Users/rschneeman/.gem/ruby/2.6.6/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/base.rb:476:in `start' /Users/rschneeman/.gem/ruby/2.6.6/gems/bundler-2.1.4/lib/bundler/cli.rb:24:in `start' /Users/rschneeman/.gem/ruby/2.6.6/gems/bundler-2.1.4/exe/bundle:46:in `block in ' /Users/rschneeman/.gem/ruby/2.6.6/gems/bundler-2.1.4/lib/bundler/friendly_errors.rb:123:in `with_friendly_errors' /Users/rschneeman/.gem/ruby/2.6.6/gems/bundler-2.1.4/exe/bundle:34:in `' /Users/rschneeman/.gem/ruby/2.6.6/bin/bundle:23:in `load' /Users/rschneeman/.gem/ruby/2.6.6/bin/bundle:23:in `
' Tasks: TOP => buildpack:release (See full trace by running task with --trace) ``` This commit fixes it. This class shells out to git so to test it, dependency injection is used in the tests and this method (which acts as a default arg) was never being called. --- lib/rake/deploy_check.rb | 4 ++-- spec/rake/deploy_check_spec.rb | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/lib/rake/deploy_check.rb b/lib/rake/deploy_check.rb index 0aa6d7cbd..d2cd40207 100644 --- a/lib/rake/deploy_check.rb +++ b/lib/rake/deploy_check.rb @@ -48,7 +48,7 @@ def tag_exists_on_remote? end # Returns a truthy value if the remote tag SHA matches the current local sha - def remote_tag_matches?(remote_sha: remote_commit_sha(next_version), local_sha: local_commit) + def remote_tag_matches?(remote_sha: remote_commit_sha(next_version), local_sha: local_commit_sha) remote_sha == local_sha end @@ -125,7 +125,7 @@ def run!(cmd) if block_given? yield out, $? else - raise "Command #{cmd} expected to return successfully did not: #{out}" + raise "Command #{cmd} expected to return successfully did not: #{out.inspect}" end end end diff --git a/spec/rake/deploy_check_spec.rb b/spec/rake/deploy_check_spec.rb index 52ff41c16..b9f97ae39 100644 --- a/spec/rake/deploy_check_spec.rb +++ b/spec/rake/deploy_check_spec.rb @@ -4,9 +4,18 @@ describe "A helper class for deploying" do describe "tests that hit github" do it "know remote tags" do - deploy = DeployCheck.new(github: "heroku/heroku-buildpack-ruby") - expect(deploy.remote_tag_array.class).to eq(Array) - expect(deploy.remote_tag_array).to include("v218") + Dir.mktmpdir do |dir| + Dir.chdir(dir) do + run!("touch foo; git init; git add .; git commit -m first") + + deploy = DeployCheck.new(github: "heroku/heroku-buildpack-ruby") + expect(deploy.remote_tag_array.class).to eq(Array) + expect(deploy.remote_tag_array).to include("v218") + + expect(deploy.remote_tag_matches?(local_sha: "nope")).to be_falsey + expect(deploy.remote_tag_matches?(remote_sha: "nope")).to be_falsey + end + end end it "remote sha" do From e5a8482fb961b4812c31632a3bff16ea30de5f6e Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Tue, 16 Mar 2021 13:40:17 -0500 Subject: [PATCH 0795/1195] Clean up CNB release process (#1139) - Delete old CNB automation - Skip changelog check on tag automation - Update username in buildpack.toml to `heroku-buildpacks` (Use ECR alias) --- .github/workflows/check_changelog.yml | 3 +- .github/workflows/release_cnb.yml | 55 --------------------------- buildpack.toml | 2 +- 3 files changed, 3 insertions(+), 57 deletions(-) delete mode 100644 .github/workflows/release_cnb.yml diff --git a/.github/workflows/check_changelog.yml b/.github/workflows/check_changelog.yml index 0fd96b05c..fe41a8044 100644 --- a/.github/workflows/check_changelog.yml +++ b/.github/workflows/check_changelog.yml @@ -6,7 +6,8 @@ on: jobs: build: if: | - !contains(github.event.pull_request.labels.*.name, 'dependencies') + !contains(github.event.pull_request.labels.*.name, 'dependencies') && + !contains(github.event.pull_request.labels.*.name, 'automation') runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 diff --git a/.github/workflows/release_cnb.yml b/.github/workflows/release_cnb.yml deleted file mode 100644 index 40a134464..000000000 --- a/.github/workflows/release_cnb.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: Release CNB - -on: [push] # Could use to push tags - -jobs: - build: - if: startsWith(github.ref, 'refs/tags/') - runs-on: ubuntu-latest - steps: - - name: Setup Ruby - uses: ruby/setup-ruby@v1.40.0 - with: - ruby-version: 2.6.6 - - uses: actions/checkout@v2 - - name: bundle install - run: bundle install --jobs 4 --retry 3 - - name: build tar file - run: bundle exec rake buildpack:tarball - - uses: actions/upload-artifact@v2 - with: - name: buildpack.tgz - path: buildpacks/* - - release: - if: startsWith(github.ref, 'refs/tags/') - needs: build - runs-on: ubuntu-latest - steps: - - name: 'Get Version' - run: | - [[ $GITHUB_REF =~ ^refs\/tags\/(.*)$ ]] && version=${BASH_REMATCH[1]} - echo "::set-env name=VERSION::$version" - - name: 'Download list binary' - uses: actions/download-artifact@v2 - with: - name: buildpack.tgz - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ env.VERSION }} - release_name: ${{ env.VERSION }} - draft: false - prerelease: false - - name: Upload Release Asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: heroku-buildpack-ruby-${{ env.VERSION }}.tgz - asset_name: heroku-buildpack-ruby-${{ env.VERSION }}.tgz - asset_content_type: application/gzip diff --git a/buildpack.toml b/buildpack.toml index f6d94ebdb..36700dd7d 100644 --- a/buildpack.toml +++ b/buildpack.toml @@ -39,4 +39,4 @@ id = "heroku-20" [metadata.release] [metadata.release.docker] -repository = "public.ecr.aws/r2f9u0w4/heroku-ruby-buildpack" +repository = "public.ecr.aws/heroku-buildpacks/heroku-ruby-buildpack" From b65092f942c5ceeec7faede40778b075ae324f23 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Tue, 6 Apr 2021 14:42:15 -0500 Subject: [PATCH 0796/1195] [changelog skip] Clean up mime magic in repos (#1145) Several versions of the mimemagic gem were yanked. This PR updates example apps that were relying on an older version that is no longer available. --- hatchet.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hatchet.lock b/hatchet.lock index 0a94efcd8..d08b738af 100644 --- a/hatchet.lock +++ b/hatchet.lock @@ -26,7 +26,7 @@ - - "./repos/ci/ruby_no_rails_test" - 3916137106d59b008b67d738abe6a1438f8fbde6 - - "./repos/heroku/ruby-getting-started" - - c300328cd71f7a903fc2701b53ddc99af711b7e0 + - main - - "./repos/jruby/jruby_naether" - 4a11f8af5a3cca21f3659394e5bbac3cca9b6a2c - - "./repos/node/minimal_webpacker" @@ -42,9 +42,9 @@ - - "./repos/rack/mri_200" - f9922cbd9c6f44fdded54912f66038db37cb4b8f - - "./repos/rails_versions/active_storage_local" - - e2119af6ddd4bc21fda9bc7da6401e7aa256e38d + - 18853ba7dda61745995740b4ca6f5f90bbd8afba - - "./repos/rails_versions/active_storage_non_local" - - cba59b7559f1f806684b65654228d44fcda91a82 + - 86dddf0127043abba1cb2890590a1d38f111edbd - - "./repos/rails_versions/rails3_default_ruby" - a6b44db674c0d3538633989295e2cfd5e8e1ba0d - - "./repos/rails_versions/rails42_default_ruby" @@ -56,11 +56,11 @@ - - "./repos/rails_versions/rails51_webpacker" - 75c5c4f21b1d88fc3b8edf60b3f871df3ad70208 - - "./repos/rails_versions/rails6-basic" - - 3b404ac714a16877781b7bf69f1b8a308df6c92f + - 6b81e0246c64c332181c22ace4ac96b57309cb85 - - "./repos/rails_versions/rails_lts_23_default_ruby" - 7178b2f97d3b2b3170b390d997dcb212dd52cd30 - - "./repos/rails_versions/sprockets_asset_compile_true" - - 98c6675cf97059278709cf75030e28063e0228d2 + - 6f3aa208046a5c79e84fc272f52f5ebb7b775755 - - "./repos/rake/asset_precompile_fail" - 16f7834331d6bb3fc5c284130b14eb1ff74d99d5 - - "./repos/rake/asset_precompile_not_found" From 28da80176ba7166e8fcf7214f43bf90c5e284fce Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Tue, 6 Apr 2021 14:52:40 -0500 Subject: [PATCH 0797/1195] [close 1135] Update bundler 2.x to 2.2.15 (#1144) --- CHANGELOG.md | 2 ++ changelogs/unreleased/bundler_2_2_15.md | 3 +++ lib/language_pack/helpers/bundler_wrapper.rb | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 changelogs/unreleased/bundler_2_2_15.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 425613a68..9f86922b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Main (unreleased) +* Bundler 2.x is now 2.2.15 (https://github.com/heroku/heroku-buildpack-ruby/pull/1144) + ## v225 (2/25/2021) * Bundler 2.x is now 2.2.11 (https://github.com/heroku/heroku-buildpack-ruby/pull/1132) diff --git a/changelogs/unreleased/bundler_2_2_15.md b/changelogs/unreleased/bundler_2_2_15.md new file mode 100644 index 000000000..48165ea8d --- /dev/null +++ b/changelogs/unreleased/bundler_2_2_15.md @@ -0,0 +1,3 @@ +## Ruby apps with Bundler 2.x now receive version 2.2.15 + +The [Ruby Buildpack](https://devcenter.heroku.com/articles/ruby-support#libraries) now includes Bundler 2.2.15. Applications specifying Bundler 2.x in their `Gemfile.lock` will now receive this version of bundler. diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index d4a61219f..4844c2655 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -37,7 +37,7 @@ class LanguagePack::Helpers::BundlerWrapper BLESSED_BUNDLER_VERSIONS = {} BLESSED_BUNDLER_VERSIONS["1"] = "1.17.3" - BLESSED_BUNDLER_VERSIONS["2"] = "2.2.11" + BLESSED_BUNDLER_VERSIONS["2"] = "2.2.15" BUNDLED_WITH_REGEX = /^BUNDLED WITH$(\r?\n) (?\d+)\.\d+\.\d+/m class GemfileParseError < BuildpackError From 5ac709986d90a5666dae736e5dfa4cbeb9453642 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Mon, 12 Apr 2021 10:37:02 -0500 Subject: [PATCH 0798/1195] [changelog skip] Remove Heroku-16 from tests: (#1146) ``` Hatchet::App::FailedDeployError: Could not deploy 'hatchet-t-5e1aedd6a2' (default_ruby) using 'Hatchet::GitApp' at path: 'test/fixtures/repos/ruby/default_ruby' if this was expected add `allow_failure: true` to your deploy hash. Buildpack: nil Repo: https://git.heroku.com/hatchet-t-5e1aedd6a2.git output: remote: Compressing source files... done. remote: Building source: remote: remote: ! Your app is using the Heroku-16 stack, which will be end-of-life on May 1st, 2021. remote: ! remote: ! Builds on Heroku-16 will not be possible from June 1st, 2021. remote: ! remote: ! Please upgrade the stack of your app as soon as possible: remote: ! https://devcenter.heroku.com/articles/upgrading-to-the-latest-stack remote: ! remote: ! Heroku-16 EOL FAQ: https://help.heroku.com/0S5P41DC/heroku-16-end-of-life-faq remote: ! remote: ! THIS IS A ONE-OFF NOTICE. THE NEXT DEPLOY WILL FUNCTION WITHOUT INTERRUPTION. remote: ! remote: ! The next warning of this kind will occur in: 7 day(s). remote: To https://git.heroku.com/hatchet-t-5e1aedd6a2.git Collapse ``` --- spec/hatchet/stack_spec.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/hatchet/stack_spec.rb b/spec/hatchet/stack_spec.rb index 554922684..bd3228bac 100644 --- a/spec/hatchet/stack_spec.rb +++ b/spec/hatchet/stack_spec.rb @@ -3,8 +3,8 @@ describe "Stack Changes" do xit "should reinstall gems on stack change" do Hatchet::Runner.new('default_ruby', stack: "heroku-18").deploy do |app| - app.update_stack("heroku-16") - run!('git commit --allow-empty -m "heroku-16 migrate"') + app.update_stack("heroku-20") + run!('git commit --allow-empty -m "heroku-20 migrate"') app.push! @@ -14,8 +14,8 @@ end it "should not reinstall gems if the stack did not change" do - Hatchet::Runner.new('default_ruby', stack: "heroku-16").deploy do |app| - app.update_stack("heroku-16") + Hatchet::Runner.new('default_ruby', stack: "heroku-20").deploy do |app| + app.update_stack("heroku-20") run!(%Q{git commit --allow-empty -m "cedar migrate"}) app.push! From 9394f3f5242dccdddf4c57b6148862dc6b960ee8 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Tue, 13 Apr 2021 14:21:03 -0500 Subject: [PATCH 0799/1195] v226 (#1149) --- CHANGELOG.md | 2 ++ changelogs/{unreleased => v226}/bundler_2_2_15.md | 0 lib/language_pack/version.rb | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) rename changelogs/{unreleased => v226}/bundler_2_2_15.md (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f86922b5..a193452d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Main (unreleased) +## v226 (4/13/2021) + * Bundler 2.x is now 2.2.15 (https://github.com/heroku/heroku-buildpack-ruby/pull/1144) ## v225 (2/25/2021) diff --git a/changelogs/unreleased/bundler_2_2_15.md b/changelogs/v226/bundler_2_2_15.md similarity index 100% rename from changelogs/unreleased/bundler_2_2_15.md rename to changelogs/v226/bundler_2_2_15.md diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 96ad793f2..c0b899615 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v225" + BUILDPACK_VERSION = "v226" end end From f5872a110b1df0d000befabb5b5ac53a452f98c5 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Wed, 14 Apr 2021 09:32:51 -0500 Subject: [PATCH 0800/1195] Bundler 2.2.16 (#1150) * Bundler 2.2.16 - https://github.com/rubygems/rubygems/issues/4513 - https://github.com/rubyjs/libv8/issues/310#issuecomment-742481001 - https://github.com/rubygems/rubygems/pull/4497 - https://heroku.support/978905 * Apply suggestions from code review Co-authored-by: Ed Morley <501702+edmorley@users.noreply.github.com> Co-authored-by: Ed Morley <501702+edmorley@users.noreply.github.com> --- CHANGELOG.md | 4 ++++ changelogs/v227/bundler_2216.md | 3 +++ lib/language_pack/helpers/bundler_wrapper.rb | 2 +- lib/language_pack/version.rb | 2 +- 4 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 changelogs/v227/bundler_2216.md diff --git a/CHANGELOG.md b/CHANGELOG.md index a193452d7..dcc5791c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Main (unreleased) +## v227 (4/14/2021) + +* Bundler 2.x is now 2.2.16 (https://github.com/heroku/heroku-buildpack-ruby/pull/1150) + ## v226 (4/13/2021) * Bundler 2.x is now 2.2.15 (https://github.com/heroku/heroku-buildpack-ruby/pull/1144) diff --git a/changelogs/v227/bundler_2216.md b/changelogs/v227/bundler_2216.md new file mode 100644 index 000000000..d41098263 --- /dev/null +++ b/changelogs/v227/bundler_2216.md @@ -0,0 +1,3 @@ +## Ruby apps with Bundler 2.x now receive version 2.2.16 + +The [Ruby Buildpack](https://devcenter.heroku.com/articles/ruby-support#libraries) now includes Bundler 2.2.16. Applications specifying Bundler 2.x in their `Gemfile.lock` will now receive this version of bundler. diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index 4844c2655..9f74babd6 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -37,7 +37,7 @@ class LanguagePack::Helpers::BundlerWrapper BLESSED_BUNDLER_VERSIONS = {} BLESSED_BUNDLER_VERSIONS["1"] = "1.17.3" - BLESSED_BUNDLER_VERSIONS["2"] = "2.2.15" + BLESSED_BUNDLER_VERSIONS["2"] = "2.2.16" BUNDLED_WITH_REGEX = /^BUNDLED WITH$(\r?\n) (?\d+)\.\d+\.\d+/m class GemfileParseError < BuildpackError diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index c0b899615..7c4789ccf 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v226" + BUILDPACK_VERSION = "v227" end end From fe4db44101a9482c09cadd6e5b5ebf112e278f79 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Mon, 19 Apr 2021 11:36:32 -0500 Subject: [PATCH 0801/1195] Fix date (#1152) --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dcc5791c3..cc97a6133 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Main (unreleased) -## v227 (4/14/2021) +## v227 (4/19/2021) * Bundler 2.x is now 2.2.16 (https://github.com/heroku/heroku-buildpack-ruby/pull/1150) From 52e02d56370c1e05434bc550a06f1bcde5849644 Mon Sep 17 00:00:00 2001 From: Ed Morley <501702+edmorley@users.noreply.github.com> Date: Wed, 2 Jun 2021 19:52:00 +0100 Subject: [PATCH 0802/1195] Remove support for Heroku-16 (#1163) The Heroku-16 stack reached end-of-life on May 1st, 2021, and from June 1st, 2021, builds were disabled: https://help.heroku.com/0S5P41DC/heroku-16-end-of-life-faq This change: * Removes Heroku-16 + Cedar-14 from the Ruby version presence check. * Removes the now unused `libyaml` vendoring step, since it only ran on Heroku-16 and Cedar-14. * Makes the buildpack release process no longer vendor the Heroku-16 Ruby archive. Refs GUS-W-9329723. --- CHANGELOG.md | 2 ++ buildpack.toml | 4 --- .../helpers/download_presence.rb | 4 +-- .../helpers/outdated_ruby_version.rb | 2 +- lib/language_pack/ruby.rb | 25 +------------------ lib/rake/tarballer.rb | 2 +- 6 files changed, 7 insertions(+), 32 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cc97a6133..47afedc17 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Main (unreleased) +* Remove support for the Cedar-14 and Heroku-16 stacks (https://github.com/heroku/heroku-buildpack-ruby/pull/1163) + ## v227 (4/19/2021) * Bundler 2.x is now 2.2.16 (https://github.com/heroku/heroku-buildpack-ruby/pull/1150) diff --git a/buildpack.toml b/buildpack.toml index 36700dd7d..153300704 100644 --- a/buildpack.toml +++ b/buildpack.toml @@ -16,10 +16,6 @@ url = "https://codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/ruby.tgz" dir = "." files = ["./.env"] -[[publish.Vendor]] -url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-16/ruby-2.6.6.tgz" -dir = "vendor/ruby/heroku-16" - [[publish.Vendor]] url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-18/ruby-2.6.6.tgz" dir = "vendor/ruby/heroku-18" diff --git a/lib/language_pack/helpers/download_presence.rb b/lib/language_pack/helpers/download_presence.rb index 1392b22ad..77fae2b16 100644 --- a/lib/language_pack/helpers/download_presence.rb +++ b/lib/language_pack/helpers/download_presence.rb @@ -8,7 +8,7 @@ # # download = LanguagePack::Helpers::DownloadPresence.new( # 'ruby-1.9.3.tgz', -# stacks: ['cedar-14', 'heroku-16', 'heroku-18', 'heroku-20'] +# stacks: ['heroku-18', 'heroku-20'] # ) # # download.call @@ -16,7 +16,7 @@ # puts download.exists? #=> true # puts download.valid_stack_list #=> ['cedar-14'] class LanguagePack::Helpers::DownloadPresence - STACKS = ['cedar-14', 'heroku-16', 'heroku-18', 'heroku-20'] + STACKS = ['heroku-18', 'heroku-20'] def initialize(path, stacks: STACKS) @path = path diff --git a/lib/language_pack/helpers/outdated_ruby_version.rb b/lib/language_pack/helpers/outdated_ruby_version.rb index 28bfa6efb..4d0348316 100644 --- a/lib/language_pack/helpers/outdated_ruby_version.rb +++ b/lib/language_pack/helpers/outdated_ruby_version.rb @@ -7,7 +7,7 @@ # ruby_version = LanguagePack::RubyVersion.new("ruby-2.2.5") # outdated = LanguagePack::Helpers::OutdatedRubyVersion.new( # current_ruby_version: ruby_version, -# fetcher: LanguagePack::Fetcher.new(LanguagePack::Base::VENDOR_URL, "heroku-16") +# fetcher: LanguagePack::Fetcher.new(LanguagePack::Base::VENDOR_URL, "heroku-20") # ) # # outdated.call diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index d040f01c3..d000ee384 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -203,15 +203,6 @@ def default_malloc_arena_max? return false end - def stack_not_14_not_16? - case stack - when "cedar-14", "heroku-16" - return false - else - return true - end - end - def warn_bundler_upgrade old_bundler_version = @metadata.read("bundler_version").strip if @metadata.exists?("bundler_version") @@ -608,7 +599,7 @@ def install_ruby(install_path, build_ruby_path = nil) On Heroku CI you can set your stack in the `app.json`. For example: ``` - "stack": "heroku-16" + "stack": "heroku-20" ``` ERROR end @@ -730,19 +721,6 @@ def load_default_cache end end - # install libyaml into the LP to be referenced for psych compilation - # @param [String] tmpdir to store the libyaml files - def install_libyaml(dir) - return false if stack_not_14_not_16? - - instrument 'ruby.install_libyaml' do - FileUtils.mkdir_p dir - Dir.chdir(dir) do - @fetchers[:buildpack].fetch_untar("#{@stack}/#{LIBYAML_PATH}.tgz") - end - end - end - # remove `vendor/bundle` that comes from the git repo # in case there are native ext. # users should be using `bundle pack` instead. @@ -844,7 +822,6 @@ def build_bundler env_vars = {} Dir.mktmpdir("libyaml-") do |tmpdir| libyaml_dir = "#{tmpdir}/#{LIBYAML_PATH}" - install_libyaml(libyaml_dir) # need to setup compile environment for the psych gem yaml_include = File.expand_path("#{libyaml_dir}/include").shellescape diff --git a/lib/rake/tarballer.rb b/lib/rake/tarballer.rb index b0efc1565..005225ec0 100644 --- a/lib/rake/tarballer.rb +++ b/lib/rake/tarballer.rb @@ -12,7 +12,7 @@ # In addition to TAR logic it also vendors ruby versions so # they don't need to be pulled at runtime class Tarballer - STACKS = %W{cedar-14 heroku-16 heroku-18} + STACKS = %W{heroku-18 heroku-20} def initialize(name: , directory: , io: STDOUT) @name = name From 20b1919df498eff6010374b1ca1b91d9f7b56d2a Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Thu, 24 Jun 2021 15:13:08 -0500 Subject: [PATCH 0803/1195] [close #1167] Bundler version is 2.2.21 (#1170) The current bundler version 2.2.15 has a "dependency confusion vulnerability" https://github.com/advisories/GHSA-fp4w-jxhp-m23p Upgrading to 2.2.21 mitigates this issue. --- CHANGELOG.md | 3 +++ changelogs/v228/bundler_2_2_21.md | 3 +++ lib/language_pack/helpers/bundler_wrapper.rb | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 changelogs/v228/bundler_2_2_21.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 47afedc17..976fc224f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Main (unreleased) +## v228 (6/24/2021) + +* Bundler 2.x is now 2.2.21 (https://github.com/heroku/heroku-buildpack-ruby/pull/1170) * Remove support for the Cedar-14 and Heroku-16 stacks (https://github.com/heroku/heroku-buildpack-ruby/pull/1163) ## v227 (4/19/2021) diff --git a/changelogs/v228/bundler_2_2_21.md b/changelogs/v228/bundler_2_2_21.md new file mode 100644 index 000000000..848a2d9c7 --- /dev/null +++ b/changelogs/v228/bundler_2_2_21.md @@ -0,0 +1,3 @@ +## Ruby apps with Bundler 2.x now receive version 2.2.21 + +The [Ruby Buildpack](https://devcenter.heroku.com/articles/ruby-support#libraries) now includes Bundler 2.2.21. Applications specifying Bundler 2.x in their `Gemfile.lock` will now receive bundler: 2.2.21. diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index 9f74babd6..d6281c43e 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -37,7 +37,7 @@ class LanguagePack::Helpers::BundlerWrapper BLESSED_BUNDLER_VERSIONS = {} BLESSED_BUNDLER_VERSIONS["1"] = "1.17.3" - BLESSED_BUNDLER_VERSIONS["2"] = "2.2.16" + BLESSED_BUNDLER_VERSIONS["2"] = "2.2.21" BUNDLED_WITH_REGEX = /^BUNDLED WITH$(\r?\n) (?\d+)\.\d+\.\d+/m class GemfileParseError < BuildpackError From b3fa53b1a8ce40193c05ca9ad95681bb4e3f8cbd Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Thu, 5 Aug 2021 11:47:04 -0500 Subject: [PATCH 0804/1195] [changelog skip] Run tests for Deivid rodriguez PRs (#1182) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Allow running specs with RSpec 3 The `-s` alias for the documentation formatter was removed in RSpec 3. See https://github.com/rspec/rspec-core/commit/b8d55efcf4b6b5e1656b9c2a4095c6dd3054ea03. * Allow configuring `HATCHET_BUILDPACK_BASE` So that specs can be run on forks. * Allow `rspec --only-failures` to work by default It's useful when focusing on fixing a failing test run, since it only runs currently failing specs. Co-authored-by: David Rodríguez --- .gitignore | 1 + Rakefile | 2 +- spec/spec_helper.rb | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index c8e3e471d..79d3e9fdc 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ buildpacks/* .anvil/ tmp/*.log log/*.log +spec/examples.txt diff --git a/Rakefile b/Rakefile index 58989ef66..701d9c3f3 100644 --- a/Rakefile +++ b/Rakefile @@ -126,7 +126,7 @@ begin desc "Run specs" RSpec::Core::RakeTask.new(:spec) do |t| - t.rspec_opts = %w(-fs --color) + t.rspec_opts = %w(-fd --color) #t.ruby_opts = %w(-w) end task :default => :spec diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 70d6ddd7e..3f6d3d3cb 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -7,7 +7,7 @@ require 'language_pack' require 'language_pack/shell_helpers' -ENV["HATCHET_BUILDPACK_BASE"] = "https://github.com/heroku/heroku-buildpack-ruby" +ENV["HATCHET_BUILDPACK_BASE"] ||= "https://github.com/heroku/heroku-buildpack-ruby" ENV['RACK_ENV'] = 'test' @@ -20,6 +20,7 @@ config.full_backtrace = true config.verbose_retry = true # show retry status in spec process config.default_retry_count = 2 if ENV['IS_RUNNING_ON_CI'] # retry all tests that fail again + config.example_status_persistence_file_path = 'spec/examples.txt' config.expect_with :rspec do |c| c.max_formatted_output_length = Float::INFINITY From 82a1b1be0774314043f7120e6e7ff1a8b4085f07 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 5 Aug 2021 12:03:19 -0500 Subject: [PATCH 0805/1195] Bump excon from 0.76.0 to 0.85.0 (#1174) Bumps [excon](https://github.com/excon/excon) from 0.76.0 to 0.85.0. - [Release notes](https://github.com/excon/excon/releases) - [Changelog](https://github.com/excon/excon/blob/master/changelog.txt) - [Commits](https://github.com/excon/excon/compare/v0.76.0...v0.85.0) --- updated-dependencies: - dependency-name: excon dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 84c8adb62..3deba036e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -5,7 +5,7 @@ GEM citrus (3.0.2) diff-lcs (1.4.4) erubis (2.7.0) - excon (0.76.0) + excon (0.85.0) heroics (0.1.1) erubis (~> 2.0) excon From 7501f16c5125d47fc0d1f61f267a87e9bcc273b5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 10 Aug 2021 15:12:24 +0100 Subject: [PATCH 0806/1195] Bump heroku_hatchet from 7.3.3 to 7.3.4 (#1184) Bumps [heroku_hatchet](https://github.com/heroku/hatchet) from 7.3.3 to 7.3.4. - [Release notes](https://github.com/heroku/hatchet/releases) - [Changelog](https://github.com/heroku/hatchet/blob/main/CHANGELOG.md) - [Commits](https://github.com/heroku/hatchet/compare/v7.3.3...v7.3.4) --- updated-dependencies: - dependency-name: heroku_hatchet dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 3deba036e..f8d82dd7a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -6,12 +6,13 @@ GEM diff-lcs (1.4.4) erubis (2.7.0) excon (0.85.0) - heroics (0.1.1) + heroics (0.1.2) erubis (~> 2.0) excon moneta multi_json (>= 1.9.2) - heroku_hatchet (7.3.3) + webrick + heroku_hatchet (7.3.4) excon (~> 0) platform-api (~> 3) rrrretry (~> 1) @@ -23,7 +24,7 @@ GEM parallel (1.19.2) parallel_tests (3.3.0) parallel - platform-api (3.0.0) + platform-api (3.3.0) heroics (~> 0.1.1) moneta (~> 1.0.0) rate_throttle_client (~> 0.1.0) @@ -39,10 +40,11 @@ GEM rspec-retry (0.6.2) rspec-core (> 3.3) rspec-support (3.9.3) - thor (1.0.1) + thor (1.1.0) threaded (0.0.4) toml-rb (2.0.1) citrus (~> 3.0, > 3.0) + webrick (1.7.0) PLATFORMS ruby From f3e9cc5b6ff7127cf41235bc5ea2cf9054869979 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 10 Aug 2021 15:37:09 +0100 Subject: [PATCH 0807/1195] Bump parallel_tests from 3.3.0 to 3.7.0 (#1185) Bumps [parallel_tests](https://github.com/grosser/parallel_tests) from 3.3.0 to 3.7.0. - [Release notes](https://github.com/grosser/parallel_tests/releases) - [Changelog](https://github.com/grosser/parallel_tests/blob/master/CHANGELOG.md) - [Commits](https://github.com/grosser/parallel_tests/compare/v3.3.0...v3.7.0) --- updated-dependencies: - dependency-name: parallel_tests dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index f8d82dd7a..a7be3083d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -21,8 +21,8 @@ GEM json (2.3.1) moneta (1.0.0) multi_json (1.15.0) - parallel (1.19.2) - parallel_tests (3.3.0) + parallel (1.20.1) + parallel_tests (3.7.0) parallel platform-api (3.3.0) heroics (~> 0.1.1) From 3f64a113b302ba96e143b172c93371c9c452fb01 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 17 Aug 2021 11:18:54 +0100 Subject: [PATCH 0808/1195] Bump json from 2.3.1 to 2.5.1 (#1187) Bumps [json](https://github.com/flori/json) from 2.3.1 to 2.5.1. - [Release notes](https://github.com/flori/json/releases) - [Changelog](https://github.com/flori/json/blob/master/CHANGES.md) - [Commits](https://github.com/flori/json/compare/v2.3.1...v2.5.1) --- updated-dependencies: - dependency-name: json dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index a7be3083d..694eb690f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -18,7 +18,7 @@ GEM rrrretry (~> 1) thor (~> 1) threaded (~> 0) - json (2.3.1) + json (2.5.1) moneta (1.0.0) multi_json (1.15.0) parallel (1.20.1) From 0d674939b597f6095607b5c9c084ff2cb39b6455 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Z=C3=BClke?= Date: Mon, 23 Aug 2021 17:27:10 +0200 Subject: [PATCH 0809/1195] [changelog skip] drop sqlite3 test Ruby ver req (#1189) due to broken quoting, the test currently just echos a string to stdout rather than writing it to Gemfile as intended however, the desired Ruby version isn't available on heroku-20, and the test clearly works without the requirement, so we can omit it altogether --- spec/hatchet/ruby_spec.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/spec/hatchet/ruby_spec.rb b/spec/hatchet/ruby_spec.rb index d5aad4519..64c5256a0 100644 --- a/spec/hatchet/ruby_spec.rb +++ b/spec/hatchet/ruby_spec.rb @@ -179,8 +179,7 @@ describe "Raise errors on specific gems" do it "should raise on sqlite3" do - before_deploy = -> { run!(%Q{echo "ruby '2.5.4' >> Gemfile"}) } - Hatchet::Runner.new("sqlite3_gemfile", allow_failure: true, before_deploy: before_deploy).deploy do |app| + Hatchet::Runner.new("sqlite3_gemfile", allow_failure: true).deploy do |app| expect(app).not_to be_deployed expect(app.output).to include("Detected sqlite3 gem which is not supported") expect(app.output).to include("devcenter.heroku.com/articles/sqlite3") From 731cb813e32dab9823a44565af504cc6edd2daf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Z=C3=BClke?= Date: Mon, 23 Aug 2021 18:32:45 +0200 Subject: [PATCH 0810/1195] move to new style changelog check (#1190) * move to new changelog check workflow now uses either PR description or GitHub label, and the v2 checkout action * Update .github/workflows/check_changelog.yml Co-authored-by: Ed Morley <501702+edmorley@users.noreply.github.com> Co-authored-by: Ed Morley <501702+edmorley@users.noreply.github.com> --- .github/workflows/check_changelog.yml | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/check_changelog.yml b/.github/workflows/check_changelog.yml index fe41a8044..45589e4f9 100644 --- a/.github/workflows/check_changelog.yml +++ b/.github/workflows/check_changelog.yml @@ -1,16 +1,22 @@ name: Check Changelog on: - pull_request: - types: [opened, reopened, edited, synchronize] + pull_request: + types: [opened, reopened, edited, labeled, unlabeled, synchronize] + jobs: - build: + check-changelog: + runs-on: ubuntu-latest if: | + !contains(github.event.pull_request.body, '[skip changelog]') && + !contains(github.event.pull_request.body, '[changelog skip]') && + !contains(github.event.pull_request.body, '[skip ci]') && + !contains(github.event.pull_request.labels.*.name, 'skip changelog') && !contains(github.event.pull_request.labels.*.name, 'dependencies') && !contains(github.event.pull_request.labels.*.name, 'automation') - runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - name: Check that CHANGELOG is touched - run: | - cat $GITHUB_EVENT_PATH | jq .pull_request.title | grep -i '\[\(\(changelog skip\)\|\(ci skip\)\)\]' || git diff remotes/origin/${{ github.base_ref }} --name-only | grep CHANGELOG.md + - uses: actions/checkout@v2.3.4 + - name: Check that CHANGELOG is touched + run: | + git fetch origin ${{ github.base_ref }} --depth 1 && \ + git diff remotes/origin/${{ github.base_ref }} --name-only | grep CHANGELOG.md From f48cd84d311d6e5d96dc3ae35d8465d6f321b5bc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 24 Aug 2021 08:55:28 +0100 Subject: [PATCH 0811/1195] Bump parallel_tests from 3.7.0 to 3.7.1 (#1191) Bumps [parallel_tests](https://github.com/grosser/parallel_tests) from 3.7.0 to 3.7.1. - [Release notes](https://github.com/grosser/parallel_tests/releases) - [Changelog](https://github.com/grosser/parallel_tests/blob/master/CHANGELOG.md) - [Commits](https://github.com/grosser/parallel_tests/compare/v3.7.0...v3.7.1) --- updated-dependencies: - dependency-name: parallel_tests dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 694eb690f..07664daba 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -22,7 +22,7 @@ GEM moneta (1.0.0) multi_json (1.15.0) parallel (1.20.1) - parallel_tests (3.7.0) + parallel_tests (3.7.1) parallel platform-api (3.3.0) heroics (~> 0.1.1) From 0109abdd92a9c1fd292fbe3a2f54d498402d9147 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Z=C3=BClke?= Date: Tue, 24 Aug 2021 16:40:25 +0200 Subject: [PATCH 0812/1195] use WEB_CONCURRENCY.sh for WEB_CONCURRENCY default (#1188) * use WEB_CONCURRENCY.sh for WEB_CONCURRENCY default The Node.js, PHP and Python buildpacks write their WEB_CONCURRENCY defaults logic to this file name. This ensures that the last buildpack to run defines the defaults an app will use. If each buildpack were to use its own filename, then whatever file is evaluated first by the Shell on startup would set an initial value, and following files would see the variable already set and likely skip their calculation, or apply their own lower/upper limit enforcement, as it cannot know whether the variable was set by a user, or by some other buildpack's startup logic (the Shell sources files using a glob pattern from .profile.d/ on startup, which on GNU Bash is in alnum order, see https://www.gnu.org/software/bash/manual/bash.html#Filename-Expansion) This change uses the same filename as other buildpacks, ensuring that e.g. if heroku/nodejs is used as the first and heroku/ruby as the second buildpack, the defaults set by this buildpack will apply. Right now, in this constellation, .profile.d/ruby.sh runs first, and sets a default value, then .profile.d/WEB_CONCURRENCY.sh runs later, and does nothing, as the defaults fit within Node.js's current logic - but if a user sets WEB_CONCURRENCY=0 manually, then Node.js' logic kicks in, and re-sets the value to 1, as Node.js doesn't allow a value of 0. Ruby's Puma however allows "single mode", and for that, the value needs to be 0: https://github.com/puma/puma/issues/2393 Refs https://github.com/heroku/heroku-buildpack-nodejs/pull/926 * it "has a newline between it blocks" do * named args for add_to_profiled and move ternary * changelog and... changelogs Co-authored-by: Richard Schneeman --- CHANGELOG.md | 2 ++ changelogs/unreleased/WEB_CONCURRENCY.md | 7 +++++++ lib/language_pack/base.rb | 4 ++-- lib/language_pack/ruby.rb | 4 +++- spec/hatchet/ruby_spec.rb | 22 ++++++++++++++++++++++ 5 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 changelogs/unreleased/WEB_CONCURRENCY.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 976fc224f..76928ee6d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Main (unreleased) +* Fix interoperability with other Heroku buildpacks' `$WEB_CONCURRENCY` handling (https://github.com/heroku/heroku-buildpack-ruby/pull/1188) + ## v228 (6/24/2021) * Bundler 2.x is now 2.2.21 (https://github.com/heroku/heroku-buildpack-ruby/pull/1170) diff --git a/changelogs/unreleased/WEB_CONCURRENCY.md b/changelogs/unreleased/WEB_CONCURRENCY.md new file mode 100644 index 000000000..8522594be --- /dev/null +++ b/changelogs/unreleased/WEB_CONCURRENCY.md @@ -0,0 +1,7 @@ +## Ruby buildpack now clears previous default buildpack `WEB_CONCURRENCY` values + +Some buildpacks may set a default value for the `WEB_CONCURRENCY` environment variable during dyno startup. + +When multiple buildpacks define default values, the declaration from the last buildpack in the list of multiple buildpacks takes precedence, as this is the [primary language of an app](https://devcenter.heroku.com/articles/using-multiple-buildpacks-for-an-app#adding-a-buildpack). + +The Ruby buildpack is now interoperable with other buildpacks in this regard; for example, using `heroku/nodejs` as the first, and `heroku/ruby` as the second buildpack, will no longer lead to Node.js default values for `WEB_CONCURRENCY` to apply at runtime. diff --git a/lib/language_pack/base.rb b/lib/language_pack/base.rb index fa169c4b3..056265ad3 100644 --- a/lib/language_pack/base.rb +++ b/lib/language_pack/base.rb @@ -206,11 +206,11 @@ def log(*args) def setup_language_pack_environment end - def add_to_profiled(string) + def add_to_profiled(string, filename: "ruby.sh", mode: "a") profiled_path = @layer_dir ? "#{@layer_dir}/ruby/profile.d/" : "#{build_path}/.profile.d/" FileUtils.mkdir_p profiled_path - File.open("#{profiled_path}/ruby.sh", "a") do |file| + File.open("#{profiled_path}/#{filename}", mode) do |file| file.puts string end end diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index d000ee384..e35ffa65e 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -412,7 +412,9 @@ def setup_profiled(ruby_layer_path: , gem_layer_path: ) set_env_override "DISABLE_SPRING", "1" set_env_default "MALLOC_ARENA_MAX", "2" if default_malloc_arena_max? - add_to_profiled set_default_web_concurrency if env("SENSIBLE_DEFAULTS") + + web_concurrency = env("SENSIBLE_DEFAULTS") ? set_default_web_concurrency : "" + add_to_profiled(web_concurrency, filename: "WEB_CONCURRENCY.sh", mode: "w") # always write that file, even if its empty (meaning no defaults apply), for interop with other buildpacks - and we overwrite the file rather than appending (which is the default) # TODO handle JRUBY if ruby_version.jruby? diff --git a/spec/hatchet/ruby_spec.rb b/spec/hatchet/ruby_spec.rb index 64c5256a0..f5b49f574 100644 --- a/spec/hatchet/ruby_spec.rb +++ b/spec/hatchet/ruby_spec.rb @@ -206,3 +206,25 @@ end end end + +describe "WEB_CONCURRENCY.sh" do + it "from a preceding buildpack is overwritten by this buildpack" do + buildpacks = [ + "heroku/nodejs", + :default + ] + before_deploy = -> { run!(%Q{echo "{}" > package.json}) } + Hatchet::Runner.new('default_ruby', stack: DEFAULT_STACK, buildpacks: buildpacks, before_deploy: before_deploy).deploy do |app| + expect(app.run("cat .profile.d/WEB_CONCURRENCY.sh").strip).to be_empty + expect(app.run("echo $WEB_CONCURRENCY").strip).to be_empty + expect(app.run("echo $WEB_CONCURRENCY", :heroku => {:env => "WEB_CONCURRENCY=0"}).strip).to eq("0") + end + end + + it "has defaults set with SENSIBLE_DEFAULTS on" do + config = { "SENSIBLE_DEFAULTS" => "1"} + Hatchet::Runner.new('default_ruby', stack: DEFAULT_STACK, config: config).deploy do |app| + expect(app.run("env")).to match("WEB_CONCURRENCY=") + end + end +end From dd4d21150d9d11285c5ab87ef99550adb9a79751 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 25 Aug 2021 14:18:12 +0100 Subject: [PATCH 0813/1195] Post-release updates: heroku/ruby 0.1.1 (#1186) Co-authored-by: schneems --- buildpack.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildpack.toml b/buildpack.toml index 153300704..0b7be4dba 100644 --- a/buildpack.toml +++ b/buildpack.toml @@ -2,7 +2,7 @@ api = "0.2" [buildpack] id = "heroku/ruby" -version = "0.1.1" +version = "0.1.2" name = "Ruby" ruby_version = "2.6.6" From ae35658c5ccaea1abe6ae6754a4720a9db5a86c9 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Mon, 30 Aug 2021 10:51:27 -0500 Subject: [PATCH 0814/1195] v229 (#1192) --- CHANGELOG.md | 2 ++ changelogs/{unreleased => v229}/WEB_CONCURRENCY.md | 0 lib/language_pack/version.rb | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) rename changelogs/{unreleased => v229}/WEB_CONCURRENCY.md (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 76928ee6d..e57857d70 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Main (unreleased) +## v229 (7/30/2021) + * Fix interoperability with other Heroku buildpacks' `$WEB_CONCURRENCY` handling (https://github.com/heroku/heroku-buildpack-ruby/pull/1188) ## v228 (6/24/2021) diff --git a/changelogs/unreleased/WEB_CONCURRENCY.md b/changelogs/v229/WEB_CONCURRENCY.md similarity index 100% rename from changelogs/unreleased/WEB_CONCURRENCY.md rename to changelogs/v229/WEB_CONCURRENCY.md diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 7c4789ccf..2fe10be90 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v227" + BUILDPACK_VERSION = "v229" end end From bc6c03285261f3c368286d801c65c7999161bd80 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 31 Aug 2021 09:59:24 +0100 Subject: [PATCH 0815/1195] Bump redis from 4.2.2 to 4.4.0 (#1194) Bumps [redis](https://github.com/redis/redis-rb) from 4.2.2 to 4.4.0. - [Release notes](https://github.com/redis/redis-rb/releases) - [Changelog](https://github.com/redis/redis-rb/blob/master/CHANGELOG.md) - [Commits](https://github.com/redis/redis-rb/compare/v4.2.2...v4.4.0) --- updated-dependencies: - dependency-name: redis dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 07664daba..44f520d49 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -30,7 +30,7 @@ GEM rate_throttle_client (~> 0.1.0) rake (13.0.1) rate_throttle_client (0.1.2) - redis (4.2.2) + redis (4.4.0) rrrretry (1.0.0) rspec-core (3.9.3) rspec-support (~> 3.9.3) From c2a21ff82df932fc5734ff20e7ef17f40c09b8e8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 7 Sep 2021 07:52:03 +0100 Subject: [PATCH 0816/1195] Bump ci-queue from 0.20.5 to 0.20.8 (#1196) Bumps [ci-queue](https://github.com/Shopify/ci-queue) from 0.20.5 to 0.20.8. - [Release notes](https://github.com/Shopify/ci-queue/releases) - [Commits](https://github.com/Shopify/ci-queue/compare/v0.20.5...v0.20.8) --- updated-dependencies: - dependency-name: ci-queue dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 44f520d49..81408c2d8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ GEM remote: https://rubygems.org/ specs: - ci-queue (0.20.5) + ci-queue (0.20.8) citrus (3.0.2) diff-lcs (1.4.4) erubis (2.7.0) From 41a5b1fc25e1a7e3627f5a836e8f91c5c884507b Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Thu, 9 Sep 2021 10:27:14 -0500 Subject: [PATCH 0817/1195] Clean detect output of Ruby CNB (#1197) ``` ======== Output: heroku/ruby@0.0.1 ======== no err: heroku/ruby@0.0.1 (1) ``` --- bin/detect | 1 - 1 file changed, 1 deletion(-) diff --git a/bin/detect b/bin/detect index 3f2d3afd8..7389226d3 100755 --- a/bin/detect +++ b/bin/detect @@ -15,6 +15,5 @@ if [ -f "$APP_DIR/Gemfile" ]; then echo "Ruby" exit 0 else - echo "no" exit 100 fi From d9590a8ef55b009587f788fe0e6d469d8dce7a7c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 14 Sep 2021 07:53:54 +0100 Subject: [PATCH 0818/1195] Bump rake from 13.0.1 to 13.0.6 (#1199) Bumps [rake](https://github.com/ruby/rake) from 13.0.1 to 13.0.6. - [Release notes](https://github.com/ruby/rake/releases) - [Changelog](https://github.com/ruby/rake/blob/master/History.rdoc) - [Commits](https://github.com/ruby/rake/compare/v13.0.1...v13.0.6) --- updated-dependencies: - dependency-name: rake dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 81408c2d8..0b3772b39 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -28,7 +28,7 @@ GEM heroics (~> 0.1.1) moneta (~> 1.0.0) rate_throttle_client (~> 0.1.0) - rake (13.0.1) + rake (13.0.6) rate_throttle_client (0.1.2) redis (4.4.0) rrrretry (1.0.0) From 308be99cb1369789b7c05623e0681a47fbeded81 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 14 Sep 2021 07:54:30 +0100 Subject: [PATCH 0819/1195] Post-release updates: heroku/ruby 0.1.2 (#1198) Co-authored-by: schneems --- buildpack.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildpack.toml b/buildpack.toml index 0b7be4dba..8451c559f 100644 --- a/buildpack.toml +++ b/buildpack.toml @@ -2,7 +2,7 @@ api = "0.2" [buildpack] id = "heroku/ruby" -version = "0.1.2" +version = "0.1.3" name = "Ruby" ruby_version = "2.6.6" From bcb013a728e78c221fc4ced550df5e62ec5f28c7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 21 Sep 2021 08:32:55 +0100 Subject: [PATCH 0820/1195] Bump rspec-expectations from 3.9.2 to 3.9.4 (#1201) Bumps [rspec-expectations](https://github.com/rspec/rspec-expectations) from 3.9.2 to 3.9.4. - [Release notes](https://github.com/rspec/rspec-expectations/releases) - [Changelog](https://github.com/rspec/rspec-expectations/blob/main/Changelog.md) - [Commits](https://github.com/rspec/rspec-expectations/compare/v3.9.2...v3.9.4) --- updated-dependencies: - dependency-name: rspec-expectations dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 0b3772b39..96841f631 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -34,12 +34,12 @@ GEM rrrretry (1.0.0) rspec-core (3.9.3) rspec-support (~> 3.9.3) - rspec-expectations (3.9.2) + rspec-expectations (3.9.4) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.9.0) rspec-retry (0.6.2) rspec-core (> 3.3) - rspec-support (3.9.3) + rspec-support (3.9.4) thor (1.1.0) threaded (0.0.4) toml-rb (2.0.1) From 98859a59a52fa187d9555e1c0a875e01d146b4ee Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Mon, 27 Sep 2021 11:10:33 -0500 Subject: [PATCH 0821/1195] Increase default Ruby version to 2.7.4 (#1193) * Increase default Ruby version to 2.7.4 Our policy is to stay on the latest patch release of the middle supported Ruby version. Supported versions are 3.0, 2.7, and 2.6 so the latest of the 2.7 is 2.7.4. * Fix uninitialized constant SimpleDelegator SimpleDelegator was removed from being auto-required in Ruby 2.7 https://stackoverflow.com/questions/60459709/where-is-simpledelegator-in-ruby-2-7 * Fix tests for Ruby 2.7.4 - rspec ./spec/hatchet/rails5_spec.rb:46 # Rails 5.1 with webpacker calls bin/yarn no matter what is on the path - Hatchet::Runner.new("rails51_webpacker").tap do |app| - Test does not rely on Rails 5 specific behavior - rspec ./spec/hatchet/rails5_spec.rb:4 # Rails 5 works - Hatchet::Runner.new("rails5", stack: "heroku-18").deploy do |app, heroku| - Version of Rails does not work with Ruby 2.7.4 - Not rails 5 specific, upgrading to Rails 6 - rspec ./spec/hatchet/bugs_spec.rb:12 # Bugs database connections fails with better error message - Hatchet::Runner.new("connect_to_database_on_first_push", allow_failure: true).deploy do |app| - We can use a generic/maintained app instead and inject the database connection code. * Fix circle tests * Update CHANGELOG.md Co-authored-by: Ed Morley <501702+edmorley@users.noreply.github.com> Co-authored-by: Ed Morley <501702+edmorley@users.noreply.github.com> --- .circleci/config.yml | 10 +++---- CHANGELOG.md | 1 + Gemfile | 2 +- Gemfile.lock | 2 +- buildpack.toml | 6 ++-- changelogs/ruby_274_default.md | 3 ++ hatchet.json | 3 -- lib/language_pack/helpers/binstub_wrapper.rb | 4 ++- lib/language_pack/ruby_version.rb | 2 +- spec/hatchet/bugs_spec.rb | 21 +++++++++++-- spec/hatchet/rails5_spec.rb | 31 ++------------------ spec/hatchet/rails6_spec.rb | 26 ++++++++++++++++ 12 files changed, 65 insertions(+), 46 deletions(-) create mode 100644 changelogs/ruby_274_default.md diff --git a/.circleci/config.yml b/.circleci/config.yml index fcf5a55cf..40b768141 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -11,11 +11,11 @@ jobs: - checkout - run: command: | - rvm install 2.6.6 - rvm use ruby-2.6.6 - export PATH="/opt/circleci/.rvm/rubies/ruby-2.6.6/bin:$PATH" - export GEM_HOME="/opt/circleci/.rvm/gems/ruby-2.6.6" - export GEM_PATH="/opt/circleci/.rvm/gems/ruby-2.6.6" + rvm install 2.7.4 + rvm use ruby-2.7.4 + export PATH="/opt/circleci/.rvm/rubies/ruby-2.7.4/bin:$PATH" + export GEM_HOME="/opt/circleci/.rvm/gems/ruby-2.7.4" + export GEM_PATH="/opt/circleci/.rvm/gems/ruby-2.7.4" gem install bundler -v 2.1.0 bundle install bundle exec rake hatchet:setup_ci diff --git a/CHANGELOG.md b/CHANGELOG.md index e57857d70..64138c8fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## v229 (7/30/2021) +* Default Ruby version is now 2.7.4 (https://github.com/heroku/heroku-buildpack-ruby/pull/1193) * Fix interoperability with other Heroku buildpacks' `$WEB_CONCURRENCY` handling (https://github.com/heroku/heroku-buildpack-ruby/pull/1188) ## v228 (6/24/2021) diff --git a/Gemfile b/Gemfile index e2337aeae..e4e202ff3 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ source "https://rubygems.org" git_source(:github) { |repo| "https://github.com/#{repo}.git" } -ruby '2.6.6' +ruby '2.7.4' group :development, :test do gem "toml-rb" diff --git a/Gemfile.lock b/Gemfile.lock index 96841f631..8d0c070e0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -63,7 +63,7 @@ DEPENDENCIES toml-rb RUBY VERSION - ruby 2.6.6p146 + ruby 2.7.4p191 BUNDLED WITH 2.1.4 diff --git a/buildpack.toml b/buildpack.toml index 8451c559f..3049a3b41 100644 --- a/buildpack.toml +++ b/buildpack.toml @@ -4,7 +4,7 @@ api = "0.2" id = "heroku/ruby" version = "0.1.3" name = "Ruby" -ruby_version = "2.6.6" +ruby_version = "2.7.4" [publish] @@ -17,11 +17,11 @@ dir = "." files = ["./.env"] [[publish.Vendor]] -url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-18/ruby-2.6.6.tgz" +url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-18/ruby-2.7.4.tgz" dir = "vendor/ruby/heroku-18" [[publish.Vendor]] -url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-20/ruby-2.6.6.tgz" +url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-20/ruby-2.7.4.tgz" dir = "vendor/ruby/heroku-20" [[stacks]] diff --git a/changelogs/ruby_274_default.md b/changelogs/ruby_274_default.md new file mode 100644 index 000000000..0a480c1ec --- /dev/null +++ b/changelogs/ruby_274_default.md @@ -0,0 +1,3 @@ +## Default Ruby version for new apps is now 2.7.4 + +The [default Ruby version for new Ruby applications is 2.7.4](https://devcenter.heroku.com/articles/ruby-support#default-ruby-version-for-new-apps). You’ll only get the default if the application does not specify a ruby version. diff --git a/hatchet.json b/hatchet.json index df02f33e2..3df2fd4a2 100644 --- a/hatchet.json +++ b/hatchet.json @@ -3,7 +3,6 @@ "sharpstone/asset_precompile_fail", "sharpstone/asset_precompile_pass", "sharpstone/asset_precompile_not_found", - "sharpstone/connect_to_database_on_first_push", "sharpstone/no_rakefile", "sharpstone/bad_rakefile", "sharpstone/default_with_rakefile" @@ -46,8 +45,6 @@ "sharpstone/rails3_default_ruby", "sharpstone/rails4_windows_mri193", "sharpstone/rails42_default_ruby", - "sharpstone/rails5", - "schneems/rails51_webpacker", "sharpstone/active_storage_non_local", "sharpstone/active_storage_local", "sharpstone/sprockets_asset_compile_true", diff --git a/lib/language_pack/helpers/binstub_wrapper.rb b/lib/language_pack/helpers/binstub_wrapper.rb index 702229c9c..b88ad2cbf 100644 --- a/lib/language_pack/helpers/binstub_wrapper.rb +++ b/lib/language_pack/helpers/binstub_wrapper.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true -# + +require 'delegate' + # This is a helper class, it wraps a pathname object # and adds helper methods used to pull out the first line of the file ("the shebang") # as well as determining if the file is binary or not. diff --git a/lib/language_pack/ruby_version.rb b/lib/language_pack/ruby_version.rb index eabe54c26..34f60bf06 100644 --- a/lib/language_pack/ruby_version.rb +++ b/lib/language_pack/ruby_version.rb @@ -12,7 +12,7 @@ def initialize(output = "") end end - DEFAULT_VERSION_NUMBER = "2.6.6".freeze + DEFAULT_VERSION_NUMBER = "2.7.4".freeze DEFAULT_VERSION = "ruby-#{DEFAULT_VERSION_NUMBER}".freeze LEGACY_VERSION_NUMBER = "1.9.2".freeze LEGACY_VERSION = "ruby-#{LEGACY_VERSION_NUMBER}".freeze diff --git a/spec/hatchet/bugs_spec.rb b/spec/hatchet/bugs_spec.rb index 13ddac117..e10c1c145 100644 --- a/spec/hatchet/bugs_spec.rb +++ b/spec/hatchet/bugs_spec.rb @@ -10,8 +10,25 @@ context "database connections" do it "fails with better error message" do - Hatchet::Runner.new("connect_to_database_on_first_push", allow_failure: true).deploy do |app| - expect(app.output).to match("https://devcenter.heroku.com/articles/pre-provision-database") + Hatchet::Runner.new("ruby-getting-started", allow_failure: true).tap do |app| + app.before_deploy do + Pathname("Rakefile").write(<<~EOM) + require 'bundler' + Bundler.require(:default) + + require 'active_record' + + task "assets:precompile" do + # Try to connect to a database that doesn't exist yet + ActiveRecord::Base.establish_connection + ActiveRecord::Base.connection.execute("") + end + EOM + end + + app.deploy do + expect(app.output).to match("https://devcenter.heroku.com/articles/pre-provision-database") + end end end end diff --git a/spec/hatchet/rails5_spec.rb b/spec/hatchet/rails5_spec.rb index 33b286294..faa275f09 100644 --- a/spec/hatchet/rails5_spec.rb +++ b/spec/hatchet/rails5_spec.rb @@ -1,8 +1,8 @@ require_relative '../spec_helper' describe "Rails 5" do - it "works" do - Hatchet::Runner.new("rails5", stack: "heroku-18").deploy do |app, heroku| + it "behaves correctly, not related to Rails 5 at all" do + Hatchet::Runner.new("ruby-getting-started", stack: "heroku-18").deploy do |app, heroku| # Test BUNDLE_DISABLE_VERSION_CHECK works expect(app.output).not_to include("The latest bundler is") @@ -42,30 +42,3 @@ def worker_task_for_app(app) end end -describe "Rails 5.1 with webpacker" do - it "calls bin/yarn no matter what is on the path" do - Hatchet::Runner.new("rails51_webpacker").tap do |app| - # We put our version of yarn first on the path ahead of bin/yarn - # however webpacker explicitly calls bin/yarn instead of calling - # `yarn install` - app.before_deploy do - File.open("bin/yarn", "w") do |f| - f.write <<~EOM - #! /usr/bin/env bash - - echo "Called bin/yarn binstub" - `yarn install` - EOM - end - run("chmod +x bin/yarn") - end - - app.deploy do - expect(app.output).to include("Called bin/yarn binstub") - - expect(app.output).to match("rake assets:precompile") - expect(app.output).to match("rake assets:clean") - end - end - end -end diff --git a/spec/hatchet/rails6_spec.rb b/spec/hatchet/rails6_spec.rb index 0ca1b6f40..bcc8a425b 100644 --- a/spec/hatchet/rails6_spec.rb +++ b/spec/hatchet/rails6_spec.rb @@ -8,6 +8,32 @@ end end + it "calls bin/yarn no matter what is on the path" do + Hatchet::Runner.new("rails6-basic").tap do |app| + # We put our version of yarn first on the path ahead of bin/yarn + # however webpacker explicitly calls bin/yarn instead of calling + # `yarn install` + app.before_deploy do + File.open("bin/yarn", "w") do |f| + f.write <<~EOM + #! /usr/bin/env bash + + echo "Called bin/yarn binstub" + `yarn install` + EOM + end + run("chmod +x bin/yarn") + end + + app.deploy do + expect(app.output).to include("Called bin/yarn binstub") + + expect(app.output).to match("rake assets:precompile") + expect(app.output).to match("rake assets:clean") + end + end + end + it "deploys and serves web requests via puma" do before_deploy = Proc.new do run! "echo 'web: bundle exec puma -t 5:5 -p ${PORT:-3000} -e ${RACK_ENV:-development}' > Procfile" From c508b95ba867d7ac3c152c98f169f009a818a825 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 28 Sep 2021 00:16:53 +0100 Subject: [PATCH 0822/1195] Bump parallel_tests from 3.7.1 to 3.7.3 (#1203) Bumps [parallel_tests](https://github.com/grosser/parallel_tests) from 3.7.1 to 3.7.3. - [Release notes](https://github.com/grosser/parallel_tests/releases) - [Changelog](https://github.com/grosser/parallel_tests/blob/master/CHANGELOG.md) - [Commits](https://github.com/grosser/parallel_tests/compare/v3.7.1...v3.7.3) --- updated-dependencies: - dependency-name: parallel_tests dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 8d0c070e0..e9dbd6155 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -21,8 +21,8 @@ GEM json (2.5.1) moneta (1.0.0) multi_json (1.15.0) - parallel (1.20.1) - parallel_tests (3.7.1) + parallel (1.21.0) + parallel_tests (3.7.3) parallel platform-api (3.3.0) heroics (~> 0.1.1) From 46e4377376657835d88da432a92630a928c4dd41 Mon Sep 17 00:00:00 2001 From: Ed Morley <501702+edmorley@users.noreply.github.com> Date: Wed, 29 Sep 2021 17:29:23 +0100 Subject: [PATCH 0823/1195] Correct CHANGELOG entries for #1188 and #1193 (#1205) * Moves the entry for #1193 to "unreleased", since it was not part of the v229 release. * Fixes the date for the v229 release (it was published to the buildpack registry on `2021-08-30T15:57:32.024Z`). * Turns the `Main` heading into an H2 so it's at the same heading level as the versioned headings. --- CHANGELOG.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 64138c8fe..19edd43b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,11 @@ -# Main (unreleased) +# Changelog -## v229 (7/30/2021) +## Main (unreleased) * Default Ruby version is now 2.7.4 (https://github.com/heroku/heroku-buildpack-ruby/pull/1193) + +## v229 (8/30/2021) + * Fix interoperability with other Heroku buildpacks' `$WEB_CONCURRENCY` handling (https://github.com/heroku/heroku-buildpack-ruby/pull/1188) ## v228 (6/24/2021) From abfea4f232f78358879626689d9bc893b1134038 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Oct 2021 00:07:02 +0100 Subject: [PATCH 0824/1195] Bump rspec-expectations from 3.9.4 to 3.10.1 (#1207) Bumps [rspec-expectations](https://github.com/rspec/rspec-expectations) from 3.9.4 to 3.10.1. - [Release notes](https://github.com/rspec/rspec-expectations/releases) - [Changelog](https://github.com/rspec/rspec-expectations/blob/main/Changelog.md) - [Commits](https://github.com/rspec/rspec-expectations/compare/v3.9.4...v3.10.1) --- updated-dependencies: - dependency-name: rspec-expectations dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index e9dbd6155..64331c157 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -32,14 +32,14 @@ GEM rate_throttle_client (0.1.2) redis (4.4.0) rrrretry (1.0.0) - rspec-core (3.9.3) - rspec-support (~> 3.9.3) - rspec-expectations (3.9.4) + rspec-core (3.10.1) + rspec-support (~> 3.10.0) + rspec-expectations (3.10.1) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.9.0) + rspec-support (~> 3.10.0) rspec-retry (0.6.2) rspec-core (> 3.3) - rspec-support (3.9.4) + rspec-support (3.10.2) thor (1.1.0) threaded (0.0.4) toml-rb (2.0.1) From d2ea50190a6bbbf6560092bdfac9381aa6d967c6 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Tue, 5 Oct 2021 13:22:00 -0500 Subject: [PATCH 0825/1195] Release v230 (#1208) --- CHANGELOG.md | 2 ++ changelogs/{ => v230}/ruby_274_default.md | 0 lib/language_pack/version.rb | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) rename changelogs/{ => v230}/ruby_274_default.md (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 19edd43b6..4d085916c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Main (unreleased) +## v230 (10/5/2021) + * Default Ruby version is now 2.7.4 (https://github.com/heroku/heroku-buildpack-ruby/pull/1193) ## v229 (8/30/2021) diff --git a/changelogs/ruby_274_default.md b/changelogs/v230/ruby_274_default.md similarity index 100% rename from changelogs/ruby_274_default.md rename to changelogs/v230/ruby_274_default.md diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 2fe10be90..59ffe07e0 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v229" + BUILDPACK_VERSION = "v230" end end From fe5a637da01d83e836cb926c5d3f3f4e0acf7449 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Oct 2021 08:00:22 +0000 Subject: [PATCH 0826/1195] Bump ci-queue from 0.20.8 to 0.21.0 (#1210) Bumps [ci-queue](https://github.com/Shopify/ci-queue) from 0.20.8 to 0.21.0. - [Release notes](https://github.com/Shopify/ci-queue/releases) - [Commits](https://github.com/Shopify/ci-queue/compare/v0.20.8...v0.21.0) --- updated-dependencies: - dependency-name: ci-queue dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 64331c157..2785827c3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ GEM remote: https://rubygems.org/ specs: - ci-queue (0.20.8) + ci-queue (0.21.0) citrus (3.0.2) diff-lcs (1.4.4) erubis (2.7.0) From b94277cec78f49cecce536dbf4e5bca566607425 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Tue, 19 Oct 2021 11:11:31 -0500 Subject: [PATCH 0827/1195] [close #1202] Add support for Rails 7 & jsbundling (#1212) * [close #1202] Add support for Rails 7 & jsbundling Rails 7 introduced the gem: ``` gem "jsbundling-rails", "~> 0.1.0" ``` Which no longer relies on `webpacker`. Issue #1202 was opened since developers using jsbundling would expect `yarn` to be available but won't have the `webpacker` gem which we use to gate detection for yarn installation. With this change we now install nodejs when a `package.json` is detected and yarn when `yarn.lock` is detected. * [close #1202] Add support for Rails 7 & jsbundling Rails 7 introduced the gem: ``` gem "jsbundling-rails", "~> 0.1.0" ``` Which no longer relies on `webpacker`. Issue #1202 was opened since developers using jsbundling would expect `yarn` to be available but won't have the `webpacker` gem which we use to gate detection for yarn installation. With this change we now install nodejs when a `package.json` is detected and yarn when `yarn.lock` is detected. --- .rspec | 1 + CHANGELOG.md | 3 +++ Gemfile | 1 + Gemfile.lock | 2 ++ .../unreleased/jsbundling_packagejson.md | 10 ++++++++++ changelogs/unreleased/jsbundling_yarnlock.md | 10 ++++++++++ hatchet.json | 3 ++- hatchet.lock | 8 ++------ lib/language_pack.rb | 3 ++- lib/language_pack/rails6.rb | 2 +- lib/language_pack/rails7.rb | 17 +++++++++++++++++ lib/language_pack/ruby.rb | 14 ++++++++++++-- spec/cnb/basic_local_pack_spec.rb | 2 +- spec/hatchet/rails7_spec.rb | 19 +++++++++++++++++++ 14 files changed, 83 insertions(+), 12 deletions(-) create mode 100644 .rspec create mode 100644 changelogs/unreleased/jsbundling_packagejson.md create mode 100644 changelogs/unreleased/jsbundling_yarnlock.md create mode 100644 lib/language_pack/rails7.rb create mode 100644 spec/hatchet/rails7_spec.rb diff --git a/.rspec b/.rspec new file mode 100644 index 000000000..7aac1efb0 --- /dev/null +++ b/.rspec @@ -0,0 +1 @@ +--require dead_end diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d085916c..ced65c76f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## Main (unreleased) +* Applications with `package.json` now get `nodejs` installed (https://github.com/heroku/heroku-buildpack-ruby/pull/1212) +* Applications with `yarn.lock` now get `yarn` installed (https://github.com/heroku/heroku-buildpack-ruby/pull/1212) + ## v230 (10/5/2021) * Default Ruby version is now 2.7.4 (https://github.com/heroku/heroku-buildpack-ruby/pull/1193) diff --git a/Gemfile b/Gemfile index e4e202ff3..4a0adce0e 100644 --- a/Gemfile +++ b/Gemfile @@ -15,4 +15,5 @@ group :development, :test do gem 'json' gem 'ci-queue' gem 'redis' + gem 'dead_end' end diff --git a/Gemfile.lock b/Gemfile.lock index 2785827c3..ff5d66b0b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,6 +3,7 @@ GEM specs: ci-queue (0.21.0) citrus (3.0.2) + dead_end (2.0.0) diff-lcs (1.4.4) erubis (2.7.0) excon (0.85.0) @@ -51,6 +52,7 @@ PLATFORMS DEPENDENCIES ci-queue + dead_end excon heroku_hatchet json diff --git a/changelogs/unreleased/jsbundling_packagejson.md b/changelogs/unreleased/jsbundling_packagejson.md new file mode 100644 index 000000000..41f46c704 --- /dev/null +++ b/changelogs/unreleased/jsbundling_packagejson.md @@ -0,0 +1,10 @@ +## Nodejs will now be installed for Ruby applications that have a `package.json` file + +Ruby applications using the `heroku/ruby` buildpack now receive a default version of `node` installed if they have a `package.json` file in the root directory of their application. + +Prior to this change, only applications using the `webpacker` or `execjs` gem would trigger node installation logic. This change is intended to facilitate Rails 7 applications using `jsbundling-rails` without `webpacker`. + +>Note +>Applications using the `heroku/nodejs` buildpack before the `heroku/ruby` buildpack will not see a change in behavior + +For more information, see [Heroku Ruby support documentation](https://devcenter.heroku.com/articles/ruby-support#installed-binaries). diff --git a/changelogs/unreleased/jsbundling_yarnlock.md b/changelogs/unreleased/jsbundling_yarnlock.md new file mode 100644 index 000000000..2f70d329b --- /dev/null +++ b/changelogs/unreleased/jsbundling_yarnlock.md @@ -0,0 +1,10 @@ +## Yarn will now be installed for Ruby applications that have a `yarn.lock` file + +Ruby applications using the `heroku/ruby` buildpack now receive a default version of `yarn` installed if they have a `yarn.lock` file in the root directory of their application. + +Prior to this change, only applications using the `webpacker` gem would trigger node installation logic. This change is intended to facilitate Rails 7 applications using `jsbundling-rails` without `webpacker`. + +>Note +>Applications using the `heroku/nodejs` buildpack before the `heroku/ruby` buildpack will not see a change in behavior + +For more information, see [Heroku Ruby support documentation](https://devcenter.heroku.com/articles/ruby-support#installed-binaries). diff --git a/hatchet.json b/hatchet.json index 3df2fd4a2..9d4507f47 100644 --- a/hatchet.json +++ b/hatchet.json @@ -48,7 +48,8 @@ "sharpstone/active_storage_non_local", "sharpstone/active_storage_local", "sharpstone/sprockets_asset_compile_true", - "sharpstone/rails6-basic" + "sharpstone/rails6-basic", + "sharpstone/rails-jsbundling" ], "heroku": [ "heroku/ruby-getting-started" diff --git a/hatchet.lock b/hatchet.lock index d08b738af..9f7c2bf1d 100644 --- a/hatchet.lock +++ b/hatchet.lock @@ -45,16 +45,14 @@ - 18853ba7dda61745995740b4ca6f5f90bbd8afba - - "./repos/rails_versions/active_storage_non_local" - 86dddf0127043abba1cb2890590a1d38f111edbd +- - "./repos/rails_versions/rails-jsbundling" + - 6b60a3aa7eb9507865ebba6afcca150017ab66b4 - - "./repos/rails_versions/rails3_default_ruby" - a6b44db674c0d3538633989295e2cfd5e8e1ba0d - - "./repos/rails_versions/rails42_default_ruby" - dfa0f0133dafa62064968ea2efb6432f54350138 - - "./repos/rails_versions/rails4_windows_mri193" - f4c7b6209835050468bbb87827acf652b8f4d8ce -- - "./repos/rails_versions/rails5" - - 1680c5da829e03ffb9345187971a13e5109d86a6 -- - "./repos/rails_versions/rails51_webpacker" - - 75c5c4f21b1d88fc3b8edf60b3f871df3ad70208 - - "./repos/rails_versions/rails6-basic" - 6b81e0246c64c332181c22ace4ac96b57309cb85 - - "./repos/rails_versions/rails_lts_23_default_ruby" @@ -69,8 +67,6 @@ - ce976c727d9f477957c499f39f4cf9603c378103 - - "./repos/rake/bad_rakefile" - 3cb9c7bf6494c59bd25fa74c2aa4531119e12a46 -- - "./repos/rake/connect_to_database_on_first_push" - - 635e002cb5a0400092dd5e80b88c6ffb740fda02 - - "./repos/rake/default_with_rakefile" - c6e0c4db8dcccb47e11d496e17adbc2dafc80dd8 - - "./repos/rake/no_rakefile" diff --git a/lib/language_pack.rb b/lib/language_pack.rb index 23f41bbd7..a7b43b236 100644 --- a/lib/language_pack.rb +++ b/lib/language_pack.rb @@ -13,7 +13,7 @@ def self.detect(*args) Instrument.instrument 'detect' do Dir.chdir(args.first) - pack = [ NoLockfile, Rails6, Rails5, Rails42, Rails41, Rails4, Rails3, Rails2, Rack, Ruby ].detect do |klass| + pack = [ NoLockfile, Rails7, Rails6, Rails5, Rails42, Rails41, Rails4, Rails3, Rails2, Rack, Ruby ].detect do |klass| klass.use? end @@ -50,4 +50,5 @@ def self.detect(*args) require "language_pack/rails42" require "language_pack/rails5" require "language_pack/rails6" +require "language_pack/rails7" require "language_pack/no_lockfile" diff --git a/lib/language_pack/rails6.rb b/lib/language_pack/rails6.rb index 32a603e6c..89b7678d2 100644 --- a/lib/language_pack/rails6.rb +++ b/lib/language_pack/rails6.rb @@ -9,7 +9,7 @@ def self.use? rails_version = bundler.gem_version('railties') return false unless rails_version is_rails = rails_version >= Gem::Version.new('6.x') && - rails_version < Gem::Version.new('7.0.0') + rails_version < Gem::Version.new('7.a') return is_rails end end diff --git a/lib/language_pack/rails7.rb b/lib/language_pack/rails7.rb new file mode 100644 index 000000000..cd424bd31 --- /dev/null +++ b/lib/language_pack/rails7.rb @@ -0,0 +1,17 @@ +require 'securerandom' +require "language_pack" +require "language_pack/rails6" + +class LanguagePack::Rails7 < LanguagePack::Rails6 + # @return [Boolean] true if it's a Rails 7.x app + def self.use? + instrument "rails6.use" do + rails_version = bundler.gem_version('railties') + return false unless rails_version + is_rails = rails_version >= Gem::Version.new('7.a') && + rails_version < Gem::Version.new('8.0.0') + return is_rails + end + end +end + diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index e35ffa65e..8588a4111 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -1053,7 +1053,11 @@ def pg_adapters # @note execjs will blow up if no JS RUNTIME is detected and is loaded. # @return [Array] the node.js binary path if we need it or an empty Array def add_node_js_binary - if (bundler.has_gem?('execjs') || bundler.has_gem?('webpacker')) && node_not_preinstalled? + return [] if node_js_preinstalled? + + if Pathname(build_path).join("package.json").exist? || + bundler.has_gem?('execjs') || + bundler.has_gem?('webpacker') [@node_installer.binary_path] else [] @@ -1061,7 +1065,13 @@ def add_node_js_binary end def add_yarn_binary - bundler.has_gem?('webpacker') && yarn_not_preinstalled? ? [@yarn_installer.name] : [] + return [] if yarn_preinstalled? + + if Pathname(build_path).join("yarn.lock").exist? || bundler.has_gem?('webpacker') + [@yarn_installer.name] + else + [] + end end def has_yarn_binary? diff --git a/spec/cnb/basic_local_pack_spec.rb b/spec/cnb/basic_local_pack_spec.rb index 2c792be1b..5c7ffc646 100644 --- a/spec/cnb/basic_local_pack_spec.rb +++ b/spec/cnb/basic_local_pack_spec.rb @@ -115,7 +115,7 @@ def run!(cmd) expect(app.output).to match("Compiling Ruby/Rails") run_out = app.run!("ruby -v") - expect(run_out).to match("2.6.6") + expect(run_out).to match("2.7.4") end end end diff --git a/spec/hatchet/rails7_spec.rb b/spec/hatchet/rails7_spec.rb new file mode 100644 index 000000000..fdce28447 --- /dev/null +++ b/spec/hatchet/rails7_spec.rb @@ -0,0 +1,19 @@ +require_relative '../spec_helper' + +describe "Rails 6" do + it "should detect successfully" do + Hatchet::App.new('rails-jsbundling').in_directory_fork do + expect(LanguagePack::Rails6.use?).to eq(false) + expect(LanguagePack::Rails7.use?).to eq(true) + end + end + + it "works with jsbundling" do + Hatchet::Runner.new("rails-jsbundling").tap do |app| + app.deploy do + expect(app.output).to include("yarn install") + expect(app.output).to include("Asset precompilation completed") + end + end + end +end From 51f8ad44e67bb20f4dae3d29c99b49284486e227 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 19 Oct 2021 16:19:40 +0000 Subject: [PATCH 0828/1195] Bump json from 2.5.1 to 2.6.0 (#1213) Bumps [json](https://github.com/flori/json) from 2.5.1 to 2.6.0. - [Release notes](https://github.com/flori/json/releases) - [Changelog](https://github.com/flori/json/blob/master/CHANGES.md) - [Commits](https://github.com/flori/json/compare/v2.5.1...v2.6.0) --- updated-dependencies: - dependency-name: json dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index ff5d66b0b..54e6275df 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -19,7 +19,7 @@ GEM rrrretry (~> 1) thor (~> 1) threaded (~> 0) - json (2.5.1) + json (2.6.0) moneta (1.0.0) multi_json (1.15.0) parallel (1.21.0) From e257299db8cf1f32dcfb02444fadbf515f498534 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 26 Oct 2021 09:08:24 +0100 Subject: [PATCH 0829/1195] Bump json from 2.6.0 to 2.6.1 (#1215) Bumps [json](https://github.com/flori/json) from 2.6.0 to 2.6.1. - [Release notes](https://github.com/flori/json/releases) - [Changelog](https://github.com/flori/json/blob/master/CHANGES.md) - [Commits](https://github.com/flori/json/compare/v2.6.0...v2.6.1) --- updated-dependencies: - dependency-name: json dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 54e6275df..ca26024af 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -19,7 +19,7 @@ GEM rrrretry (~> 1) thor (~> 1) threaded (~> 0) - json (2.6.0) + json (2.6.1) moneta (1.0.0) multi_json (1.15.0) parallel (1.21.0) From f8929998b0bb5fa9a63ced5737ccc92646af0f15 Mon Sep 17 00:00:00 2001 From: svc-scm <48930134+svc-scm@users.noreply.github.com> Date: Wed, 27 Oct 2021 10:26:04 -0700 Subject: [PATCH 0830/1195] Updated/Added CODEOWNERS with ECCN (#1216) --- .github/CODEOWNERS | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 25f6404da..0a44fdf7a 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1,2 @@ * @heroku/languages +#ECCN:Open Source \ No newline at end of file From 570d7578c2367de5f144a413f5834497affd9ab6 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Wed, 27 Oct 2021 15:44:01 -0500 Subject: [PATCH 0831/1195] v231 (#1217) --- CHANGELOG.md | 2 ++ changelogs/v231/.gitkeep | 0 changelogs/{unreleased => v231}/jsbundling_packagejson.md | 0 changelogs/{unreleased => v231}/jsbundling_yarnlock.md | 0 lib/language_pack/version.rb | 2 +- 5 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/v231/.gitkeep rename changelogs/{unreleased => v231}/jsbundling_packagejson.md (100%) rename changelogs/{unreleased => v231}/jsbundling_yarnlock.md (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index ced65c76f..db7b21548 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Main (unreleased) +## v231 (10/27/2021) + * Applications with `package.json` now get `nodejs` installed (https://github.com/heroku/heroku-buildpack-ruby/pull/1212) * Applications with `yarn.lock` now get `yarn` installed (https://github.com/heroku/heroku-buildpack-ruby/pull/1212) diff --git a/changelogs/v231/.gitkeep b/changelogs/v231/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/changelogs/unreleased/jsbundling_packagejson.md b/changelogs/v231/jsbundling_packagejson.md similarity index 100% rename from changelogs/unreleased/jsbundling_packagejson.md rename to changelogs/v231/jsbundling_packagejson.md diff --git a/changelogs/unreleased/jsbundling_yarnlock.md b/changelogs/v231/jsbundling_yarnlock.md similarity index 100% rename from changelogs/unreleased/jsbundling_yarnlock.md rename to changelogs/v231/jsbundling_yarnlock.md diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 59ffe07e0..39b28cb62 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v230" + BUILDPACK_VERSION = "v231" end end From 62029a9f031c6b24f0b1404285ee0b43844aba78 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Nov 2021 23:05:49 +0000 Subject: [PATCH 0832/1195] Bump excon from 0.85.0 to 0.88.0 (#1220) Bumps [excon](https://github.com/excon/excon) from 0.85.0 to 0.88.0. - [Release notes](https://github.com/excon/excon/releases) - [Changelog](https://github.com/excon/excon/blob/master/changelog.txt) - [Commits](https://github.com/excon/excon/compare/v0.85.0...v0.88.0) --- updated-dependencies: - dependency-name: excon dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index ca26024af..c7f9fd612 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -6,7 +6,7 @@ GEM dead_end (2.0.0) diff-lcs (1.4.4) erubis (2.7.0) - excon (0.85.0) + excon (0.88.0) heroics (0.1.2) erubis (~> 2.0) excon From 115bdda51b372a6834a17bda3de9a0c04b45acbb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Nov 2021 23:21:52 +0000 Subject: [PATCH 0833/1195] Bump dead_end from 2.0.0 to 2.0.2 (#1221) Bumps [dead_end](https://github.com/zombocom/dead_end) from 2.0.0 to 2.0.2. - [Release notes](https://github.com/zombocom/dead_end/releases) - [Changelog](https://github.com/zombocom/dead_end/blob/main/CHANGELOG.md) - [Commits](https://github.com/zombocom/dead_end/compare/v2.0.0...v2.0.2) --- updated-dependencies: - dependency-name: dead_end dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index c7f9fd612..b43870484 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,7 +3,7 @@ GEM specs: ci-queue (0.21.0) citrus (3.0.2) - dead_end (2.0.0) + dead_end (2.0.2) diff-lcs (1.4.4) erubis (2.7.0) excon (0.88.0) From 38e9161cef0dcaba84a0b223a75cb5263e7e6da0 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 1 Nov 2021 23:26:00 +0000 Subject: [PATCH 0834/1195] Post-release updates: heroku/ruby 0.1.3 (#1218) Co-authored-by: schneems --- buildpack.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildpack.toml b/buildpack.toml index 3049a3b41..6bb9bd922 100644 --- a/buildpack.toml +++ b/buildpack.toml @@ -2,7 +2,7 @@ api = "0.2" [buildpack] id = "heroku/ruby" -version = "0.1.3" +version = "0.1.4" name = "Ruby" ruby_version = "2.7.4" From 6ab7e9ade71ab3d104a0745d25b71ebe5966eb5a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Nov 2021 23:32:42 +0000 Subject: [PATCH 0835/1195] Bump toml-rb from 2.0.1 to 2.1.0 (#1222) Bumps [toml-rb](https://github.com/emancu/toml-rb) from 2.0.1 to 2.1.0. - [Release notes](https://github.com/emancu/toml-rb/releases) - [Commits](https://github.com/emancu/toml-rb/compare/v2.0.1...v2.1.0) --- updated-dependencies: - dependency-name: toml-rb dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index b43870484..d31a02c0e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -43,7 +43,7 @@ GEM rspec-support (3.10.2) thor (1.1.0) threaded (0.0.4) - toml-rb (2.0.1) + toml-rb (2.1.0) citrus (~> 3.0, > 3.0) webrick (1.7.0) From 8e80d54b273aed16659fa1358606d85faeec84dd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Nov 2021 23:40:40 +0000 Subject: [PATCH 0836/1195] Bump redis from 4.4.0 to 4.5.1 (#1223) Bumps [redis](https://github.com/redis/redis-rb) from 4.4.0 to 4.5.1. - [Release notes](https://github.com/redis/redis-rb/releases) - [Changelog](https://github.com/redis/redis-rb/blob/master/CHANGELOG.md) - [Commits](https://github.com/redis/redis-rb/compare/v4.4.0...v4.5.1) --- updated-dependencies: - dependency-name: redis dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index d31a02c0e..17185d3bc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -31,7 +31,7 @@ GEM rate_throttle_client (~> 0.1.0) rake (13.0.6) rate_throttle_client (0.1.2) - redis (4.4.0) + redis (4.5.1) rrrretry (1.0.0) rspec-core (3.10.1) rspec-support (~> 3.10.0) From ef1613dbb3ddfc45c7adc2ccb5a275ccae32bd86 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Nov 2021 23:47:31 +0000 Subject: [PATCH 0837/1195] Bump ci-queue from 0.21.0 to 0.21.1 (#1224) Bumps [ci-queue](https://github.com/Shopify/ci-queue) from 0.21.0 to 0.21.1. - [Release notes](https://github.com/Shopify/ci-queue/releases) - [Commits](https://github.com/Shopify/ci-queue/compare/v0.21.0...v0.21.1) --- updated-dependencies: - dependency-name: ci-queue dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 17185d3bc..c2f9b9550 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ GEM remote: https://rubygems.org/ specs: - ci-queue (0.21.0) + ci-queue (0.21.1) citrus (3.0.2) dead_end (2.0.2) diff-lcs (1.4.4) From c7ee419b28a766edb0f4be6af398c529bcf2d06e Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Tue, 9 Nov 2021 16:46:20 -0600 Subject: [PATCH 0838/1195] Make lxpc a no-op (#1228) * Bootstrap off of main * No-op lxpc * v232 --- CHANGELOG.md | 4 ++++ app.json | 2 +- lib/language_pack/instrument.rb | 2 +- lib/language_pack/version.rb | 2 +- spec/hatchet/rails7_spec.rb | 2 ++ 5 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index db7b21548..2c5f4208a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Main (unreleased) +## v232 (11/9/2021) + +* Deactivate LXPC (https://github.com/heroku/heroku-buildpack-ruby/pull/1228) + ## v231 (10/27/2021) * Applications with `package.json` now get `nodejs` installed (https://github.com/heroku/heroku-buildpack-ruby/pull/1212) diff --git a/app.json b/app.json index ab7affa4f..5d8b1006c 100644 --- a/app.json +++ b/app.json @@ -24,7 +24,7 @@ }, "buildpacks": [ { "url": "https://github.com/heroku/heroku-buildpack-cli.git" }, - { "url": "heroku/ruby" } + { "url": "https://github.com/heroku/heroku-buildpack-ruby" } ] } } diff --git a/lib/language_pack/instrument.rb b/lib/language_pack/instrument.rb index ccc7397ef..e9a6566b7 100644 --- a/lib/language_pack/instrument.rb +++ b/lib/language_pack/instrument.rb @@ -25,7 +25,7 @@ def self.instrument(cat, title = "", *args) end def self.out - Thread.current[:out] ||= ENV['LOGPLEX_DEFAULT_TOKEN'] ? Lpxc.new(batch_size: 1) : StringIO.new + Thread.current[:out] ||= StringIO.new end def self.trace(name, *args, &blk) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 39b28cb62..d58b7134e 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v231" + BUILDPACK_VERSION = "v232" end end diff --git a/spec/hatchet/rails7_spec.rb b/spec/hatchet/rails7_spec.rb index fdce28447..2a9ae04e1 100644 --- a/spec/hatchet/rails7_spec.rb +++ b/spec/hatchet/rails7_spec.rb @@ -9,6 +9,8 @@ end it "works with jsbundling" do + skip("rails-turbo was yanked and I don't know why") + Hatchet::Runner.new("rails-jsbundling").tap do |app| app.deploy do expect(app.output).to include("yarn install") From 951fc728979695990c32df2d4d60ae2d6f6f61c2 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Thu, 11 Nov 2021 13:02:39 -0600 Subject: [PATCH 0839/1195] Remove instrumentation (#1229) Previously we used logplex to collect production performance statistics. It worked like this. We collect the stats, then stream them to a logplex app endpoint using l2met format. A logplex drain read from the data, serialized it into a Postgres database where we later wrote custom dashboards via SQL queries to find places to optimize. That setup was ad-hoc. After we did the immediate perf work we decommissioned the drain and the Postgres database. We didn't remove the logplex integration or the instrumentation partially because we didn't know if we would need to do another round of performance analysis and partially because it was believed not removing it was "safer" (when this happened there were far fewer tests on the buildpack and developing on it was a far riskier endeavor). We haven't used this in years and are in the process of re-writing the Ruby buildpack. Any future instrumentation and performance analysis will be done away from this codebase. We can safely remove the instrumentation, lpxc (used to send logs to the endpoint), dontenv (used to source the environment variable for logplex), and the logic around preserving and copying the `.env` file from prior builds. #GUS-W-8216066 --- CHANGELOG.md | 4 +- bin/support/ruby_build | 12 +- bin/support/ruby_compile | 12 +- bin/support/ruby_test-compile | 12 +- buildpack.toml | 5 - lib/language_pack.rb | 15 +- lib/language_pack/base.rb | 73 +- lib/language_pack/helpers/bundler_wrapper.rb | 86 +- lib/language_pack/helpers/rake_runner.rb | 12 +- lib/language_pack/instrument.rb | 69 -- lib/language_pack/rack.rb | 30 +- lib/language_pack/rails2.rb | 54 +- lib/language_pack/rails3.rb | 118 ++- lib/language_pack/rails4.rb | 86 +- lib/language_pack/rails41.rb | 18 +- lib/language_pack/rails42.rb | 18 +- lib/language_pack/rails5.rb | 18 +- lib/language_pack/rails6.rb | 18 +- lib/language_pack/rails7.rb | 12 +- lib/language_pack/ruby.rb | 926 +++++++++---------- lib/language_pack/shell_helpers.rb | 1 + lib/language_pack/test/ruby.rb | 46 +- vendor/dotenv.rb | 7 - vendor/lpxc.rb | 177 ---- 24 files changed, 711 insertions(+), 1118 deletions(-) delete mode 100644 lib/language_pack/instrument.rb delete mode 100644 vendor/dotenv.rb delete mode 100644 vendor/lpxc.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c5f4208a..6a82ae469 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,11 @@ ## Main (unreleased) +* Remove instrumentation and LPXC logic (https://github.com/heroku/heroku-buildpack-ruby/pull/1229) + ## v232 (11/9/2021) -* Deactivate LXPC (https://github.com/heroku/heroku-buildpack-ruby/pull/1228) +* Deactivate LPXC (https://github.com/heroku/heroku-buildpack-ruby/pull/1228) ## v231 (10/27/2021) diff --git a/bin/support/ruby_build b/bin/support/ruby_build index f86aefc87..ddcb77edf 100755 --- a/bin/support/ruby_build +++ b/bin/support/ruby_build @@ -18,13 +18,11 @@ ENV_DIR="#{PLATFORM_DIR}/env" PLAN=ARGV[3] begin - LanguagePack::Instrument.trace 'compile', 'app.compile' do - LanguagePack::ShellHelpers.initialize_env(ENV_DIR) - if pack = LanguagePack.detect(ARGV[0], nil, LAYER_DIR) - pack.topic("Compiling #{pack.name}") - pack.log("compile") do - pack.build - end + LanguagePack::ShellHelpers.initialize_env(ENV_DIR) + if pack = LanguagePack.detect(ARGV[0], nil, LAYER_DIR) + pack.topic("Compiling #{pack.name}") + pack.log("compile") do + pack.build end end rescue Exception => e diff --git a/bin/support/ruby_compile b/bin/support/ruby_compile index fe82b57b0..7d5b3e1fe 100755 --- a/bin/support/ruby_compile +++ b/bin/support/ruby_compile @@ -12,13 +12,11 @@ require "language_pack" require "language_pack/shell_helpers" begin - LanguagePack::Instrument.trace 'compile', 'app.compile' do - LanguagePack::ShellHelpers.initialize_env(ARGV[2]) - if pack = LanguagePack.detect(ARGV[0], ARGV[1]) - pack.topic("Compiling #{pack.name}") - pack.log("compile") do - pack.compile - end + LanguagePack::ShellHelpers.initialize_env(ARGV[2]) + if pack = LanguagePack.detect(ARGV[0], ARGV[1]) + pack.topic("Compiling #{pack.name}") + pack.log("compile") do + pack.compile end end rescue Exception => e diff --git a/bin/support/ruby_test-compile b/bin/support/ruby_test-compile index 81b007c01..7c3ae8216 100755 --- a/bin/support/ruby_test-compile +++ b/bin/support/ruby_test-compile @@ -19,13 +19,11 @@ require "language_pack/test" include LanguagePack::ShellHelpers begin - LanguagePack::Instrument.trace 'test_compile', 'app.test_compile' do - if pack = LanguagePack.detect(ARGV[0], ARGV[1]) - LanguagePack::ShellHelpers.initialize_env(ARGV[2]) - pack.topic("Setting up Test for #{pack.name}") - pack.log("test_compile") do - pack.compile - end + if pack = LanguagePack.detect(ARGV[0], ARGV[1]) + LanguagePack::ShellHelpers.initialize_env(ARGV[2]) + pack.topic("Setting up Test for #{pack.name}") + pack.log("test_compile") do + pack.compile end end rescue Exception => e diff --git a/buildpack.toml b/buildpack.toml index 6bb9bd922..c6689f156 100644 --- a/buildpack.toml +++ b/buildpack.toml @@ -11,11 +11,6 @@ ruby_version = "2.7.4" [publish.Ignore] files = ["spec/"] -[[publish.Vendor]] -url = "https://codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/ruby.tgz" -dir = "." -files = ["./.env"] - [[publish.Vendor]] url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-18/ruby-2.7.4.tgz" dir = "vendor/ruby/heroku-18" diff --git a/lib/language_pack.rb b/lib/language_pack.rb index a7b43b236..05703038d 100644 --- a/lib/language_pack.rb +++ b/lib/language_pack.rb @@ -10,25 +10,20 @@ module Helpers # @param [Array] first argument is a String of the build directory # @return [LanguagePack] the {LanguagePack} detected def self.detect(*args) - Instrument.instrument 'detect' do - Dir.chdir(args.first) + Dir.chdir(args.first) - pack = [ NoLockfile, Rails7, Rails6, Rails5, Rails42, Rails41, Rails4, Rails3, Rails2, Rack, Ruby ].detect do |klass| - klass.use? - end - - return pack ? pack.new(*args) : nil + pack = [ NoLockfile, Rails7, Rails6, Rails5, Rails42, Rails41, Rails4, Rails3, Rails2, Rack, Ruby ].detect do |klass| + klass.use? end + + return pack ? pack.new(*args) : nil end end - $:.unshift File.expand_path("../../vendor", __FILE__) $:.unshift File.expand_path("..", __FILE__) -require 'dotenv' require 'language_pack/shell_helpers' -require 'language_pack/instrument' require "language_pack/helpers/plugin_installer" require "language_pack/helpers/stale_file_cleaner" require "language_pack/helpers/rake_runner" diff --git a/lib/language_pack/base.rb b/lib/language_pack/base.rb index 056265ad3..a8d573ecc 100644 --- a/lib/language_pack/base.rb +++ b/lib/language_pack/base.rb @@ -8,7 +8,6 @@ require "language_pack/helpers/layer" require "language_pack/metadata" require "language_pack/fetcher" -require "language_pack/instrument" Encoding.default_external = Encoding::UTF_8 if defined?(Encoding) ENV["BPLOG_PREFIX"] = "buildpack.ruby" @@ -28,26 +27,16 @@ class LanguagePack::Base # @param [String] the path of the build dir # @param [String] the path of the cache dir this is nil during detect and release def initialize(build_path, cache_path = nil, layer_dir=nil) - self.class.instrument "base.initialize" do - @build_path = build_path - @stack = ENV.fetch("STACK") - @cache = LanguagePack::Cache.new(cache_path) - @metadata = LanguagePack::Metadata.new(@cache) - @bundler_cache = LanguagePack::BundlerCache.new(@cache, @stack) - @id = Digest::SHA1.hexdigest("#{Time.now.to_f}-#{rand(1000000)}")[0..10] - @fetchers = {:buildpack => LanguagePack::Fetcher.new(VENDOR_URL) } - @layer_dir = layer_dir - - Dir.chdir build_path - end - end - - def instrument(*args, &block) - self.class.instrument(*args, &block) - end - - def self.instrument(*args, &block) - LanguagePack::Instrument.instrument(*args, &block) + @build_path = build_path + @stack = ENV.fetch("STACK") + @cache = LanguagePack::Cache.new(cache_path) + @metadata = LanguagePack::Metadata.new(@cache) + @bundler_cache = LanguagePack::BundlerCache.new(@cache, @stack) + @id = Digest::SHA1.hexdigest("#{Time.now.to_f}-#{rand(1000000)}")[0..10] + @fetchers = {:buildpack => LanguagePack::Fetcher.new(VENDOR_URL) } + @layer_dir = layer_dir + + Dir.chdir build_path end def self.===(build_path) @@ -82,40 +71,36 @@ def default_process_types # this is called to build the slug def compile write_release_yaml - instrument 'base.compile' do + Kernel.puts "" + warnings.each do |warning| + Kernel.puts "\e[1m\e[33m###### WARNING:\e[0m"# Bold yellow Kernel.puts "" - warnings.each do |warning| - Kernel.puts "\e[1m\e[33m###### WARNING:\e[0m"# Bold yellow - Kernel.puts "" - puts warning - Kernel.puts "" - end - if deprecations.any? - topic "DEPRECATIONS:" - puts @deprecations.join("\n") - end + puts warning Kernel.puts "" end + if deprecations.any? + topic "DEPRECATIONS:" + puts @deprecations.join("\n") + end + Kernel.puts "" mcount "success" end def build write_release_toml - instrument 'base.compile' do + Kernel.puts "" + warnings.each do |warning| + Kernel.puts "\e[1m\e[33m###### WARNING:\e[0m"# Bold yellow + Kernel.puts "" + puts warning Kernel.puts "" - warnings.each do |warning| - Kernel.puts "\e[1m\e[33m###### WARNING:\e[0m"# Bold yellow - Kernel.puts "" - puts warning - Kernel.puts "" - Kernel.puts "" - end - if deprecations.any? - topic "DEPRECATIONS:" - puts @deprecations.join("\n") - end Kernel.puts "" end + if deprecations.any? + topic "DEPRECATIONS:" + puts @deprecations.join("\n") + end + Kernel.puts "" mcount "success" end diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index d6281c43e..1123bfbe7 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -100,10 +100,8 @@ def has_gem?(name) end def gem_version(name) - instrument "ruby.gem_version" do - if spec = specs[name] - spec.version - end + if spec = specs[name] + spec.version end end @@ -131,29 +129,23 @@ def dir_name "bundler-#{version}" end - def instrument(*args, &block) - LanguagePack::Instrument.instrument(*args, &block) - end - def ruby_version - instrument 'detect_ruby_version' do - env = { "PATH" => "#{bundler_path}/bin:#{ENV['PATH']}", - "RUBYLIB" => File.join(bundler_path, "gems", dir_name, "lib"), - "GEM_PATH" => "#{bundler_path}:#{ENV["GEM_PATH"]}", - "BUNDLE_DISABLE_VERSION_CHECK" => "true" - } - command = "bundle platform --ruby" - - # Silently check for ruby version - output = run_stdout(command, user_env: true, env: env).strip.lines.last - - # If there's a gem in the Gemfile (i.e. syntax error) emit error - raise GemfileParseError.new(run("bundle check", user_env: true, env: env)) unless $?.success? - if output.match(/No ruby version specified/) - "" - else - output.strip.sub('(', '').sub(')', '').sub(/(p-?\d+)/, ' \1').split.join('-') - end + env = { "PATH" => "#{bundler_path}/bin:#{ENV['PATH']}", + "RUBYLIB" => File.join(bundler_path, "gems", dir_name, "lib"), + "GEM_PATH" => "#{bundler_path}:#{ENV["GEM_PATH"]}", + "BUNDLE_DISABLE_VERSION_CHECK" => "true" + } + command = "bundle platform --ruby" + + # Silently check for ruby version + output = run_stdout(command, user_env: true, env: env).strip.lines.last + + # If there's a gem in the Gemfile (i.e. syntax error) emit error + raise GemfileParseError.new(run("bundle check", user_env: true, env: env)) unless $?.success? + if output.match(/No ruby version specified/) + "" + else + output.strip.sub('(', '').sub(')', '').sub(/(p-?\d+)/, ' \1').split.join('-') end end @@ -178,33 +170,29 @@ def bundler_version_escape_valve! private def fetch_bundler - instrument 'fetch_bundler' do - return true if Dir.exists?(bundler_path) - - topic("Installing bundler #{@version}") - bundler_version_escape_valve! - - # Install directory structure (as of Bundler 2.1.4): - # - cache - # - bin - # - gems - # - specifications - # - build_info - # - extensions - # - doc - FileUtils.mkdir_p(bundler_path) - Dir.chdir(bundler_path) do - @fetcher.fetch_untar(@bundler_tar) - end - Dir["bin/*"].each {|path| `chmod 755 #{path}` } + return true if Dir.exists?(bundler_path) + + topic("Installing bundler #{@version}") + bundler_version_escape_valve! + + # Install directory structure (as of Bundler 2.1.4): + # - cache + # - bin + # - gems + # - specifications + # - build_info + # - extensions + # - doc + FileUtils.mkdir_p(bundler_path) + Dir.chdir(bundler_path) do + @fetcher.fetch_untar(@bundler_tar) end + Dir["bin/*"].each {|path| `chmod 755 #{path}` } end def parse_gemfile_lock - instrument 'parse_bundle' do - gemfile_contents = File.read(@gemfile_lock_path) - Bundler::LockfileParser.new(gemfile_contents) - end + gemfile_contents = File.read(@gemfile_lock_path) + Bundler::LockfileParser.new(gemfile_contents) end def major_bundler_version diff --git a/lib/language_pack/helpers/rake_runner.rb b/lib/language_pack/helpers/rake_runner.rb index d2c07e56a..0f18a2523 100644 --- a/lib/language_pack/helpers/rake_runner.rb +++ b/lib/language_pack/helpers/rake_runner.rb @@ -81,16 +81,10 @@ def rakefile_can_load? @rakefile_can_load end - def instrument(*args, &block) - LanguagePack::Instrument.instrument(*args, &block) - end - def load_rake_tasks(options = {}) - instrument "ruby.rake_task_defined" do - @rake_tasks ||= RakeTask.new("-P --trace").invoke(options.merge(quiet: true)).output - @rakefile_can_load ||= $?.success? - @rake_tasks - end + @rake_tasks ||= RakeTask.new("-P --trace").invoke(options.merge(quiet: true)).output + @rakefile_can_load ||= $?.success? + @rake_tasks end def load_rake_tasks!(options = {}, raise_on_fail = false) diff --git a/lib/language_pack/instrument.rb b/lib/language_pack/instrument.rb deleted file mode 100644 index e9a6566b7..000000000 --- a/lib/language_pack/instrument.rb +++ /dev/null @@ -1,69 +0,0 @@ -require 'benchmark' -require 'stringio' -require 'lpxc' -require 'date' -require 'language_pack/ruby' - -module LanguagePack - module Instrument - def self.bench_msg(message, level = 0, start_time, end_time, duration, build_id, buildpack_version) - out.puts "measure.#{message}.start=#{start_time} measure.#{message}.end=#{end_time} measure.#{message}.duration=#{duration} measure.#{message}.level=#{level} measure.#{message}.build_id=#{build_id} request_id=#{request_id} measure.#{message}.buildpack_version=#{buildpack_version} measure.#{message}.buildpack=#{buildpack_name} " - end - - def self.instrument(cat, title = "", *args) - ret = nil - start_time = DateTime.now.iso8601(6) - duration = Benchmark.realtime do - yield_with_block_depth do - ret = yield - end - end - end_time = DateTime.now.iso8601(6) - bench_msg(cat, block_depth, start_time, end_time, duration, build_id, buildpack_version) - - ret - end - - def self.out - Thread.current[:out] ||= StringIO.new - end - - def self.trace(name, *args, &blk) - ret = nil - block_depth = 0 - - instrument(name) { blk.call } - end - - def self.yield_with_block_depth - self.block_depth += 1 - yield - ensure - self.block_depth -= 1 - end - - def self.block_depth - Thread.current[:block_depth] || 0 - end - - def self.block_depth=(value) - Thread.current[:block_depth] = value - end - - def self.build_id - ENV['REQUEST_ID'] || ENV['SLUG_ID'] - end - - def self.request_id - ENV['REQUEST_ID'] - end - - def self.buildpack_version - LanguagePack::Ruby::BUILDPACK_VERSION - end - - def self.buildpack_name - LanguagePack::Ruby::NAME - end - end -end diff --git a/lib/language_pack/rack.rb b/lib/language_pack/rack.rb index 3a77b58ef..dd302c914 100644 --- a/lib/language_pack/rack.rb +++ b/lib/language_pack/rack.rb @@ -7,9 +7,7 @@ class LanguagePack::Rack < LanguagePack::Ruby # detects if this is a valid Rack app by seeing if "config.ru" exists # @return [Boolean] true if it's a Rack app def self.use? - instrument "rack.use" do - bundler.gem_version('rack') - end + bundler.gem_version('rack') end def name @@ -17,24 +15,20 @@ def name end def default_config_vars - instrument "rack.default_config_vars" do - super.merge({ - "RACK_ENV" => env("RACK_ENV") || "production" - }) - end + super.merge({ + "RACK_ENV" => env("RACK_ENV") || "production" + }) end def default_process_types - instrument "rack.default_process_types" do - # let's special case thin here if we detect it - web_process = bundler.has_gem?("thin") ? - "bundle exec thin start -R config.ru -e $RACK_ENV -p ${PORT:-5000}" : - "bundle exec rackup config.ru -p ${PORT:-5000}" - - super.merge({ - "web" => web_process - }) - end + # let's special case thin here if we detect it + web_process = bundler.has_gem?("thin") ? + "bundle exec thin start -R config.ru -e $RACK_ENV -p ${PORT:-5000}" : + "bundle exec rackup config.ru -p ${PORT:-5000}" + + super.merge({ + "web" => web_process + }) end private diff --git a/lib/language_pack/rails2.rb b/lib/language_pack/rails2.rb index 75177f6ad..48627c452 100644 --- a/lib/language_pack/rails2.rb +++ b/lib/language_pack/rails2.rb @@ -7,13 +7,11 @@ class LanguagePack::Rails2 < LanguagePack::Ruby # detects if this is a valid Rails 2 app # @return [Boolean] true if it's a Rails 2 app def self.use? - instrument "rails2.use" do - rails_version = bundler.gem_version('rails') - return false unless rails_version - is_rails2 = rails_version >= Gem::Version.new('2.0.0') && - rails_version < Gem::Version.new('3.0.0') - return is_rails2 - end + rails_version = bundler.gem_version('rails') + return false unless rails_version + is_rails2 = rails_version >= Gem::Version.new('2.0.0') && + rails_version < Gem::Version.new('3.0.0') + return is_rails2 end def initialize(*args) @@ -33,34 +31,28 @@ def default_env_vars end def default_config_vars - instrument "rails2.default_config_vars" do - config_vars = super - default_env_vars.map do |key, value| - config_vars[key] = env(key) || value - end - config_vars + config_vars = super + default_env_vars.map do |key, value| + config_vars[key] = env(key) || value end + config_vars end def default_process_types - instrument "rails2.default_process_types" do - web_process = bundler.has_gem?("thin") ? - "bundle exec thin start -e $RAILS_ENV -p ${PORT:-5000}" : - "bundle exec ruby script/server -p ${PORT:-5000}" + web_process = bundler.has_gem?("thin") ? + "bundle exec thin start -e $RAILS_ENV -p ${PORT:-5000}" : + "bundle exec ruby script/server -p ${PORT:-5000}" - process_types = super - process_types["web"] = web_process - process_types["worker"] = "bundle exec rake jobs:work" if has_jobs_work_task? - process_types["console"] = "bundle exec script/console" - process_types - end + process_types = super + process_types["web"] = web_process + process_types["worker"] = "bundle exec rake jobs:work" if has_jobs_work_task? + process_types["console"] = "bundle exec script/console" + process_types end def compile - instrument "rails2.compile" do - install_plugins - super - end + install_plugins + super end def build @@ -91,11 +83,9 @@ def has_jobs_work_task? end def install_plugins - instrument "rails2.install_plugins" do - plugins = ["rails_log_stdout"].reject { |plugin| bundler.has_gem?(plugin) } - topic "Rails plugin injection" - LanguagePack::Helpers::PluginsInstaller.new(plugins).install - end + plugins = ["rails_log_stdout"].reject { |plugin| bundler.has_gem?(plugin) } + topic "Rails plugin injection" + LanguagePack::Helpers::PluginsInstaller.new(plugins).install end # sets up the profile.d script for this buildpack diff --git a/lib/language_pack/rails3.rb b/lib/language_pack/rails3.rb index b40e2594c..b80661b14 100644 --- a/lib/language_pack/rails3.rb +++ b/lib/language_pack/rails3.rb @@ -6,13 +6,11 @@ class LanguagePack::Rails3 < LanguagePack::Rails2 # detects if this is a Rails 3.x app # @return [Boolean] true if it's a Rails 3.x app def self.use? - instrument "rails3.use" do - rails_version = bundler.gem_version('railties') - return false unless rails_version - is_rails3 = rails_version >= Gem::Version.new('3.0.0') && - rails_version < Gem::Version.new('4.0.0') - return is_rails3 - end + rails_version = bundler.gem_version('railties') + return false unless rails_version + is_rails3 = rails_version >= Gem::Version.new('3.0.0') && + rails_version < Gem::Version.new('4.0.0') + return is_rails3 end def name @@ -20,17 +18,15 @@ def name end def default_process_types - instrument "rails3.default_process_types" do - # let's special case thin here - web_process = bundler.has_gem?("thin") ? - "bundle exec thin start -R config.ru -e $RAILS_ENV -p ${PORT:-5000}" : - "bundle exec rails server -p ${PORT:-5000}" - - super.merge({ - "web" => web_process, - "console" => "bundle exec rails console" - }) - end + # let's special case thin here + web_process = bundler.has_gem?("thin") ? + "bundle exec thin start -R config.ru -e $RAILS_ENV -p ${PORT:-5000}" : + "bundle exec rails server -p ${PORT:-5000}" + + super.merge({ + "web" => web_process, + "console" => "bundle exec rails console" + }) end def rake_env @@ -38,9 +34,7 @@ def rake_env end def compile - instrument "rails3.compile" do - super - end + super end def config_detect @@ -159,61 +153,55 @@ def assets_compile_enabled? end def install_plugins - instrument "rails3.install_plugins" do - return false if bundler.has_gem?('rails_12factor') - plugins = {"rails_log_stdout" => "rails_stdout_logging", "rails3_serve_static_assets" => "rails_serve_static_assets" }. - reject { |plugin, gem| bundler.has_gem?(gem) } - return false if plugins.empty? - plugins.each do |plugin, gem| - warn "Injecting plugin '#{plugin}'" - end - warn "Add 'rails_12factor' gem to your Gemfile to skip plugin injection" - LanguagePack::Helpers::PluginsInstaller.new(plugins.keys).install + return false if bundler.has_gem?('rails_12factor') + plugins = {"rails_log_stdout" => "rails_stdout_logging", "rails3_serve_static_assets" => "rails_serve_static_assets" }. + reject { |plugin, gem| bundler.has_gem?(gem) } + return false if plugins.empty? + plugins.each do |plugin, gem| + warn "Injecting plugin '#{plugin}'" end + warn "Add 'rails_12factor' gem to your Gemfile to skip plugin injection" + LanguagePack::Helpers::PluginsInstaller.new(plugins.keys).install end # runs the tasks for the Rails 3.1 asset pipeline def run_assets_precompile_rake_task - instrument "rails3.run_assets_precompile_rake_task" do - log("assets_precompile") do - if File.exists?("public/assets/manifest.yml") - puts "Detected manifest.yml, assuming assets were compiled locally" - return true - end - - precompile = rake.task("assets:precompile") - return true unless precompile.is_defined? - - topic("Preparing app for Rails asset pipeline") - - precompile.invoke(env: rake_env) - - if precompile.success? - log "assets_precompile", :status => "success" - puts "Asset precompilation completed (#{"%.2f" % precompile.time}s)" - else - precompile_fail(precompile.output) - end + log("assets_precompile") do + if File.exists?("public/assets/manifest.yml") + puts "Detected manifest.yml, assuming assets were compiled locally" + return true + end + + precompile = rake.task("assets:precompile") + return true unless precompile.is_defined? + + topic("Preparing app for Rails asset pipeline") + + precompile.invoke(env: rake_env) + + if precompile.success? + log "assets_precompile", :status => "success" + puts "Asset precompilation completed (#{"%.2f" % precompile.time}s)" + else + precompile_fail(precompile.output) end end end # generate a dummy database_url def database_url - instrument "rails3.setup_database_url_env" do - # need to use a dummy DATABASE_URL here, so rails can load the environment - return env("DATABASE_URL") if env("DATABASE_URL") - scheme = - if bundler.has_gem?("pg") || bundler.has_gem?("jdbc-postgres") - "postgres" - elsif bundler.has_gem?("mysql") - "mysql" - elsif bundler.has_gem?("mysql2") - "mysql2" - elsif bundler.has_gem?("sqlite3") || bundler.has_gem?("sqlite3-ruby") - "sqlite3" - end - "#{scheme}://user:pass@127.0.0.1/dbname" + # need to use a dummy DATABASE_URL here, so rails can load the environment + return env("DATABASE_URL") if env("DATABASE_URL") + scheme = + if bundler.has_gem?("pg") || bundler.has_gem?("jdbc-postgres") + "postgres" + elsif bundler.has_gem?("mysql") + "mysql" + elsif bundler.has_gem?("mysql2") + "mysql2" + elsif bundler.has_gem?("sqlite3") || bundler.has_gem?("sqlite3-ruby") + "sqlite3" end + "#{scheme}://user:pass@127.0.0.1/dbname" end end diff --git a/lib/language_pack/rails4.rb b/lib/language_pack/rails4.rb index 86e11b6fd..a19eb4ebd 100644 --- a/lib/language_pack/rails4.rb +++ b/lib/language_pack/rails4.rb @@ -8,13 +8,11 @@ class LanguagePack::Rails4 < LanguagePack::Rails3 # detects if this is a Rails 4.x app # @return [Boolean] true if it's a Rails 4.x app def self.use? - instrument "rails4.use" do - rails_version = bundler.gem_version('railties') - return false unless rails_version - is_rails4 = rails_version >= Gem::Version.new('4.0.0.beta') && - rails_version < Gem::Version.new('4.1.0.beta1') - return is_rails4 - end + rails_version = bundler.gem_version('railties') + return false unless rails_version + is_rails4 = rails_version >= Gem::Version.new('4.0.0.beta') && + rails_version < Gem::Version.new('4.1.0.beta1') + return is_rails4 end def name @@ -22,34 +20,28 @@ def name end def default_process_types - instrument "rails4.default_process_types" do - super.merge({ - "web" => "bin/rails server -p ${PORT:-5000} -e $RAILS_ENV", - "console" => "bin/rails console" - }) - end + super.merge({ + "web" => "bin/rails server -p ${PORT:-5000} -e $RAILS_ENV", + "console" => "bin/rails console" + }) end def compile - instrument "rails4.compile" do - super - end + super end private def install_plugins - instrument "rails4.install_plugins" do - return false if bundler.has_gem?('rails_12factor') - plugins = ["rails_serve_static_assets", "rails_stdout_logging"].reject { |plugin| bundler.has_gem?(plugin) } - return false if plugins.empty? + return false if bundler.has_gem?('rails_12factor') + plugins = ["rails_serve_static_assets", "rails_stdout_logging"].reject { |plugin| bundler.has_gem?(plugin) } + return false if plugins.empty? warn <<-WARNING Include 'rails_12factor' gem to enable all platform features See https://devcenter.heroku.com/articles/rails-integration-gems for more information. WARNING # do not install plugins, do not call super - end end def public_assets_folder @@ -68,46 +60,42 @@ def cleanup end def run_assets_precompile_rake_task - instrument "rails4.run_assets_precompile_rake_task" do - log("assets_precompile") do - if Dir.glob("public/assets/{.sprockets-manifest-*.json,manifest-*.json}", File::FNM_DOTMATCH).any? - puts "Detected manifest file, assuming assets were compiled locally" - return true - end + log("assets_precompile") do + if Dir.glob("public/assets/{.sprockets-manifest-*.json,manifest-*.json}", File::FNM_DOTMATCH).any? + puts "Detected manifest file, assuming assets were compiled locally" + return true + end - precompile = rake.task("assets:precompile") - return true if precompile.not_defined? + precompile = rake.task("assets:precompile") + return true if precompile.not_defined? - topic("Preparing app for Rails asset pipeline") + topic("Preparing app for Rails asset pipeline") - @cache.load_without_overwrite public_assets_folder - @cache.load default_assets_cache + @cache.load_without_overwrite public_assets_folder + @cache.load default_assets_cache - precompile.invoke(env: rake_env) + precompile.invoke(env: rake_env) - if precompile.success? - log "assets_precompile", :status => "success" - puts "Asset precompilation completed (#{"%.2f" % precompile.time}s)" + if precompile.success? + log "assets_precompile", :status => "success" + puts "Asset precompilation completed (#{"%.2f" % precompile.time}s)" - clean_task = rake.task("assets:clean") - if clean_task.task_defined? - puts "Cleaning assets" - clean_task.invoke(env: rake_env) + clean_task = rake.task("assets:clean") + if clean_task.task_defined? + puts "Cleaning assets" + clean_task.invoke(env: rake_env) - cleanup_assets_cache - @cache.store public_assets_folder - @cache.store default_assets_cache - end - else - precompile_fail(precompile.output) + cleanup_assets_cache + @cache.store public_assets_folder + @cache.store default_assets_cache end + else + precompile_fail(precompile.output) end end end def cleanup_assets_cache - instrument "rails4.cleanup_assets_cache" do - LanguagePack::Helpers::StaleFileCleaner.new(default_assets_cache).clean_over(ASSETS_CACHE_LIMIT) - end + LanguagePack::Helpers::StaleFileCleaner.new(default_assets_cache).clean_over(ASSETS_CACHE_LIMIT) end end diff --git a/lib/language_pack/rails41.rb b/lib/language_pack/rails41.rb index 2d8ae1b54..294a39e3b 100644 --- a/lib/language_pack/rails41.rb +++ b/lib/language_pack/rails41.rb @@ -6,20 +6,16 @@ class LanguagePack::Rails41 < LanguagePack::Rails4 # detects if this is a Rails 4.x app # @return [Boolean] true if it's a Rails 4.x app def self.use? - instrument "rails41.use" do - rails_version = bundler.gem_version('railties') - return false unless rails_version - is_rails4 = rails_version >= Gem::Version.new('4.1.0.beta1') && - rails_version < Gem::Version.new('5.0.0') - return is_rails4 - end + rails_version = bundler.gem_version('railties') + return false unless rails_version + is_rails4 = rails_version >= Gem::Version.new('4.1.0.beta1') && + rails_version < Gem::Version.new('5.0.0') + return is_rails4 end def setup_profiled(*args) - instrument 'setup_profiled' do - super(*args) - set_env_default "SECRET_KEY_BASE", app_secret - end + super(*args) + set_env_default "SECRET_KEY_BASE", app_secret end def default_config_vars diff --git a/lib/language_pack/rails42.rb b/lib/language_pack/rails42.rb index 16816d049..c0780d031 100644 --- a/lib/language_pack/rails42.rb +++ b/lib/language_pack/rails42.rb @@ -5,20 +5,16 @@ class LanguagePack::Rails42 < LanguagePack::Rails41 # detects if this is a Rails 4.2 app # @return [Boolean] true if it's a Rails 4.2 app def self.use? - instrument "rails42.use" do - rails_version = bundler.gem_version('railties') - return false unless rails_version - is_rails42 = rails_version >= Gem::Version.new('4.2.0') && - rails_version < Gem::Version.new('5.0.0') - return is_rails42 - end + rails_version = bundler.gem_version('railties') + return false unless rails_version + is_rails42 = rails_version >= Gem::Version.new('4.2.0') && + rails_version < Gem::Version.new('5.0.0') + return is_rails42 end def setup_profiled(*args) - instrument 'setup_profiled' do - super(*args) - set_env_default "RAILS_SERVE_STATIC_FILES", "enabled" - end + super(*args) + set_env_default "RAILS_SERVE_STATIC_FILES", "enabled" end def default_config_vars diff --git a/lib/language_pack/rails5.rb b/lib/language_pack/rails5.rb index 514b3a013..a54ae4475 100644 --- a/lib/language_pack/rails5.rb +++ b/lib/language_pack/rails5.rb @@ -5,20 +5,16 @@ class LanguagePack::Rails5 < LanguagePack::Rails42 # @return [Boolean] true if it's a Rails 5.x app def self.use? - instrument "rails5.use" do - rails_version = bundler.gem_version('railties') - return false unless rails_version - is_rails = rails_version >= Gem::Version.new('5.x') && - rails_version < Gem::Version.new('6.0.0') - return is_rails - end + rails_version = bundler.gem_version('railties') + return false unless rails_version + is_rails = rails_version >= Gem::Version.new('5.x') && + rails_version < Gem::Version.new('6.0.0') + return is_rails end def setup_profiled(*args) - instrument 'setup_profiled' do - super(*args) - set_env_default "RAILS_LOG_TO_STDOUT", "enabled" - end + super(*args) + set_env_default "RAILS_LOG_TO_STDOUT", "enabled" end def default_config_vars diff --git a/lib/language_pack/rails6.rb b/lib/language_pack/rails6.rb index 89b7678d2..0d20b9f5f 100644 --- a/lib/language_pack/rails6.rb +++ b/lib/language_pack/rails6.rb @@ -5,19 +5,15 @@ class LanguagePack::Rails6 < LanguagePack::Rails5 # @return [Boolean] true if it's a Rails 6.x app def self.use? - instrument "rails6.use" do - rails_version = bundler.gem_version('railties') - return false unless rails_version - is_rails = rails_version >= Gem::Version.new('6.x') && - rails_version < Gem::Version.new('7.a') - return is_rails - end + rails_version = bundler.gem_version('railties') + return false unless rails_version + is_rails = rails_version >= Gem::Version.new('6.x') && + rails_version < Gem::Version.new('7.a') + return is_rails end def compile - instrument "rails6.compile" do - FileUtils.mkdir_p("tmp/pids") - super - end + FileUtils.mkdir_p("tmp/pids") + super end end diff --git a/lib/language_pack/rails7.rb b/lib/language_pack/rails7.rb index cd424bd31..bc0094c8c 100644 --- a/lib/language_pack/rails7.rb +++ b/lib/language_pack/rails7.rb @@ -5,13 +5,11 @@ class LanguagePack::Rails7 < LanguagePack::Rails6 # @return [Boolean] true if it's a Rails 7.x app def self.use? - instrument "rails6.use" do - rails_version = bundler.gem_version('railties') - return false unless rails_version - is_rails = rails_version >= Gem::Version.new('7.a') && - rails_version < Gem::Version.new('8.0.0') - return is_rails - end + rails_version = bundler.gem_version('railties') + return false unless rails_version + is_rails = rails_version >= Gem::Version.new('7.a') && + rails_version < Gem::Version.new('8.0.0') + return is_rails end end diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 8588a4111..df24f1f51 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -25,9 +25,7 @@ class LanguagePack::Ruby < LanguagePack::Base # detects if this is a valid Ruby app # @return [Boolean] true if it's a Ruby app def self.use? - instrument "ruby.use" do - File.exist?("Gemfile") - end + File.exist?("Gemfile") end def self.bundler @@ -51,30 +49,24 @@ def name end def default_addons - instrument "ruby.default_addons" do - add_dev_database_addon - end + add_dev_database_addon end def default_config_vars - instrument "ruby.default_config_vars" do - vars = { - "LANG" => env("LANG") || "en_US.UTF-8", - } - - ruby_version.jruby? ? vars.merge({ - "JRUBY_OPTS" => default_jruby_opts - }) : vars - end + vars = { + "LANG" => env("LANG") || "en_US.UTF-8", + } + + ruby_version.jruby? ? vars.merge({ + "JRUBY_OPTS" => default_jruby_opts + }) : vars end def default_process_types - instrument "ruby.default_process_types" do - { - "rake" => "bundle exec rake", - "console" => "bundle exec irb" - } - end + { + "rake" => "bundle exec rake", + "console" => "bundle exec irb" + } end def best_practice_warnings @@ -88,37 +80,35 @@ def best_practice_warnings end def compile - instrument 'ruby.compile' do - # check for new app at the beginning of the compile - new_app? - Dir.chdir(build_path) - remove_vendor_bundle - warn_bundler_upgrade - warn_bad_binstubs - install_ruby(slug_vendor_ruby, build_ruby_path) - setup_language_pack_environment( - ruby_layer_path: File.expand_path("."), - gem_layer_path: File.expand_path("."), - bundle_path: "vendor/bundle", - bundle_default_without: "development:test" - ) - allow_git do - install_bundler_in_app(slug_vendor_base) - load_bundler_cache - build_bundler - post_bundler - create_database_yml - install_binaries - run_assets_precompile_rake_task - end - config_detect - best_practice_warnings - warn_outdated_ruby - setup_profiled(ruby_layer_path: "$HOME", gem_layer_path: "$HOME") # $HOME is set to /app at run time - setup_export - cleanup - super + # check for new app at the beginning of the compile + new_app? + Dir.chdir(build_path) + remove_vendor_bundle + warn_bundler_upgrade + warn_bad_binstubs + install_ruby(slug_vendor_ruby, build_ruby_path) + setup_language_pack_environment( + ruby_layer_path: File.expand_path("."), + gem_layer_path: File.expand_path("."), + bundle_path: "vendor/bundle", + bundle_default_without: "development:test" + ) + allow_git do + install_bundler_in_app(slug_vendor_base) + load_bundler_cache + build_bundler + post_bundler + create_database_yml + install_binaries + run_assets_precompile_rake_task end + config_detect + best_practice_warnings + warn_outdated_ruby + setup_profiled(ruby_layer_path: "$HOME", gem_layer_path: "$HOME") # $HOME is set to /app at run time + setup_export + cleanup + super rescue => e warn_outdated_ruby raise e @@ -231,9 +221,7 @@ def self.slug_vendor_base # the relative path to the bundler directory of gems # @return [String] resulting path def slug_vendor_base - instrument 'ruby.slug_vendor_base' do - @slug_vendor_base ||= self.class.slug_vendor_base - end + @slug_vendor_base ||= self.class.slug_vendor_base end # the relative path to the vendored ruby directory @@ -251,18 +239,16 @@ def build_ruby_path # fetch the ruby version from bundler # @return [String, nil] returns the ruby version if detected or nil if none is detected def ruby_version - instrument 'ruby.ruby_version' do - return @ruby_version if @ruby_version - new_app = !File.exist?("vendor/heroku") - last_version_file = "buildpack_ruby_version" - last_version = nil - last_version = @metadata.read(last_version_file).strip if @metadata.exists?(last_version_file) - - @ruby_version = LanguagePack::RubyVersion.new(bundler.ruby_version, - is_new: new_app, - last_version: last_version) - return @ruby_version - end + return @ruby_version if @ruby_version + new_app = !File.exist?("vendor/heroku") + last_version_file = "buildpack_ruby_version" + last_version = nil + last_version = @metadata.read(last_version_file).strip if @metadata.exists?(last_version_file) + + @ruby_version = LanguagePack::RubyVersion.new(bundler.ruby_version, + is_new: new_app, + last_version: last_version) + return @ruby_version end def set_default_web_concurrency @@ -298,135 +284,129 @@ def default_jruby_opts # sets up the environment variables for the build process def setup_language_pack_environment(ruby_layer_path:, gem_layer_path:, bundle_path:, bundle_default_without:) - instrument 'ruby.setup_language_pack_environment' do - if ruby_version.jruby? - ENV["PATH"] += ":bin" - ENV["JRUBY_OPTS"] = env('JRUBY_BUILD_OPTS') || env('JRUBY_OPTS') - end - setup_ruby_install_env(ruby_layer_path) - - # By default Node can address 1.5GB of memory, a limitation it inherits from - # the underlying v8 engine. This can occasionally cause issues during frontend - # builds where memory use can exceed this threshold. - # - # This passes an argument to all Node processes during the build, so that they - # can take advantage of all available memory on the build dynos. - ENV["NODE_OPTIONS"] ||= "--max_old_space_size=2560" - - # TODO when buildpack-env-args rolls out, we can get rid of - # ||= and the manual setting below - default_config_vars.each do |key, value| - ENV[key] ||= value - end + if ruby_version.jruby? + ENV["PATH"] += ":bin" + ENV["JRUBY_OPTS"] = env('JRUBY_BUILD_OPTS') || env('JRUBY_OPTS') + end + setup_ruby_install_env(ruby_layer_path) + + # By default Node can address 1.5GB of memory, a limitation it inherits from + # the underlying v8 engine. This can occasionally cause issues during frontend + # builds where memory use can exceed this threshold. + # + # This passes an argument to all Node processes during the build, so that they + # can take advantage of all available memory on the build dynos. + ENV["NODE_OPTIONS"] ||= "--max_old_space_size=2560" + + # TODO when buildpack-env-args rolls out, we can get rid of + # ||= and the manual setting below + default_config_vars.each do |key, value| + ENV[key] ||= value + end - paths = [] - gem_path = "#{gem_layer_path}/#{slug_vendor_base}" - ENV["GEM_PATH"] = gem_path - ENV["GEM_HOME"] = gem_path + paths = [] + gem_path = "#{gem_layer_path}/#{slug_vendor_base}" + ENV["GEM_PATH"] = gem_path + ENV["GEM_HOME"] = gem_path - ENV["DISABLE_SPRING"] = "1" + ENV["DISABLE_SPRING"] = "1" - # Rails has a binstub for yarn that doesn't work for all applications - # we need to ensure that yarn comes before local bin dir for that case - paths << yarn_preinstall_bin_path if yarn_preinstalled? + # Rails has a binstub for yarn that doesn't work for all applications + # we need to ensure that yarn comes before local bin dir for that case + paths << yarn_preinstall_bin_path if yarn_preinstalled? - # Need to remove `./bin` folder since it links to the wrong --prefix ruby binstubs breaking require in Ruby 1.9.2 and 1.8.7. - # Because for 1.9.2 and 1.8.7 there is a "build" ruby and a non-"build" Ruby - paths << "#{File.expand_path(".")}/bin" unless ruby_version.ruby_192_or_lower? + # Need to remove `./bin` folder since it links to the wrong --prefix ruby binstubs breaking require in Ruby 1.9.2 and 1.8.7. + # Because for 1.9.2 and 1.8.7 there is a "build" ruby and a non-"build" Ruby + paths << "#{File.expand_path(".")}/bin" unless ruby_version.ruby_192_or_lower? - paths << "#{gem_layer_path}/#{bundler_binstubs_path}" # Binstubs from bundler, eg. vendor/bundle/bin - paths << "#{gem_layer_path}/#{slug_vendor_base}/bin" # Binstubs from rubygems, eg. vendor/bundle/ruby/2.6.0/bin - paths << ENV["PATH"] + paths << "#{gem_layer_path}/#{bundler_binstubs_path}" # Binstubs from bundler, eg. vendor/bundle/bin + paths << "#{gem_layer_path}/#{slug_vendor_base}/bin" # Binstubs from rubygems, eg. vendor/bundle/ruby/2.6.0/bin + paths << ENV["PATH"] - ENV["PATH"] = paths.join(":") + ENV["PATH"] = paths.join(":") - ENV["BUNDLE_WITHOUT"] = env("BUNDLE_WITHOUT") || bundle_default_without - if ENV["BUNDLE_WITHOUT"].include?(' ') - ENV["BUNDLE_WITHOUT"] = ENV["BUNDLE_WITHOUT"].tr(' ', ':') + ENV["BUNDLE_WITHOUT"] = env("BUNDLE_WITHOUT") || bundle_default_without + if ENV["BUNDLE_WITHOUT"].include?(' ') + ENV["BUNDLE_WITHOUT"] = ENV["BUNDLE_WITHOUT"].tr(' ', ':') - warn("Your BUNDLE_WITHOUT contains a space, we are converting it to a colon `:` BUNDLE_WITHOUT=#{ENV["BUNDLE_WITHOUT"]}", inline: true) - end - ENV["BUNDLE_PATH"] = bundle_path - ENV["BUNDLE_BIN"] = bundler_binstubs_path - ENV["BUNDLE_DEPLOYMENT"] = "1" - ENV["BUNDLE_GLOBAL_PATH_APPENDS_RUBY_SCOPE"] = "1" if bundler.needs_ruby_global_append_path? + warn("Your BUNDLE_WITHOUT contains a space, we are converting it to a colon `:` BUNDLE_WITHOUT=#{ENV["BUNDLE_WITHOUT"]}", inline: true) end + ENV["BUNDLE_PATH"] = bundle_path + ENV["BUNDLE_BIN"] = bundler_binstubs_path + ENV["BUNDLE_DEPLOYMENT"] = "1" + ENV["BUNDLE_GLOBAL_PATH_APPENDS_RUBY_SCOPE"] = "1" if bundler.needs_ruby_global_append_path? end # Sets up the environment variables for subsequent processes run by # muiltibuildpack. We can't use profile.d because $HOME isn't set up def setup_export(layer = nil) - instrument 'ruby.setup_export' do - if layer - paths = ENV["PATH"] - else - paths = ENV["PATH"].split(":").map do |path| - /^\/.*/ !~ path ? "#{build_path}/#{path}" : path - end.join(":") - end + if layer + paths = ENV["PATH"] + else + paths = ENV["PATH"].split(":").map do |path| + /^\/.*/ !~ path ? "#{build_path}/#{path}" : path + end.join(":") + end - # TODO ensure path exported is correct - set_export_path "PATH", paths, layer + # TODO ensure path exported is correct + set_export_path "PATH", paths, layer - if layer - gem_path = "#{layer.path}/#{slug_vendor_base}" - else - gem_path = "#{build_path}/#{slug_vendor_base}" - end - set_export_path "GEM_PATH", gem_path, layer - set_export_default "LANG", "en_US.UTF-8", layer - - # TODO handle jruby - if ruby_version.jruby? - set_export_default "JRUBY_OPTS", default_jruby_opts - end + if layer + gem_path = "#{layer.path}/#{slug_vendor_base}" + else + gem_path = "#{build_path}/#{slug_vendor_base}" + end + set_export_path "GEM_PATH", gem_path, layer + set_export_default "LANG", "en_US.UTF-8", layer - set_export_default "BUNDLE_PATH", ENV["BUNDLE_PATH"], layer - set_export_default "BUNDLE_WITHOUT", ENV["BUNDLE_WITHOUT"], layer - set_export_default "BUNDLE_BIN", ENV["BUNDLE_BIN"], layer - set_export_default "BUNDLE_GLOBAL_PATH_APPENDS_RUBY_SCOPE", ENV["BUNDLE_GLOBAL_PATH_APPENDS_RUBY_SCOPE"], layer if bundler.needs_ruby_global_append_path? - set_export_default "BUNDLE_DEPLOYMENT", ENV["BUNDLE_DEPLOYMENT"], layer if ENV["BUNDLE_DEPLOYMENT"] # Unset on windows since we delete the Gemfile.lock + # TODO handle jruby + if ruby_version.jruby? + set_export_default "JRUBY_OPTS", default_jruby_opts end + + set_export_default "BUNDLE_PATH", ENV["BUNDLE_PATH"], layer + set_export_default "BUNDLE_WITHOUT", ENV["BUNDLE_WITHOUT"], layer + set_export_default "BUNDLE_BIN", ENV["BUNDLE_BIN"], layer + set_export_default "BUNDLE_GLOBAL_PATH_APPENDS_RUBY_SCOPE", ENV["BUNDLE_GLOBAL_PATH_APPENDS_RUBY_SCOPE"], layer if bundler.needs_ruby_global_append_path? + set_export_default "BUNDLE_DEPLOYMENT", ENV["BUNDLE_DEPLOYMENT"], layer if ENV["BUNDLE_DEPLOYMENT"] # Unset on windows since we delete the Gemfile.lock end # sets up the profile.d script for this buildpack def setup_profiled(ruby_layer_path: , gem_layer_path: ) - instrument 'setup_profiled' do - profiled_path = [] - - # Rails has a binstub for yarn that doesn't work for all applications - # we need to ensure that yarn comes before local bin dir for that case - if yarn_preinstalled? - profiled_path << yarn_preinstall_bin_path.gsub(File.expand_path("."), "$HOME") - elsif has_yarn_binary? - profiled_path << "#{ruby_layer_path}/vendor/#{@yarn_installer.binary_path}" - end - profiled_path << "$HOME/bin" # /app in production - profiled_path << "#{gem_layer_path}/#{bundler_binstubs_path}" # Binstubs from bundler, eg. vendor/bundle/bin - profiled_path << "#{gem_layer_path}/#{slug_vendor_base}/bin" # Binstubs from rubygems, eg. vendor/bundle/ruby/2.6.0/bin - profiled_path << "$PATH" - - set_env_default "LANG", "en_US.UTF-8" - set_env_override "GEM_PATH", "#{gem_layer_path}/#{slug_vendor_base}:$GEM_PATH" - set_env_override "PATH", profiled_path.join(":") - set_env_override "DISABLE_SPRING", "1" + profiled_path = [] + + # Rails has a binstub for yarn that doesn't work for all applications + # we need to ensure that yarn comes before local bin dir for that case + if yarn_preinstalled? + profiled_path << yarn_preinstall_bin_path.gsub(File.expand_path("."), "$HOME") + elsif has_yarn_binary? + profiled_path << "#{ruby_layer_path}/vendor/#{@yarn_installer.binary_path}" + end + profiled_path << "$HOME/bin" # /app in production + profiled_path << "#{gem_layer_path}/#{bundler_binstubs_path}" # Binstubs from bundler, eg. vendor/bundle/bin + profiled_path << "#{gem_layer_path}/#{slug_vendor_base}/bin" # Binstubs from rubygems, eg. vendor/bundle/ruby/2.6.0/bin + profiled_path << "$PATH" - set_env_default "MALLOC_ARENA_MAX", "2" if default_malloc_arena_max? + set_env_default "LANG", "en_US.UTF-8" + set_env_override "GEM_PATH", "#{gem_layer_path}/#{slug_vendor_base}:$GEM_PATH" + set_env_override "PATH", profiled_path.join(":") + set_env_override "DISABLE_SPRING", "1" - web_concurrency = env("SENSIBLE_DEFAULTS") ? set_default_web_concurrency : "" - add_to_profiled(web_concurrency, filename: "WEB_CONCURRENCY.sh", mode: "w") # always write that file, even if its empty (meaning no defaults apply), for interop with other buildpacks - and we overwrite the file rather than appending (which is the default) + set_env_default "MALLOC_ARENA_MAX", "2" if default_malloc_arena_max? - # TODO handle JRUBY - if ruby_version.jruby? - set_env_default "JRUBY_OPTS", default_jruby_opts - end + web_concurrency = env("SENSIBLE_DEFAULTS") ? set_default_web_concurrency : "" + add_to_profiled(web_concurrency, filename: "WEB_CONCURRENCY.sh", mode: "w") # always write that file, even if its empty (meaning no defaults apply), for interop with other buildpacks - and we overwrite the file rather than appending (which is the default) - set_env_default "BUNDLE_PATH", ENV["BUNDLE_PATH"] - set_env_default "BUNDLE_WITHOUT", ENV["BUNDLE_WITHOUT"] - set_env_default "BUNDLE_BIN", ENV["BUNDLE_BIN"] - set_env_default "BUNDLE_GLOBAL_PATH_APPENDS_RUBY_SCOPE", ENV["BUNDLE_GLOBAL_PATH_APPENDS_RUBY_SCOPE"] if bundler.needs_ruby_global_append_path? - set_env_default "BUNDLE_DEPLOYMENT", ENV["BUNDLE_DEPLOYMENT"] if ENV["BUNDLE_DEPLOYMENT"] # Unset on windows since we delete the Gemfile.lock + # TODO handle JRUBY + if ruby_version.jruby? + set_env_default "JRUBY_OPTS", default_jruby_opts end + + set_env_default "BUNDLE_PATH", ENV["BUNDLE_PATH"] + set_env_default "BUNDLE_WITHOUT", ENV["BUNDLE_WITHOUT"] + set_env_default "BUNDLE_BIN", ENV["BUNDLE_BIN"] + set_env_default "BUNDLE_GLOBAL_PATH_APPENDS_RUBY_SCOPE", ENV["BUNDLE_GLOBAL_PATH_APPENDS_RUBY_SCOPE"] if bundler.needs_ruby_global_append_path? + set_env_default "BUNDLE_DEPLOYMENT", ENV["BUNDLE_DEPLOYMENT"] if ENV["BUNDLE_DEPLOYMENT"] # Unset on windows since we delete the Gemfile.lock end def warn_outdated_ruby @@ -525,58 +505,56 @@ def warn_outdated_minor # install the vendored ruby # @return [Boolean] true if it installs the vendored ruby and false otherwise def install_ruby(install_path, build_ruby_path = nil) - instrument 'ruby.install_ruby' do - # Could do a compare operation to avoid re-downloading ruby - return false unless ruby_version - installer = LanguagePack::Installers::RubyInstaller.installer(ruby_version).new(@stack) + # Could do a compare operation to avoid re-downloading ruby + return false unless ruby_version + installer = LanguagePack::Installers::RubyInstaller.installer(ruby_version).new(@stack) - @ruby_download_check = LanguagePack::Helpers::DownloadPresence.new(ruby_version.file_name) - @ruby_download_check.call + @ruby_download_check = LanguagePack::Helpers::DownloadPresence.new(ruby_version.file_name) + @ruby_download_check.call - if ruby_version.build? - installer.fetch_unpack(ruby_version, build_ruby_path, true) - end + if ruby_version.build? + installer.fetch_unpack(ruby_version, build_ruby_path, true) + end - installer.install(ruby_version, install_path) + installer.install(ruby_version, install_path) - @outdated_version_check = LanguagePack::Helpers::OutdatedRubyVersion.new( - current_ruby_version: ruby_version, - fetcher: installer.fetcher - ) - @outdated_version_check.call + @outdated_version_check = LanguagePack::Helpers::OutdatedRubyVersion.new( + current_ruby_version: ruby_version, + fetcher: installer.fetcher + ) + @outdated_version_check.call - @metadata.write("buildpack_ruby_version", ruby_version.version_for_download) + @metadata.write("buildpack_ruby_version", ruby_version.version_for_download) - topic "Using Ruby version: #{ruby_version.version_for_download}" - if !ruby_version.set - warn(<<~WARNING) - You have not declared a Ruby version in your Gemfile. + topic "Using Ruby version: #{ruby_version.version_for_download}" + if !ruby_version.set + warn(<<~WARNING) + You have not declared a Ruby version in your Gemfile. - To declare a Ruby version add this line to your Gemfile: + To declare a Ruby version add this line to your Gemfile: - ``` - ruby "#{LanguagePack::RubyVersion::DEFAULT_VERSION_NUMBER}" - ``` + ``` + ruby "#{LanguagePack::RubyVersion::DEFAULT_VERSION_NUMBER}" + ``` - For more information see: - https://devcenter.heroku.com/articles/ruby-versions - WARNING - end + For more information see: + https://devcenter.heroku.com/articles/ruby-versions + WARNING - if ruby_version.warn_ruby_26_bundler? - warn(<<~WARNING, inline: true) - There is a known bundler bug with your version of Ruby + if ruby_version.warn_ruby_26_bundler? + warn(<<~WARNING, inline: true) + There is a known bundler bug with your version of Ruby - Your version of Ruby contains a problem with the built-in integration of bundler. If - you encounter a bundler error you need to upgrade your Ruby version. We suggest you upgrade to: + Your version of Ruby contains a problem with the built-in integration of bundler. If + you encounter a bundler error you need to upgrade your Ruby version. We suggest you upgrade to: - #{@outdated_version_check.suggested_ruby_minor_version} + #{@outdated_version_check.suggested_ruby_minor_version} - For more information see: - https://devcenter.heroku.com/articles/bundler-version#known-upgrade-issues - WARNING - end + For more information see: + https://devcenter.heroku.com/articles/bundler-version#known-upgrade-issues + WARNING end + end true rescue LanguagePack::Fetcher::FetchError @@ -639,23 +617,19 @@ def ruby_install_binstub_path(ruby_layer_path = ".") # setup the environment so we can use the vendored ruby def setup_ruby_install_env(ruby_layer_path = ".") - instrument 'ruby.setup_ruby_install_env' do - ENV["PATH"] = "#{File.expand_path(ruby_install_binstub_path(ruby_layer_path))}:#{ENV["PATH"]}" - end + ENV["PATH"] = "#{File.expand_path(ruby_install_binstub_path(ruby_layer_path))}:#{ENV["PATH"]}" end # installs vendored gems into the slug def install_bundler_in_app(bundler_dir) - instrument 'ruby.install_language_pack_gems' do - FileUtils.mkdir_p(bundler_dir) - Dir.chdir(bundler_dir) do |dir| - `cp -R #{bundler.bundler_path}/. .` - end - - # write bundler shim, so we can control the version bundler used - # Ruby 2.6.0 started vendoring bundler - write_bundler_shim("vendor/bundle/bin") if ruby_version.vendored_bundler? + FileUtils.mkdir_p(bundler_dir) + Dir.chdir(bundler_dir) do |dir| + `cp -R #{bundler.bundler_path}/. .` end + + # write bundler shim, so we can control the version bundler used + # Ruby 2.6.0 started vendoring bundler + write_bundler_shim("vendor/bundle/bin") if ruby_version.vendored_bundler? end # default set of binaries to install @@ -666,10 +640,8 @@ def binaries # vendors binaries into the slug def install_binaries - instrument 'ruby.install_binaries' do - binaries.each {|binary| install_binary(binary) } - Dir["bin/*"].each {|path| run("chmod +x #{path}") } - end + binaries.each {|binary| install_binary(binary) } + Dir["bin/*"].each {|path| run("chmod +x #{path}") } end # vendors individual binary into the slug @@ -713,13 +685,11 @@ def load_default_cache? # loads a default bundler cache for new apps to speed up initial bundle installs def load_default_cache - instrument "ruby.load_default_cache" do - if false # load_default_cache? - puts "New app detected loading default bundler cache" - patchlevel = run("ruby -e 'puts RUBY_PATCHLEVEL'").strip - cache_name = "#{LanguagePack::RubyVersion::DEFAULT_VERSION}-p#{patchlevel}-default-cache" - @fetchers[:buildpack].fetch_untar("#{cache_name}.tgz") - end + if false # load_default_cache? + puts "New app detected loading default bundler cache" + patchlevel = run("ruby -e 'puts RUBY_PATCHLEVEL'").strip + cache_name = "#{LanguagePack::RubyVersion::DEFAULT_VERSION}-p#{patchlevel}-default-cache" + @fetchers[:buildpack].fetch_untar("#{cache_name}.tgz") end end @@ -779,192 +749,181 @@ def write_bundler_shim(path) # runs bundler to install the dependencies def build_bundler - instrument 'ruby.build_bundler' do - log("bundle") do - if File.exist?("#{Dir.pwd}/.bundle/config") - warn(<<~WARNING, inline: true) - You have the `.bundle/config` file checked into your repository - It contains local state like the location of the installed bundle - as well as configured git local gems, and other settings that should - not be shared between multiple checkouts of a single repo. Please - remove the `.bundle/` folder from your repo and add it to your `.gitignore` file. - - https://devcenter.heroku.com/articles/bundler-configuration - WARNING - end + log("bundle") do + if File.exist?("#{Dir.pwd}/.bundle/config") + warn(<<~WARNING, inline: true) + You have the `.bundle/config` file checked into your repository + It contains local state like the location of the installed bundle + as well as configured git local gems, and other settings that should + not be shared between multiple checkouts of a single repo. Please + remove the `.bundle/` folder from your repo and add it to your `.gitignore` file. + + https://devcenter.heroku.com/articles/bundler-configuration + WARNING + end - if bundler.windows_gemfile_lock? - log("bundle", "has_windows_gemfile_lock") + if bundler.windows_gemfile_lock? + log("bundle", "has_windows_gemfile_lock") - File.unlink("Gemfile.lock") - ENV.delete("BUNDLE_DEPLOYMENT") + File.unlink("Gemfile.lock") + ENV.delete("BUNDLE_DEPLOYMENT") - warn(<<~WARNING, inline: true) - Removing `Gemfile.lock` because it was generated on Windows. - Bundler will do a full resolve so native gems are handled properly. - This may result in unexpected gem versions being used in your app. - In rare occasions Bundler may not be able to resolve your dependencies at all. + warn(<<~WARNING, inline: true) + Removing `Gemfile.lock` because it was generated on Windows. + Bundler will do a full resolve so native gems are handled properly. + This may result in unexpected gem versions being used in your app. + In rare occasions Bundler may not be able to resolve your dependencies at all. - https://devcenter.heroku.com/articles/bundler-windows-gemfile - WARNING - end + https://devcenter.heroku.com/articles/bundler-windows-gemfile + WARNING + end - bundle_command = String.new("") - bundle_command << "BUNDLE_WITHOUT='#{ENV["BUNDLE_WITHOUT"]}' " - bundle_command << "BUNDLE_PATH=#{ENV["BUNDLE_PATH"]} " - bundle_command << "BUNDLE_BIN=#{ENV["BUNDLE_BIN"]} " - bundle_command << "BUNDLE_DEPLOYMENT=#{ENV["BUNDLE_DEPLOYMENT"]} " if ENV["BUNDLE_DEPLOYMENT"] # Unset on windows since we delete the Gemfile.lock - bundle_command << "BUNDLE_GLOBAL_PATH_APPENDS_RUBY_SCOPE=#{ENV["BUNDLE_GLOBAL_PATH_APPENDS_RUBY_SCOPE"]} " if bundler.needs_ruby_global_append_path? - bundle_command << "bundle install -j4" - - topic("Installing dependencies using bundler #{bundler.version}") - - bundler_output = String.new("") - bundle_time = nil - env_vars = {} - Dir.mktmpdir("libyaml-") do |tmpdir| - libyaml_dir = "#{tmpdir}/#{LIBYAML_PATH}" - - # need to setup compile environment for the psych gem - yaml_include = File.expand_path("#{libyaml_dir}/include").shellescape - yaml_lib = File.expand_path("#{libyaml_dir}/lib").shellescape - pwd = Dir.pwd - bundler_path = "#{pwd}/#{slug_vendor_base}/gems/#{bundler.dir_name}/lib" - - # we need to set BUNDLE_CONFIG and BUNDLE_GEMFILE for - # codon since it uses bundler. - env_vars["BUNDLE_GEMFILE"] = "#{pwd}/Gemfile" - env_vars["BUNDLE_CONFIG"] = "#{pwd}/.bundle/config" - env_vars["CPATH"] = noshellescape("#{yaml_include}:$CPATH") - env_vars["CPPATH"] = noshellescape("#{yaml_include}:$CPPATH") - env_vars["LIBRARY_PATH"] = noshellescape("#{yaml_lib}:$LIBRARY_PATH") - env_vars["RUBYOPT"] = syck_hack - env_vars["NOKOGIRI_USE_SYSTEM_LIBRARIES"] = "true" - env_vars["BUNDLE_DISABLE_VERSION_CHECK"] = "true" - env_vars["BUNDLER_LIB_PATH"] = "#{bundler_path}" if ruby_version.ruby_version == "1.8.7" - env_vars["BUNDLE_DISABLE_VERSION_CHECK"] = "true" - - puts "Running: #{bundle_command}" - instrument "ruby.bundle_install" do - bundle_time = Benchmark.realtime do - bundler_output << pipe("#{bundle_command} --no-clean", out: "2>&1", env: env_vars, user_env: true) - end - end + bundle_command = String.new("") + bundle_command << "BUNDLE_WITHOUT='#{ENV["BUNDLE_WITHOUT"]}' " + bundle_command << "BUNDLE_PATH=#{ENV["BUNDLE_PATH"]} " + bundle_command << "BUNDLE_BIN=#{ENV["BUNDLE_BIN"]} " + bundle_command << "BUNDLE_DEPLOYMENT=#{ENV["BUNDLE_DEPLOYMENT"]} " if ENV["BUNDLE_DEPLOYMENT"] # Unset on windows since we delete the Gemfile.lock + bundle_command << "BUNDLE_GLOBAL_PATH_APPENDS_RUBY_SCOPE=#{ENV["BUNDLE_GLOBAL_PATH_APPENDS_RUBY_SCOPE"]} " if bundler.needs_ruby_global_append_path? + bundle_command << "bundle install -j4" + + topic("Installing dependencies using bundler #{bundler.version}") + + bundler_output = String.new("") + bundle_time = nil + env_vars = {} + Dir.mktmpdir("libyaml-") do |tmpdir| + libyaml_dir = "#{tmpdir}/#{LIBYAML_PATH}" + + # need to setup compile environment for the psych gem + yaml_include = File.expand_path("#{libyaml_dir}/include").shellescape + yaml_lib = File.expand_path("#{libyaml_dir}/lib").shellescape + pwd = Dir.pwd + bundler_path = "#{pwd}/#{slug_vendor_base}/gems/#{bundler.dir_name}/lib" + + # we need to set BUNDLE_CONFIG and BUNDLE_GEMFILE for + # codon since it uses bundler. + env_vars["BUNDLE_GEMFILE"] = "#{pwd}/Gemfile" + env_vars["BUNDLE_CONFIG"] = "#{pwd}/.bundle/config" + env_vars["CPATH"] = noshellescape("#{yaml_include}:$CPATH") + env_vars["CPPATH"] = noshellescape("#{yaml_include}:$CPPATH") + env_vars["LIBRARY_PATH"] = noshellescape("#{yaml_lib}:$LIBRARY_PATH") + env_vars["RUBYOPT"] = syck_hack + env_vars["NOKOGIRI_USE_SYSTEM_LIBRARIES"] = "true" + env_vars["BUNDLE_DISABLE_VERSION_CHECK"] = "true" + env_vars["BUNDLER_LIB_PATH"] = "#{bundler_path}" if ruby_version.ruby_version == "1.8.7" + env_vars["BUNDLE_DISABLE_VERSION_CHECK"] = "true" + + puts "Running: #{bundle_command}" + bundle_time = Benchmark.realtime do + bundler_output << pipe("#{bundle_command} --no-clean", out: "2>&1", env: env_vars, user_env: true) end + end - if $?.success? - puts "Bundle completed (#{"%.2f" % bundle_time}s)" - log "bundle", :status => "success" - puts "Cleaning up the bundler cache." - instrument "ruby.bundle_clean" do - # Only show bundle clean output when not using default cache - if load_default_cache? - run("bundle clean > /dev/null", user_env: true, env: env_vars) - else - pipe("bundle clean", out: "2> /dev/null", user_env: true, env: env_vars) - end - end - @bundler_cache.store - - # Keep gem cache out of the slug - FileUtils.rm_rf("#{slug_vendor_base}/cache") + if $?.success? + puts "Bundle completed (#{"%.2f" % bundle_time}s)" + log "bundle", :status => "success" + puts "Cleaning up the bundler cache." + # Only show bundle clean output when not using default cache + if load_default_cache? + run("bundle clean > /dev/null", user_env: true, env: env_vars) else - mcount "fail.bundle.install" - log "bundle", :status => "failure" - error_message = "Failed to install gems via Bundler." - puts "Bundler Output: #{bundler_output}" - if bundler_output.match(/An error occurred while installing sqlite3/) - mcount "fail.sqlite3" - error_message += <<~ERROR - - Detected sqlite3 gem which is not supported on Heroku: - https://devcenter.heroku.com/articles/sqlite3 - ERROR - end - - if bundler_output.match(/but your Gemfile specified/) - mcount "fail.ruby_version_mismatch" - error_message += <<~ERROR - - Detected a mismatch between your Ruby version installed and - Ruby version specified in Gemfile or Gemfile.lock. You can - correct this by running: - - $ bundle update --ruby - $ git add Gemfile.lock - $ git commit -m "update ruby version" - - If this does not solve the issue please see this documentation: - - https://devcenter.heroku.com/articles/ruby-versions#your-ruby-version-is-x-but-your-gemfile-specified-y - ERROR - end - - error error_message + pipe("bundle clean", out: "2> /dev/null", user_env: true, env: env_vars) + end + @bundler_cache.store + + # Keep gem cache out of the slug + FileUtils.rm_rf("#{slug_vendor_base}/cache") + else + mcount "fail.bundle.install" + log "bundle", :status => "failure" + error_message = "Failed to install gems via Bundler." + puts "Bundler Output: #{bundler_output}" + if bundler_output.match(/An error occurred while installing sqlite3/) + mcount "fail.sqlite3" + error_message += <<~ERROR + + Detected sqlite3 gem which is not supported on Heroku: + https://devcenter.heroku.com/articles/sqlite3 + ERROR end + + if bundler_output.match(/but your Gemfile specified/) + mcount "fail.ruby_version_mismatch" + error_message += <<~ERROR + + Detected a mismatch between your Ruby version installed and + Ruby version specified in Gemfile or Gemfile.lock. You can + correct this by running: + + $ bundle update --ruby + $ git add Gemfile.lock + $ git commit -m "update ruby version" + + If this does not solve the issue please see this documentation: + + https://devcenter.heroku.com/articles/ruby-versions#your-ruby-version-is-x-but-your-gemfile-specified-y + ERROR + end + + error error_message end end end def post_bundler - instrument "ruby.post_bundler" do - Dir[File.join(slug_vendor_base, "**", ".git")].each do |dir| - FileUtils.rm_rf(dir) - end - bundler.clean + Dir[File.join(slug_vendor_base, "**", ".git")].each do |dir| + FileUtils.rm_rf(dir) end + bundler.clean end # RUBYOPT line that requires syck_hack file # @return [String] require string if needed or else an empty string def syck_hack - instrument "ruby.syck_hack" do - syck_hack_file = File.expand_path(File.join(File.dirname(__FILE__), "../../vendor/syck_hack")) - rv = run_stdout('ruby -e "puts RUBY_VERSION"').strip - # < 1.9.3 includes syck, so we need to use the syck hack - if Gem::Version.new(rv) < Gem::Version.new("1.9.3") - "-r#{syck_hack_file}" - else - "" - end + syck_hack_file = File.expand_path(File.join(File.dirname(__FILE__), "../../vendor/syck_hack")) + rv = run_stdout('ruby -e "puts RUBY_VERSION"').strip + # < 1.9.3 includes syck, so we need to use the syck hack + if Gem::Version.new(rv) < Gem::Version.new("1.9.3") + "-r#{syck_hack_file}" + else + "" end end # writes ERB based database.yml for Rails. The database.yml uses the DATABASE_URL from the environment during runtime. def create_database_yml - instrument 'ruby.create_database_yml' do - return false unless File.directory?("config") - return false if bundler.has_gem?('activerecord') && bundler.gem_version('activerecord') >= Gem::Version.new('4.1.0.beta1') - - log("create_database_yml") do - topic("Writing config/database.yml to read from DATABASE_URL") - File.open("config/database.yml", "w") do |file| - file.puts <<-DATABASE_YML + return false unless File.directory?("config") + return false if bundler.has_gem?('activerecord') && bundler.gem_version('activerecord') >= Gem::Version.new('4.1.0.beta1') + + log("create_database_yml") do + topic("Writing config/database.yml to read from DATABASE_URL") + File.open("config/database.yml", "w") do |file| + file.puts <<-DATABASE_YML <% require 'cgi' require 'uri' begin - uri = URI.parse(ENV["DATABASE_URL"]) +uri = URI.parse(ENV["DATABASE_URL"]) rescue URI::InvalidURIError - raise "Invalid DATABASE_URL" +raise "Invalid DATABASE_URL" end raise "No RACK_ENV or RAILS_ENV found" unless ENV["RAILS_ENV"] || ENV["RACK_ENV"] def attribute(name, value, force_string = false) - if value - value_string = - if force_string - '"' + value + '"' - else - value - end - "\#{name}: \#{value_string}" - else - "" - end +if value + value_string = + if force_string + '"' + value + '"' + else + value + end + "\#{name}: \#{value_string}" +else + "" +end end adapter = uri.scheme @@ -983,18 +942,17 @@ def attribute(name, value, force_string = false) %> <%= ENV["RAILS_ENV"] || ENV["RACK_ENV"] %>: - <%= attribute "adapter", adapter %> - <%= attribute "database", database %> - <%= attribute "username", username %> - <%= attribute "password", password, true %> - <%= attribute "host", host %> - <%= attribute "port", port %> +<%= attribute "adapter", adapter %> +<%= attribute "database", database %> +<%= attribute "username", username %> +<%= attribute "password", password, true %> +<%= attribute "host", host %> +<%= attribute "port", port %> <% params.each do |key, value| %> - <%= key %>: <%= value.first %> +<%= key %>: <%= value.first %> <% end %> - DATABASE_YML - end + DATABASE_YML end end end @@ -1125,18 +1083,16 @@ def yarn_not_preinstalled? end def run_assets_precompile_rake_task - instrument 'ruby.run_assets_precompile_rake_task' do - precompile = rake.task("assets:precompile") - return true unless precompile.is_defined? + precompile = rake.task("assets:precompile") + return true unless precompile.is_defined? - topic "Precompiling assets" - precompile.invoke(env: rake_env) - if precompile.success? - puts "Asset precompilation completed (#{"%.2f" % precompile.time}s)" - else - precompile_fail(precompile.output) - end + topic "Precompiling assets" + precompile.invoke(env: rake_env) + if precompile.success? + puts "Asset precompilation completed (#{"%.2f" % precompile.time}s)" + else + precompile_fail(precompile.output) end end @@ -1239,106 +1195,102 @@ def valid_bundler_cache?(path, metadata) end def load_bundler_cache - instrument "ruby.load_bundler_cache" do - cache.load "vendor" - - full_ruby_version = run_stdout(%q(ruby -v)).strip - rubygems_version = run_stdout(%q(gem -v)).strip - heroku_metadata = "vendor/heroku" - old_rubygems_version = nil - ruby_version_cache = "ruby_version" - buildpack_version_cache = "buildpack_version" - bundler_version_cache = "bundler_version" - rubygems_version_cache = "rubygems_version" - stack_cache = "stack" - - # bundle clean does not remove binstubs - FileUtils.rm_rf("vendor/bundler/bin") - - old_rubygems_version = @metadata.read(ruby_version_cache).strip if @metadata.exists?(ruby_version_cache) - old_stack = @metadata.read(stack_cache).strip if @metadata.exists?(stack_cache) - old_stack ||= DEFAULT_LEGACY_STACK - - stack_change = old_stack != @stack - convert_stack = @bundler_cache.old? - @bundler_cache.convert_stack(stack_change) if convert_stack - if !new_app? && stack_change - puts "Purging Cache. Changing stack from #{old_stack} to #{@stack}" - purge_bundler_cache(old_stack) - elsif !new_app? && !convert_stack - @bundler_cache.load - end + cache.load "vendor" - # fix bug from v37 deploy - if File.exists?("vendor/ruby_version") - puts "Broken cache detected. Purging build cache." - cache.clear("vendor") - FileUtils.rm_rf("vendor/ruby_version") - purge_bundler_cache - # fix bug introduced in v38 - elsif !@metadata.include?(buildpack_version_cache) && @metadata.exists?(ruby_version_cache) - puts "Broken cache detected. Purging build cache." - purge_bundler_cache - elsif (@bundler_cache.exists? || @bundler_cache.old?) && @metadata.exists?(ruby_version_cache) && full_ruby_version != @metadata.read(ruby_version_cache).strip - puts "Ruby version change detected. Clearing bundler cache." - puts "Old: #{@metadata.read(ruby_version_cache).strip}" - puts "New: #{full_ruby_version}" - purge_bundler_cache - end + full_ruby_version = run_stdout(%q(ruby -v)).strip + rubygems_version = run_stdout(%q(gem -v)).strip + heroku_metadata = "vendor/heroku" + old_rubygems_version = nil + ruby_version_cache = "ruby_version" + buildpack_version_cache = "buildpack_version" + bundler_version_cache = "bundler_version" + rubygems_version_cache = "rubygems_version" + stack_cache = "stack" - # fix git gemspec bug from Bundler 1.3.0+ upgrade - if File.exists?(bundler_cache) && !@metadata.exists?(bundler_version_cache) && !run("find vendor/bundle/*/*/bundler/gems/*/ -name *.gemspec").include?("No such file or directory") - puts "Old bundler cache detected. Clearing bundler cache." - purge_bundler_cache - end + # bundle clean does not remove binstubs + FileUtils.rm_rf("vendor/bundler/bin") - # fix for https://github.com/heroku/heroku-buildpack-ruby/issues/86 - if (!@metadata.exists?(rubygems_version_cache) || - (old_rubygems_version == "2.0.0" && old_rubygems_version != rubygems_version)) && - @metadata.exists?(ruby_version_cache) && @metadata.read(ruby_version_cache).strip.include?("ruby 2.0.0p0") - puts "Updating to rubygems #{rubygems_version}. Clearing bundler cache." - purge_bundler_cache - end + old_rubygems_version = @metadata.read(ruby_version_cache).strip if @metadata.exists?(ruby_version_cache) + old_stack = @metadata.read(stack_cache).strip if @metadata.exists?(stack_cache) + old_stack ||= DEFAULT_LEGACY_STACK - # fix for https://github.com/sparklemotion/nokogiri/issues/923 - if @metadata.exists?(buildpack_version_cache) && (bv = @metadata.read(buildpack_version_cache).sub('v', '').to_i) && bv != 0 && bv <= 76 - puts "Fixing nokogiri install. Clearing bundler cache." - puts "See https://github.com/sparklemotion/nokogiri/issues/923." - purge_bundler_cache - end + stack_change = old_stack != @stack + convert_stack = @bundler_cache.old? + @bundler_cache.convert_stack(stack_change) if convert_stack + if !new_app? && stack_change + puts "Purging Cache. Changing stack from #{old_stack} to #{@stack}" + purge_bundler_cache(old_stack) + elsif !new_app? && !convert_stack + @bundler_cache.load + end - # recompile nokogiri to use new libyaml - if @metadata.exists?(buildpack_version_cache) && (bv = @metadata.read(buildpack_version_cache).sub('v', '').to_i) && bv != 0 && bv <= 99 && bundler.has_gem?("psych") - puts "Need to recompile psych for CVE-2013-6393. Clearing bundler cache." - puts "See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=737076." - purge_bundler_cache - end + # fix bug from v37 deploy + if File.exists?("vendor/ruby_version") + puts "Broken cache detected. Purging build cache." + cache.clear("vendor") + FileUtils.rm_rf("vendor/ruby_version") + purge_bundler_cache + # fix bug introduced in v38 + elsif !@metadata.include?(buildpack_version_cache) && @metadata.exists?(ruby_version_cache) + puts "Broken cache detected. Purging build cache." + purge_bundler_cache + elsif (@bundler_cache.exists? || @bundler_cache.old?) && @metadata.exists?(ruby_version_cache) && full_ruby_version != @metadata.read(ruby_version_cache).strip + puts "Ruby version change detected. Clearing bundler cache." + puts "Old: #{@metadata.read(ruby_version_cache).strip}" + puts "New: #{full_ruby_version}" + purge_bundler_cache + end - # recompile gems for libyaml 0.1.7 update - if @metadata.exists?(buildpack_version_cache) && (bv = @metadata.read(buildpack_version_cache).sub('v', '').to_i) && bv != 0 && bv <= 147 && - (@metadata.exists?(ruby_version_cache) && @metadata.read(ruby_version_cache).strip.match(/ruby 2\.1\.(9|10)/) || - bundler.has_gem?("psych") - ) - puts "Need to recompile gems for CVE-2014-2014-9130. Clearing bundler cache." - puts "See https://devcenter.heroku.com/changelog-items/1016." - purge_bundler_cache - end + # fix git gemspec bug from Bundler 1.3.0+ upgrade + if File.exists?(bundler_cache) && !@metadata.exists?(bundler_version_cache) && !run("find vendor/bundle/*/*/bundler/gems/*/ -name *.gemspec").include?("No such file or directory") + puts "Old bundler cache detected. Clearing bundler cache." + purge_bundler_cache + end - FileUtils.mkdir_p(heroku_metadata) - @metadata.write(ruby_version_cache, full_ruby_version, false) - @metadata.write(buildpack_version_cache, BUILDPACK_VERSION, false) - @metadata.write(bundler_version_cache, bundler.version, false) - @metadata.write(rubygems_version_cache, rubygems_version, false) - @metadata.write(stack_cache, @stack, false) - @metadata.save + # fix for https://github.com/heroku/heroku-buildpack-ruby/issues/86 + if (!@metadata.exists?(rubygems_version_cache) || + (old_rubygems_version == "2.0.0" && old_rubygems_version != rubygems_version)) && + @metadata.exists?(ruby_version_cache) && @metadata.read(ruby_version_cache).strip.include?("ruby 2.0.0p0") + puts "Updating to rubygems #{rubygems_version}. Clearing bundler cache." + purge_bundler_cache end + + # fix for https://github.com/sparklemotion/nokogiri/issues/923 + if @metadata.exists?(buildpack_version_cache) && (bv = @metadata.read(buildpack_version_cache).sub('v', '').to_i) && bv != 0 && bv <= 76 + puts "Fixing nokogiri install. Clearing bundler cache." + puts "See https://github.com/sparklemotion/nokogiri/issues/923." + purge_bundler_cache + end + + # recompile nokogiri to use new libyaml + if @metadata.exists?(buildpack_version_cache) && (bv = @metadata.read(buildpack_version_cache).sub('v', '').to_i) && bv != 0 && bv <= 99 && bundler.has_gem?("psych") + puts "Need to recompile psych for CVE-2013-6393. Clearing bundler cache." + puts "See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=737076." + purge_bundler_cache + end + + # recompile gems for libyaml 0.1.7 update + if @metadata.exists?(buildpack_version_cache) && (bv = @metadata.read(buildpack_version_cache).sub('v', '').to_i) && bv != 0 && bv <= 147 && + (@metadata.exists?(ruby_version_cache) && @metadata.read(ruby_version_cache).strip.match(/ruby 2\.1\.(9|10)/) || + bundler.has_gem?("psych") + ) + puts "Need to recompile gems for CVE-2014-2014-9130. Clearing bundler cache." + puts "See https://devcenter.heroku.com/changelog-items/1016." + purge_bundler_cache + end + + FileUtils.mkdir_p(heroku_metadata) + @metadata.write(ruby_version_cache, full_ruby_version, false) + @metadata.write(buildpack_version_cache, BUILDPACK_VERSION, false) + @metadata.write(bundler_version_cache, bundler.version, false) + @metadata.write(rubygems_version_cache, rubygems_version, false) + @metadata.write(stack_cache, @stack, false) + @metadata.save end def purge_bundler_cache(stack = nil) - instrument "ruby.purge_bundler_cache" do - @bundler_cache.clear(stack) - # need to reinstall language pack gems - install_bundler_in_app(slug_vendor_base) - end + @bundler_cache.clear(stack) + # need to reinstall language pack gems + install_bundler_in_app(slug_vendor_base) end end diff --git a/lib/language_pack/shell_helpers.rb b/lib/language_pack/shell_helpers.rb index 00fe81dac..87b1a40e0 100644 --- a/lib/language_pack/shell_helpers.rb +++ b/lib/language_pack/shell_helpers.rb @@ -1,4 +1,5 @@ require "shellwords" +require "timeout" class BuildpackError < StandardError end diff --git a/lib/language_pack/test/ruby.rb b/lib/language_pack/test/ruby.rb index 73d3351c7..f1421112d 100644 --- a/lib/language_pack/test/ruby.rb +++ b/lib/language_pack/test/ruby.rb @@ -1,31 +1,29 @@ #module LanguagePack::Test::Ruby class LanguagePack::Ruby def compile - instrument 'ruby.test.compile' do - new_app? - Dir.chdir(build_path) - remove_vendor_bundle - warn_bad_binstubs - install_ruby(slug_vendor_ruby, build_ruby_path) - setup_language_pack_environment( - ruby_layer_path: File.expand_path("."), - gem_layer_path: File.expand_path("."), - bundle_path: "vendor/bundle", - bundle_default_without: "development" - ) - setup_export - allow_git do - install_bundler_in_app(slug_vendor_base) - load_bundler_cache - build_bundler - post_bundler - create_database_yml - install_binaries - prepare_tests - end - setup_profiled(ruby_layer_path: "$HOME", gem_layer_path: "$HOME") # $HOME is set to /app at run time - super + new_app? + Dir.chdir(build_path) + remove_vendor_bundle + warn_bad_binstubs + install_ruby(slug_vendor_ruby, build_ruby_path) + setup_language_pack_environment( + ruby_layer_path: File.expand_path("."), + gem_layer_path: File.expand_path("."), + bundle_path: "vendor/bundle", + bundle_default_without: "development" + ) + setup_export + allow_git do + install_bundler_in_app(slug_vendor_base) + load_bundler_cache + build_bundler + post_bundler + create_database_yml + install_binaries + prepare_tests end + setup_profiled(ruby_layer_path: "$HOME", gem_layer_path: "$HOME") # $HOME is set to /app at run time + super end private diff --git a/vendor/dotenv.rb b/vendor/dotenv.rb deleted file mode 100644 index cca1c077d..000000000 --- a/vendor/dotenv.rb +++ /dev/null @@ -1,7 +0,0 @@ -# imports contents of .env file into ENV -file = File.expand_path("../../.env", __FILE__) -if File.exists?(file) - File.read(file).split("\n").map {|x| x.split("=") }.each do |k,v| - ENV[k.strip] = v.strip - end -end diff --git a/vendor/lpxc.rb b/vendor/lpxc.rb deleted file mode 100644 index 2e3ed30c0..000000000 --- a/vendor/lpxc.rb +++ /dev/null @@ -1,177 +0,0 @@ -require 'time' -require 'net/http' -require 'uri' -require 'thread' -require 'timeout' - -class Lpxc - - #After parsing opts and initializing defaults, the initializer - #will start 2 threads. One thread for sending HTTP requests and another - #thread for flushing log messages to the outlet thread periodically. - #:hash => {}:: A data structure for grouping log messages by token. - #:request_queue => SizedQueue.new:: Contains HTTP requests ready for outlet thread to deliver to logplex. - #:default_token => nil:: You can specify a token that will be used for any call to Lpxc#puts that doesn't include a token. - #:structured_data => '-':: Structured-data field for syslog headers. Ignored by logplex. - #:msgid => '-':: Msg ID field for syslog headers. Ignored by logplex. - #:procid => 'lpxc':: Proc ID field for syslog headers. This will show up in the Heroku logs tail command as: app [lpxc]. - #:hostname => 'myhost':: Hostname field for syslog headers. Ignored by logplex. - #:max_reqs_per_conn => 1_000:: Number of requests before we re-establish our keep-alive connection to logplex. - #:conn_timeout => 2:: Number of seconds before timing out a sindle request to logplex. - #:batch_size => 300:: Max number of log messages inside single HTTP request. - #:flush_interval => 0.5:: Fractional number of seconds before flushing all log messages in buffer to logplex. - #:logplex_url => \'https://east.logplex.io/logs':: HTTP server that will accept our log messages. - #:disable_delay_flush => nil:: Force flush only batch_size is reached. - def initialize(opts={}) - @hash_lock = Mutex.new - @hash = opts[:hash] || Hash.new - @request_queue = opts[:request_queue] || SizedQueue.new(1) - @default_token = opts[:default_token] || ENV['LOGPLEX_DEFAULT_TOKEN'] - @structured_data = opts[:structured_data] || "-" - @msgid = opts[:msgid] || "-" - @procid = opts[:procid] || "lpxc" - @hostname = opts[:hostname] || "myhost" - @max_reqs_per_conn = opts[:max_reqs_per_conn] || 1_000 - @conn_timeout = opts[:conn_timeout] || 2 - @batch_size = opts[:batch_size] || 300 - @flush_interval = opts[:flush_interval] || 0.5 - @logplex_url = URI(opts[:logplex_url] || ENV["LOGPLEX_URL"] || - raise("Must set logplex url.")) - - #Keep track of the number of requests that the outlet - #is processing. This value is used by the wait function. - @req_in_flight = 0 - - #Initialize the last_flush to an arbitrary time. - @last_flush = Time.now + @flush_interval - - #Start the processing threads. - Thread.new {outlet} - Thread.new {delay_flush} if opts[:disable_delay_flush].nil? - end - - #The interface to publish logs into the stream. - #This function will set the log message to the current time in UTC. - #If the buffer for this token's log messages is full, it will flush the buffer. - def puts(msg, tok=@default_token) - @hash_lock.synchronize do - #Messages are grouped by their token since 1 http request - #to logplex must only contain log messages belonging to a single token. - q = @hash[tok] ||= SizedQueue.new(@batch_size) - #This call will block if the queue is full. - #However this should never happen since the next command will flush - #the queue if we add the last item. - q.enq({:t => Time.now.utc, :token => tok, :msg => msg}) - flush if q.size == q.max - end - end - - #Wait until all of the data has been cleared from memory. - #This is useful if you don't want your program to exit before - #we are able to deliver log messages to logplex. - def wait - sleep(0.1) until - @hash.length.zero? && - @request_queue.empty? && - @req_in_flight.zero? - end - - private - - #Take a lock to read all of the buffered messages. - #Once we have read the messages, we make 1 http request for the batch. - #We pass the request off into the request queue so that the request - #can be sent to LOGPLEX_URL. - def flush - @hash.each do |tok, msgs| - #Copy the messages from the queue into the payload array. - payloads = [] - msgs.size.times {payloads << msgs.deq} - return if payloads.nil? || payloads.empty? - - #Use the payloads array to build a string that will be - #used as the http body for the logplex request. - body = "" - payloads.flatten.each do |payload| - body += "#{fmt(payload)}" - end - - #Build a new HTTP request and place it into the queue - #to be processed by the HTTP connection. - req = Net::HTTP::Post.new(@logplex_url.path) - req.basic_auth("token", tok) - req.add_field('Content-Type', 'application/logplex-1') - req.body = body - @request_queue.enq(req) - @hash.delete(tok) - @last_flush = Time.now - end - end - - - #This method must be called in order for the messages to be sent to Logplex. - #This method also spawns a thread that allows the messages to be batched. - #Messages are flushed from memory every 500ms or when we have 300 messages, - #whichever comes first. - def delay_flush - loop do - begin - if interval_ready? - @hash_lock.synchronize {flush} - end - sleep(0.01) - rescue => e - end - end - end - - def interval_ready? - (Time.now.to_f - @last_flush.to_f).abs >= @flush_interval - end - - #Format the user message into RFC5425 format. - #This method also prepends the length to the message. - def fmt(data) - pkt = "<190>1 " - pkt += "#{data[:t].strftime("%Y-%m-%dT%H:%M:%S+00:00")} " - pkt += "#{@hostname} " - pkt += "#{data[:token]} " - pkt += "#{@procid} " - pkt += "#{@msgid} " - pkt += "#{@structured_data} " - pkt += data[:msg] - "#{pkt.size} #{pkt}" - end - - #We use a keep-alive connection to send data to LOGPLEX_URL. - #Each request will contain one or more log messages. - def outlet - loop do - http = Net::HTTP.new(@logplex_url.host, @logplex_url.port) - http.use_ssl = true if @logplex_url.scheme == 'https' - begin - http.start do |conn| - num_reqs = 0 - while num_reqs < @max_reqs_per_conn - #Blocks waiting for a request. - req = @request_queue.deq - @req_in_flight += 1 - resp = nil - begin - Timeout::timeout(@conn_timeout) {resp = conn.request(req)} - rescue => e - next - ensure - @req_in_flight -= 1 - end - num_reqs += 1 - end - end - rescue => e - ensure - http.finish if http.started? - end - end - end - -end From fc428a019f933d38c4bfcf524a4d9347b7d3b420 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 22 Nov 2021 08:39:32 +0000 Subject: [PATCH 0840/1195] Bump dead_end from 2.0.2 to 3.0.2 (#1230) Bumps [dead_end](https://github.com/zombocom/dead_end) from 2.0.2 to 3.0.2. - [Release notes](https://github.com/zombocom/dead_end/releases) - [Changelog](https://github.com/zombocom/dead_end/blob/main/CHANGELOG.md) - [Commits](https://github.com/zombocom/dead_end/compare/v2.0.2...v3.0.2) --- updated-dependencies: - dependency-name: dead_end dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index c2f9b9550..370247994 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,7 +3,7 @@ GEM specs: ci-queue (0.21.1) citrus (3.0.2) - dead_end (2.0.2) + dead_end (3.0.2) diff-lcs (1.4.4) erubis (2.7.0) excon (0.88.0) From 75ca73e3dfd7ad07d62772ca3db2bb8e17de5e80 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 23 Nov 2021 08:36:29 +0000 Subject: [PATCH 0841/1195] Bump dead_end from 3.0.2 to 3.1.0 (#1235) Bumps [dead_end](https://github.com/zombocom/dead_end) from 3.0.2 to 3.1.0. - [Release notes](https://github.com/zombocom/dead_end/releases) - [Changelog](https://github.com/zombocom/dead_end/blob/main/CHANGELOG.md) - [Commits](https://github.com/zombocom/dead_end/compare/v3.0.2...v3.1.0) --- updated-dependencies: - dependency-name: dead_end dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 370247994..e370fdc68 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,7 +3,7 @@ GEM specs: ci-queue (0.21.1) citrus (3.0.2) - dead_end (3.0.2) + dead_end (3.1.0) diff-lcs (1.4.4) erubis (2.7.0) excon (0.88.0) From bfd4e6d3c86ffd2805bef3cf28619ba0176b6d04 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Tue, 30 Nov 2021 01:58:10 -0600 Subject: [PATCH 0842/1195] Add links to buildpack homepage (#1236) GUS-W-10237554 --- buildpack.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/buildpack.toml b/buildpack.toml index c6689f156..52bd2353c 100644 --- a/buildpack.toml +++ b/buildpack.toml @@ -4,6 +4,7 @@ api = "0.2" id = "heroku/ruby" version = "0.1.4" name = "Ruby" +homepage = "https://github.com/heroku/heroku-buildpack-ruby" ruby_version = "2.7.4" [publish] From f34916346590aa84b1305f370c1b05ff0fa7c67d Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Wed, 1 Dec 2021 16:23:08 -0600 Subject: [PATCH 0843/1195] Update default Ruby version to 2.7.5 (#1237) GUS-W-10255600 --- .circleci/config.yml | 10 +++++----- CHANGELOG.md | 1 + Gemfile | 2 +- Gemfile.lock | 2 +- buildpack.toml | 6 +++--- changelogs/unreleased/ruby_275_default.md | 3 +++ lib/language_pack/ruby_version.rb | 2 +- 7 files changed, 15 insertions(+), 11 deletions(-) create mode 100644 changelogs/unreleased/ruby_275_default.md diff --git a/.circleci/config.yml b/.circleci/config.yml index 40b768141..220ffcc93 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -11,11 +11,11 @@ jobs: - checkout - run: command: | - rvm install 2.7.4 - rvm use ruby-2.7.4 - export PATH="/opt/circleci/.rvm/rubies/ruby-2.7.4/bin:$PATH" - export GEM_HOME="/opt/circleci/.rvm/gems/ruby-2.7.4" - export GEM_PATH="/opt/circleci/.rvm/gems/ruby-2.7.4" + rvm install 2.7.5 + rvm use ruby-2.7.5 + export PATH="/opt/circleci/.rvm/rubies/ruby-2.7.5/bin:$PATH" + export GEM_HOME="/opt/circleci/.rvm/gems/ruby-2.7.5" + export GEM_PATH="/opt/circleci/.rvm/gems/ruby-2.7.5" gem install bundler -v 2.1.0 bundle install bundle exec rake hatchet:setup_ci diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a82ae469..67776747d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Main (unreleased) +* Default Ruby version is now 2.7.5 (https://github.com/heroku/heroku-buildpack-ruby/pull/1237) * Remove instrumentation and LPXC logic (https://github.com/heroku/heroku-buildpack-ruby/pull/1229) ## v232 (11/9/2021) diff --git a/Gemfile b/Gemfile index 4a0adce0e..7a2e31a99 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ source "https://rubygems.org" git_source(:github) { |repo| "https://github.com/#{repo}.git" } -ruby '2.7.4' +ruby '2.7.5' group :development, :test do gem "toml-rb" diff --git a/Gemfile.lock b/Gemfile.lock index e370fdc68..2c323f72e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -65,7 +65,7 @@ DEPENDENCIES toml-rb RUBY VERSION - ruby 2.7.4p191 + ruby 2.7.5p203 BUNDLED WITH 2.1.4 diff --git a/buildpack.toml b/buildpack.toml index 52bd2353c..155d97afe 100644 --- a/buildpack.toml +++ b/buildpack.toml @@ -5,7 +5,7 @@ id = "heroku/ruby" version = "0.1.4" name = "Ruby" homepage = "https://github.com/heroku/heroku-buildpack-ruby" -ruby_version = "2.7.4" +ruby_version = "2.7.5" [publish] @@ -13,11 +13,11 @@ ruby_version = "2.7.4" files = ["spec/"] [[publish.Vendor]] -url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-18/ruby-2.7.4.tgz" +url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-18/ruby-2.7.5.tgz" dir = "vendor/ruby/heroku-18" [[publish.Vendor]] -url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-20/ruby-2.7.4.tgz" +url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-20/ruby-2.7.5.tgz" dir = "vendor/ruby/heroku-20" [[stacks]] diff --git a/changelogs/unreleased/ruby_275_default.md b/changelogs/unreleased/ruby_275_default.md new file mode 100644 index 000000000..27c088192 --- /dev/null +++ b/changelogs/unreleased/ruby_275_default.md @@ -0,0 +1,3 @@ +## Default Ruby version for new apps is now 2.7.5 + +The [default Ruby version for new Ruby applications is 2.7.5](https://devcenter.heroku.com/articles/ruby-support#default-ruby-version-for-new-apps). You’ll only get the default if the application does not specify a ruby version. diff --git a/lib/language_pack/ruby_version.rb b/lib/language_pack/ruby_version.rb index 34f60bf06..88d14ffe3 100644 --- a/lib/language_pack/ruby_version.rb +++ b/lib/language_pack/ruby_version.rb @@ -12,7 +12,7 @@ def initialize(output = "") end end - DEFAULT_VERSION_NUMBER = "2.7.4".freeze + DEFAULT_VERSION_NUMBER = "2.7.5".freeze DEFAULT_VERSION = "ruby-#{DEFAULT_VERSION_NUMBER}".freeze LEGACY_VERSION_NUMBER = "1.9.2".freeze LEGACY_VERSION = "ruby-#{LEGACY_VERSION_NUMBER}".freeze From 8f5c6bbd3b3d3c566e15e9bd229bfffea0df7e2b Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Thu, 2 Dec 2021 15:29:18 -0600 Subject: [PATCH 0844/1195] Update Ruby's default Node and Yarn versions (#1238) * Update Ruby's default Node and Yarn versions Applications using the `heroku/ruby` buildpack that do not have a version of Node installed by another buildpack (such as the `heroku/nodejs` buildpack) will now receive: - Node version 16.13.0 (was previously 12.16.2) - Yarn version 1.2.17 (was previously 1.22.4) GUS-W-10255676 * Update changelogs/unreleased/node_yarn.md Co-authored-by: Ed Morley <501702+edmorley@users.noreply.github.com> Co-authored-by: Alec Rust Co-authored-by: Ed Morley <501702+edmorley@users.noreply.github.com> --- CHANGELOG.md | 1 + changelogs/unreleased/node_yarn.md | 8 ++++++++ lib/language_pack/helpers/nodebin.rb | 4 ++-- 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 changelogs/unreleased/node_yarn.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 67776747d..8fb317444 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Main (unreleased) +* Default node version now 16.13.1, yarn is 1.22.17 (https://github.com/heroku/heroku-buildpack-ruby/pull/1238) * Default Ruby version is now 2.7.5 (https://github.com/heroku/heroku-buildpack-ruby/pull/1237) * Remove instrumentation and LPXC logic (https://github.com/heroku/heroku-buildpack-ruby/pull/1229) diff --git a/changelogs/unreleased/node_yarn.md b/changelogs/unreleased/node_yarn.md new file mode 100644 index 000000000..c769c5d7f --- /dev/null +++ b/changelogs/unreleased/node_yarn.md @@ -0,0 +1,8 @@ +## Ruby apps now default to Node version 16.13.1 and Yarn version 1.22.17 + +Applications using the `heroku/ruby` buildpack that do not have a version of Node installed by another buildpack (such as the `heroku/nodejs` buildpack) will now receive: + +- Node version 16.13.1 (was previously 12.16.2) +- Yarn version 1.22.17 (was previously 1.22.4) + +These versions and instructions on how to specify a specific version of these binaries can be found on the [installed binaries section of the Heroku Ruby Support page](https://devcenter.heroku.com/articles/ruby-support#installed-binaries). diff --git a/lib/language_pack/helpers/nodebin.rb b/lib/language_pack/helpers/nodebin.rb index 01ad5b1fe..0dafdce9d 100644 --- a/lib/language_pack/helpers/nodebin.rb +++ b/lib/language_pack/helpers/nodebin.rb @@ -2,7 +2,7 @@ class LanguagePack::Helpers::Nodebin def self.hardcoded_node_lts - version = "12.16.2" + version = "16.13.1" { "number" => version, "url" => "https://s3.amazonaws.com/heroku-nodebin/node/release/linux-x64/node-v#{version}-linux-x64.tar.gz" @@ -10,7 +10,7 @@ def self.hardcoded_node_lts end def self.hardcoded_yarn - version = "1.22.4" + version = "1.22.17" { "number" => version, "url" => "https://s3.amazonaws.com/heroku-nodebin/yarn/release/yarn-v#{version}.tar.gz" From f556ff3cc73d2dd9a2dfcb74513f7fdc9fa6d89d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 14 Dec 2021 09:46:44 +0000 Subject: [PATCH 0845/1195] Bump excon from 0.88.0 to 0.89.0 (#1241) Bumps [excon](https://github.com/excon/excon) from 0.88.0 to 0.89.0. - [Release notes](https://github.com/excon/excon/releases) - [Changelog](https://github.com/excon/excon/blob/master/changelog.txt) - [Commits](https://github.com/excon/excon/compare/v0.88.0...v0.89.0) --- updated-dependencies: - dependency-name: excon dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 2c323f72e..ca31be30c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -6,7 +6,7 @@ GEM dead_end (3.1.0) diff-lcs (1.4.4) erubis (2.7.0) - excon (0.88.0) + excon (0.89.0) heroics (0.1.2) erubis (~> 2.0) excon From d8342b33db4415c99940d965c3ca989b432b17c7 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Thu, 16 Dec 2021 10:42:11 -0600 Subject: [PATCH 0846/1195] v233 (#1244) --- CHANGELOG.md | 2 ++ changelogs/v233/.gitkeep | 0 changelogs/{unreleased => v233}/node_yarn.md | 0 changelogs/{unreleased => v233}/ruby_275_default.md | 0 lib/language_pack/version.rb | 2 +- 5 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/v233/.gitkeep rename changelogs/{unreleased => v233}/node_yarn.md (100%) rename changelogs/{unreleased => v233}/ruby_275_default.md (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8fb317444..9042b992c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Main (unreleased) +## v233 (12/16/2021) + * Default node version now 16.13.1, yarn is 1.22.17 (https://github.com/heroku/heroku-buildpack-ruby/pull/1238) * Default Ruby version is now 2.7.5 (https://github.com/heroku/heroku-buildpack-ruby/pull/1237) * Remove instrumentation and LPXC logic (https://github.com/heroku/heroku-buildpack-ruby/pull/1229) diff --git a/changelogs/v233/.gitkeep b/changelogs/v233/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/changelogs/unreleased/node_yarn.md b/changelogs/v233/node_yarn.md similarity index 100% rename from changelogs/unreleased/node_yarn.md rename to changelogs/v233/node_yarn.md diff --git a/changelogs/unreleased/ruby_275_default.md b/changelogs/v233/ruby_275_default.md similarity index 100% rename from changelogs/unreleased/ruby_275_default.md rename to changelogs/v233/ruby_275_default.md diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index d58b7134e..77c07009c 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v232" + BUILDPACK_VERSION = "v233" end end From 7d2b2ce99ed3ceb9c71cfb770fe58f493ef3c9f4 Mon Sep 17 00:00:00 2001 From: Ed Morley <501702+edmorley@users.noreply.github.com> Date: Thu, 16 Dec 2021 16:53:29 +0000 Subject: [PATCH 0847/1195] Enable Dependabot for GitHub Actions (#1243) For parity with our other repos. The custom label setting has been removed, since by default Dependabot adds both a `dependencies` label and a language-specific label, whereas the custom config only adds the former. The concurrent PR setting has also been removed, since raising rate limits makes this a non-issue, and with GitHub's new auto-merge feature, updating dependencies is much easier if all the PRs are opened from the start. Co-authored-by: Richard Schneeman --- .github/dependabot.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 5921c9525..403b3087e 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -2,8 +2,9 @@ version: 2 updates: - package-ecosystem: "bundler" directory: "/" - open-pull-requests-limit: 1 # Limit concurrent CI runs from executing schedule: interval: "weekly" - labels: - - "dependencies" + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" From 6dcea294fe63ee0e097d09fb29790e4ba08f8454 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 16 Dec 2021 18:54:50 +0000 Subject: [PATCH 0848/1195] Bump ci-queue from 0.21.1 to 0.22.0 (#1247) Bumps [ci-queue](https://github.com/Shopify/ci-queue) from 0.21.1 to 0.22.0. - [Release notes](https://github.com/Shopify/ci-queue/releases) - [Commits](https://github.com/Shopify/ci-queue/compare/v0.21.1...v0.22.0) --- updated-dependencies: - dependency-name: ci-queue dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index ca31be30c..c3342582a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ GEM remote: https://rubygems.org/ specs: - ci-queue (0.21.1) + ci-queue (0.22.0) citrus (3.0.2) dead_end (3.1.0) diff-lcs (1.4.4) From 18978cd860b183a711991662144252921b355b53 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 16 Dec 2021 19:11:46 +0000 Subject: [PATCH 0849/1195] Bump actions/checkout from 2.3.4 to 2.4.0 (#1246) Bumps [actions/checkout](https://github.com/actions/checkout) from 2.3.4 to 2.4.0. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v2.3.4...v2.4.0) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/check_changelog.yml | 2 +- .github/workflows/release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check_changelog.yml b/.github/workflows/check_changelog.yml index 45589e4f9..70fd9884a 100644 --- a/.github/workflows/check_changelog.yml +++ b/.github/workflows/check_changelog.yml @@ -15,7 +15,7 @@ jobs: !contains(github.event.pull_request.labels.*.name, 'dependencies') && !contains(github.event.pull_request.labels.*.name, 'automation') steps: - - uses: actions/checkout@v2.3.4 + - uses: actions/checkout@v2.4.0 - name: Check that CHANGELOG is touched run: | git fetch origin ${{ github.base_ref }} --depth 1 && \ diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b223cb98e..86f720acc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,7 +15,7 @@ jobs: steps: - id: checkout name: "Checkout code" - uses: actions/checkout@v2 + uses: actions/checkout@v2.4.0 - id: setup-pack name: "Setup pack" uses: buildpacks/github-actions/setup-pack@v4.0.0 From 9762663063ee3aab85bf85a594164bb3ad1485e2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 16 Dec 2021 19:31:22 +0000 Subject: [PATCH 0850/1195] Bump buildpacks/github-actions from 4.0.0 to 4.5.0 (#1245) Bumps [buildpacks/github-actions](https://github.com/buildpacks/github-actions) from 4.0.0 to 4.5.0. - [Release notes](https://github.com/buildpacks/github-actions/releases) - [Commits](https://github.com/buildpacks/github-actions/compare/v4.0.0...v4.5.0) --- updated-dependencies: - dependency-name: buildpacks/github-actions dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 86f720acc..9570fe64d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,7 +18,7 @@ jobs: uses: actions/checkout@v2.4.0 - id: setup-pack name: "Setup pack" - uses: buildpacks/github-actions/setup-pack@v4.0.0 + uses: buildpacks/github-actions/setup-pack@v4.5.0 - id: login name: "Login to public ECR" uses: docker/login-action@v1 From cdc7902735b512ade68561de752f31c611f39ba0 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Thu, 16 Dec 2021 14:53:14 -0600 Subject: [PATCH 0851/1195] Fix database.yml indentation (#1252) Close #1250 In https://github.com/heroku/heroku-buildpack-ruby/pull/1229/files#diff-d7f6f21bc5e80a7032506dae28ef835682a02ae9d2d9d162faccf793a826f1bcR944-R950 a helper method with a block was removed. All code within the block was indented. When the block was removed the indentation was incorrectly collapsed for the `config/database.yml` heredoc. Prior to Rails 4.1 Heroku would over-write any database.yml to read from DATABASE_URL https://devcenter.heroku.com/changelog-items/709. This is running tests, and adding a changelog for #1251 Co-authored-by: Ben Hutton --- CHANGELOG.md | 4 ++++ lib/language_pack/ruby.rb | 40 ++++++++++++++++++------------------ lib/language_pack/version.rb | 2 +- 3 files changed, 25 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9042b992c..1db147e8c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Main (unreleased) +## v234 (12/16/2021) + +* Fix YML indentation from v233 (https://github.com/heroku/heroku-buildpack-ruby/pull/1252) + ## v233 (12/16/2021) * Default node version now 16.13.1, yarn is 1.22.17 (https://github.com/heroku/heroku-buildpack-ruby/pull/1238) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index df24f1f51..579605018 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -905,25 +905,25 @@ def create_database_yml require 'uri' begin -uri = URI.parse(ENV["DATABASE_URL"]) + uri = URI.parse(ENV["DATABASE_URL"]) rescue URI::InvalidURIError -raise "Invalid DATABASE_URL" + raise "Invalid DATABASE_URL" end raise "No RACK_ENV or RAILS_ENV found" unless ENV["RAILS_ENV"] || ENV["RACK_ENV"] def attribute(name, value, force_string = false) -if value - value_string = - if force_string - '"' + value + '"' - else - value - end - "\#{name}: \#{value_string}" -else - "" -end + if value + value_string = + if force_string + '"' + value + '"' + else + value + end + "\#{name}: \#{value_string}" + else + "" + end end adapter = uri.scheme @@ -942,15 +942,15 @@ def attribute(name, value, force_string = false) %> <%= ENV["RAILS_ENV"] || ENV["RACK_ENV"] %>: -<%= attribute "adapter", adapter %> -<%= attribute "database", database %> -<%= attribute "username", username %> -<%= attribute "password", password, true %> -<%= attribute "host", host %> -<%= attribute "port", port %> + <%= attribute "adapter", adapter %> + <%= attribute "database", database %> + <%= attribute "username", username %> + <%= attribute "password", password, true %> + <%= attribute "host", host %> + <%= attribute "port", port %> <% params.each do |key, value| %> -<%= key %>: <%= value.first %> + <%= key %>: <%= value.first %> <% end %> DATABASE_YML end diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 77c07009c..4eb00c7ba 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v233" + BUILDPACK_VERSION = "v234" end end From 30c00037587aa25e3d1a4a005575bb81f259ed84 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Mon, 3 Jan 2022 11:15:13 -0600 Subject: [PATCH 0852/1195] Update bundler to 2.2.33 (#1248) close #1225 --- CHANGELOG.md | 2 ++ changelogs/unreleased/bundler_2_2_33.md | 3 +++ lib/language_pack/helpers/bundler_wrapper.rb | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 changelogs/unreleased/bundler_2_2_33.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 1db147e8c..842b29b37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Main (unreleased) +* Bundler 2.x is now 2.2.33 (https://github.com/heroku/heroku-buildpack-ruby/pull/1248) + ## v234 (12/16/2021) * Fix YML indentation from v233 (https://github.com/heroku/heroku-buildpack-ruby/pull/1252) diff --git a/changelogs/unreleased/bundler_2_2_33.md b/changelogs/unreleased/bundler_2_2_33.md new file mode 100644 index 000000000..c22ad8888 --- /dev/null +++ b/changelogs/unreleased/bundler_2_2_33.md @@ -0,0 +1,3 @@ +## Ruby apps with Bundler 2.x now receive version 2.2.33 + +The [Ruby Buildpack](https://devcenter.heroku.com/articles/ruby-support#libraries) now includes Bundler 2.2.33. Applications specifying Bundler 2.x in their `Gemfile.lock` will now receive this version of bundler. diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index 1123bfbe7..d4d8faba3 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -37,7 +37,7 @@ class LanguagePack::Helpers::BundlerWrapper BLESSED_BUNDLER_VERSIONS = {} BLESSED_BUNDLER_VERSIONS["1"] = "1.17.3" - BLESSED_BUNDLER_VERSIONS["2"] = "2.2.21" + BLESSED_BUNDLER_VERSIONS["2"] = "2.2.33" BUNDLED_WITH_REGEX = /^BUNDLED WITH$(\r?\n) (?\d+)\.\d+\.\d+/m class GemfileParseError < BuildpackError From a6ac7977832d7187cd5e70182463b225b9035079 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Mon, 3 Jan 2022 14:37:33 -0600 Subject: [PATCH 0853/1195] Fix Rails 7 tests (#1239) This test started failing because the `turbo-rails` gem we were using was yanked. https://github.com/hotwired/turbo-rails/issues/273. This commit revs the hatchet lock version to point at the latest changes to the fixture: https://github.com/sharpstone/rails-jsbundling/commit/192a71e0931aa00724412521dcad4d1e1db2ec0f GUS-W-10261468 --- hatchet.lock | 2 +- spec/hatchet/rails7_spec.rb | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/hatchet.lock b/hatchet.lock index 9f7c2bf1d..f91a969da 100644 --- a/hatchet.lock +++ b/hatchet.lock @@ -46,7 +46,7 @@ - - "./repos/rails_versions/active_storage_non_local" - 86dddf0127043abba1cb2890590a1d38f111edbd - - "./repos/rails_versions/rails-jsbundling" - - 6b60a3aa7eb9507865ebba6afcca150017ab66b4 + - 192a71e0931aa00724412521dcad4d1e1db2ec0f - - "./repos/rails_versions/rails3_default_ruby" - a6b44db674c0d3538633989295e2cfd5e8e1ba0d - - "./repos/rails_versions/rails42_default_ruby" diff --git a/spec/hatchet/rails7_spec.rb b/spec/hatchet/rails7_spec.rb index 2a9ae04e1..fdce28447 100644 --- a/spec/hatchet/rails7_spec.rb +++ b/spec/hatchet/rails7_spec.rb @@ -9,8 +9,6 @@ end it "works with jsbundling" do - skip("rails-turbo was yanked and I don't know why") - Hatchet::Runner.new("rails-jsbundling").tap do |app| app.deploy do expect(app.output).to include("yarn install") From 716f14cf7cc7935fa1d88fc5e01c1388647410fe Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Tue, 4 Jan 2022 09:46:17 -0600 Subject: [PATCH 0854/1195] Release for v235 (#1256) --- CHANGELOG.md | 2 ++ Rakefile | 32 +++++++++++++++++++ .../{unreleased => v235}/bundler_2_2_33.md | 0 3 files changed, 34 insertions(+) rename changelogs/{unreleased => v235}/bundler_2_2_33.md (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 842b29b37..7fe471561 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Main (unreleased) +## v235 (2022/01/03) + * Bundler 2.x is now 2.2.33 (https://github.com/heroku/heroku-buildpack-ruby/pull/1248) ## v234 (12/16/2021) diff --git a/Rakefile b/Rakefile index 701d9c3f3..5eef001af 100644 --- a/Rakefile +++ b/Rakefile @@ -65,6 +65,38 @@ def install_gem(gem_name, version) end namespace :buildpack do + desc "prepares the next version of the buildpack for release" + task :prepare do + deploy = DeployCheck.new(github: "heroku/heroku-buildpack-ruby") + unreleased_changelogs = Pathname(__dir__).join("changelogs/unreleased").glob("*.md") + if unreleased_changelogs.empty? + puts "No devcenter changelog entries on disk in changelogs/unreleased" + else + next_changelog_dir = Pathname(__dir__).join("changelogs").join(deploy.next_version.to_s) + + next_changelog_dir.mkpath + + unreleased_changelogs.each do |source| + dest = next_changelog_dir.join(source.basename) + puts "Moving #{source} to #{dest}" + FileUtils.mv(source, dest) + end + end + + changelog_md = Pathname(__dir__).join("CHANGELOG.md") + contents = changelog_md.read + version_string = "## #{deploy.next_version}" + if contents.include?(version_string) + puts "Found an entry in CHANGELOG.md for #{version_string}" + else + new_section = "## Main (unreleased)\n\n#{version_string} (#{Time.now.strftime("%Y/%m/%d")})" + + puts "Writing to CHANGELOG.md:\n\n#{new_section}" + + changelog_md.write(contents.gsub("## Main (unreleased)", new_section)) + end + end + desc "releases the next version of the buildpack" task :release do deploy = DeployCheck.new(github: "heroku/heroku-buildpack-ruby") diff --git a/changelogs/unreleased/bundler_2_2_33.md b/changelogs/v235/bundler_2_2_33.md similarity index 100% rename from changelogs/unreleased/bundler_2_2_33.md rename to changelogs/v235/bundler_2_2_33.md From accd4f8efbe22922904e18b20090b6511210b043 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Tue, 4 Jan 2022 09:53:25 -0600 Subject: [PATCH 0855/1195] Reintroduce PR limit (#1249) When multiple PRs are opened concurrently multiple tests are fired off. These all compete for the same API limits. Hatchet has baked in rate limiter. When it runs out of API requests, it will slow down. If too many concurrent CI executions are kicked off at one time, all the builds slow one another down, and prevent any of them from completing. --- .github/dependabot.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 403b3087e..3933d101e 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -2,6 +2,7 @@ version: 2 updates: - package-ecosystem: "bundler" directory: "/" + open-pull-requests-limit: 1 # Limit concurrent CI runs from executing, do not remove schedule: interval: "weekly" - package-ecosystem: "github-actions" From 689ec98ab3b25c8af30f17e9863c703d5c6bb761 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Tue, 4 Jan 2022 14:27:03 -0600 Subject: [PATCH 0856/1195] Specialize Rails7 Database setup on Heroku CI (#1257) * Test Rails 7 app against Heroku CI Added a test for Rails 7 to exercise behavior in https://github.com/heroku/heroku-buildpack-ruby/issues/1254. Update the Rails 7 example app to use the released version instead of alpha. Also update the app to be Heroku CI compat app (adds app.json): - https://github.com/sharpstone/rails-jsbundling/commit/34bd25cef7c09758b3e7763a5d4be6dc94364606 - https://github.com/sharpstone/rails-jsbundling/commit/a98a4e41708b48a36a0adb941df4b7d28d25d5d5 - https://github.com/sharpstone/rails-jsbundling/commit/b4ec664cbe63dd9176884f746f64a46bed879c21 - https://github.com/sharpstone/rails-jsbundling/commit/1fb48b40bf506fbc3fb7c00a67e8f98dce82ac07 Add CI tests against Rails 7 * Specialize Rails7 Database setup In Rails 6.1 the tasks used for database setup in our test pack were deprecated. They were removed in Rails 7 https://edgeguides.rubyonrails.org/7_0_release_notes.html. This commit moves to specialize the tasks for Rails7+ to use `db:schema:load` per deprecation instruction: ``` DEPRECATION WARNING: Using `bin/rails db:schema:load_if_ruby` is deprecated and will be removed in Rails 7.0. Configure the format using `config.active_record.schema_format = :ruby` to use `schema.rb` and run `bin/rails db:schema:load` instead. (called from
at /app/bin/rake:4) ``` * v236 --- CHANGELOG.md | 4 ++++ Rakefile | 5 +++++ hatchet.lock | 2 +- lib/language_pack/test.rb | 3 +++ lib/language_pack/test/rails2.rb | 4 ++-- lib/language_pack/test/rails7.rb | 9 +++++++++ lib/language_pack/test/ruby.rb | 7 +++++-- lib/language_pack/version.rb | 2 +- spec/hatchet/rails7_spec.rb | 7 +++++++ 9 files changed, 37 insertions(+), 6 deletions(-) create mode 100644 lib/language_pack/test/rails7.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index 7fe471561..d23666615 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Main (unreleased) +## v236 (2022/01/04) + +* Fix deprecated rake tasks for Rails 7 on Heroku CI (https://github.com/heroku/heroku-buildpack-ruby/pull/1257) + ## v235 (2022/01/03) * Bundler 2.x is now 2.2.33 (https://github.com/heroku/heroku-buildpack-ruby/pull/1248) diff --git a/Rakefile b/Rakefile index 5eef001af..a9352ceaa 100644 --- a/Rakefile +++ b/Rakefile @@ -95,6 +95,11 @@ namespace :buildpack do changelog_md.write(contents.gsub("## Main (unreleased)", new_section)) end + + version_rb = Pathname(__dir__).join("lib/language_pack/version.rb") + puts "Updating version.rb" + contents = version_rb.read.gsub(/BUILDPACK_VERSION = .*$/, %Q{BUILDPACK_VERSION = "#{deploy.next_version.to_s}"}) + version_rb.write(contents) end desc "releases the next version of the buildpack" diff --git a/hatchet.lock b/hatchet.lock index f91a969da..2efac12d7 100644 --- a/hatchet.lock +++ b/hatchet.lock @@ -46,7 +46,7 @@ - - "./repos/rails_versions/active_storage_non_local" - 86dddf0127043abba1cb2890590a1d38f111edbd - - "./repos/rails_versions/rails-jsbundling" - - 192a71e0931aa00724412521dcad4d1e1db2ec0f + - 34bd25cef7c09758b3e7763a5d4be6dc94364606 - - "./repos/rails_versions/rails3_default_ruby" - a6b44db674c0d3538633989295e2cfd5e8e1ba0d - - "./repos/rails_versions/rails42_default_ruby" diff --git a/lib/language_pack/test.rb b/lib/language_pack/test.rb index fc52af6d4..0f8f7eb07 100644 --- a/lib/language_pack/test.rb +++ b/lib/language_pack/test.rb @@ -3,5 +3,8 @@ module LanguagePack::Test end +# Behavior changes for the test pack work by opening existing language_pack +# classes and over-writing their behavior to extend test functionality require "language_pack/test/ruby" require "language_pack/test/rails2" +require "language_pack/test/rails7" diff --git a/lib/language_pack/test/rails2.rb b/lib/language_pack/test/rails2.rb index 71e2fa766..24d6323e9 100644 --- a/lib/language_pack/test/rails2.rb +++ b/lib/language_pack/test/rails2.rb @@ -1,4 +1,5 @@ -#module LanguagePack::Test::Rails2 +# Opens up the class of the Rails2 language pack and +# overwrites methods defined in `language_pack/test/ruby.rb` class LanguagePack::Rails2 # sets up the profile.d script for this buildpack def setup_profiled(ruby_layer_path: , gem_layer_path: ) @@ -51,7 +52,6 @@ def clear_db_test_tasks end end - private def db_prepare_test_rake_tasks schema_load = rake.task("db:schema:load_if_ruby") structure_load = rake.task("db:structure:load_if_sql") diff --git a/lib/language_pack/test/rails7.rb b/lib/language_pack/test/rails7.rb new file mode 100644 index 000000000..3af3c5010 --- /dev/null +++ b/lib/language_pack/test/rails7.rb @@ -0,0 +1,9 @@ +# Opens up the class of the Rails7 language pack and +# overwrites methods defined in `language_pack/test/ruby.rb` or `language_pack/test/rails2.rb` +class LanguagePack::Rails7 + # Rails removed the db:schema:load_if_ruby and `db:structure:load_if_sql` tasks + # they've been replaced by `db:schema:load` instead + def db_prepare_test_rake_tasks + ["db:schema:load", "db:migrate"].map {|name| rake.task(name) } + end +end diff --git a/lib/language_pack/test/ruby.rb b/lib/language_pack/test/ruby.rb index f1421112d..43498d67e 100644 --- a/lib/language_pack/test/ruby.rb +++ b/lib/language_pack/test/ruby.rb @@ -1,4 +1,8 @@ -#module LanguagePack::Test::Ruby +# Opens up the class of the Ruby language pack and +# overwrites methods defined in `language_pack/ruby.rb` +# +# Other "test packs" futher extend this behavior by hooking into +# methods or over writing methods defined here. class LanguagePack::Ruby def compile new_app? @@ -26,7 +30,6 @@ def compile super end - private def db_prepare_test_rake_tasks ["db:schema:load", "db:migrate"].map {|name| rake.task(name) } end diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 4eb00c7ba..242186dc9 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v234" + BUILDPACK_VERSION = "v236" end end diff --git a/spec/hatchet/rails7_spec.rb b/spec/hatchet/rails7_spec.rb index fdce28447..af9da0d6a 100644 --- a/spec/hatchet/rails7_spec.rb +++ b/spec/hatchet/rails7_spec.rb @@ -16,4 +16,11 @@ end end end + + it "Works on Heroku CI" do + Hatchet::Runner.new("rails-jsbundling").run_ci do |test_run| + expect(test_run.output).to match("db:schema:load") + expect(test_run.output).to match("db:migrate") + end + end end From 9c743a44781fec77cb54c4e26536620f084decea Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Jan 2022 08:55:40 +0000 Subject: [PATCH 0857/1195] Bump dead_end from 3.1.0 to 3.1.1 (#1259) Bumps [dead_end](https://github.com/zombocom/dead_end) from 3.1.0 to 3.1.1. - [Release notes](https://github.com/zombocom/dead_end/releases) - [Changelog](https://github.com/zombocom/dead_end/blob/main/CHANGELOG.md) - [Commits](https://github.com/zombocom/dead_end/compare/v3.1.0...v3.1.1) --- updated-dependencies: - dependency-name: dead_end dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index c3342582a..67f8c46d3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,7 +3,7 @@ GEM specs: ci-queue (0.22.0) citrus (3.0.2) - dead_end (3.1.0) + dead_end (3.1.1) diff-lcs (1.4.4) erubis (2.7.0) excon (0.89.0) From 0e62228f79eba8e8052010139766950b611f687f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 18 Jan 2022 08:31:53 +0000 Subject: [PATCH 0858/1195] Bump rspec-expectations from 3.10.1 to 3.10.2 (#1260) Bumps [rspec-expectations](https://github.com/rspec/rspec-expectations) from 3.10.1 to 3.10.2. - [Release notes](https://github.com/rspec/rspec-expectations/releases) - [Changelog](https://github.com/rspec/rspec-expectations/blob/main/Changelog.md) - [Commits](https://github.com/rspec/rspec-expectations/compare/v3.10.1...v3.10.2) --- updated-dependencies: - dependency-name: rspec-expectations dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 67f8c46d3..e8c78e595 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -4,7 +4,7 @@ GEM ci-queue (0.22.0) citrus (3.0.2) dead_end (3.1.1) - diff-lcs (1.4.4) + diff-lcs (1.5.0) erubis (2.7.0) excon (0.89.0) heroics (0.1.2) @@ -35,12 +35,12 @@ GEM rrrretry (1.0.0) rspec-core (3.10.1) rspec-support (~> 3.10.0) - rspec-expectations (3.10.1) + rspec-expectations (3.10.2) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.10.0) rspec-retry (0.6.2) rspec-core (> 3.3) - rspec-support (3.10.2) + rspec-support (3.10.3) thor (1.1.0) threaded (0.0.4) toml-rb (2.1.0) From a4044f4a972eeae6df5578fbf1b4b55ef3240d31 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 18 Jan 2022 08:38:07 +0000 Subject: [PATCH 0859/1195] Bump excon from 0.89.0 to 0.90.0 (#1261) Bumps [excon](https://github.com/excon/excon) from 0.89.0 to 0.90.0. - [Release notes](https://github.com/excon/excon/releases) - [Changelog](https://github.com/excon/excon/blob/master/changelog.txt) - [Commits](https://github.com/excon/excon/compare/v0.89.0...v0.90.0) --- updated-dependencies: - dependency-name: excon dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index e8c78e595..723b7c961 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -6,7 +6,7 @@ GEM dead_end (3.1.1) diff-lcs (1.5.0) erubis (2.7.0) - excon (0.89.0) + excon (0.90.0) heroics (0.1.2) erubis (~> 2.0) excon From 5232972774cd61d621ee6ec1546d422f3b9f2ff5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 25 Jan 2022 09:24:09 +0000 Subject: [PATCH 0860/1195] Bump toml-rb from 2.1.0 to 2.1.1 (#1262) Bumps [toml-rb](https://github.com/emancu/toml-rb) from 2.1.0 to 2.1.1. - [Release notes](https://github.com/emancu/toml-rb/releases) - [Commits](https://github.com/emancu/toml-rb/compare/v2.1.0...v2.1.1) --- updated-dependencies: - dependency-name: toml-rb dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 723b7c961..37c8ca13a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -43,7 +43,7 @@ GEM rspec-support (3.10.3) thor (1.1.0) threaded (0.0.4) - toml-rb (2.1.0) + toml-rb (2.1.1) citrus (~> 3.0, > 3.0) webrick (1.7.0) From b22a0365fa33196505dff7378d020a932132e069 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 25 Jan 2022 09:30:07 +0000 Subject: [PATCH 0861/1195] Bump buildpacks/github-actions from 4.5.0 to 4.5.1 (#1263) Bumps [buildpacks/github-actions](https://github.com/buildpacks/github-actions) from 4.5.0 to 4.5.1. - [Release notes](https://github.com/buildpacks/github-actions/releases) - [Commits](https://github.com/buildpacks/github-actions/compare/v4.5.0...v4.5.1) --- updated-dependencies: - dependency-name: buildpacks/github-actions dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9570fe64d..b53eac397 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,7 +18,7 @@ jobs: uses: actions/checkout@v2.4.0 - id: setup-pack name: "Setup pack" - uses: buildpacks/github-actions/setup-pack@v4.5.0 + uses: buildpacks/github-actions/setup-pack@v4.5.1 - id: login name: "Login to public ECR" uses: docker/login-action@v1 From dcee6c3fc6790501562d99ab375f1cb209c97698 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Feb 2022 08:09:48 +0000 Subject: [PATCH 0862/1195] Bump rspec-core from 3.10.1 to 3.10.2 (#1264) Bumps [rspec-core](https://github.com/rspec/rspec-core) from 3.10.1 to 3.10.2. - [Release notes](https://github.com/rspec/rspec-core/releases) - [Changelog](https://github.com/rspec/rspec-core/blob/main/Changelog.md) - [Commits](https://github.com/rspec/rspec-core/compare/v3.10.1...v3.10.2) --- updated-dependencies: - dependency-name: rspec-core dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 37c8ca13a..348eaef21 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -33,7 +33,7 @@ GEM rate_throttle_client (0.1.2) redis (4.5.1) rrrretry (1.0.0) - rspec-core (3.10.1) + rspec-core (3.10.2) rspec-support (~> 3.10.0) rspec-expectations (3.10.2) diff-lcs (>= 1.2.0, < 2.0) From 8537380a1b5b189ae9b8086a222e8776bc891196 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Feb 2022 08:18:39 +0000 Subject: [PATCH 0863/1195] Bump ci-queue from 0.22.0 to 0.22.1 (#1265) Bumps [ci-queue](https://github.com/Shopify/ci-queue) from 0.22.0 to 0.22.1. - [Release notes](https://github.com/Shopify/ci-queue/releases) - [Commits](https://github.com/Shopify/ci-queue/compare/v0.22.0...v0.22.1) --- updated-dependencies: - dependency-name: ci-queue dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 348eaef21..996656fb5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ GEM remote: https://rubygems.org/ specs: - ci-queue (0.22.0) + ci-queue (0.22.1) citrus (3.0.2) dead_end (3.1.1) diff-lcs (1.5.0) From 274f7370408f740b0f52ebb23bf27d718fb2a7fd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Feb 2022 08:26:46 +0000 Subject: [PATCH 0864/1195] Bump toml-rb from 2.1.1 to 2.1.2 (#1266) Bumps [toml-rb](https://github.com/emancu/toml-rb) from 2.1.1 to 2.1.2. - [Release notes](https://github.com/emancu/toml-rb/releases) - [Commits](https://github.com/emancu/toml-rb/compare/v2.1.1...v2.1.2) --- updated-dependencies: - dependency-name: toml-rb dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 996656fb5..11bb235c4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -43,7 +43,7 @@ GEM rspec-support (3.10.3) thor (1.1.0) threaded (0.0.4) - toml-rb (2.1.1) + toml-rb (2.1.2) citrus (~> 3.0, > 3.0) webrick (1.7.0) From 1ce7f4fef474267a6bd0af990779286334c9a653 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 8 Feb 2022 08:27:02 +0000 Subject: [PATCH 0865/1195] Bump redis from 4.5.1 to 4.6.0 (#1268) Bumps [redis](https://github.com/redis/redis-rb) from 4.5.1 to 4.6.0. - [Release notes](https://github.com/redis/redis-rb/releases) - [Changelog](https://github.com/redis/redis-rb/blob/master/CHANGELOG.md) - [Commits](https://github.com/redis/redis-rb/compare/v4.5.1...v4.6.0) --- updated-dependencies: - dependency-name: redis dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 11bb235c4..1bc251b71 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -31,7 +31,7 @@ GEM rate_throttle_client (~> 0.1.0) rake (13.0.6) rate_throttle_client (0.1.2) - redis (4.5.1) + redis (4.6.0) rrrretry (1.0.0) rspec-core (3.10.2) rspec-support (~> 3.10.0) From 17f62d43f91338c4c7e63699d5e54552ce0951fb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 8 Feb 2022 08:36:06 +0000 Subject: [PATCH 0866/1195] Bump excon from 0.90.0 to 0.91.0 (#1269) Bumps [excon](https://github.com/excon/excon) from 0.90.0 to 0.91.0. - [Release notes](https://github.com/excon/excon/releases) - [Changelog](https://github.com/excon/excon/blob/master/changelog.txt) - [Commits](https://github.com/excon/excon/compare/v0.90.0...v0.91.0) --- updated-dependencies: - dependency-name: excon dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 1bc251b71..0a8c8f2ef 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -6,7 +6,7 @@ GEM dead_end (3.1.1) diff-lcs (1.5.0) erubis (2.7.0) - excon (0.90.0) + excon (0.91.0) heroics (0.1.2) erubis (~> 2.0) excon From 0a94245f9c9491359c3542b931b3f566f9d18fe6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 15 Feb 2022 11:06:07 +0000 Subject: [PATCH 0867/1195] Bump rspec-expectations from 3.10.2 to 3.11.0 (#1272) Bumps [rspec-expectations](https://github.com/rspec/rspec-expectations) from 3.10.2 to 3.11.0. - [Release notes](https://github.com/rspec/rspec-expectations/releases) - [Changelog](https://github.com/rspec/rspec-expectations/blob/main/Changelog.md) - [Commits](https://github.com/rspec/rspec-expectations/compare/v3.10.2...v3.11.0) --- updated-dependencies: - dependency-name: rspec-expectations dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 0a8c8f2ef..407ab16ea 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -33,14 +33,14 @@ GEM rate_throttle_client (0.1.2) redis (4.6.0) rrrretry (1.0.0) - rspec-core (3.10.2) - rspec-support (~> 3.10.0) - rspec-expectations (3.10.2) + rspec-core (3.11.0) + rspec-support (~> 3.11.0) + rspec-expectations (3.11.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.10.0) + rspec-support (~> 3.11.0) rspec-retry (0.6.2) rspec-core (> 3.3) - rspec-support (3.10.3) + rspec-support (3.11.0) thor (1.1.0) threaded (0.0.4) toml-rb (2.1.2) From c6e9a1c47f8d59bf436e2b28d31c6f141622b83f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 22 Feb 2022 09:19:36 +0000 Subject: [PATCH 0868/1195] Bump buildpacks/github-actions from 4.5.1 to 4.6.0 (#1275) Bumps [buildpacks/github-actions](https://github.com/buildpacks/github-actions) from 4.5.1 to 4.6.0. - [Release notes](https://github.com/buildpacks/github-actions/releases) - [Commits](https://github.com/buildpacks/github-actions/compare/v4.5.1...v4.6.0) --- updated-dependencies: - dependency-name: buildpacks/github-actions dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b53eac397..74e337a42 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,7 +18,7 @@ jobs: uses: actions/checkout@v2.4.0 - id: setup-pack name: "Setup pack" - uses: buildpacks/github-actions/setup-pack@v4.5.1 + uses: buildpacks/github-actions/setup-pack@v4.6.0 - id: login name: "Login to public ECR" uses: docker/login-action@v1 From 2b567c597d5cb110774eb21b9616b311d8e4ee9d Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Wed, 23 Feb 2022 13:24:10 -0600 Subject: [PATCH 0869/1195] Update default Ruby version to 3.0.3 (#1270) * Update default Ruby version to 3.0.3 ## CircleCI Ruby version I'm unable to get RVM working with 3.0.3 for some reason on circleci. We need an exact ruby version, not just any 3.0.x version so their images won't work. I'm switching over to ruby-install and chruby for total control. I first tried installing via apt-get and for some reason it couldn't find them even after running an apt-get update. This is gnarly, but it works and gives me a lot of control. It's frustrating to have to go down this route, but I feel good about the final solution ## CircleCI docker setup Cutlass interfaces with docker through the API and needs a different setup otherwise it fails with error: ``` stderr: ERROR: downloading buildpack from docker://cutlass_local_buildpack_21223a55e82b762fde3c: unsupported protocol docker in URI docker://cutlass_local_buildpack_21223a55e82b762fde3c # /home/circleci/.gem/ruby/3.0.3/gems/cutlass-0.3.0/lib/cutlass/pack_build.rb:96:in `call_pack' # /home/circleci/.gem/ruby/3.0.3/gems/cutlass-0.3.0/lib/cutlass/pack_build.rb:73:in `call' # /home/circleci/.gem/ruby/3.0.3/gems/cutlass-0.3.0/lib/cutlass/app.rb:118:in `pack_build' # ./spec/cnb/basic_local_pack_spec.rb:88:in `block (3 levels) in ' ``` ## Ruby 3 syntax I hit some issues with kwargs and super. Using `**` instead of `*` ## CNB runner The home-brew cnb runner was failing and I don't know why. Switching to cutlass fixed the issues. It wasn't worth it to investigate more. * Update .circleci/config.yml Co-authored-by: Ed Morley <501702+edmorley@users.noreply.github.com> * Update spec/spec_helper.rb Co-authored-by: Ed Morley <501702+edmorley@users.noreply.github.com> * Update .circleci/config.yml Co-authored-by: Ed Morley <501702+edmorley@users.noreply.github.com> * Remove incorrect caching code https://github.com/heroku/heroku-buildpack-ruby/pull/1270#discussion_r809501218 * Fix tests dependent on heroku-18 stack Co-authored-by: Ed Morley <501702+edmorley@users.noreply.github.com> --- .circleci/config.yml | 63 +++++++++--- CHANGELOG.md | 2 + Gemfile | 3 +- Gemfile.lock | 12 ++- buildpack.toml | 6 +- changelogs/unreleased/ruby_303_default.md | 3 + hatchet.json | 4 +- hatchet.lock | 12 +-- lib/language_pack/rack.rb | 4 +- lib/language_pack/rails2.rb | 4 +- lib/language_pack/rails41.rb | 4 +- lib/language_pack/rails42.rb | 4 +- lib/language_pack/rails5.rb | 4 +- lib/language_pack/ruby_version.rb | 2 +- spec/cnb/basic_local_pack_spec.rb | 89 ++++++----------- spec/hatchet/ci_spec.rb | 18 +++- spec/hatchet/rubies_spec.rb | 17 +--- spec/hatchet/ruby_spec.rb | 112 ++++++++++++++++++---- spec/spec_helper.rb | 23 ++++- 19 files changed, 252 insertions(+), 134 deletions(-) create mode 100644 changelogs/unreleased/ruby_303_default.md diff --git a/.circleci/config.yml b/.circleci/config.yml index 220ffcc93..bdb7322c5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,26 +1,65 @@ version: 2.1 orbs: - buildpacks: jkutner/buildpacks@0.1.0 - ruby: circleci/ruby@0.2.1 + pack: buildpacks/pack@0.2.4 + jobs: build: - machine: true + machine: + image: ubuntu-2004:202201-02 steps: - - buildpacks/install-pack: - version: "0.11.0" - checkout + - pack/install-pack: + version: 0.24.0 + - restore_cache: + keys: + - v3-ruby-3.0.3 + - run: + name: Install ruby-install command: | - rvm install 2.7.5 - rvm use ruby-2.7.5 - export PATH="/opt/circleci/.rvm/rubies/ruby-2.7.5/bin:$PATH" - export GEM_HOME="/opt/circleci/.rvm/gems/ruby-2.7.5" - export GEM_PATH="/opt/circleci/.rvm/gems/ruby-2.7.5" - gem install bundler -v 2.1.0 + wget -O ruby-install-0.8.3.tar.gz https://github.com/postmodern/ruby-install/archive/v0.8.3.tar.gz + tar -xzvf ruby-install-0.8.3.tar.gz + cd ruby-install-0.8.3/ + sudo make install + - run: + name: Install chruby + command: | + wget -O chruby-0.3.9.tar.gz https://github.com/postmodern/chruby/archive/v0.3.9.tar.gz + tar -xzvf chruby-0.3.9.tar.gz + cd chruby-0.3.9/ + sudo make install + + - run: + name: Ruby install + command: | + ruby-install ruby 3.0.3 --no-reinstall + + - run: + name: Set chruby defaults + command: | + echo 'source /usr/local/share/chruby/chruby.sh' >> $BASH_ENV + echo 'chruby ruby-3.0.3' >> $BASH_ENV + + - save_cache: + key: v3-ruby-3.0.3 + paths: + - "~/.rubies" + + - run: + command: | + rvm implode --force + chruby 3.0.3 + + gem install bundler -v 2.2.32 --no-document + bundle config deployment 'true' + bundle config path ./vendor/bundle bundle install + bundle clean + bundle exec rake hatchet:setup_ci echo "pack version: $(pack --version)" - rspec spec/cnb/ + + bundle exec rspec spec/cnb/ workflows: main: diff --git a/CHANGELOG.md b/CHANGELOG.md index d23666615..e9daaeeda 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Main (unreleased) +* Default Ruby version is now 3.0.3 (https://github.com/heroku/heroku-buildpack-ruby/pull/1270) + ## v236 (2022/01/04) * Fix deprecated rake tasks for Rails 7 on Heroku CI (https://github.com/heroku/heroku-buildpack-ruby/pull/1257) diff --git a/Gemfile b/Gemfile index 7a2e31a99..fffd6343f 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ source "https://rubygems.org" git_source(:github) { |repo| "https://github.com/#{repo}.git" } -ruby '2.7.5' +ruby '3.0.3' group :development, :test do gem "toml-rb" @@ -16,4 +16,5 @@ group :development, :test do gem 'ci-queue' gem 'redis' gem 'dead_end' + gem 'cutlass' end diff --git a/Gemfile.lock b/Gemfile.lock index 407ab16ea..1ecca9fa8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,8 +3,13 @@ GEM specs: ci-queue (0.22.1) citrus (3.0.2) + cutlass (0.3.0) + docker-api (>= 2.0) dead_end (3.1.1) diff-lcs (1.5.0) + docker-api (2.2.0) + excon (>= 0.47.0) + multi_json erubis (2.7.0) excon (0.91.0) heroics (0.1.2) @@ -41,7 +46,7 @@ GEM rspec-retry (0.6.2) rspec-core (> 3.3) rspec-support (3.11.0) - thor (1.1.0) + thor (1.2.1) threaded (0.0.4) toml-rb (2.1.2) citrus (~> 3.0, > 3.0) @@ -52,6 +57,7 @@ PLATFORMS DEPENDENCIES ci-queue + cutlass dead_end excon heroku_hatchet @@ -65,7 +71,7 @@ DEPENDENCIES toml-rb RUBY VERSION - ruby 2.7.5p203 + ruby 3.0.3p157 BUNDLED WITH - 2.1.4 + 2.2.32 diff --git a/buildpack.toml b/buildpack.toml index 155d97afe..74403f413 100644 --- a/buildpack.toml +++ b/buildpack.toml @@ -5,7 +5,7 @@ id = "heroku/ruby" version = "0.1.4" name = "Ruby" homepage = "https://github.com/heroku/heroku-buildpack-ruby" -ruby_version = "2.7.5" +ruby_version = "3.0.3" [publish] @@ -13,11 +13,11 @@ ruby_version = "2.7.5" files = ["spec/"] [[publish.Vendor]] -url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-18/ruby-2.7.5.tgz" +url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-18/ruby-3.0.3.tgz" dir = "vendor/ruby/heroku-18" [[publish.Vendor]] -url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-20/ruby-2.7.5.tgz" +url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-20/ruby-3.0.3.tgz" dir = "vendor/ruby/heroku-20" [[stacks]] diff --git a/changelogs/unreleased/ruby_303_default.md b/changelogs/unreleased/ruby_303_default.md new file mode 100644 index 000000000..2dfd512b2 --- /dev/null +++ b/changelogs/unreleased/ruby_303_default.md @@ -0,0 +1,3 @@ +## Default Ruby version for new apps is now 3.0.3 + +The [default Ruby version for new Ruby applications is 3.0.3](https://devcenter.heroku.com/articles/ruby-support#default-ruby-version-for-new-apps). You’ll only get the default if the application does not specify a ruby version. diff --git a/hatchet.json b/hatchet.json index 9d4507f47..08dccd905 100644 --- a/hatchet.json +++ b/hatchet.json @@ -13,12 +13,10 @@ "sharpstone/git_gemspec", "sharpstone/no_lockfile", "sharpstone/sqlite3_gemfile", - "sharpstone/nokogiri_160", - "sharpstone/bundle-ruby-version-not-in-lockfile" + "sharpstone/nokogiri_160" ], "ruby": [ "sharpstone/ruby_version_does_not_exist", - "sharpstone/cd_ruby", "sharpstone/ruby_193_jruby_173", "sharpstone/ruby_193_jruby_176", "sharpstone/ruby_193_jruby_17161_jdk7", diff --git a/hatchet.lock b/hatchet.lock index 2efac12d7..54bda69ea 100644 --- a/hatchet.lock +++ b/hatchet.lock @@ -1,8 +1,6 @@ --- - - "./repos/bundler/bad_gemfile_on_platform" - 5dd45c83631f58d121afb48b513016cc9e2d3432 -- - "./repos/bundler/bundle-ruby-version-not-in-lockfile" - - 5c8219d8bbdc8faa6a98781867b9fce25a6f2abb - - "./repos/bundler/git_gemspec" - 7755e19caf122e1373bce73ffe9b333e9411d732 - - "./repos/bundler/no_lockfile" @@ -20,9 +18,9 @@ - - "./repos/ci/heroku-ci-json-example" - 4e5410a7381f486ba3df7739e02e52f32fdd4dda - - "./repos/ci/rails5_ruby_schema_format" - - d76be86c66ae8f45ec611fb2c4d8eb3adac0ad4b + - 8b8a3a7850bdba29bdefc70c0f80f35a9e6c96ae - - "./repos/ci/rails5_sql_schema_format" - - df48237c57f89bb3629937ae6b1d6af070100ed3 + - ee81b300a1019b47bbcaec0a512932df7dc23bc0 - - "./repos/ci/ruby_no_rails_test" - 3916137106d59b008b67d738abe6a1438f8fbde6 - - "./repos/heroku/ruby-getting-started" @@ -30,7 +28,7 @@ - - "./repos/jruby/jruby_naether" - 4a11f8af5a3cca21f3659394e5bbac3cca9b6a2c - - "./repos/node/minimal_webpacker" - - bca8b8169c553a0f62f0263b621cf3a5813e4023 + - 9d55c0ee923824829305eb23e23b7ff98d2ee3ba - - "./repos/rack/default_ruby" - master - - "./repos/rack/mri_187_nokogiri" @@ -46,7 +44,7 @@ - - "./repos/rails_versions/active_storage_non_local" - 86dddf0127043abba1cb2890590a1d38f111edbd - - "./repos/rails_versions/rails-jsbundling" - - 34bd25cef7c09758b3e7763a5d4be6dc94364606 + - f2c1455efb5892208b08a4a964e7f8e692b9b6f9 - - "./repos/rails_versions/rails3_default_ruby" - a6b44db674c0d3538633989295e2cfd5e8e1ba0d - - "./repos/rails_versions/rails42_default_ruby" @@ -75,8 +73,6 @@ - 6e4662c44b49e2c3c9429f00e7e7f4708142b03f - - "./repos/ruby/bad_ruby_version" - 7bf3470265a87ea6361640aa4bfce6ce3b743520 -- - "./repos/ruby/cd_ruby" - - 88df7181e301d25a8da992107747acff62670327 - - "./repos/ruby/empty-procfile" - 7cae0aae424c2028b81b5d37ee24d42db8e545b9 - - "./repos/ruby/jruby-minimal" diff --git a/lib/language_pack/rack.rb b/lib/language_pack/rack.rb index dd302c914..408010b63 100644 --- a/lib/language_pack/rack.rb +++ b/lib/language_pack/rack.rb @@ -34,8 +34,8 @@ def default_process_types private # sets up the profile.d script for this buildpack - def setup_profiled(*args) - super(*args) + def setup_profiled(**args) + super(**args) set_env_default "RACK_ENV", "production" end diff --git a/lib/language_pack/rails2.rb b/lib/language_pack/rails2.rb index 48627c452..1cf7322f8 100644 --- a/lib/language_pack/rails2.rb +++ b/lib/language_pack/rails2.rb @@ -89,8 +89,8 @@ def install_plugins end # sets up the profile.d script for this buildpack - def setup_profiled(*args) - super(*args) + def setup_profiled(**args) + super(**args) default_env_vars.each do |key, value| set_env_default key, value end diff --git a/lib/language_pack/rails41.rb b/lib/language_pack/rails41.rb index 294a39e3b..6c40fcd04 100644 --- a/lib/language_pack/rails41.rb +++ b/lib/language_pack/rails41.rb @@ -13,8 +13,8 @@ def self.use? return is_rails4 end - def setup_profiled(*args) - super(*args) + def setup_profiled(**args) + super(**args) set_env_default "SECRET_KEY_BASE", app_secret end diff --git a/lib/language_pack/rails42.rb b/lib/language_pack/rails42.rb index c0780d031..55d5cbe82 100644 --- a/lib/language_pack/rails42.rb +++ b/lib/language_pack/rails42.rb @@ -12,8 +12,8 @@ def self.use? return is_rails42 end - def setup_profiled(*args) - super(*args) + def setup_profiled(**args) + super(**args) set_env_default "RAILS_SERVE_STATIC_FILES", "enabled" end diff --git a/lib/language_pack/rails5.rb b/lib/language_pack/rails5.rb index a54ae4475..f4c5596eb 100644 --- a/lib/language_pack/rails5.rb +++ b/lib/language_pack/rails5.rb @@ -12,8 +12,8 @@ def self.use? return is_rails end - def setup_profiled(*args) - super(*args) + def setup_profiled(**args) + super(**args) set_env_default "RAILS_LOG_TO_STDOUT", "enabled" end diff --git a/lib/language_pack/ruby_version.rb b/lib/language_pack/ruby_version.rb index 88d14ffe3..601c19fa1 100644 --- a/lib/language_pack/ruby_version.rb +++ b/lib/language_pack/ruby_version.rb @@ -12,7 +12,7 @@ def initialize(output = "") end end - DEFAULT_VERSION_NUMBER = "2.7.5".freeze + DEFAULT_VERSION_NUMBER = "3.0.3".freeze DEFAULT_VERSION = "ruby-#{DEFAULT_VERSION_NUMBER}".freeze LEGACY_VERSION_NUMBER = "1.9.2".freeze LEGACY_VERSION = "ruby-#{LEGACY_VERSION_NUMBER}".freeze diff --git a/spec/cnb/basic_local_pack_spec.rb b/spec/cnb/basic_local_pack_spec.rb index 5c7ffc646..6241124af 100644 --- a/spec/cnb/basic_local_pack_spec.rb +++ b/spec/cnb/basic_local_pack_spec.rb @@ -1,61 +1,32 @@ require_relative '../spec_helper' -class CnbRun - attr_accessor :image_name, :output, :repo_path, :buildpack_path, :builder - - def initialize(repo_path, builder: "heroku/buildpacks:18", buildpack_paths: ) - @repo_path = repo_path - @image_name = "heroku-buildpack-ruby-tests:#{SecureRandom.hex}" - @builder = builder - @buildpack_paths = Array.new(buildpack_paths) - @build_output = "" - end - - def call - command = String.new("pack build #{image_name} --path #{repo_path} --builder heroku/buildpacks:18") - @buildpack_paths.each do |path| - command << " --buildpack #{path}" - end - - @output = run_local!(command) - yield self - ensure - teardown - end +describe "cnb" do + it "locally runs default_ruby app" do + Cutlass::App.new("default_ruby").transaction do |app| + app.pack_build - def teardown - return unless image_name - repo_name, tag_name = image_name.split(":") + expect(app.stdout).to include("Installing rake") - docker_list = `docker images --no-trunc | grep #{repo_name} | grep #{tag_name}`.strip - run_local!("docker rmi #{image_name} --force") if !docker_list.empty? - @image_name = nil - end + app.run_multi("ruby -v") do |out| + expect(out.stdout).to match(LanguagePack::RubyVersion::DEFAULT_VERSION_NUMBER) + end - def run(cmd) - `docker run #{image_name} '#{cmd}'`.strip - end + app.run_multi("bundle list") do |out| + expect(out.stdout).to match("rack") + end - def run!(cmd) - out = run(cmd) - raise "Command #{cmd.inspect} failed. Output: #{out}" unless $?.success? - out - end + app.run_multi("gem list") do |out| + expect(out.stdout).to match("rack") + end - private def run_local!(cmd) - out = `#{cmd}` - raise "Command #{cmd.inspect} failed. Output: #{out}" unless $?.success? - out - end -end + app.run_multi(%Q{ruby -e "require 'rack'; puts 'done'"}) do |out| + expect(out.stdout).to match("done") + end -describe "cnb" do - it "locally runs default_ruby app" do - CnbRun.new(hatchet_path("rack/default_ruby"), buildpack_paths: [buildpack_path]).call do |app| - expect(app.output).to match("Compiling Ruby/Rack") + # Test cache + app.pack_build - run_out = app.run!("ruby -v") - expect(run_out).to match(LanguagePack::RubyVersion::DEFAULT_VERSION_NUMBER) + expect(app.stdout).to include("Using rake") end end @@ -76,7 +47,7 @@ def run!(cmd) # Stacks that the buildpack will work with [[stacks]] - id = "heroku-18" + id = "heroku-20" [[stacks]] id = "org.cloudfoundry.stacks.cflinuxfs3" @@ -101,21 +72,23 @@ def run!(cmd) FileUtils.chmod("+x", "#{second_buildpack_dir}/bin/detect") FileUtils.chmod("+x", "#{second_buildpack_dir}/bin/build") - CnbRun.new(hatchet_path("rack/default_ruby"), buildpack_paths: [buildpack_path, second_buildpack_dir]).call do |app| - expect(app.output).to match("Compiling Ruby/Rack") + Cutlass::App.new("default_ruby", buildpacks: [:default, second_buildpack_dir]).transaction do |app| + app.pack_build + + expect(app.stdout).to match("Compiling Ruby/Rack") - expect(app.output).to match("com.examples.buildpacks.test_ruby_export") - expect(app.output).to match("Which gem: /workspace/bin/gem") + expect(app.stdout).to match("com.examples.buildpacks.test_ruby_export") + expect(app.stdout).to match("Which gem: /workspace/bin/gem") end end end it "locally runs rails getting started" do - CnbRun.new(hatchet_path("heroku/ruby-getting-started"), buildpack_paths: [buildpack_path]).call do |app| - expect(app.output).to match("Compiling Ruby/Rails") + Cutlass::App.new("ruby-getting-started").transaction do |app| + app.pack_build + expect(app.stdout).to match("Compiling Ruby/Rails") - run_out = app.run!("ruby -v") - expect(run_out).to match("2.7.4") + expect(app.run("ruby -v").stdout).to match("2.7.4") end end end diff --git a/spec/hatchet/ci_spec.rb b/spec/hatchet/ci_spec.rb index 832db823e..f75bcfa1c 100644 --- a/spec/hatchet/ci_spec.rb +++ b/spec/hatchet/ci_spec.rb @@ -11,14 +11,24 @@ end it "Works with Rails 5 ruby schema apps" do - Hatchet::Runner.new("rails5_ruby_schema_format").run_ci do |test_run| - expect(test_run.output).to match("db:schema:load_if_ruby completed") + Hatchet::Runner.new("rails5_ruby_schema_format").tap do |app| + app.before_deploy do + Pathname("Gemfile").write("ruby '2.7.5'", mode: "a") + end + app.run_ci do |test_run| + expect(test_run.output).to match("db:schema:load_if_ruby completed") + end end end it "Works with Rails 5 SQL schema apps" do - Hatchet::Runner.new("rails5_sql_schema_format").run_ci do |test_run| - expect(test_run.output).to match("db:structure:load_if_sql completed") + Hatchet::Runner.new("rails5_sql_schema_format").tap do |app| + app.before_deploy do + Pathname("Gemfile").write("ruby '2.7.5'", mode: "a") + end + app.run_ci do |test_run| + expect(test_run.output).to match("db:structure:load_if_sql completed") + end end end diff --git a/spec/hatchet/rubies_spec.rb b/spec/hatchet/rubies_spec.rb index 49b2ec815..22e029111 100644 --- a/spec/hatchet/rubies_spec.rb +++ b/spec/hatchet/rubies_spec.rb @@ -54,28 +54,21 @@ end end end - - it "should deploy jruby with the naether gem" do - app = Hatchet::Runner.new("jruby_naether", stack: DEFAULT_STACK) - app.deploy do |app| - expect(app.output).to match("Installing naether") - expect(app.output).not_to include("An error occurred while installing naether") - end - end end describe "Upgrading ruby apps" do - it "works when changing from default version" do + it "works when changing versions" do app = Hatchet::Runner.new("default_ruby", stack: DEFAULT_STACK) app.deploy do |app| expect(app.run("env | grep MALLOC_ARENA_MAX")).to match("MALLOC_ARENA_MAX=2") expect(app.run("env | grep DISABLE_SPRING")).to match("DISABLE_SPRING=1") - run!(%Q{echo "ruby '2.5.1'" >> Gemfile}) + # Deploy again + run!(%Q{echo "ruby '2.7.5'" >> Gemfile}) run!("git add -A; git commit -m update-ruby") app.push! - expect(app.output).to match("2.5.1") - expect(app.run("ruby -v")).to match("2.5.1") + expect(app.output).to match("2.7.5") + expect(app.run("ruby -v")).to match("2.7.5") expect(app.output).to match("Ruby version change detected") end end diff --git a/spec/hatchet/ruby_spec.rb b/spec/hatchet/ruby_spec.rb index f5b49f574..ca200651b 100644 --- a/spec/hatchet/ruby_spec.rb +++ b/spec/hatchet/ruby_spec.rb @@ -115,33 +115,109 @@ ] config = {FORCE_ABSOLUTE_PATHS_BUILDPACK_IGNORE_PATHS: "BUNDLE_PATH"} - Hatchet::Runner.new('cd_ruby', stack: DEFAULT_STACK, buildpacks: buildpacks, config: config).deploy do |app| - expect(app.output).to match("cd version ruby 2.5.1") - expect(app.run("which ruby").strip).to eq("/app/bin/ruby") + Hatchet::Runner.new('default_ruby', stack: DEFAULT_STACK, buildpacks: buildpacks, config: config).tap do |app| + app.before_deploy do + Pathname("Gemfile").write(<<~'EOF') + source "https://rubygems.org" + + ruby "~> 3.0.0" + + gem "rake" + EOF + + Pathname("Gemfile.lock").write(<<~'EOF') + GEM + remote: https://rubygems.org/ + specs: + rake (13.0.6) + + PLATFORMS + ruby + x86_64-darwin-20 + + DEPENDENCIES + rake + + RUBY VERSION + ruby 3.0.3p157 + + BUNDLED WITH + 2.3.7 + EOF + + Pathname("Rakefile").write(<<~'EOF') + task "assets:precompile" do + out = `cd client && bundle exec ruby -v` + puts "cd version #{out}" + unless $?.success? + puts "Failed: #{out}" + exit 1 + end + end + EOF + + dir = Pathname("client") + dir.mkpath + FileUtils.touch(dir.join(".gitkeep")) + end + + app.deploy do |app| + expect(app.output).to match("cd version ruby 3.0.3") + + expect(app.run("which ruby").strip).to eq("/app/bin/ruby") + end end end end describe "bundler ruby version matcher" do it "installs a version even when not present in the Gemfile.lock" do - Hatchet::Runner.new('bundle-ruby-version-not-in-lockfile', stack: DEFAULT_STACK).deploy do |app| - expect(app.output).to match("2.5.1") - expect(app.run("ruby -v")).to match("2.5.1") - end - end + Hatchet::Runner.new('default_ruby', stack: DEFAULT_STACK).tap do |app| + app.before_deploy do + Pathname("Gemfile").write(<<~'EOF') + source "https://rubygems.org" - it "works even when patchfile is specified" do - Hatchet::Runner.new('problem_gemfile_version', stack: DEFAULT_STACK).deploy do |app| - expect(app.output).to match("2.5.1") - end - end - end + ruby "~> 3.0.0" - describe "2.5.0" do - it "works" do - Hatchet::Runner.new("ruby_25", stack: "heroku-18").deploy do |app| - expect(app.output).to include("There is a more recent Ruby version available") + gem "sinatra" + EOF + + Pathname("Gemfile.lock").write(<<~'EOF') + GEM + remote: https://rubygems.org/ + specs: + mustermann (1.1.1) + ruby2_keywords (~> 0.0.1) + rack (2.2.3) + rack-protection (2.2.0) + rack + ruby2_keywords (0.0.5) + sinatra (2.2.0) + mustermann (~> 1.0) + rack (~> 2.2) + rack-protection (= 2.2.0) + tilt (~> 2.0) + tilt (2.0.10) + + PLATFORMS + ruby + x86_64-darwin-20 + + DEPENDENCIES + sinatra + + BUNDLED WITH + 2.3.7 + EOF + + end + + app.deploy do |app| + # Intentionally different than the default ruby version + expect(app.output).to match("3.0.0") + expect(app.run("ruby -v")).to match("3.0.0") + end end end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 3f6d3d3cb..795ce63f1 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -11,7 +11,28 @@ ENV['RACK_ENV'] = 'test' -DEFAULT_STACK = 'heroku-18' +DEFAULT_STACK = 'heroku-20' + + +def hatchet_path(path = "") + Pathname(__FILE__).join("../../repos").expand_path.join(path) +end + +puts hatchet_path + +require 'cutlass' + +RUBY_BUILDPACK = Cutlass::LocalBuildpack.new(directory: Pathname(__dir__).join("..")) +Cutlass.config do |config| + config.default_builder = "heroku/buildpacks:20" + + # Where do your test fixtures live? + config.default_repo_dirs = hatchet_path("").children + + # Where does your buildpack live? + # Can be a directory or a Cutlass:LocalBuildpack instance + config.default_buildpack_paths = [RUBY_BUILDPACK] +end RSpec.configure do |config| config.filter_run focused: true unless ENV['IS_RUNNING_ON_CI'] From 3017df8e805b81ad25a3374b746f44b5dc9379a9 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Thu, 24 Feb 2022 13:19:20 -0600 Subject: [PATCH 0870/1195] v237 (#1277) --- CHANGELOG.md | 2 ++ changelogs/{unreleased => v237}/ruby_303_default.md | 0 lib/language_pack/version.rb | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) rename changelogs/{unreleased => v237}/ruby_303_default.md (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index e9daaeeda..5660e7eec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Main (unreleased) +## v237 (2022/02/24) + * Default Ruby version is now 3.0.3 (https://github.com/heroku/heroku-buildpack-ruby/pull/1270) ## v236 (2022/01/04) diff --git a/changelogs/unreleased/ruby_303_default.md b/changelogs/v237/ruby_303_default.md similarity index 100% rename from changelogs/unreleased/ruby_303_default.md rename to changelogs/v237/ruby_303_default.md diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 242186dc9..a8e1c9e57 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v236" + BUILDPACK_VERSION = "v237" end end From 7dc078cfb73e5a010768250cc90a3c3d1910423c Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Tue, 1 Mar 2022 16:16:07 -0600 Subject: [PATCH 0871/1195] Upgrade bundler to 2.3.7 (#1276) Close #1273 --- CHANGELOG.md | 4 ++++ changelogs/v238/bundle-upgrade.md | 3 +++ lib/language_pack/helpers/bundler_wrapper.rb | 2 +- lib/language_pack/version.rb | 2 +- 4 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 changelogs/v238/bundle-upgrade.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 5660e7eec..c5b5deeb9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Main (unreleased) +## v238 (2022/03/02) + +* Bundler 2.x is now 2.3.7 (https://github.com/heroku/heroku-buildpack-ruby/pull/1276) + ## v237 (2022/02/24) * Default Ruby version is now 3.0.3 (https://github.com/heroku/heroku-buildpack-ruby/pull/1270) diff --git a/changelogs/v238/bundle-upgrade.md b/changelogs/v238/bundle-upgrade.md new file mode 100644 index 000000000..5e5bcf52b --- /dev/null +++ b/changelogs/v238/bundle-upgrade.md @@ -0,0 +1,3 @@ +## Ruby apps with Bundler 2.x now receive version 2.3.7 + +The [Ruby Buildpack](https://devcenter.heroku.com/articles/ruby-support#libraries) now includes Bundler 2.3.7. Applications specifying Bundler 2.x in their `Gemfile.lock` will now receive bundler: 2.3.7. diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index d4d8faba3..8eee0bda4 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -37,7 +37,7 @@ class LanguagePack::Helpers::BundlerWrapper BLESSED_BUNDLER_VERSIONS = {} BLESSED_BUNDLER_VERSIONS["1"] = "1.17.3" - BLESSED_BUNDLER_VERSIONS["2"] = "2.2.33" + BLESSED_BUNDLER_VERSIONS["2"] = "2.3.7" BUNDLED_WITH_REGEX = /^BUNDLED WITH$(\r?\n) (?\d+)\.\d+\.\d+/m class GemfileParseError < BuildpackError diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index a8e1c9e57..3cb234880 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v237" + BUILDPACK_VERSION = "v238" end end From d42226c1dc0dfbc123b1facaeae276cf3d2689a6 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Thu, 3 Mar 2022 13:31:02 -0600 Subject: [PATCH 0872/1195] Rollback bundler change (#1281) Bundler 2.3.7 caused issues: - https://github.com/rubygems/rubygems/issues/5351 - https://github.com/heroku/heroku-buildpack-ruby/issues/1280 Internal (private) tickets: - https://heroku.support/1083230 - https://heroku.support/1081495 - https://heroku.support/1082829 I've already rolled back the build pack deploy via the buildpack CLI. This commit is intended to represent the currently deployed software accurately in the codebase. --- CHANGELOG.md | 4 ++++ lib/language_pack/helpers/bundler_wrapper.rb | 2 +- lib/language_pack/version.rb | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c5b5deeb9..c39703f6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Main (unreleased) +## v239 (2022/03/02) + +* Rollback bundler 2.x change. Bundler 2.x is now back at 2.2.33 (https://github.com/heroku/heroku-buildpack-ruby/pull/1281) + ## v238 (2022/03/02) * Bundler 2.x is now 2.3.7 (https://github.com/heroku/heroku-buildpack-ruby/pull/1276) diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index 8eee0bda4..d4d8faba3 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -37,7 +37,7 @@ class LanguagePack::Helpers::BundlerWrapper BLESSED_BUNDLER_VERSIONS = {} BLESSED_BUNDLER_VERSIONS["1"] = "1.17.3" - BLESSED_BUNDLER_VERSIONS["2"] = "2.3.7" + BLESSED_BUNDLER_VERSIONS["2"] = "2.2.33" BUNDLED_WITH_REGEX = /^BUNDLED WITH$(\r?\n) (?\d+)\.\d+\.\d+/m class GemfileParseError < BuildpackError diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 3cb234880..86f0650b3 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v238" + BUILDPACK_VERSION = "v239" end end From faba2f3b35d0ed7fdd8f32f779f709e21ec92448 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Mon, 28 Mar 2022 15:48:07 -0500 Subject: [PATCH 0873/1195] Split bootstrap version from default version (#1289) * Split bootstrap version from default version Currently the bootstrapped version of Ruby is coupled to the default version we give customers who do not specify a version. With heroku-22 (based on Ubuntu 22.04) we cannot use the current default (3.0.3) because it cannot compile for heroku-22 https://bugs.ruby-lang.org/issues/18658. This change provides a second mechanism for specifying the bootstrapped version. GUS-W-10343881 * Update buildpack.toml Co-authored-by: Ed Morley <501702+edmorley@users.noreply.github.com> Co-authored-by: Ed Morley <501702+edmorley@users.noreply.github.com> --- .circleci/config.yml | 10 +++++----- CHANGELOG.md | 2 ++ Gemfile | 2 +- Gemfile.lock | 4 ++-- buildpack.toml | 13 ++++++++++--- lib/language_pack/ruby_version.rb | 1 + spec/helpers/config_spec.rb | 11 ++++++++--- 7 files changed, 29 insertions(+), 14 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index bdb7322c5..fcea5e83a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -12,7 +12,7 @@ jobs: version: 0.24.0 - restore_cache: keys: - - v3-ruby-3.0.3 + - v3-ruby-3.1.1 - run: name: Install ruby-install @@ -32,23 +32,23 @@ jobs: - run: name: Ruby install command: | - ruby-install ruby 3.0.3 --no-reinstall + ruby-install ruby 3.1.1 --no-reinstall - run: name: Set chruby defaults command: | echo 'source /usr/local/share/chruby/chruby.sh' >> $BASH_ENV - echo 'chruby ruby-3.0.3' >> $BASH_ENV + echo 'chruby ruby-3.1.1' >> $BASH_ENV - save_cache: - key: v3-ruby-3.0.3 + key: v3-ruby-3.1.1 paths: - "~/.rubies" - run: command: | rvm implode --force - chruby 3.0.3 + chruby 3.1.1 gem install bundler -v 2.2.32 --no-document bundle config deployment 'true' diff --git a/CHANGELOG.md b/CHANGELOG.md index c39703f6b..d79d8d45a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Main (unreleased) +* Add support for heroku-22 (https://github.com/heroku/heroku-buildpack-ruby/pull/1289) + ## v239 (2022/03/02) * Rollback bundler 2.x change. Bundler 2.x is now back at 2.2.33 (https://github.com/heroku/heroku-buildpack-ruby/pull/1281) diff --git a/Gemfile b/Gemfile index fffd6343f..dc3a8674c 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ source "https://rubygems.org" git_source(:github) { |repo| "https://github.com/#{repo}.git" } -ruby '3.0.3' +ruby '3.1.1' group :development, :test do gem "toml-rb" diff --git a/Gemfile.lock b/Gemfile.lock index 1ecca9fa8..8e1c276f7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -71,7 +71,7 @@ DEPENDENCIES toml-rb RUBY VERSION - ruby 3.0.3p157 + ruby 3.1.1p18 BUNDLED WITH - 2.2.32 + 2.3.10 diff --git a/buildpack.toml b/buildpack.toml index 74403f413..8c0470e5b 100644 --- a/buildpack.toml +++ b/buildpack.toml @@ -5,7 +5,7 @@ id = "heroku/ruby" version = "0.1.4" name = "Ruby" homepage = "https://github.com/heroku/heroku-buildpack-ruby" -ruby_version = "3.0.3" +ruby_version = "3.1.1" [publish] @@ -13,19 +13,26 @@ ruby_version = "3.0.3" files = ["spec/"] [[publish.Vendor]] -url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-18/ruby-3.0.3.tgz" +url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-18/ruby-3.1.1.tgz" dir = "vendor/ruby/heroku-18" [[publish.Vendor]] -url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-20/ruby-3.0.3.tgz" +url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-20/ruby-3.1.1.tgz" dir = "vendor/ruby/heroku-20" +[[publish.Vendor]] +url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-22/ruby-3.1.1.tgz" +dir = "vendor/ruby/heroku-22" + [[stacks]] id = "heroku-18" [[stacks]] id = "heroku-20" +[[stacks]] +id = "heroku-22" + [metadata] [metadata.release] diff --git a/lib/language_pack/ruby_version.rb b/lib/language_pack/ruby_version.rb index 601c19fa1..a6651bdc8 100644 --- a/lib/language_pack/ruby_version.rb +++ b/lib/language_pack/ruby_version.rb @@ -12,6 +12,7 @@ def initialize(output = "") end end + BOOTSTRAP_VERSION_NUMBER = "3.1.1".freeze DEFAULT_VERSION_NUMBER = "3.0.3".freeze DEFAULT_VERSION = "ruby-#{DEFAULT_VERSION_NUMBER}".freeze LEGACY_VERSION_NUMBER = "1.9.2".freeze diff --git a/spec/helpers/config_spec.rb b/spec/helpers/config_spec.rb index 32f3b0e98..102f433ea 100644 --- a/spec/helpers/config_spec.rb +++ b/spec/helpers/config_spec.rb @@ -1,17 +1,22 @@ require 'spec_helper' describe "Boot Strap Config" do - it "matches the default ruby version" do + it "matches toml config" do require 'toml-rb' config = TomlRB.load_file("buildpack.toml") bootstrap_version = config["buildpack"]["ruby_version"] - expect(bootstrap_version).to eq(LanguagePack::RubyVersion::DEFAULT_VERSION_NUMBER) + expect(bootstrap_version).to eq(LanguagePack::RubyVersion::BOOTSTRAP_VERSION_NUMBER) urls = config["publish"]["Vendor"].map {|h| h["url"] if h["dir"] != "." }.compact urls.each do |url| expect(url.include?(bootstrap_version)).to be_truthy, "expected #{url.inspect} to include #{bootstrap_version.inspect} but it did not" end - expect(`ruby -v`).to match(Regexp.escape(LanguagePack::RubyVersion::DEFAULT_VERSION_NUMBER)) + expect(`ruby -v`).to match(Regexp.escape(LanguagePack::RubyVersion::BOOTSTRAP_VERSION_NUMBER)) + + bootstrap_version = Gem::Version.new(LanguagePack::RubyVersion::BOOTSTRAP_VERSION_NUMBER) + default_version = Gem::Version.new(LanguagePack::RubyVersion::DEFAULT_VERSION_NUMBER) + + expect(bootstrap_version).to be >= default_version end end From dfbcc8c77c53175af7d1f814a5a836b62fd48cc3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 29 Mar 2022 08:13:04 +0100 Subject: [PATCH 0874/1195] Bump peter-evans/create-pull-request from 3 to 4 (#1291) Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 3 to 4. - [Release notes](https://github.com/peter-evans/create-pull-request/releases) - [Commits](https://github.com/peter-evans/create-pull-request/compare/v3...v4) --- updated-dependencies: - dependency-name: peter-evans/create-pull-request dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 74e337a42..e77d4eb1a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -58,7 +58,7 @@ jobs: run: ./.github/scripts/release-workflow-prepare-pr.sh "${{ steps.package.outputs.id }}" "${{ steps.package.outputs.version }}" "docker://${{ steps.package.outputs.address }}" shell: bash - name: Create Pull Request - uses: peter-evans/create-pull-request@v3 + uses: peter-evans/create-pull-request@v4 with: title: "Post-release updates: ${{ steps.package.outputs.id }} ${{ steps.package.outputs.version }}" commit-message: "Post-release updates: ${{ steps.package.outputs.id }} ${{ steps.package.outputs.version }}" From 0f454b1ec798bf5983936aca8c71e93de1d411cd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 29 Mar 2022 07:13:35 +0000 Subject: [PATCH 0875/1195] Bump excon from 0.91.0 to 0.92.1 (#1286) Bumps [excon](https://github.com/excon/excon) from 0.91.0 to 0.92.1. - [Release notes](https://github.com/excon/excon/releases) - [Changelog](https://github.com/excon/excon/blob/master/changelog.txt) - [Commits](https://github.com/excon/excon/compare/v0.91.0...v0.92.1) --- updated-dependencies: - dependency-name: excon dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 8e1c276f7..5eff0e9a2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GEM excon (>= 0.47.0) multi_json erubis (2.7.0) - excon (0.91.0) + excon (0.92.1) heroics (0.1.2) erubis (~> 2.0) excon From 5adf0f712a5e94f44b0e8ac2ecd965ea2afb2191 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 29 Mar 2022 07:13:55 +0000 Subject: [PATCH 0876/1195] Bump actions/checkout from 2.4.0 to 3 (#1283) Bumps [actions/checkout](https://github.com/actions/checkout) from 2.4.0 to 3. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v2.4.0...v3) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/check_changelog.yml | 2 +- .github/workflows/release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check_changelog.yml b/.github/workflows/check_changelog.yml index 70fd9884a..2c9b08ffc 100644 --- a/.github/workflows/check_changelog.yml +++ b/.github/workflows/check_changelog.yml @@ -15,7 +15,7 @@ jobs: !contains(github.event.pull_request.labels.*.name, 'dependencies') && !contains(github.event.pull_request.labels.*.name, 'automation') steps: - - uses: actions/checkout@v2.4.0 + - uses: actions/checkout@v3 - name: Check that CHANGELOG is touched run: | git fetch origin ${{ github.base_ref }} --depth 1 && \ diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e77d4eb1a..ff43b689e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,7 +15,7 @@ jobs: steps: - id: checkout name: "Checkout code" - uses: actions/checkout@v2.4.0 + uses: actions/checkout@v3 - id: setup-pack name: "Setup pack" uses: buildpacks/github-actions/setup-pack@v4.6.0 From b7c8180bd9add46e179346f691ff1e339b87357c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 29 Mar 2022 07:20:35 +0000 Subject: [PATCH 0877/1195] Bump parallel_tests from 3.7.3 to 3.8.1 (#1292) Bumps [parallel_tests](https://github.com/grosser/parallel_tests) from 3.7.3 to 3.8.1. - [Release notes](https://github.com/grosser/parallel_tests/releases) - [Changelog](https://github.com/grosser/parallel_tests/blob/master/CHANGELOG.md) - [Commits](https://github.com/grosser/parallel_tests/compare/v3.7.3...v3.8.1) --- updated-dependencies: - dependency-name: parallel_tests dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 5eff0e9a2..dc945b2f8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -27,8 +27,8 @@ GEM json (2.6.1) moneta (1.0.0) multi_json (1.15.0) - parallel (1.21.0) - parallel_tests (3.7.3) + parallel (1.22.1) + parallel_tests (3.8.1) parallel platform-api (3.3.0) heroics (~> 0.1.1) From c409a33b7a8029c8a61fa45cc7bc96ff43f05937 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Tue, 5 Apr 2022 12:15:07 -0500 Subject: [PATCH 0878/1195] Upgrade Bundler 2.x to v2.3.10 (#1296) --- CHANGELOG.md | 1 + changelogs/unreleased/bundler_2_3_10.md | 3 +++ lib/language_pack/helpers/bundler_wrapper.rb | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 changelogs/unreleased/bundler_2_3_10.md diff --git a/CHANGELOG.md b/CHANGELOG.md index d79d8d45a..8fb90620b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Main (unreleased) * Add support for heroku-22 (https://github.com/heroku/heroku-buildpack-ruby/pull/1289) +* Bundler 2.x is now 2.3.10 (https://github.com/heroku/heroku-buildpack-ruby/pull/1296) ## v239 (2022/03/02) diff --git a/changelogs/unreleased/bundler_2_3_10.md b/changelogs/unreleased/bundler_2_3_10.md new file mode 100644 index 000000000..0eb468053 --- /dev/null +++ b/changelogs/unreleased/bundler_2_3_10.md @@ -0,0 +1,3 @@ +## Ruby apps with Bundler 2.x now receive version 2.3.10 + +The [Ruby Buildpack](https://devcenter.heroku.com/articles/ruby-support#libraries) now includes Bundler 2.3.10. Applications specifying Bundler 2.x in their `Gemfile.lock` will now receive this version of bundler. diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index d4d8faba3..6f6a5e390 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -37,7 +37,7 @@ class LanguagePack::Helpers::BundlerWrapper BLESSED_BUNDLER_VERSIONS = {} BLESSED_BUNDLER_VERSIONS["1"] = "1.17.3" - BLESSED_BUNDLER_VERSIONS["2"] = "2.2.33" + BLESSED_BUNDLER_VERSIONS["2"] = "2.3.10" BUNDLED_WITH_REGEX = /^BUNDLED WITH$(\r?\n) (?\d+)\.\d+\.\d+/m class GemfileParseError < BuildpackError From 0a709998984cff5cc7702949ebf6ab5471e3f566 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Tue, 5 Apr 2022 12:27:40 -0500 Subject: [PATCH 0879/1195] v240 (#1298) --- CHANGELOG.md | 2 ++ changelogs/{unreleased => v240}/bundler_2_3_10.md | 0 lib/language_pack/version.rb | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) rename changelogs/{unreleased => v240}/bundler_2_3_10.md (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8fb90620b..23e00638d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Main (unreleased) +## v240 (2022/04/05) + * Add support for heroku-22 (https://github.com/heroku/heroku-buildpack-ruby/pull/1289) * Bundler 2.x is now 2.3.10 (https://github.com/heroku/heroku-buildpack-ruby/pull/1296) diff --git a/changelogs/unreleased/bundler_2_3_10.md b/changelogs/v240/bundler_2_3_10.md similarity index 100% rename from changelogs/unreleased/bundler_2_3_10.md rename to changelogs/v240/bundler_2_3_10.md diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 86f0650b3..80c22f6d6 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v239" + BUILDPACK_VERSION = "v240" end end From 6450aad33a4b62c21e1c9b2084b4f19adac5500b Mon Sep 17 00:00:00 2001 From: Ed Morley <501702+edmorley@users.noreply.github.com> Date: Wed, 27 Apr 2022 09:28:26 +0100 Subject: [PATCH 0880/1195] Delete CNB release workflow (#1303) Since: - new CNB releases will be occurring from the new repo (https://github.com/heroku/buildpacks-ruby) - the env vars required to do a release are no longer set on this repo (so this workflow is currently broken) --- .github/workflows/release.yml | 69 ----------------------------------- 1 file changed, 69 deletions(-) delete mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index ff43b689e..000000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: Release Buildpack -on: - workflow_dispatch: - inputs: - requested_buildpack_id: - description: "Buildpack ID" - required: true - -jobs: - release: - name: Release ${{ github.event.inputs.requested_buildpack_id }} - runs-on: ubuntu-20.04 # ubuntu-latest currently resolves to 18.04 which does not have aws-cli 2.x yet - env: - REQUESTED_BUILDPACK_ID: ${{ github.event.inputs.requested_buildpack_id }} - steps: - - id: checkout - name: "Checkout code" - uses: actions/checkout@v3 - - id: setup-pack - name: "Setup pack" - uses: buildpacks/github-actions/setup-pack@v4.6.0 - - id: login - name: "Login to public ECR" - uses: docker/login-action@v1 - with: - registry: public.ecr.aws - username: ${{ secrets.AWS_ACCESS_KEY_ID }} - password: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - env: - AWS_REGION: us-east-1 - - id: package - name: "Package buildpack and publish to container registry" - run: ./.github/scripts/release-workflow-package-push.sh - shell: bash - - id: add-registry-entry - name: "Request Registry Entry" - uses: docker://ghcr.io/buildpacks/actions/registry/request-add-entry:4.0.0 - with: - token: ${{ secrets.PUBLIC_REPO_TOKEN }} - id: ${{ steps.package.outputs.id }} - version: ${{ steps.package.outputs.version }} - address: ${{ steps.package.outputs.address }} - - id: create_release - name: Create Release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ steps.package.outputs.id }}_${{ steps.package.outputs.version }} - release_name: ${{ steps.package.outputs.id }} ${{ steps.package.outputs.version }} - body: | - Find the changelog here: [CHANGELOG](${{ steps.package.outputs.path }}/CHANGELOG.md) - Docker: `docker pull ${{ steps.package.outputs.address }}` - draft: false - prerelease: false - - id: prepare-pr - name: "Prepare PR with version bumps and CHANGELOG updates" - run: ./.github/scripts/release-workflow-prepare-pr.sh "${{ steps.package.outputs.id }}" "${{ steps.package.outputs.version }}" "docker://${{ steps.package.outputs.address }}" - shell: bash - - name: Create Pull Request - uses: peter-evans/create-pull-request@v4 - with: - title: "Post-release updates: ${{ steps.package.outputs.id }} ${{ steps.package.outputs.version }}" - commit-message: "Post-release updates: ${{ steps.package.outputs.id }} ${{ steps.package.outputs.version }}" - branch-suffix: "random" - labels: "automation" - body: | - Automated pull-request to update buildpack versions and changelogs - after releasing version `${{ steps.package.outputs.version }}` of `${{ steps.package.outputs.id }}`. From 35f8db8137166f51f32865b1502432fde7e4d77c Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Fri, 27 May 2022 11:36:41 -0500 Subject: [PATCH 0881/1195] Enable heroku-22 download presence check (#1290) Adding this does two things. It turns on the download check for anyone trying to deploy to heroku-22. This will suggest a different stack if a binary is not found. For example if a customer wants to use 2.5.4 on heroku-22 it would suggest they try to deploy to heroku-18 or heroku-20 instead as heroku-22 doesn't have that binary. In theory it could also affect customers on other stacks trying to use a version of Ruby not available on their stack (but present on heroku-22). If that happens they'll see heroku-22 in their stack suggestions. While it's technically a possibility the only supported stacks now are heroku-18 and heroku-20 and they have all the binaries (and more) that heroku-22 has. GUS-W-10343881 --- lib/language_pack/helpers/download_presence.rb | 2 +- spec/helpers/download_presence_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/language_pack/helpers/download_presence.rb b/lib/language_pack/helpers/download_presence.rb index 77fae2b16..f337fe226 100644 --- a/lib/language_pack/helpers/download_presence.rb +++ b/lib/language_pack/helpers/download_presence.rb @@ -16,7 +16,7 @@ # puts download.exists? #=> true # puts download.valid_stack_list #=> ['cedar-14'] class LanguagePack::Helpers::DownloadPresence - STACKS = ['heroku-18', 'heroku-20'] + STACKS = ['heroku-18', 'heroku-20', 'heroku-22'] def initialize(path, stacks: STACKS) @path = path diff --git a/spec/helpers/download_presence_spec.rb b/spec/helpers/download_presence_spec.rb index 19e442510..30a5959ad 100644 --- a/spec/helpers/download_presence_spec.rb +++ b/spec/helpers/download_presence_spec.rb @@ -69,7 +69,7 @@ it "detects default ruby version" do download = LanguagePack::Helpers::DownloadPresence.new( - "#{LanguagePack::RubyVersion::DEFAULT_VERSION}.tgz", + "ruby-3.1.1.tgz", ) download.call @@ -84,7 +84,7 @@ ) download.call - + expect(download.supported_stack?(current_stack: "unknown-stack")).to be_falsey expect(download.next_stack(current_stack: "unknown-stack")).to be_nil expect(download.exists_on_next_stack?(current_stack:"unknown-stack")).to be_falsey From c056d9157da3e2fe425b2005ac33b1b48bbddc6d Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Mon, 6 Jun 2022 14:55:20 -0500 Subject: [PATCH 0882/1195] Remove Ruby dependency on bin/release (#1308) * Remove Ruby dependency on bin/release 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. * Fix test 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. * v241 --- CHANGELOG.md | 4 ++++ bin/release | 12 ++++++++---- lib/language_pack/version.rb | 2 +- spec/cnb/basic_local_pack_spec.rb | 2 +- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 23e00638d..89fa97a44 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Main (unreleased) +## v241 (2022/06/06) + +- `bin/release` is re-written in bash (https://github.com/heroku/heroku-buildpack-ruby/pull/1308) + ## v240 (2022/04/05) * Add support for heroku-22 (https://github.com/heroku/heroku-buildpack-ruby/pull/1289) diff --git a/bin/release b/bin/release index c26158a67..6868d0a6c 100755 --- a/bin/release +++ b/bin/release @@ -1,6 +1,10 @@ -#!/usr/bin/env ruby +#!/usr/bin/env bash -require 'pathname' +# fail hard +set -o pipefail +# fail harder +set -eu -release = Pathname.new(ARGV.first).join("tmp/heroku-buildpack-release-step.yml") -puts release.read if release.exist? +BUILD_DIR=${1:-} + +cat "$BUILD_DIR/tmp/heroku-buildpack-release-step.yml" diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 80c22f6d6..69f6ae198 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v240" + BUILDPACK_VERSION = "v241" end end diff --git a/spec/cnb/basic_local_pack_spec.rb b/spec/cnb/basic_local_pack_spec.rb index 6241124af..6e1b79e3d 100644 --- a/spec/cnb/basic_local_pack_spec.rb +++ b/spec/cnb/basic_local_pack_spec.rb @@ -88,7 +88,7 @@ app.pack_build expect(app.stdout).to match("Compiling Ruby/Rails") - expect(app.run("ruby -v").stdout).to match("2.7.4") + expect(app.run("ruby -v").stdout).to match("3.1.2") end end end From 6c79a7a2812d32723e6daa3a414863a183964cef Mon Sep 17 00:00:00 2001 From: Ed Morley <501702+edmorley@users.noreply.github.com> Date: Tue, 7 Jun 2022 16:12:27 +0100 Subject: [PATCH 0883/1195] Make `bin/release` handle a missing release file (#1309) 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. --- CHANGELOG.md | 7 +++++-- bin/release | 15 +++++++++------ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 89fa97a44..a3346772e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,13 +2,16 @@ ## Main (unreleased) +* Ensure `bin/release` exits zero if `tmp/heroku-buildpack-release-step.yml` does not exist (https://github.com/heroku/heroku-buildpack-ruby/pull/1309) + ## v241 (2022/06/06) -- `bin/release` is re-written in bash (https://github.com/heroku/heroku-buildpack-ruby/pull/1308) +* `bin/release` is re-written in bash, so it supports Heroku-22 (https://github.com/heroku/heroku-buildpack-ruby/pull/1308) +* Download presence check now includes heroku-22 (https://github.com/heroku/heroku-buildpack-ruby/pull/1290) ## v240 (2022/04/05) -* Add support for heroku-22 (https://github.com/heroku/heroku-buildpack-ruby/pull/1289) +* Add initial support for heroku-22 (https://github.com/heroku/heroku-buildpack-ruby/pull/1289) * Bundler 2.x is now 2.3.10 (https://github.com/heroku/heroku-buildpack-ruby/pull/1296) ## v239 (2022/03/02) diff --git a/bin/release b/bin/release index 6868d0a6c..e55dd4623 100755 --- a/bin/release +++ b/bin/release @@ -1,10 +1,13 @@ #!/usr/bin/env bash -# fail hard -set -o pipefail -# fail harder -set -eu +set -euo pipefail -BUILD_DIR=${1:-} +BUILD_DIR="${1:-}" +RELEASE_FILE="${BUILD_DIR}/tmp/heroku-buildpack-release-step.yml" -cat "$BUILD_DIR/tmp/heroku-buildpack-release-step.yml" +# Whilst the release file is always written by the buildpack, some apps use +# third-party slug cleaner buildpacks to remove this and other files, so we +# cannot assume it still exists by the time the release step runs. +if [[ -f "${RELEASE_FILE}" ]]; then + cat "${RELEASE_FILE}" +fi From 7812e2aa962e9ae6dee077910651b5dbeb2aa818 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Tue, 7 Jun 2022 11:03:23 -0500 Subject: [PATCH 0884/1195] Release v242 and Rev bootstrap Ruby version (#1310) Ruby 3.1.2 is the latest in the 3.1.x series. --- .circleci/config.yml | 10 +++++----- CHANGELOG.md | 3 +++ Gemfile | 2 +- Gemfile.lock | 2 +- buildpack.toml | 8 ++++---- lib/language_pack/ruby_version.rb | 2 +- lib/language_pack/version.rb | 2 +- 7 files changed, 16 insertions(+), 13 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index fcea5e83a..a7980ed5a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -12,7 +12,7 @@ jobs: version: 0.24.0 - restore_cache: keys: - - v3-ruby-3.1.1 + - v3-ruby-3.1.2 - run: name: Install ruby-install @@ -32,23 +32,23 @@ jobs: - run: name: Ruby install command: | - ruby-install ruby 3.1.1 --no-reinstall + ruby-install ruby 3.1.2 --no-reinstall - run: name: Set chruby defaults command: | echo 'source /usr/local/share/chruby/chruby.sh' >> $BASH_ENV - echo 'chruby ruby-3.1.1' >> $BASH_ENV + echo 'chruby ruby-3.1.2' >> $BASH_ENV - save_cache: - key: v3-ruby-3.1.1 + key: v3-ruby-3.1.2 paths: - "~/.rubies" - run: command: | rvm implode --force - chruby 3.1.1 + chruby 3.1.2 gem install bundler -v 2.2.32 --no-document bundle config deployment 'true' diff --git a/CHANGELOG.md b/CHANGELOG.md index a3346772e..6abea9975 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,10 @@ ## Main (unreleased) +## v242 (2022/06/07) + * Ensure `bin/release` exits zero if `tmp/heroku-buildpack-release-step.yml` does not exist (https://github.com/heroku/heroku-buildpack-ruby/pull/1309) +* Bootstrap Ruby version used by the buildpack internals is updated to Ruby 3.1.2 (https://github.com/heroku/heroku-buildpack-ruby/pull/1310) ## v241 (2022/06/06) diff --git a/Gemfile b/Gemfile index dc3a8674c..52f80c991 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ source "https://rubygems.org" git_source(:github) { |repo| "https://github.com/#{repo}.git" } -ruby '3.1.1' +ruby '3.1.2' group :development, :test do gem "toml-rb" diff --git a/Gemfile.lock b/Gemfile.lock index dc945b2f8..9a4d74c91 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -71,7 +71,7 @@ DEPENDENCIES toml-rb RUBY VERSION - ruby 3.1.1p18 + ruby 3.1.2p20 BUNDLED WITH 2.3.10 diff --git a/buildpack.toml b/buildpack.toml index 8c0470e5b..57578c016 100644 --- a/buildpack.toml +++ b/buildpack.toml @@ -5,7 +5,7 @@ id = "heroku/ruby" version = "0.1.4" name = "Ruby" homepage = "https://github.com/heroku/heroku-buildpack-ruby" -ruby_version = "3.1.1" +ruby_version = "3.1.2" [publish] @@ -13,15 +13,15 @@ ruby_version = "3.1.1" files = ["spec/"] [[publish.Vendor]] -url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-18/ruby-3.1.1.tgz" +url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-18/ruby-3.1.2.tgz" dir = "vendor/ruby/heroku-18" [[publish.Vendor]] -url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-20/ruby-3.1.1.tgz" +url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-20/ruby-3.1.2.tgz" dir = "vendor/ruby/heroku-20" [[publish.Vendor]] -url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-22/ruby-3.1.1.tgz" +url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-22/ruby-3.1.2.tgz" dir = "vendor/ruby/heroku-22" [[stacks]] diff --git a/lib/language_pack/ruby_version.rb b/lib/language_pack/ruby_version.rb index a6651bdc8..39c5e1162 100644 --- a/lib/language_pack/ruby_version.rb +++ b/lib/language_pack/ruby_version.rb @@ -12,7 +12,7 @@ def initialize(output = "") end end - BOOTSTRAP_VERSION_NUMBER = "3.1.1".freeze + BOOTSTRAP_VERSION_NUMBER = "3.1.2".freeze DEFAULT_VERSION_NUMBER = "3.0.3".freeze DEFAULT_VERSION = "ruby-#{DEFAULT_VERSION_NUMBER}".freeze LEGACY_VERSION_NUMBER = "1.9.2".freeze diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 69f6ae198..193100438 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v241" + BUILDPACK_VERSION = "v242" end end From d4f0fe14c867db0946be50d11c722a9f2d89e71a Mon Sep 17 00:00:00 2001 From: Ed Morley <501702+edmorley@users.noreply.github.com> Date: Tue, 14 Jun 2022 14:38:41 +0100 Subject: [PATCH 0885/1195] Adjust curl retry and connection timeout handling (#1313) In the shimmed CNBs used in `heroku/builder` we have been seeing quite a few transient errors related to buildpacks downloading from S3. Adding appropriate retries and connection timeouts to all of our buildpack's curl usages should help with these, as well as make builds more reliable in general for users on Heroku, plus also anyone using a shimmed CNB locally with Pack CLI (where the network connection may be even less reliable). The `--retry-connrefused` option has been used since otherwise curl doesn't retry cases where the connection was refused. Ideally we would use `--retry-all-errors` which takes that one step further, however that option was only added in curl 7.71, so is only supported by Heroku-22+. For more on curl options, see: https://curl.se/docs/manpage.html GUS-W-11283397. --- CHANGELOG.md | 2 ++ bin/support/bash_functions.sh | 2 +- bin/support/download_ruby | 2 +- lib/language_pack/helpers/plugin_installer.rb | 6 +++++- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6abea9975..0019eb1fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Main (unreleased) +* Adjust curl retry and connection timeout handling (https://github.com/heroku/heroku-buildpack-ruby/pull/1312) + ## v242 (2022/06/07) * Ensure `bin/release` exits zero if `tmp/heroku-buildpack-release-step.yml` does not exist (https://github.com/heroku/heroku-buildpack-ruby/pull/1309) diff --git a/bin/support/bash_functions.sh b/bin/support/bash_functions.sh index 4bc4a70e5..298b98a64 100755 --- a/bin/support/bash_functions.sh +++ b/bin/support/bash_functions.sh @@ -110,7 +110,7 @@ compile_buildpack_v2() if [[ "$url" =~ \.tgz$ ]] || [[ "$url" =~ \.tgz\? ]]; then mkdir -p "$dir" - curl_retry_on_18 -s "$url" | tar xvz -C "$dir" >/dev/null 2>&1 + curl_retry_on_18 -s --fail --retry 3 --retry-connrefused --connect-timeout ${CURL_CONNECT_TIMEOUT:-3} "$url" | tar xvz -C "$dir" >/dev/null 2>&1 else git clone "$url" "$dir" >/dev/null 2>&1 fi diff --git a/bin/support/download_ruby b/bin/support/download_ruby index 0fe10bb94..40a8615c1 100755 --- a/bin/support/download_ruby +++ b/bin/support/download_ruby @@ -34,7 +34,7 @@ fi mkdir -p "$RUBY_BOOTSTRAP_DIR" -curl_retry_on_18 --fail --silent --location -o "$RUBY_BOOTSTRAP_DIR/ruby.tgz" "$heroku_buildpack_ruby_url" || { +curl_retry_on_18 --fail --retry 3 --retry-connrefused --connect-timeout ${CURL_CONNECT_TIMEOUT:-3} --silent --location -o "$RUBY_BOOTSTRAP_DIR/ruby.tgz" "$heroku_buildpack_ruby_url" || { cat< Date: Tue, 14 Jun 2022 14:47:17 +0100 Subject: [PATCH 0886/1195] Switch away from deprecated path-based S3 URLs (#1311) S3 URLs where the bucket name is part of the URL path are deprecated. Instead, it's recommended to use the virtual-hosted style references, where the bucket name is part of the domain. The latter allows AWS to use DNS to direct requests directly to the appropriate regions S3 endpoint, rather than having to route via the global S3 endpoint (which AWS describe as being a single point of failure/harder to scale etc). There is a small chance this may also help with some of the S3 reliability issues seen in `heroku/builder` Circle CI runs - however even if it doesn't, at least we'll no longer be using the deprecated URLs/endpoints. See: https://aws.amazon.com/blogs/aws/amazon-s3-path-deprecation-plan-the-rest-of-the-story/ https://docs.aws.amazon.com/AmazonS3/latest/userguide/VirtualHosting.html https://docs.aws.amazon.com/general/latest/gr/s3.html#s3_region GUS-W-11283397. Co-authored-by: Richard Schneeman --- CHANGELOG.md | 1 + Rakefile | 3 ++- bin/compile | 2 +- bin/support/bash_functions.sh | 2 +- bin/support/download_ruby | 2 +- bin/test-compile | 2 +- buildpack.toml | 6 +++--- lib/language_pack/base.rb | 2 +- lib/language_pack/helpers/nodebin.rb | 4 ++-- lib/language_pack/installers/rbx_installer.rb | 2 +- lib/language_pack/ruby.rb | 2 +- 11 files changed, 15 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0019eb1fb..a98c222e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Main (unreleased) +* Switch away from deprecated path-based S3 URLs (https://github.com/heroku/heroku-buildpack-ruby/pull/1311) * Adjust curl retry and connection timeout handling (https://github.com/heroku/heroku-buildpack-ruby/pull/1312) ## v242 (2022/06/07) diff --git a/Rakefile b/Rakefile index a9352ceaa..1a46f363c 100644 --- a/Rakefile +++ b/Rakefile @@ -11,6 +11,7 @@ ENV["BUILDPACK_LOG_FILE"] ||= "tmp/buildpack.log" require_relative 'lib/rake/deploy_check' require_relative 'lib/rake/tarballer' +S3_BUCKET_REGION = "us-east-1" S3_BUCKET_NAME = "heroku-buildpack-ruby" def s3_tools_dir @@ -148,7 +149,7 @@ task "ruby:manifest" do require 'rexml/document' require 'yaml' - document = REXML::Document.new(`curl https://#{S3_BUCKET_NAME}.s3.amazonaws.com`) + document = REXML::Document.new(`curl https://#{S3_BUCKET_NAME}.s3.#{S3_BUCKET_REGION}.amazonaws.com`) rubies = document.elements.to_a("//Contents/Key").map {|node| node.text }.select {|text| text.match(/^(ruby|rbx|jruby)-\\\\d+\\\\.\\\\d+\\\\.\\\\d+(-p\\\\d+)?/) } Dir.mktmpdir("ruby_versions-") do |tmpdir| diff --git a/bin/compile b/bin/compile index e3c85c27e..e7926be25 100755 --- a/bin/compile +++ b/bin/compile @@ -25,7 +25,7 @@ if detect_needs_java "$BUILD_DIR"; then EOM - compile_buildpack_v2 "$BUILD_DIR" "$CACHE_DIR" "$ENV_DIR" "https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/jvm.tgz" "heroku/jvm" + compile_buildpack_v2 "$BUILD_DIR" "$CACHE_DIR" "$ENV_DIR" "https://buildpack-registry.s3.us-east-1.amazonaws.com/buildpacks/heroku/jvm.tgz" "heroku/jvm" fi $heroku_buildpack_ruby_dir/bin/ruby $BIN_DIR/support/ruby_compile $@ diff --git a/bin/support/bash_functions.sh b/bin/support/bash_functions.sh index 298b98a64..b96cb33e4 100755 --- a/bin/support/bash_functions.sh +++ b/bin/support/bash_functions.sh @@ -81,7 +81,7 @@ detect_needs_java() # # Example: # -# compile_buildpack_v2 "$build_dir" "$cache_dir" "$env_dir" "https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/nodejs.tgz" "heroku/nodejs" +# compile_buildpack_v2 "$build_dir" "$cache_dir" "$env_dir" "https://buildpack-registry.s3.us-east-1.amazonaws.com/buildpacks/heroku/nodejs.tgz" "heroku/nodejs" # compile_buildpack_v2() { diff --git a/bin/support/download_ruby b/bin/support/download_ruby index 40a8615c1..37737ba8d 100755 --- a/bin/support/download_ruby +++ b/bin/support/download_ruby @@ -26,7 +26,7 @@ curl_retry_on_18() { regex=".*ruby_version = [\'\"]([0-9]+\.[0-9]+\.[0-9]+)[\'\"].*" if [[ $(cat "$BIN_DIR/../buildpack.toml") =~ $regex ]] then - heroku_buildpack_ruby_url="https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/$STACK/ruby-${BASH_REMATCH[1]}.tgz" + heroku_buildpack_ruby_url="https://heroku-buildpack-ruby.s3.us-east-1.amazonaws.com/$STACK/ruby-${BASH_REMATCH[1]}.tgz" else echo "Could not detect ruby version to bootstrap" exit 1 diff --git a/bin/test-compile b/bin/test-compile index 1c996c15a..0d221614a 100755 --- a/bin/test-compile +++ b/bin/test-compile @@ -25,7 +25,7 @@ if detect_needs_java "$BUILD_DIR"; then EOM - compile_buildpack_v2 "$BUILD_DIR" "$CACHE_DIR" "$ENV_DIR" "https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/jvm.tgz" "heroku/jvm" + compile_buildpack_v2 "$BUILD_DIR" "$CACHE_DIR" "$ENV_DIR" "https://buildpack-registry.s3.us-east-1.amazonaws.com/buildpacks/heroku/jvm.tgz" "heroku/jvm" fi $heroku_buildpack_ruby_dir/bin/ruby $BIN_DIR/support/ruby_test-compile $@ diff --git a/buildpack.toml b/buildpack.toml index 57578c016..6548cf3da 100644 --- a/buildpack.toml +++ b/buildpack.toml @@ -13,15 +13,15 @@ ruby_version = "3.1.2" files = ["spec/"] [[publish.Vendor]] -url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-18/ruby-3.1.2.tgz" +url = "https://heroku-buildpack-ruby.s3.us-east-1.amazonaws.com/heroku-18/ruby-3.1.2.tgz" dir = "vendor/ruby/heroku-18" [[publish.Vendor]] -url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-20/ruby-3.1.2.tgz" +url = "https://heroku-buildpack-ruby.s3.us-east-1.amazonaws.com/heroku-20/ruby-3.1.2.tgz" dir = "vendor/ruby/heroku-20" [[publish.Vendor]] -url = "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-22/ruby-3.1.2.tgz" +url = "https://heroku-buildpack-ruby.s3.us-east-1.amazonaws.com/heroku-22/ruby-3.1.2.tgz" dir = "vendor/ruby/heroku-22" [[stacks]] diff --git a/lib/language_pack/base.rb b/lib/language_pack/base.rb index a8d573ecc..135e88aea 100644 --- a/lib/language_pack/base.rb +++ b/lib/language_pack/base.rb @@ -17,7 +17,7 @@ class LanguagePack::Base include LanguagePack::ShellHelpers extend LanguagePack::ShellHelpers - VENDOR_URL = ENV['BUILDPACK_VENDOR_URL'] || "https://s3-external-1.amazonaws.com/heroku-buildpack-ruby" + VENDOR_URL = ENV['BUILDPACK_VENDOR_URL'] || "https://heroku-buildpack-ruby.s3.us-east-1.amazonaws.com" DEFAULT_LEGACY_STACK = "cedar" ROOT_DIR = File.expand_path("../../..", __FILE__) diff --git a/lib/language_pack/helpers/nodebin.rb b/lib/language_pack/helpers/nodebin.rb index 0dafdce9d..2bf31bdd8 100644 --- a/lib/language_pack/helpers/nodebin.rb +++ b/lib/language_pack/helpers/nodebin.rb @@ -5,7 +5,7 @@ def self.hardcoded_node_lts version = "16.13.1" { "number" => version, - "url" => "https://s3.amazonaws.com/heroku-nodebin/node/release/linux-x64/node-v#{version}-linux-x64.tar.gz" + "url" => "https://heroku-nodebin.s3.us-east-1.amazonaws.com/node/release/linux-x64/node-v#{version}-linux-x64.tar.gz" } end @@ -13,7 +13,7 @@ def self.hardcoded_yarn version = "1.22.17" { "number" => version, - "url" => "https://s3.amazonaws.com/heroku-nodebin/yarn/release/yarn-v#{version}.tar.gz" + "url" => "https://heroku-nodebin.s3.us-east-1.amazonaws.com/yarn/release/yarn-v#{version}.tar.gz" } end diff --git a/lib/language_pack/installers/rbx_installer.rb b/lib/language_pack/installers/rbx_installer.rb index 91e870e25..800f92d3a 100644 --- a/lib/language_pack/installers/rbx_installer.rb +++ b/lib/language_pack/installers/rbx_installer.rb @@ -4,7 +4,7 @@ class LanguagePack::Installers::RbxInstaller include LanguagePack::ShellHelpers, LanguagePack::Installers::RubyInstaller - BASE_URL = "https://rubinius-binaries-rubinius-com.s3.amazonaws.com/ubuntu/14.04/x86_64/" + BASE_URL = "https://rubinius-binaries-rubinius-com.s3.us-west-2.amazonaws.com/ubuntu/14.04/x86_64/" def initialize(stack) @fetcher = LanguagePack::Fetcher.new(BASE_URL) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 579605018..db2101f91 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -646,7 +646,7 @@ def install_binaries # vendors individual binary into the slug # @param [String] name of the binary package from S3. - # Example: https://s3.amazonaws.com/language-pack-ruby/node-0.4.7.tgz, where name is "node-0.4.7" + # Example: https://heroku-buildpack-ruby.s3.us-east-1.amazonaws.com/node-0.4.7.tgz, where name is "node-0.4.7" def install_binary(name) topic "Installing #{name}" bin_dir = "bin" From 65badbd5c24fecf13722a143a00c175b519ad6f5 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Tue, 14 Jun 2022 09:20:59 -0500 Subject: [PATCH 0887/1195] v243 (#1314) --- CHANGELOG.md | 2 ++ lib/language_pack/version.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a98c222e5..3e714fe6f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Main (unreleased) +## v243 (2022/06/14) + * Switch away from deprecated path-based S3 URLs (https://github.com/heroku/heroku-buildpack-ruby/pull/1311) * Adjust curl retry and connection timeout handling (https://github.com/heroku/heroku-buildpack-ruby/pull/1312) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 193100438..cd10e6425 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v242" + BUILDPACK_VERSION = "v243" end end From 8889caba83d9aef329fbac38e82ceca45ab73fdd Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Mon, 25 Jul 2022 15:23:46 -0500 Subject: [PATCH 0888/1195] Default Ruby version for new apps is now 3.1.2 (#1316) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ## Default Ruby version for new apps is now 3.1.2 The [default Ruby version for new Ruby applications is 3.1.2](https://devcenter.heroku.com/articles/ruby-support#default-ruby-version-for-new-apps). You’ll only get the default if the application does not specify a ruby version. Before we can make heroku-22 the default we need the defaults to work with heroku-22. Due to https://bugs.ruby-lang.org/issues/18658 Ruby 2.7 and 3.0 do not work on Heroku-22. As a result we are upgrading the default version of Ruby to 3.1.x. This change will only impact customers with no Ruby version specified in their Gemfile.lock GUS-W-11484844 * v244 --- CHANGELOG.md | 4 ++++ changelogs/v244/default_ruby.md | 3 +++ hatchet.lock | 2 +- lib/language_pack/ruby_version.rb | 2 +- lib/language_pack/version.rb | 2 +- 5 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 changelogs/v244/default_ruby.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e714fe6f..3c7feb9c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Main (unreleased) +## v244 (2022/07/25) + +* Default Ruby version is now 3.1.2 (https://github.com/heroku/heroku-buildpack-ruby/pull/1316) + ## v243 (2022/06/14) * Switch away from deprecated path-based S3 URLs (https://github.com/heroku/heroku-buildpack-ruby/pull/1311) diff --git a/changelogs/v244/default_ruby.md b/changelogs/v244/default_ruby.md new file mode 100644 index 000000000..0017cbd03 --- /dev/null +++ b/changelogs/v244/default_ruby.md @@ -0,0 +1,3 @@ +## Default Ruby version for new apps is now 3.1.2 + +The [default Ruby version for new Ruby applications is 3.1.2](https://devcenter.heroku.com/articles/ruby-support#default-ruby-version-for-new-apps). You’ll only get the default if the application does not specify a ruby version. diff --git a/hatchet.lock b/hatchet.lock index 54bda69ea..d9acda211 100644 --- a/hatchet.lock +++ b/hatchet.lock @@ -44,7 +44,7 @@ - - "./repos/rails_versions/active_storage_non_local" - 86dddf0127043abba1cb2890590a1d38f111edbd - - "./repos/rails_versions/rails-jsbundling" - - f2c1455efb5892208b08a4a964e7f8e692b9b6f9 + - c58178e061d9846386ca34ea31c99f6e6bb8dbf7 - - "./repos/rails_versions/rails3_default_ruby" - a6b44db674c0d3538633989295e2cfd5e8e1ba0d - - "./repos/rails_versions/rails42_default_ruby" diff --git a/lib/language_pack/ruby_version.rb b/lib/language_pack/ruby_version.rb index 39c5e1162..3af949c4e 100644 --- a/lib/language_pack/ruby_version.rb +++ b/lib/language_pack/ruby_version.rb @@ -13,7 +13,7 @@ def initialize(output = "") end BOOTSTRAP_VERSION_NUMBER = "3.1.2".freeze - DEFAULT_VERSION_NUMBER = "3.0.3".freeze + DEFAULT_VERSION_NUMBER = "3.1.2".freeze DEFAULT_VERSION = "ruby-#{DEFAULT_VERSION_NUMBER}".freeze LEGACY_VERSION_NUMBER = "1.9.2".freeze LEGACY_VERSION = "ruby-#{LEGACY_VERSION_NUMBER}".freeze diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index cd10e6425..a1631172f 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v243" + BUILDPACK_VERSION = "v244" end end From 83da2a7651f97b5354900144a57d6c5c53862269 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 27 Jul 2022 07:14:19 +0100 Subject: [PATCH 0889/1195] Bump excon from 0.92.1 to 0.92.4 (#1317) Bumps [excon](https://github.com/excon/excon) from 0.92.1 to 0.92.4. - [Release notes](https://github.com/excon/excon/releases) - [Changelog](https://github.com/excon/excon/blob/master/changelog.txt) - [Commits](https://github.com/excon/excon/compare/v0.92.1...v0.92.4) --- updated-dependencies: - dependency-name: excon dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 9a4d74c91..28fec753c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GEM excon (>= 0.47.0) multi_json erubis (2.7.0) - excon (0.92.1) + excon (0.92.4) heroics (0.1.2) erubis (~> 2.0) excon From bd8666a852d0eec06f4defc548679b798800bfb2 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Tue, 8 Nov 2022 12:54:58 -0600 Subject: [PATCH 0890/1195] Remove circle tests (#1326) * Remove circle tests The CNB codebase is now at https://github.com/heroku/buildpacks-ruby and we're moving away from CircleCI GUS-W-11832774 * Remove unused tests * Fix failing tests on heroku-22 Rails LTS does not yet support Ruby 3.1 so these tests cannot run on Heroku-22 which is now the default. * Remove cutlass dep --- .circleci/config.yml | 68 ---------------------- Gemfile | 1 - Gemfile.lock | 6 -- app.json | 26 +++++---- hatchet.json | 5 +- hatchet.lock | 6 +- spec/cnb/basic_local_pack_spec.rb | 95 ------------------------------- spec/hatchet/ci_spec.rb | 10 +--- spec/hatchet/rails23_spec.rb | 2 +- spec/hatchet/rails3_spec.rb | 2 +- spec/hatchet/rails4_spec.rb | 6 +- spec/hatchet/rails6_spec.rb | 30 +--------- spec/spec_helper.rb | 20 ++----- 13 files changed, 32 insertions(+), 245 deletions(-) delete mode 100644 .circleci/config.yml delete mode 100644 spec/cnb/basic_local_pack_spec.rb diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index a7980ed5a..000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,68 +0,0 @@ -version: 2.1 -orbs: - pack: buildpacks/pack@0.2.4 - -jobs: - build: - machine: - image: ubuntu-2004:202201-02 - steps: - - checkout - - pack/install-pack: - version: 0.24.0 - - restore_cache: - keys: - - v3-ruby-3.1.2 - - - run: - name: Install ruby-install - command: | - wget -O ruby-install-0.8.3.tar.gz https://github.com/postmodern/ruby-install/archive/v0.8.3.tar.gz - tar -xzvf ruby-install-0.8.3.tar.gz - cd ruby-install-0.8.3/ - sudo make install - - run: - name: Install chruby - command: | - wget -O chruby-0.3.9.tar.gz https://github.com/postmodern/chruby/archive/v0.3.9.tar.gz - tar -xzvf chruby-0.3.9.tar.gz - cd chruby-0.3.9/ - sudo make install - - - run: - name: Ruby install - command: | - ruby-install ruby 3.1.2 --no-reinstall - - - run: - name: Set chruby defaults - command: | - echo 'source /usr/local/share/chruby/chruby.sh' >> $BASH_ENV - echo 'chruby ruby-3.1.2' >> $BASH_ENV - - - save_cache: - key: v3-ruby-3.1.2 - paths: - - "~/.rubies" - - - run: - command: | - rvm implode --force - chruby 3.1.2 - - gem install bundler -v 2.2.32 --no-document - bundle config deployment 'true' - bundle config path ./vendor/bundle - bundle install - bundle clean - - bundle exec rake hatchet:setup_ci - echo "pack version: $(pack --version)" - - bundle exec rspec spec/cnb/ - -workflows: - main: - jobs: - - build - diff --git a/Gemfile b/Gemfile index 52f80c991..b69e4b1d1 100644 --- a/Gemfile +++ b/Gemfile @@ -16,5 +16,4 @@ group :development, :test do gem 'ci-queue' gem 'redis' gem 'dead_end' - gem 'cutlass' end diff --git a/Gemfile.lock b/Gemfile.lock index 28fec753c..1f0f7fc59 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,13 +3,8 @@ GEM specs: ci-queue (0.22.1) citrus (3.0.2) - cutlass (0.3.0) - docker-api (>= 2.0) dead_end (3.1.1) diff-lcs (1.5.0) - docker-api (2.2.0) - excon (>= 0.47.0) - multi_json erubis (2.7.0) excon (0.92.4) heroics (0.1.2) @@ -57,7 +52,6 @@ PLATFORMS DEPENDENCIES ci-queue - cutlass dead_end excon heroku_hatchet diff --git a/app.json b/app.json index 5d8b1006c..9f743dcb3 100644 --- a/app.json +++ b/app.json @@ -1,30 +1,34 @@ { - "name":"Heroku Buildpack Ruby", - "description":"The buildpack for Ruby", + "name": "Heroku Buildpack Ruby", + "description": "The buildpack for Ruby", "environments": { "test": { - "addons":[ + "addons": [ "heroku-redis:hobby-dev" ], "env": { - "HATCHET_RETRIES": "3", - "IS_RUNNING_ON_CI": "true", - "HATCHET_APP_LIMIT": "100", - "BUILDPACK_LOG_FILE": "tmp/buildpack.log" + "HATCHET_RETRIES": "3", + "IS_RUNNING_ON_CI": "true", + "HATCHET_APP_LIMIT": "100", + "BUILDPACK_LOG_FILE": "tmp/buildpack.log" }, "formation": { "test": { - "size": "performance-l", + "size": "performance-l", "quantity": 16 } }, "scripts": { "test-setup": "bundle exec rake hatchet:setup_ci", - "test": "bundle exec rspec-queue --max-requeues=3 --timeout 180 --queue $REDIS_URL --exclude-pattern 'cnb/**/*' || { cat log/test_order.log; $(exit 1); }" + "test": "bundle exec rspec-queue --max-requeues=3 --timeout 180 --queue $REDIS_URL || { cat log/test_order.log; $(exit 1); }" }, "buildpacks": [ - { "url": "https://github.com/heroku/heroku-buildpack-cli.git" }, - { "url": "https://github.com/heroku/heroku-buildpack-ruby" } + { + "url": "https://github.com/heroku/heroku-buildpack-cli.git" + }, + { + "url": "https://github.com/heroku/heroku-buildpack-ruby" + } ] } } diff --git a/hatchet.json b/hatchet.json index 08dccd905..921ae7886 100644 --- a/hatchet.json +++ b/hatchet.json @@ -46,7 +46,7 @@ "sharpstone/active_storage_non_local", "sharpstone/active_storage_local", "sharpstone/sprockets_asset_compile_true", - "sharpstone/rails6-basic", + "sharpstone/rails61", "sharpstone/rails-jsbundling" ], "heroku": [ @@ -60,7 +60,6 @@ "sharpstone/heroku-ci-json-example", "sharpstone/rails5_sql_schema_format", "sharpstone/ruby_no_rails_test", - "sharpstone/activerecord_rake_tasks_does_not_exist", - "sharpstone/ci_fails_ruby_default_bundler" + "sharpstone/activerecord_rake_tasks_does_not_exist" ] } diff --git a/hatchet.lock b/hatchet.lock index d9acda211..92b59e0d6 100644 --- a/hatchet.lock +++ b/hatchet.lock @@ -13,8 +13,6 @@ - 116db685f54dae18f703b3beb90e64fdbddb048d - - "./repos/ci/activerecord_rake_tasks_does_not_exist" - a6b711be6921cf7a0aa4e31269c37965799ea110 -- - "./repos/ci/ci_fails_ruby_default_bundler" - - a99cfbe3395bbd4539d5984b73d61771243b6208 - - "./repos/ci/heroku-ci-json-example" - 4e5410a7381f486ba3df7739e02e52f32fdd4dda - - "./repos/ci/rails5_ruby_schema_format" @@ -51,8 +49,8 @@ - dfa0f0133dafa62064968ea2efb6432f54350138 - - "./repos/rails_versions/rails4_windows_mri193" - f4c7b6209835050468bbb87827acf652b8f4d8ce -- - "./repos/rails_versions/rails6-basic" - - 6b81e0246c64c332181c22ace4ac96b57309cb85 +- - "./repos/rails_versions/rails61" + - e896f51e679eaf2204aa4fab6d038103fc622aed - - "./repos/rails_versions/rails_lts_23_default_ruby" - 7178b2f97d3b2b3170b390d997dcb212dd52cd30 - - "./repos/rails_versions/sprockets_asset_compile_true" diff --git a/spec/cnb/basic_local_pack_spec.rb b/spec/cnb/basic_local_pack_spec.rb deleted file mode 100644 index 6e1b79e3d..000000000 --- a/spec/cnb/basic_local_pack_spec.rb +++ /dev/null @@ -1,95 +0,0 @@ -require_relative '../spec_helper' - -describe "cnb" do - it "locally runs default_ruby app" do - Cutlass::App.new("default_ruby").transaction do |app| - app.pack_build - - expect(app.stdout).to include("Installing rake") - - app.run_multi("ruby -v") do |out| - expect(out.stdout).to match(LanguagePack::RubyVersion::DEFAULT_VERSION_NUMBER) - end - - app.run_multi("bundle list") do |out| - expect(out.stdout).to match("rack") - end - - app.run_multi("gem list") do |out| - expect(out.stdout).to match("rack") - end - - app.run_multi(%Q{ruby -e "require 'rack'; puts 'done'"}) do |out| - expect(out.stdout).to match("done") - end - - # Test cache - app.pack_build - - expect(app.stdout).to include("Using rake") - end - end - - it "uses multiple buildpacks" do - Dir.mktmpdir do |second_buildpack_dir| - FileUtils.mkdir_p("#{second_buildpack_dir}/bin") - - File.open("#{second_buildpack_dir}/buildpack.toml", "w") do |f| - f.write <<~EOM - # Buildpack API version - api = "0.2" - - # Buildpack ID and metadata - [buildpack] - id = "com.examples.buildpacks.test_ruby_export" - version = "0.0.1" - name = "Test Ruby Export Buildpack" - - # Stacks that the buildpack will work with - [[stacks]] - id = "heroku-20" - - [[stacks]] - id = "org.cloudfoundry.stacks.cflinuxfs3" - EOM - end - File.open("#{second_buildpack_dir}/bin/detect", "w") do |f| - f.write <<~EOM - #! /usr/bin/env bash - - exit 0 - EOM - end - - File.open("#{second_buildpack_dir}/bin/build", "w") do |f| - f.write <<~EOM - #! /usr/bin/env bash - - echo "Which gem: $(which gem)" - exit 0 - EOM - end - FileUtils.chmod("+x", "#{second_buildpack_dir}/bin/detect") - FileUtils.chmod("+x", "#{second_buildpack_dir}/bin/build") - - Cutlass::App.new("default_ruby", buildpacks: [:default, second_buildpack_dir]).transaction do |app| - app.pack_build - - expect(app.stdout).to match("Compiling Ruby/Rack") - - expect(app.stdout).to match("com.examples.buildpacks.test_ruby_export") - expect(app.stdout).to match("Which gem: /workspace/bin/gem") - end - end - end - - it "locally runs rails getting started" do - Cutlass::App.new("ruby-getting-started").transaction do |app| - app.pack_build - expect(app.stdout).to match("Compiling Ruby/Rails") - - expect(app.run("ruby -v").stdout).to match("3.1.2") - end - end -end - diff --git a/spec/hatchet/ci_spec.rb b/spec/hatchet/ci_spec.rb index f75bcfa1c..41c2207f0 100644 --- a/spec/hatchet/ci_spec.rb +++ b/spec/hatchet/ci_spec.rb @@ -11,7 +11,7 @@ end it "Works with Rails 5 ruby schema apps" do - Hatchet::Runner.new("rails5_ruby_schema_format").tap do |app| + Hatchet::Runner.new("rails5_ruby_schema_format", stack: "heroku-20").tap do |app| app.before_deploy do Pathname("Gemfile").write("ruby '2.7.5'", mode: "a") end @@ -22,7 +22,7 @@ end it "Works with Rails 5 SQL schema apps" do - Hatchet::Runner.new("rails5_sql_schema_format").tap do |app| + Hatchet::Runner.new("rails5_sql_schema_format", stack: "heroku-20").tap do |app| app.before_deploy do Pathname("Gemfile").write("ruby '2.7.5'", mode: "a") end @@ -57,10 +57,4 @@ expect(test_run.output).to_not match("db:migrate") end end - - it "works when using a Ruby version different from default with an older version of bundler and not declaring a test script" do - Hatchet::Runner.new("ci_fails_ruby_default_bundler").run_ci do |test_run| - expect(test_run.output).to match("rspec") - end - end end diff --git a/spec/hatchet/rails23_spec.rb b/spec/hatchet/rails23_spec.rb index 9c198e1da..a605642ed 100644 --- a/spec/hatchet/rails23_spec.rb +++ b/spec/hatchet/rails23_spec.rb @@ -4,7 +4,7 @@ it "should deploy" do skip("Need RAILS_LTS_CREDS env var set") unless ENV["RAILS_LTS_CREDS"] - Hatchet::Runner.new('rails_lts_23_default_ruby', config: rails_lts_config).tap do |app| + Hatchet::Runner.new('rails_lts_23_default_ruby', config: rails_lts_config, stack: rails_lts_stack).tap do |app| app.before_deploy do Pathname("Gemfile").write("ruby '2.7.2'", mode: "a") end diff --git a/spec/hatchet/rails3_spec.rb b/spec/hatchet/rails3_spec.rb index e4c9faf50..7593169dc 100644 --- a/spec/hatchet/rails3_spec.rb +++ b/spec/hatchet/rails3_spec.rb @@ -4,7 +4,7 @@ it "should deploy and inject plugins" do skip("Need RAILS_LTS_CREDS env var set") unless ENV["RAILS_LTS_CREDS"] - Hatchet::Runner.new("rails3_default_ruby", config: rails_lts_config).tap do |app| + Hatchet::Runner.new("rails3_default_ruby", config: rails_lts_config, stack: rails_lts_stack).tap do |app| app.before_deploy do Pathname("Gemfile").write("ruby '2.7.2'", mode: "a") end diff --git a/spec/hatchet/rails4_spec.rb b/spec/hatchet/rails4_spec.rb index de55b67f4..e7b851028 100644 --- a/spec/hatchet/rails4_spec.rb +++ b/spec/hatchet/rails4_spec.rb @@ -4,7 +4,7 @@ it "should be able to run a migration without heroku specific database.yml" do skip("Need RAILS_LTS_CREDS env var set") unless ENV["RAILS_LTS_CREDS"] - Hatchet::Runner.new("rails42_default_ruby", config: rails_lts_config).tap do |app| + Hatchet::Runner.new("rails42_default_ruby", config: rails_lts_config, stack: rails_lts_stack).tap do |app| app.before_deploy do Pathname("Gemfile").write("ruby '2.7.2'", mode: "a") end @@ -22,7 +22,7 @@ it "should skip asset compilation when deployed with NEW manifest file" do skip("Need RAILS_LTS_CREDS env var set") unless ENV["RAILS_LTS_CREDS"] - Hatchet::Runner.new("rails42_default_ruby", config: rails_lts_config).tap do |app| + Hatchet::Runner.new("rails42_default_ruby", config: rails_lts_config, stack: rails_lts_stack).tap do |app| app.before_deploy do Pathname("Gemfile").write("ruby '2.7.2'", mode: "a") Pathname("public/assets/manifest-ccf61eade4793995271564a4767ce6b6.json").tap {|p| p.dirname.mkpath; FileUtils.touch(p) } @@ -37,7 +37,7 @@ it "should skip asset compilation when deployed with OLD manifest file" do skip("Need RAILS_LTS_CREDS env var set") unless ENV["RAILS_LTS_CREDS"] - Hatchet::Runner.new("rails42_default_ruby", config: rails_lts_config).tap do |app| + Hatchet::Runner.new("rails42_default_ruby", config: rails_lts_config, stack: rails_lts_stack).tap do |app| app.before_deploy do Pathname("Gemfile").write("ruby '2.7.2'", mode: "a") Pathname("public/assets/.sprockets-manifest-040763ccc5036260c52c6adcf77d73f7.json").tap {|p| p.dirname.mkpath; FileUtils.touch(p) } diff --git a/spec/hatchet/rails6_spec.rb b/spec/hatchet/rails6_spec.rb index bcc8a425b..b25a1ef1c 100644 --- a/spec/hatchet/rails6_spec.rb +++ b/spec/hatchet/rails6_spec.rb @@ -2,38 +2,12 @@ describe "Rails 6" do it "should detect successfully" do - Hatchet::App.new('rails6-basic').in_directory_fork do + Hatchet::App.new('rails61').in_directory_fork do expect(LanguagePack::Rails5.use?).to eq(false) expect(LanguagePack::Rails6.use?).to eq(true) end end - it "calls bin/yarn no matter what is on the path" do - Hatchet::Runner.new("rails6-basic").tap do |app| - # We put our version of yarn first on the path ahead of bin/yarn - # however webpacker explicitly calls bin/yarn instead of calling - # `yarn install` - app.before_deploy do - File.open("bin/yarn", "w") do |f| - f.write <<~EOM - #! /usr/bin/env bash - - echo "Called bin/yarn binstub" - `yarn install` - EOM - end - run("chmod +x bin/yarn") - end - - app.deploy do - expect(app.output).to include("Called bin/yarn binstub") - - expect(app.output).to match("rake assets:precompile") - expect(app.output).to match("rake assets:clean") - end - end - end - it "deploys and serves web requests via puma" do before_deploy = Proc.new do run! "echo 'web: bundle exec puma -t 5:5 -p ${PORT:-3000} -e ${RACK_ENV:-development}' > Procfile" @@ -43,7 +17,7 @@ run! %Q{echo 'task "assets:precompile" do ; end' > Rakefile} end - Hatchet::Runner.new('rails6-basic', before_deploy: before_deploy).deploy do |app| + Hatchet::Runner.new('rails61', before_deploy: before_deploy).deploy do |app| expect(app.output).to match("Fetching railties 6") expect(app.output).to match("rake assets:precompile") diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 795ce63f1..115ca3b18 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -18,22 +18,6 @@ def hatchet_path(path = "") Pathname(__FILE__).join("../../repos").expand_path.join(path) end -puts hatchet_path - -require 'cutlass' - -RUBY_BUILDPACK = Cutlass::LocalBuildpack.new(directory: Pathname(__dir__).join("..")) -Cutlass.config do |config| - config.default_builder = "heroku/buildpacks:20" - - # Where do your test fixtures live? - config.default_repo_dirs = hatchet_path("").children - - # Where does your buildpack live? - # Can be a directory or a Cutlass:LocalBuildpack instance - config.default_buildpack_paths = [RUBY_BUILDPACK] -end - RSpec.configure do |config| config.filter_run focused: true unless ENV['IS_RUNNING_ON_CI'] config.run_all_when_everything_filtered = true @@ -80,6 +64,10 @@ def rails_lts_config { 'BUNDLE_GEMS__RAILSLTS__COM' => ENV["RAILS_LTS_CREDS"] } end +def rails_lts_stack + "heroku-20" +end + def hatchet_path(path = "") Pathname.new(__FILE__).join("../../repos").expand_path.join(path) end From 37805fe49a9322f9bf38ffeced4f0e23087844a3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 8 Nov 2022 19:03:37 +0000 Subject: [PATCH 0891/1195] Bump json from 2.6.1 to 2.6.2 (#1319) Bumps [json](https://github.com/flori/json) from 2.6.1 to 2.6.2. - [Release notes](https://github.com/flori/json/releases) - [Changelog](https://github.com/flori/json/blob/master/CHANGES.md) - [Commits](https://github.com/flori/json/compare/v2.6.1...v2.6.2) --- updated-dependencies: - dependency-name: json dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 1f0f7fc59..094974b66 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -19,7 +19,7 @@ GEM rrrretry (~> 1) thor (~> 1) threaded (~> 0) - json (2.6.1) + json (2.6.2) moneta (1.0.0) multi_json (1.15.0) parallel (1.22.1) From 68a205978e0ea560345ab52c9037b0d0be7e558f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 8 Nov 2022 19:19:01 +0000 Subject: [PATCH 0892/1195] Bump dead_end from 3.1.1 to 4.0.0 (#1329) Bumps [dead_end](https://github.com/zombocom/dead_end) from 3.1.1 to 4.0.0. - [Release notes](https://github.com/zombocom/dead_end/releases) - [Changelog](https://github.com/ruby/syntax_suggest/blob/main/CHANGELOG.md) - [Commits](https://github.com/zombocom/dead_end/compare/v3.1.1...v4.0.0) --- updated-dependencies: - dependency-name: dead_end dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 094974b66..b54c86ab7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,7 +3,7 @@ GEM specs: ci-queue (0.22.1) citrus (3.0.2) - dead_end (3.1.1) + dead_end (4.0.0) diff-lcs (1.5.0) erubis (2.7.0) excon (0.92.4) From 804bb69146b68eeb2fa43ac2b48312620974395e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 8 Nov 2022 19:28:32 +0000 Subject: [PATCH 0893/1195] Bump rspec-core from 3.11.0 to 3.12.0 (#1330) Bumps [rspec-core](https://github.com/rspec/rspec-core) from 3.11.0 to 3.12.0. - [Release notes](https://github.com/rspec/rspec-core/releases) - [Changelog](https://github.com/rspec/rspec-core/blob/main/Changelog.md) - [Commits](https://github.com/rspec/rspec-core/compare/v3.11.0...v3.12.0) --- updated-dependencies: - dependency-name: rspec-core dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index b54c86ab7..8c47152ea 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -33,14 +33,14 @@ GEM rate_throttle_client (0.1.2) redis (4.6.0) rrrretry (1.0.0) - rspec-core (3.11.0) - rspec-support (~> 3.11.0) - rspec-expectations (3.11.0) + rspec-core (3.12.0) + rspec-support (~> 3.12.0) + rspec-expectations (3.12.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.11.0) + rspec-support (~> 3.12.0) rspec-retry (0.6.2) rspec-core (> 3.3) - rspec-support (3.11.0) + rspec-support (3.12.0) thor (1.2.1) threaded (0.0.4) toml-rb (2.1.2) From f9e29a5db0b6de17ac958d4bf1824fd66b98a317 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 9 Nov 2022 08:48:04 +0000 Subject: [PATCH 0894/1195] Bump ci-queue from 0.22.1 to 0.24.2 (#1332) Bumps [ci-queue](https://github.com/Shopify/ci-queue) from 0.22.1 to 0.24.2. - [Release notes](https://github.com/Shopify/ci-queue/releases) - [Commits](https://github.com/Shopify/ci-queue/compare/v0.22.1...v0.24.2) --- updated-dependencies: - dependency-name: ci-queue dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 8c47152ea..c6eef0bb3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ GEM remote: https://rubygems.org/ specs: - ci-queue (0.22.1) + ci-queue (0.24.2) citrus (3.0.2) dead_end (4.0.0) diff-lcs (1.5.0) From 475143eadc2bac824ef854bcc72ed629947715ae Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 9 Nov 2022 09:04:22 +0000 Subject: [PATCH 0895/1195] Bump toml-rb from 2.1.2 to 2.2.0 (#1333) Bumps [toml-rb](https://github.com/emancu/toml-rb) from 2.1.2 to 2.2.0. - [Release notes](https://github.com/emancu/toml-rb/releases) - [Commits](https://github.com/emancu/toml-rb/compare/v2.1.2...v2.2.0) --- updated-dependencies: - dependency-name: toml-rb dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index c6eef0bb3..c86b06abb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -43,7 +43,7 @@ GEM rspec-support (3.12.0) thor (1.2.1) threaded (0.0.4) - toml-rb (2.1.2) + toml-rb (2.2.0) citrus (~> 3.0, > 3.0) webrick (1.7.0) From 30d39b04bfec34b105746c336de8d794f4ea3608 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 9 Nov 2022 09:30:41 +0000 Subject: [PATCH 0896/1195] Bump excon from 0.92.4 to 0.94.0 (#1334) Bumps [excon](https://github.com/excon/excon) from 0.92.4 to 0.94.0. - [Release notes](https://github.com/excon/excon/releases) - [Changelog](https://github.com/excon/excon/blob/master/changelog.txt) - [Commits](https://github.com/excon/excon/compare/v0.92.4...v0.94.0) --- updated-dependencies: - dependency-name: excon dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index c86b06abb..176844b87 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -6,7 +6,7 @@ GEM dead_end (4.0.0) diff-lcs (1.5.0) erubis (2.7.0) - excon (0.92.4) + excon (0.94.0) heroics (0.1.2) erubis (~> 2.0) excon From 17f45ac952f73c24d6e936f2129fc8456acb3995 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 9 Nov 2022 09:39:54 +0000 Subject: [PATCH 0897/1195] Bump redis from 4.6.0 to 5.0.5 (#1335) Bumps [redis](https://github.com/redis/redis-rb) from 4.6.0 to 5.0.5. - [Release notes](https://github.com/redis/redis-rb/releases) - [Changelog](https://github.com/redis/redis-rb/blob/master/CHANGELOG.md) - [Commits](https://github.com/redis/redis-rb/compare/v4.6.0...v5.0.5) --- updated-dependencies: - dependency-name: redis dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 176844b87..7a34fae8a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,6 +3,7 @@ GEM specs: ci-queue (0.24.2) citrus (3.0.2) + connection_pool (2.3.0) dead_end (4.0.0) diff-lcs (1.5.0) erubis (2.7.0) @@ -31,7 +32,10 @@ GEM rate_throttle_client (~> 0.1.0) rake (13.0.6) rate_throttle_client (0.1.2) - redis (4.6.0) + redis (5.0.5) + redis-client (>= 0.9.0) + redis-client (0.11.1) + connection_pool rrrretry (1.0.0) rspec-core (3.12.0) rspec-support (~> 3.12.0) From c5c8d4c08e33808a50dede538f9cc541016c28a3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 9 Nov 2022 09:53:17 +0000 Subject: [PATCH 0898/1195] Bump parallel_tests from 3.8.1 to 4.0.0 (#1336) Bumps [parallel_tests](https://github.com/grosser/parallel_tests) from 3.8.1 to 4.0.0. - [Release notes](https://github.com/grosser/parallel_tests/releases) - [Changelog](https://github.com/grosser/parallel_tests/blob/master/CHANGELOG.md) - [Commits](https://github.com/grosser/parallel_tests/compare/v3.8.1...v4.0.0) --- updated-dependencies: - dependency-name: parallel_tests dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 7a34fae8a..566633250 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -24,7 +24,7 @@ GEM moneta (1.0.0) multi_json (1.15.0) parallel (1.22.1) - parallel_tests (3.8.1) + parallel_tests (4.0.0) parallel platform-api (3.3.0) heroics (~> 0.1.1) From 64c76505b548eeee030830bbb9dd8181857d9d51 Mon Sep 17 00:00:00 2001 From: Joe Krump Date: Wed, 9 Nov 2022 04:59:42 -0500 Subject: [PATCH 0899/1195] Fix typo in deploy_check.rb log message (#1323) Fix typo "comit" by replacing it with "commit" --- lib/rake/deploy_check.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rake/deploy_check.rb b/lib/rake/deploy_check.rb index d2cd40207..63b00f03c 100644 --- a/lib/rake/deploy_check.rb +++ b/lib/rake/deploy_check.rb @@ -77,7 +77,7 @@ def check_sync!(local_sha: local_commit_sha, remote_sha: remote_commit_sha) return if remote_sha == local_sha raise <<~EOM - Must be in-sync with #{@github}. Local comit: #{local_sha.inspect} #{@github}: #{remote_sha.inspect} + Must be in-sync with #{@github}. Local commit: #{local_sha.inspect} #{@github}: #{remote_sha.inspect} "Make sure that you've pulled: `git pull --rebase #{@github_url} main` EOM end From 5c7e7f64ca951a11961dc165f9d5db6aa6d6b7da Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Wed, 16 Nov 2022 11:04:04 -0600 Subject: [PATCH 0900/1195] Bundler 2.3.25 supports the new Ruby preview naming schemes (#1337) Bundler 2.3.25 supports the new Ruby preview naming schemes. Ruby previews have moved from just using the Ruby version number as the name, ala `3.0.0` and now includes the preview name like `3.2.0.preview3`. This lets us support Ruby 3.2.0.preview3. --- CHANGELOG.md | 2 ++ lib/language_pack/helpers/bundler_wrapper.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c7feb9c5..bbae1c868 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Main (unreleased) +* Bump Bundler 2 wrapper to 2.3.25 (https://github.com/heroku/heroku-buildpack-ruby/pull/1337) + ## v244 (2022/07/25) * Default Ruby version is now 3.1.2 (https://github.com/heroku/heroku-buildpack-ruby/pull/1316) diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index 6f6a5e390..a8440a3cf 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -37,7 +37,7 @@ class LanguagePack::Helpers::BundlerWrapper BLESSED_BUNDLER_VERSIONS = {} BLESSED_BUNDLER_VERSIONS["1"] = "1.17.3" - BLESSED_BUNDLER_VERSIONS["2"] = "2.3.10" + BLESSED_BUNDLER_VERSIONS["2"] = "2.3.25" BUNDLED_WITH_REGEX = /^BUNDLED WITH$(\r?\n) (?\d+)\.\d+\.\d+/m class GemfileParseError < BuildpackError From 9f382c631f2b34486f4a3b8a036946ab8f2c7c96 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Wed, 16 Nov 2022 16:44:04 -0600 Subject: [PATCH 0901/1195] v245 (#1338) * add devcenter changelog entry * add v245 * Update version.rb * Fix test Co-authored-by: Richard Schneeman --- CHANGELOG.md | 2 ++ changelogs/v245/bundler_2_3_25.md | 3 +++ lib/language_pack/version.rb | 2 +- spec/helpers/bundler_wrapper_spec.rb | 4 ++-- 4 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 changelogs/v245/bundler_2_3_25.md diff --git a/CHANGELOG.md b/CHANGELOG.md index bbae1c868..e2dacddfe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Main (unreleased) +## v245 (2022/11/16) + * Bump Bundler 2 wrapper to 2.3.25 (https://github.com/heroku/heroku-buildpack-ruby/pull/1337) ## v244 (2022/07/25) diff --git a/changelogs/v245/bundler_2_3_25.md b/changelogs/v245/bundler_2_3_25.md new file mode 100644 index 000000000..512c9d3e6 --- /dev/null +++ b/changelogs/v245/bundler_2_3_25.md @@ -0,0 +1,3 @@ +## Ruby apps with Bundler 2.x now receive version 2.3.25 + +The [Ruby Buildpack](https://devcenter.heroku.com/articles/ruby-support#libraries) now includes Bundler 2.3.25. Applications specifying Bundler 2.x in their `Gemfile.lock` will now receive this version of bundler. diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index a1631172f..3cb4e81f7 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v244" + BUILDPACK_VERSION = "v245" end end diff --git a/spec/helpers/bundler_wrapper_spec.rb b/spec/helpers/bundler_wrapper_spec.rb index 279b4f617..6d6c7229d 100644 --- a/spec/helpers/bundler_wrapper_spec.rb +++ b/spec/helpers/bundler_wrapper_spec.rb @@ -54,7 +54,7 @@ def wrapper.topic(*args); end # Silence output in tests Bundler.with_unbundled_env do @bundler.install - expect(@bundler.ruby_version).to eq("ruby-2.5.1-p0") + expect(@bundler.ruby_version).to eq("ruby-2.5.1") ruby_version = LanguagePack::RubyVersion.new(@bundler.ruby_version, is_new: true) expect(ruby_version.version_for_download).to eq("ruby-2.5.1") @@ -78,7 +78,7 @@ def wrapper.topic(*args); end # Silence output in tests @bundler.install run!(%{echo '\nputs "some output"\n' >> Gemfile}) - expect(@bundler.ruby_version).to eq("ruby-2.5.1-p0") + expect(@bundler.ruby_version).to eq("ruby-2.5.1") end end end From b37eadc5f054e345ba9a24a9bc51457fe5ced8b9 Mon Sep 17 00:00:00 2001 From: Josh W Lewis Date: Tue, 29 Nov 2022 13:44:56 -0600 Subject: [PATCH 0902/1195] Bump default Node.js and Yarn versions (#1342) * Bump default Node.js and Yarn versions * Add links to changelog * Update CHANGELOG.md Co-authored-by: Ed Morley <501702+edmorley@users.noreply.github.com> Co-authored-by: Ed Morley <501702+edmorley@users.noreply.github.com> --- CHANGELOG.md | 5 +++++ changelogs/v246/node_defaults.md | 10 ++++++++++ lib/language_pack/helpers/nodebin.rb | 4 ++-- lib/language_pack/version.rb | 2 +- 4 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 changelogs/v246/node_defaults.md diff --git a/CHANGELOG.md b/CHANGELOG.md index e2dacddfe..2d2756e93 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ ## Main (unreleased) +## v246 (2022/11/29) + +* Default Node.js version now 16.18.1 (https://github.com/heroku/heroku-buildpack-ruby/pull/1342) +* Default Yarn version now 1.22.19 (https://github.com/heroku/heroku-buildpack-ruby/pull/1342) + ## v245 (2022/11/16) * Bump Bundler 2 wrapper to 2.3.25 (https://github.com/heroku/heroku-buildpack-ruby/pull/1337) diff --git a/changelogs/v246/node_defaults.md b/changelogs/v246/node_defaults.md new file mode 100644 index 000000000..85b85959c --- /dev/null +++ b/changelogs/v246/node_defaults.md @@ -0,0 +1,10 @@ +## Ruby apps now default to Node version 16.18.1 and Yarn version 1.22.19 + +Applications using the `heroku/ruby` buildpack that do not already have `node` +and/or `yarn` installed by another buildpack (such as the `heroku/nodejs` +buildpack) will now receive: + +- Node.js version 16.18.1 (was previously 16.13.1) +- Yarn version 1.22.19 (was previously 1.22.17) + +These versions and instructions on how to specify a specific version of these binaries can be found on the [installed binaries section of the Heroku Ruby Support page](https://devcenter.heroku.com/articles/ruby-support#installed-binaries). diff --git a/lib/language_pack/helpers/nodebin.rb b/lib/language_pack/helpers/nodebin.rb index 2bf31bdd8..4e2c895a2 100644 --- a/lib/language_pack/helpers/nodebin.rb +++ b/lib/language_pack/helpers/nodebin.rb @@ -2,7 +2,7 @@ class LanguagePack::Helpers::Nodebin def self.hardcoded_node_lts - version = "16.13.1" + version = "16.18.1" { "number" => version, "url" => "https://heroku-nodebin.s3.us-east-1.amazonaws.com/node/release/linux-x64/node-v#{version}-linux-x64.tar.gz" @@ -10,7 +10,7 @@ def self.hardcoded_node_lts end def self.hardcoded_yarn - version = "1.22.17" + version = "1.22.19" { "number" => version, "url" => "https://heroku-nodebin.s3.us-east-1.amazonaws.com/yarn/release/yarn-v#{version}.tar.gz" diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 3cb4e81f7..821e1a603 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v245" + BUILDPACK_VERSION = "v246" end end From a9889fe78d6a3d871899c5cc9f72dfb4aa1a02be Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Tue, 6 Dec 2022 10:08:11 -0600 Subject: [PATCH 0903/1195] v247 (#1343) * v247 * change redis addon to mini for EFP * Disable hatchet run multi The way run multi works is by running multiple `heroku run` commands at the same time. This is much faster than doing them serially. The problem is that one restriction of free Heroku dynes was (key word) that you cannot have more than one dyno running at a time. To get around this limitation, hatchet facilitates scaling dynos up to standard-1 and down back to free, which no longer exists. This is code inside of hatchet that now fails: ```ruby if @run_multi_is_setup @run_multi_array.map(&:join) platform_api.formation.update(name, "web", {"size" => "free"}) end ``` We can avoid this problem in the short term by removing the need to call `run_multi`. Co-authored-by: Richard Schneeman --- CHANGELOG.md | 4 ++++ app.json | 2 +- changelogs/v247/jruby_releases.md | 10 ++++++++++ lib/language_pack/version.rb | 2 +- spec/hatchet/bundler_spec.rb | 20 ++++++++++---------- 5 files changed, 26 insertions(+), 12 deletions(-) create mode 100644 changelogs/v247/jruby_releases.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d2756e93..0b7f0f121 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Main (unreleased) +## v247 (2022/12/01) + +* JRuby 9.3.7.0, 9.3.8.0, 9.3.9.0, 9.4.0.0 + ## v246 (2022/11/29) * Default Node.js version now 16.18.1 (https://github.com/heroku/heroku-buildpack-ruby/pull/1342) diff --git a/app.json b/app.json index 9f743dcb3..f0c801d15 100644 --- a/app.json +++ b/app.json @@ -4,7 +4,7 @@ "environments": { "test": { "addons": [ - "heroku-redis:hobby-dev" + "heroku-redis:mini" ], "env": { "HATCHET_RETRIES": "3", diff --git a/changelogs/v247/jruby_releases.md b/changelogs/v247/jruby_releases.md new file mode 100644 index 000000000..8f3903fa2 --- /dev/null +++ b/changelogs/v247/jruby_releases.md @@ -0,0 +1,10 @@ +## JRuby versions 9.4.0.0, 9.3.9.0, 9.3.8.0, and 9.3.7.0 are now available + +The following Ruby versions are now available on the Heroku platform: + +- JRuby 9.4.0.0 +- JRuby 9.3.9.0 +- JRuby 9.3.8.0 +- JRuby 9.3.7.0 + +You can see the latest versions on the [Ruby support page](https://devcenter.heroku.com/articles/ruby-support). diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 821e1a603..91a9592e0 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v246" + BUILDPACK_VERSION = "v247" end end diff --git a/spec/hatchet/bundler_spec.rb b/spec/hatchet/bundler_spec.rb index 3b57a2791..947f8518d 100644 --- a/spec/hatchet/bundler_spec.rb +++ b/spec/hatchet/bundler_spec.rb @@ -16,7 +16,7 @@ abi_version[-1] = "0" # turn 2.5.7 into 2.5.0 pending("Must enable HATCHET_EXPENSIVE_MODE") unless ENV["HATCHET_EXPENSIVE_MODE"] - Hatchet::Runner.new("default_ruby", run_multi: true, stack: "heroku-18").tap do |app| + Hatchet::Runner.new("default_ruby", stack: "heroku-18").tap do |app| app.before_deploy do run!(%Q{echo "ruby '#{ruby_version}'" >> Gemfile}) run!(%Q{printf "\nBUNDLED WITH\n 2.0.1\n" >> Gemfile.lock}) @@ -29,11 +29,11 @@ app.commit! app.push! - app.run_multi("ls vendor/bundle/ruby/#{abi_version}/gems") do |ls_output| - expect(ls_output).to match("rake-") - end + # app.run_multi("ls vendor/bundle/ruby/#{abi_version}/gems") do |ls_output| + # expect(ls_output).to match("rake-") + # end - app.run_multi("which -a rake") do |which_rake| + app.run("which -a rake") do |which_rake| expect(which_rake).to include("/app/vendor/bundle/bin/rake") expect(which_rake).to include("/app/vendor/bundle/ruby/#{abi_version}/bin/rake") end @@ -46,7 +46,7 @@ abi_version[-1] = "0" # turn 2.6.6 into 2.6.0 pending("Must enable HATCHET_EXPENSIVE_MODE") unless ENV["HATCHET_EXPENSIVE_MODE"] - Hatchet::Runner.new("default_ruby", run_multi: true).tap do |app| + Hatchet::Runner.new("default_ruby").tap do |app| app.before_deploy do run!(%Q{printf "\nBUNDLED WITH\n 1.0.1\n" >> Gemfile.lock}) end @@ -54,11 +54,11 @@ expect(app.output).to match("Installing dependencies using bundler 1.") expect(app.output).to match("BUNDLE_GLOBAL_PATH_APPENDS_RUBY_SCOPE=1") - app.run_multi("ls vendor/bundle/ruby/#{abi_version}/gems") do |ls_output| - expect(ls_output).to match("rake-") - end + # app.run_multi("ls vendor/bundle/ruby/#{abi_version}/gems") do |ls_output| + # expect(ls_output).to match("rake-") + # end - app.run_multi("which -a rake") do |which_rake| + app.run("which -a rake") do |which_rake| expect(which_rake).to include("/app/vendor/bundle/bin/rake") expect(which_rake).to include("/app/vendor/bundle/ruby/#{abi_version}/bin/rake") end From 104fe3a374e07a8f3723f110c2148d57ecb9ee79 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Tue, 6 Dec 2022 11:18:41 -0600 Subject: [PATCH 0904/1195] v248 (#1345) --- CHANGELOG.md | 4 ++++ changelogs/v248/ruby-320-rc1.md | 10 ++++++++++ lib/language_pack/version.rb | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 changelogs/v248/ruby-320-rc1.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b7f0f121..8a29d5a8e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Main (unreleased) +## v248 (2022/12/06) + +* Ruby 3.2.0-rc1 is available + ## v247 (2022/12/01) * JRuby 9.3.7.0, 9.3.8.0, 9.3.9.0, 9.4.0.0 diff --git a/changelogs/v248/ruby-320-rc1.md b/changelogs/v248/ruby-320-rc1.md new file mode 100644 index 000000000..a5b98326b --- /dev/null +++ b/changelogs/v248/ruby-320-rc1.md @@ -0,0 +1,10 @@ +# Ruby version 3.2.0-rc1 is now available + +The following Ruby versions are now available on the Heroku platform: + +- Ruby 3.2.0-rc1 + +>note +>Stability-sensitive applications should not use Ruby 3.2.0 in it's release candidate state. + +You can see the latest versions on the [Ruby support page](https://devcenter.heroku.com/articles/ruby-support). diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 91a9592e0..8c8815b0f 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v247" + BUILDPACK_VERSION = "v248" end end From 129f77bb39d39fc2ada25cab133ae503d7f3d9f7 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Fri, 16 Dec 2022 10:23:44 -0600 Subject: [PATCH 0905/1195] Skip db add-on with HEROKU_SKIP_DATABASE_PROVISION (#1349) * Skip db add-on with HEROKU_SKIP_DATABASE_PROVISION When applications are deployed to Heroku, the last buildpack to execute can request addons are provisioned via the [`bin/release` interface](https://devcenter.heroku.com/articles/buildpack-api#bin-release). The `heroku/ruby` buildpack checks if the application [contains a postgres gem](https://github.com/heroku/heroku-buildpack-ruby/blob/104fe3a374e07a8f3723f110c2148d57ecb9ee79/lib/language_pack/ruby.rb#L992-L1008) and request that Heroku provision a database for the application automatically. Before the change to pricing, the database requested was free and the addition of this addon by the buildpack would save developers time while setting up applications. Developers using the `heroku/ruby` buildpack to deploy new applications who do not want this behavior can opt-out by setting the environment variable: ```shell $ heroku config:set HEROKU_SKIP_DATABASE_PROVISION=1 ``` This will prevent the database from being requested. This environement variable only affects `heroku/ruby` users and only affects applications that have not had a successful first deployment. This environment variable interface is experiemental and subject to change. Before any change, a deprecation warning will be emitted from the `heroku/ruby` buildpack on deployment with additional details. For more information see [Ruby database provisioning](https://devcenter.heroku.com/articles/ruby-database-provisioning). * v249 * Apply suggestions from code review Update wording Co-authored-by: Ed Morley <501702+edmorley@users.noreply.github.com> Co-authored-by: Ed Morley <501702+edmorley@users.noreply.github.com> --- CHANGELOG.md | 4 ++++ changelogs/v249/skip_database_provision.md | 15 +++++++++++++++ lib/language_pack/ruby.rb | 2 ++ lib/language_pack/version.rb | 2 +- 4 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 changelogs/v249/skip_database_provision.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a29d5a8e..3e1d87158 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Main (unreleased) +## v249 (2022/12/16) + +* Apps with the environment variable `HEROKU_SKIP_DATABASE_PROVISION=1` set will no longer receive a database on the first push to a new Heroku app. This environment variable interface is not standard across other buildpacks and may be deprecated via warnings in the build output and changed in the future. + ## v248 (2022/12/06) * Ruby 3.2.0-rc1 is available diff --git a/changelogs/v249/skip_database_provision.md b/changelogs/v249/skip_database_provision.md new file mode 100644 index 000000000..4536d2c85 --- /dev/null +++ b/changelogs/v249/skip_database_provision.md @@ -0,0 +1,15 @@ +## Apps that use the `heroku/ruby` buildpack can now skip automatic database provisioning using an environment variable + +When applications are deployed to Heroku, the last buildpack to execute can request add-ons are provisioned via the [`bin/release` interface](https://devcenter.heroku.com/articles/buildpack-api#bin-release). The `heroku/ruby` buildpack checks if the application [contains a Postgres gem](https://github.com/heroku/heroku-buildpack-ruby/blob/104fe3a374e07a8f3723f110c2148d57ecb9ee79/lib/language_pack/ruby.rb#L992-L1008) and requests that Heroku provision a database for the application automatically. Before the pricing change, the database requested was free, and adding this add-on by the buildpack would save developers time while setting up applications. + +Developers using the `heroku/ruby` buildpack to deploy new applications who do not want this behavior can now opt out by setting the `HEROKU_SKIP_DATABASE_PROVISION` environment variable: + +```shell +$ heroku config:set HEROKU_SKIP_DATABASE_PROVISION=1 +``` + +This setting will prevent the database from being requested. This environment variable only affects `heroku/ruby` users and only affects applications without a successful first deployment. Any already deployed applications that do not want a Heroku database must manually remove their add-on. + +This environment variable interface is experimental and subject to change. Before any change, a deprecation warning will be emitted from the `heroku/ruby` buildpack on deployment with additional details. + +For more information, see [Ruby database provisioning](https://devcenter.heroku.com/articles/ruby-database-provisioning). diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index db2101f91..81784e273 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -992,6 +992,8 @@ def allow_git(&blk) # decides if we need to enable the dev database addon # @return [Array] the database addon if the pg gem is detected or an empty Array if it isn't. def add_dev_database_addon + return [] if env("HEROKU_SKIP_DATABASE_PROVISION") + pg_adapters.any? {|a| bundler.has_gem?(a) } ? ['heroku-postgresql'] : [] end diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 8c8815b0f..c77e5b012 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v248" + BUILDPACK_VERSION = "v249" end end From a1dc09a93fc81a73482d6db0ecb02298001d5af4 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Mon, 26 Dec 2022 04:16:30 -0600 Subject: [PATCH 0906/1195] v250 for Ruby 3.2.0 release (#1351) --- CHANGELOG.md | 4 ++++ changelogs/v250/ruby-320.md | 7 +++++++ 2 files changed, 11 insertions(+) create mode 100644 changelogs/v250/ruby-320.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e1d87158..3e8d3b89d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Main (unreleased) +## v250 (2022/12/25) + +* Ruby 3.2.0 is available + ## v249 (2022/12/16) * Apps with the environment variable `HEROKU_SKIP_DATABASE_PROVISION=1` set will no longer receive a database on the first push to a new Heroku app. This environment variable interface is not standard across other buildpacks and may be deprecated via warnings in the build output and changed in the future. diff --git a/changelogs/v250/ruby-320.md b/changelogs/v250/ruby-320.md new file mode 100644 index 000000000..c29c97228 --- /dev/null +++ b/changelogs/v250/ruby-320.md @@ -0,0 +1,7 @@ +# Ruby version 3.2.0 is now available + +The following Ruby versions are now available on the Heroku platform: + +- Ruby 3.2.0 + +You can see the latest versions on the [Ruby support page](https://devcenter.heroku.com/articles/ruby-support). From b4a9ceb0c2f2f4c985d2ba993c23f8612e9c1c89 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Fri, 3 Feb 2023 12:02:27 -0600 Subject: [PATCH 0907/1195] Release Jruby 9.3.10.0 (#1359) heroku/docker-heroku-jruby-builder#17 --- CHANGELOG.md | 4 ++++ lib/language_pack/version.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e8d3b89d..664be1461 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Main (unreleased) +## v251 (2023/02/03) + +* Jruby 9.3.10.0 is available + ## v250 (2022/12/25) * Ruby 3.2.0 is available diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index c77e5b012..bc7ee8e9a 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v249" + BUILDPACK_VERSION = "v251" end end From 1beb2072cbce824e9a35266ab066193156aba6a3 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Wed, 8 Feb 2023 13:06:12 -0600 Subject: [PATCH 0908/1195] Update buildpack for Ruby and JRuby binary release (#1360) --- CHANGELOG.md | 5 +++++ changelogs/v252/jruby-9-4-1-0.md | 7 +++++++ changelogs/v252/ruby-3-2-1.md | 7 +++++++ lib/language_pack/version.rb | 2 +- 4 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 changelogs/v252/jruby-9-4-1-0.md create mode 100644 changelogs/v252/ruby-3-2-1.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 664be1461..2d4f847fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ ## Main (unreleased) +## v252 (2023/02/08) + +* Ruby 3.2.1 is now available +* JRuby 9.4.1.0 is now available + ## v251 (2023/02/03) * Jruby 9.3.10.0 is available diff --git a/changelogs/v252/jruby-9-4-1-0.md b/changelogs/v252/jruby-9-4-1-0.md new file mode 100644 index 000000000..6f5c6b945 --- /dev/null +++ b/changelogs/v252/jruby-9-4-1-0.md @@ -0,0 +1,7 @@ +## JRuby 9.4.1.0 is now available + +The following Ruby versions are now available on the Heroku platform: + +- JRuby 9.4.1.0 + +You can see the latest versions on the [Ruby support page](https://devcenter.heroku.com/articles/ruby-support). diff --git a/changelogs/v252/ruby-3-2-1.md b/changelogs/v252/ruby-3-2-1.md new file mode 100644 index 000000000..3625cb424 --- /dev/null +++ b/changelogs/v252/ruby-3-2-1.md @@ -0,0 +1,7 @@ +# Ruby version 3.2.1 is now available + +The following Ruby versions are now available on the Heroku platform: + +- Ruby 3.2.1 + +You can see the latest versions on the [Ruby support page](https://devcenter.heroku.com/articles/ruby-support). diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index bc7ee8e9a..bc5d66752 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v251" + BUILDPACK_VERSION = "v252" end end From 931af31954b43133a01c2e35367cb3a7e07dd05f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 2 Mar 2023 10:08:19 +0000 Subject: [PATCH 0909/1195] Bump json from 2.6.2 to 2.6.3 (#1344) Bumps [json](https://github.com/flori/json) from 2.6.2 to 2.6.3. - [Release notes](https://github.com/flori/json/releases) - [Changelog](https://github.com/flori/json/blob/master/CHANGES.md) - [Commits](https://github.com/flori/json/compare/v2.6.2...v2.6.3) --- updated-dependencies: - dependency-name: json dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 566633250..c38174127 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -20,7 +20,7 @@ GEM rrrretry (~> 1) thor (~> 1) threaded (~> 0) - json (2.6.2) + json (2.6.3) moneta (1.0.0) multi_json (1.15.0) parallel (1.22.1) From 8a161e4506f9d9b0dfe949e09d990cd2d3a8bd6a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 2 Mar 2023 10:18:00 +0000 Subject: [PATCH 0910/1195] Bump rspec-core from 3.12.0 to 3.12.1 (#1363) Bumps [rspec-core](https://github.com/rspec/rspec-core) from 3.12.0 to 3.12.1. - [Release notes](https://github.com/rspec/rspec-core/releases) - [Changelog](https://github.com/rspec/rspec-core/blob/main/Changelog.md) - [Commits](https://github.com/rspec/rspec-core/compare/v3.12.0...v3.12.1) --- updated-dependencies: - dependency-name: rspec-core dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index c38174127..0c78499f9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -37,7 +37,7 @@ GEM redis-client (0.11.1) connection_pool rrrretry (1.0.0) - rspec-core (3.12.0) + rspec-core (3.12.1) rspec-support (~> 3.12.0) rspec-expectations (3.12.0) diff-lcs (>= 1.2.0, < 2.0) From 49382c8e0a50355effcd7124e40b37e555297bab Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 2 Mar 2023 10:31:01 +0000 Subject: [PATCH 0911/1195] Bump excon from 0.94.0 to 0.99.0 (#1364) Bumps [excon](https://github.com/excon/excon) from 0.94.0 to 0.99.0. - [Release notes](https://github.com/excon/excon/releases) - [Changelog](https://github.com/excon/excon/blob/master/changelog.txt) - [Commits](https://github.com/excon/excon/compare/v0.94.0...v0.99.0) --- updated-dependencies: - dependency-name: excon dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 0c78499f9..9a8f7724a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -7,7 +7,7 @@ GEM dead_end (4.0.0) diff-lcs (1.5.0) erubis (2.7.0) - excon (0.94.0) + excon (0.99.0) heroics (0.1.2) erubis (~> 2.0) excon From a748e215f4130f7401a367cc8f063691f99ab268 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 7 Mar 2023 12:51:43 +0000 Subject: [PATCH 0912/1195] Bump heroku_hatchet from 7.3.4 to 8.0.2 (#1367) Bumps [heroku_hatchet](https://github.com/heroku/hatchet) from 7.3.4 to 8.0.2. - [Release notes](https://github.com/heroku/hatchet/releases) - [Changelog](https://github.com/heroku/hatchet/blob/main/CHANGELOG.md) - [Commits](https://github.com/heroku/hatchet/compare/v7.3.4...v8.0.2) --- updated-dependencies: - dependency-name: heroku_hatchet dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 9a8f7724a..1f4cbc013 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -14,7 +14,7 @@ GEM moneta multi_json (>= 1.9.2) webrick - heroku_hatchet (7.3.4) + heroku_hatchet (8.0.2) excon (~> 0) platform-api (~> 3) rrrretry (~> 1) @@ -26,7 +26,7 @@ GEM parallel (1.22.1) parallel_tests (4.0.0) parallel - platform-api (3.3.0) + platform-api (3.5.0) heroics (~> 0.1.1) moneta (~> 1.0.0) rate_throttle_client (~> 0.1.0) @@ -49,7 +49,7 @@ GEM threaded (0.0.4) toml-rb (2.2.0) citrus (~> 3.0, > 3.0) - webrick (1.7.0) + webrick (1.8.1) PLATFORMS ruby From 825c2a4d5bd622727572c60061b4f8b17e1da676 Mon Sep 17 00:00:00 2001 From: Ed Morley <501702+edmorley@users.noreply.github.com> Date: Tue, 7 Mar 2023 13:10:25 +0000 Subject: [PATCH 0913/1195] Add a scheduled Hatchet app cleaner workflow (#1366) As of Hatchet v8.x, Hatchet now: - Removes the apps it creates after each test runs, rather than only enabling maintenance mode. This occurs even if an individual test fails. - Cleans up older apps iff it runs into the app limit. (This is only done when the app limit is hit, in order to prevent hundreds of unnecessary API requests, when test concurrency is high.) However, leftover apps can still occur in the following cases: - The GitHub Actions run is cancelled, or aborts in a non-clean way. - If a Hatchet bug (or a mis-use of Hatchet by the tests) cause Hatchet to exit non-cleanly. - If there is a platform incident causing the Heroku API to not be available. Therefore, this scheduled cleanup job has been added to catch any such leftover apps. It runs daily at 6am UTC, and can also be triggered manually via the GitHub dashboard. The cleanup job only deletes apps older than 10 minutes, so that it doesn't break any in progress CI jobs. GUS-W-12629391. --- .github/workflows/hatchet_app_cleaner.yml | 31 +++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/hatchet_app_cleaner.yml diff --git a/.github/workflows/hatchet_app_cleaner.yml b/.github/workflows/hatchet_app_cleaner.yml new file mode 100644 index 000000000..45d95ad10 --- /dev/null +++ b/.github/workflows/hatchet_app_cleaner.yml @@ -0,0 +1,31 @@ +name: Hatchet app cleaner + +on: + schedule: + # Daily at 6am UTC. + - cron: "0 6 * * *" + # Allow the workflow to be manually triggered too. + workflow_dispatch: + +permissions: + contents: read + +jobs: + hatchet-app-cleaner: + runs-on: ubuntu-latest + env: + HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} + HEROKU_API_USER: ${{ secrets.HEROKU_API_USER }} + HEROKU_DISABLE_AUTOUPDATE: 1 + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Install Ruby and dependencies + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + ruby-version: "2.7" + - name: Run Hatchet destroy + # Only apps older than 10 minutes are destroyed, to ensure that any + # in progress CI runs are not interrupted. + run: bundle exec hatchet destroy --older-than 10 From eb7fce53ca7b685b3486cabf866c1b50b2922052 Mon Sep 17 00:00:00 2001 From: Ed Morley <501702+edmorley@users.noreply.github.com> Date: Tue, 7 Mar 2023 13:58:18 +0000 Subject: [PATCH 0914/1195] Switch Hatchet app cleaner to Ruby 3.1 (#1368) Since this repo's `Gemfile` requires Ruby 3.1. Resolves: ``` Your Ruby version is 2.7.7, but your Gemfile specified 3.1.2 ``` From: https://github.com/heroku/heroku-buildpack-ruby/actions/runs/4354507220/jobs/7609892161 --- .github/workflows/hatchet_app_cleaner.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/hatchet_app_cleaner.yml b/.github/workflows/hatchet_app_cleaner.yml index 45d95ad10..4b93ac11f 100644 --- a/.github/workflows/hatchet_app_cleaner.yml +++ b/.github/workflows/hatchet_app_cleaner.yml @@ -24,7 +24,7 @@ jobs: uses: ruby/setup-ruby@v1 with: bundler-cache: true - ruby-version: "2.7" + ruby-version: "3.1" - name: Run Hatchet destroy # Only apps older than 10 minutes are destroyed, to ensure that any # in progress CI runs are not interrupted. From 17d090c69acd65d93ed99e5c3e9d753c6969fee0 Mon Sep 17 00:00:00 2001 From: Ed Morley <501702+edmorley@users.noreply.github.com> Date: Tue, 7 Mar 2023 20:01:11 +0000 Subject: [PATCH 0915/1195] Relax Ruby constraint in Gemfile (#1371) So that the Hatchet app cleaner can use latest Ruby 3.1. Resolves: ``` Your Ruby version is 3.1.3, but your Gemfile specified 3.1.2 ``` From: https://github.com/heroku/heroku-buildpack-ruby/actions/runs/4355145552/jobs/7611367502 Follow-up to #1366 and #1368. --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index b69e4b1d1..c887ccc55 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ source "https://rubygems.org" git_source(:github) { |repo| "https://github.com/#{repo}.git" } -ruby '3.1.2' +ruby '>= 3.1', '< 3.3' group :development, :test do gem "toml-rb" From 551f1621b3c54191d6346fffff0edbcb3deeb139 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 14 Mar 2023 09:10:19 +0000 Subject: [PATCH 0916/1195] Bump rspec-expectations from 3.12.0 to 3.12.2 (#1372) Bumps [rspec-expectations](https://github.com/rspec/rspec-expectations) from 3.12.0 to 3.12.2. - [Release notes](https://github.com/rspec/rspec-expectations/releases) - [Changelog](https://github.com/rspec/rspec-expectations/blob/main/Changelog.md) - [Commits](https://github.com/rspec/rspec-expectations/compare/v3.12.0...v3.12.2) --- updated-dependencies: - dependency-name: rspec-expectations dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 1f4cbc013..999866dc2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -39,7 +39,7 @@ GEM rrrretry (1.0.0) rspec-core (3.12.1) rspec-support (~> 3.12.0) - rspec-expectations (3.12.0) + rspec-expectations (3.12.2) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) rspec-retry (0.6.2) From 7a3d86f025002ba9c7f07e079d9b81783a2d78d7 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Fri, 31 Mar 2023 10:19:09 -0500 Subject: [PATCH 0917/1195] v253 (#1375) --- CHANGELOG.md | 4 ++++ changelogs/v253/ruby_278_306_314_322.md | 10 ++++++++++ lib/language_pack/version.rb | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 changelogs/v253/ruby_278_306_314_322.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d4f847fd..1585025e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Main (unreleased) +## v253 (2023/03/31) + +- Ruby versions 2.7.8, 3.0.6, 3.1.4, 3.2.2 are now available + ## v252 (2023/02/08) * Ruby 3.2.1 is now available diff --git a/changelogs/v253/ruby_278_306_314_322.md b/changelogs/v253/ruby_278_306_314_322.md new file mode 100644 index 000000000..1d2a5a60d --- /dev/null +++ b/changelogs/v253/ruby_278_306_314_322.md @@ -0,0 +1,10 @@ +## Ruby versions 2.7.8, 3.0.6, 3.1.4, 3.2.2 are now available + +The following Ruby versions are now available on the Heroku platform: + +- Ruby 2.7.8 +- Ruby 3.0.6 +- Ruby 3.1.4 +- Ruby 3.2.2 + +You can see the latest versions on the [Ruby support page](https://devcenter.heroku.com/articles/ruby-support). diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index bc5d66752..0d848a50f 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v252" + BUILDPACK_VERSION = "v253" end end From 6a9a81ad880359df509b2ef499fbe19d82f70f86 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Fri, 12 May 2023 11:02:56 -0500 Subject: [PATCH 0918/1195] Ruby 3.3.0-preview1 (#1380) * Ruby 3.3.0-preview1 * v254 * Default Ruby version is now 3.1.4 --- CHANGELOG.md | 5 +++ Gemfile.lock | 2 +- buildpack.toml | 13 ++---- changelogs/v254/default-ruby-314.md | 3 ++ changelogs/v254/ruby-330-preview1.md | 11 +++++ hatchet.lock | 2 +- .../helpers/download_presence.rb | 4 +- lib/language_pack/ruby_version.rb | 4 +- lib/language_pack/shell_helpers.rb | 2 + lib/language_pack/version.rb | 2 +- lib/rake/tarballer.rb | 2 +- spec/hatchet/bugs_spec.rb | 9 +--- spec/hatchet/bundler_spec.rb | 31 ------------- spec/hatchet/ci_spec.rb | 6 --- spec/hatchet/rails5_spec.rb | 44 ------------------- spec/hatchet/stack_spec.rb | 26 ----------- spec/helpers/bundler_wrapper_spec.rb | 15 +------ 17 files changed, 35 insertions(+), 146 deletions(-) create mode 100644 changelogs/v254/default-ruby-314.md create mode 100644 changelogs/v254/ruby-330-preview1.md delete mode 100644 spec/hatchet/rails5_spec.rb delete mode 100644 spec/hatchet/stack_spec.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index 1585025e2..a274e40f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ ## Main (unreleased) +## v254 (2023/05/12) + +- Default Ruby version is now 3.1.4 +- Ruby 3.3.0-preview1 is now available + ## v253 (2023/03/31) - Ruby versions 2.7.8, 3.0.6, 3.1.4, 3.2.2 are now available diff --git a/Gemfile.lock b/Gemfile.lock index 999866dc2..d304163a9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -69,7 +69,7 @@ DEPENDENCIES toml-rb RUBY VERSION - ruby 3.1.2p20 + ruby 3.1.4p223 BUNDLED WITH 2.3.10 diff --git a/buildpack.toml b/buildpack.toml index 6548cf3da..a0ec7cf45 100644 --- a/buildpack.toml +++ b/buildpack.toml @@ -5,7 +5,7 @@ id = "heroku/ruby" version = "0.1.4" name = "Ruby" homepage = "https://github.com/heroku/heroku-buildpack-ruby" -ruby_version = "3.1.2" +ruby_version = "3.1.4" [publish] @@ -13,20 +13,13 @@ ruby_version = "3.1.2" files = ["spec/"] [[publish.Vendor]] -url = "https://heroku-buildpack-ruby.s3.us-east-1.amazonaws.com/heroku-18/ruby-3.1.2.tgz" -dir = "vendor/ruby/heroku-18" - -[[publish.Vendor]] -url = "https://heroku-buildpack-ruby.s3.us-east-1.amazonaws.com/heroku-20/ruby-3.1.2.tgz" +url = "https://heroku-buildpack-ruby.s3.us-east-1.amazonaws.com/heroku-20/ruby-3.1.4.tgz" dir = "vendor/ruby/heroku-20" [[publish.Vendor]] -url = "https://heroku-buildpack-ruby.s3.us-east-1.amazonaws.com/heroku-22/ruby-3.1.2.tgz" +url = "https://heroku-buildpack-ruby.s3.us-east-1.amazonaws.com/heroku-22/ruby-3.1.4.tgz" dir = "vendor/ruby/heroku-22" -[[stacks]] -id = "heroku-18" - [[stacks]] id = "heroku-20" diff --git a/changelogs/v254/default-ruby-314.md b/changelogs/v254/default-ruby-314.md new file mode 100644 index 000000000..69f3d431d --- /dev/null +++ b/changelogs/v254/default-ruby-314.md @@ -0,0 +1,3 @@ +## Default Ruby version for new apps is now 3.1.4 + +The [default Ruby version for new Ruby applications is 3.1.4](https://devcenter.heroku.com/articles/ruby-support#default-ruby-version-for-new-apps). You’ll only get the default if the application does not specify a ruby version. diff --git a/changelogs/v254/ruby-330-preview1.md b/changelogs/v254/ruby-330-preview1.md new file mode 100644 index 000000000..a046ae121 --- /dev/null +++ b/changelogs/v254/ruby-330-preview1.md @@ -0,0 +1,11 @@ +# Ruby version 3.3.0-preview1 is now available + +[Ruby v3.3.0 preview1](/articles/ruby-support#ruby-versions) is now available on Heroku. To run your app using this preview version of Ruby, add the following `ruby` directive to your Gemfile: + +```ruby +ruby "3.3.0" +``` + +For more information on [Ruby 3.3.0-preview1, you can view the release announcement](https://www.ruby-lang.org/en/news/). + +Note: This version of Ruby is not suitable for production applications. However, it can be used to test that your application is ready for the December release of Ruby 3.3.0 and to [provide feedback](https://bugs.ruby-lang.org/projects/ruby-master/issues) to the Ruby core team. diff --git a/hatchet.lock b/hatchet.lock index 92b59e0d6..c8fe801e9 100644 --- a/hatchet.lock +++ b/hatchet.lock @@ -26,7 +26,7 @@ - - "./repos/jruby/jruby_naether" - 4a11f8af5a3cca21f3659394e5bbac3cca9b6a2c - - "./repos/node/minimal_webpacker" - - 9d55c0ee923824829305eb23e23b7ff98d2ee3ba + - 9152fec98df59a0bf8a5478ed428841ee135acbb - - "./repos/rack/default_ruby" - master - - "./repos/rack/mri_187_nokogiri" diff --git a/lib/language_pack/helpers/download_presence.rb b/lib/language_pack/helpers/download_presence.rb index f337fe226..68e35d99b 100644 --- a/lib/language_pack/helpers/download_presence.rb +++ b/lib/language_pack/helpers/download_presence.rb @@ -8,7 +8,7 @@ # # download = LanguagePack::Helpers::DownloadPresence.new( # 'ruby-1.9.3.tgz', -# stacks: ['heroku-18', 'heroku-20'] +# stacks: ['heroku-20', 'heroku-22'] # ) # # download.call @@ -16,7 +16,7 @@ # puts download.exists? #=> true # puts download.valid_stack_list #=> ['cedar-14'] class LanguagePack::Helpers::DownloadPresence - STACKS = ['heroku-18', 'heroku-20', 'heroku-22'] + STACKS = ['heroku-20', 'heroku-22'] def initialize(path, stacks: STACKS) @path = path diff --git a/lib/language_pack/ruby_version.rb b/lib/language_pack/ruby_version.rb index 3af949c4e..3d5c17fc3 100644 --- a/lib/language_pack/ruby_version.rb +++ b/lib/language_pack/ruby_version.rb @@ -12,8 +12,8 @@ def initialize(output = "") end end - BOOTSTRAP_VERSION_NUMBER = "3.1.2".freeze - DEFAULT_VERSION_NUMBER = "3.1.2".freeze + BOOTSTRAP_VERSION_NUMBER = "3.1.4".freeze + DEFAULT_VERSION_NUMBER = "3.1.4".freeze DEFAULT_VERSION = "ruby-#{DEFAULT_VERSION_NUMBER}".freeze LEGACY_VERSION_NUMBER = "1.9.2".freeze LEGACY_VERSION = "ruby-#{LEGACY_VERSION_NUMBER}".freeze diff --git a/lib/language_pack/shell_helpers.rb b/lib/language_pack/shell_helpers.rb index 87b1a40e0..54d11d67f 100644 --- a/lib/language_pack/shell_helpers.rb +++ b/lib/language_pack/shell_helpers.rb @@ -169,6 +169,8 @@ def initialize(command, options = {}) raise "Cannot specify :file, and :out" if options[:out] @file = Pathname.new(@file) @file.dirname.mkpath + FileUtils.touch(@file) + options[:out] = ">> #{@file} 2>&1" end diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 0d848a50f..183d995ed 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v253" + BUILDPACK_VERSION = "v254" end end diff --git a/lib/rake/tarballer.rb b/lib/rake/tarballer.rb index 005225ec0..be87a68b3 100644 --- a/lib/rake/tarballer.rb +++ b/lib/rake/tarballer.rb @@ -12,7 +12,7 @@ # In addition to TAR logic it also vendors ruby versions so # they don't need to be pulled at runtime class Tarballer - STACKS = %W{heroku-18 heroku-20} + STACKS = %W{heroku-20 heroku-22} def initialize(name: , directory: , io: STDOUT) @name = name diff --git a/spec/hatchet/bugs_spec.rb b/spec/hatchet/bugs_spec.rb index e10c1c145..f1ca04ca0 100644 --- a/spec/hatchet/bugs_spec.rb +++ b/spec/hatchet/bugs_spec.rb @@ -1,16 +1,9 @@ require_relative '../spec_helper' describe "Bugs" do - it "nokogiri should use the system libxml2" do - Hatchet::Runner.new("nokogiri_160").deploy do |app| - expect(app.output).to match("nokogiri") - expect(app.run("bundle exec nokogiri -v")).not_to include("WARNING: Nokogiri was built against LibXML version") - end - end - context "database connections" do it "fails with better error message" do - Hatchet::Runner.new("ruby-getting-started", allow_failure: true).tap do |app| + Hatchet::Runner.new("ruby-getting-started", allow_failure: true).tap do |app| app.before_deploy do Pathname("Rakefile").write(<<~EOM) require 'bundler' diff --git a/spec/hatchet/bundler_spec.rb b/spec/hatchet/bundler_spec.rb index 947f8518d..e343e1ed6 100644 --- a/spec/hatchet/bundler_spec.rb +++ b/spec/hatchet/bundler_spec.rb @@ -10,37 +10,6 @@ end end - it "deploys with version 2.x with Ruby 2.5" do - ruby_version = "2.5.7" - abi_version = ruby_version.dup - abi_version[-1] = "0" # turn 2.5.7 into 2.5.0 - pending("Must enable HATCHET_EXPENSIVE_MODE") unless ENV["HATCHET_EXPENSIVE_MODE"] - - Hatchet::Runner.new("default_ruby", stack: "heroku-18").tap do |app| - app.before_deploy do - run!(%Q{echo "ruby '#{ruby_version}'" >> Gemfile}) - run!(%Q{printf "\nBUNDLED WITH\n 2.0.1\n" >> Gemfile.lock}) - end - app.deploy do - expect(app.output).to match("Installing dependencies using bundler 2.") - expect(app.output).to_not match("BUNDLE_GLOBAL_PATH_APPENDS_RUBY_SCOPE=1") - - # Double deploy problem with Ruby 2.5.5 - app.commit! - app.push! - - # app.run_multi("ls vendor/bundle/ruby/#{abi_version}/gems") do |ls_output| - # expect(ls_output).to match("rake-") - # end - - app.run("which -a rake") do |which_rake| - expect(which_rake).to include("/app/vendor/bundle/bin/rake") - expect(which_rake).to include("/app/vendor/bundle/ruby/#{abi_version}/bin/rake") - end - end - end - end - it "deploys with version 1.x" do abi_version = LanguagePack::RubyVersion::DEFAULT_VERSION_NUMBER.dup abi_version[-1] = "0" # turn 2.6.6 into 2.6.0 diff --git a/spec/hatchet/ci_spec.rb b/spec/hatchet/ci_spec.rb index 41c2207f0..d2330e8fd 100644 --- a/spec/hatchet/ci_spec.rb +++ b/spec/hatchet/ci_spec.rb @@ -51,10 +51,4 @@ expect(test_run.output).to_not match("Fetching rake") end end - - it "Works with a rails app that does not have activerecord" do - Hatchet::Runner.new("activerecord_rake_tasks_does_not_exist").run_ci do |test_run| - expect(test_run.output).to_not match("db:migrate") - end - end end diff --git a/spec/hatchet/rails5_spec.rb b/spec/hatchet/rails5_spec.rb deleted file mode 100644 index faa275f09..000000000 --- a/spec/hatchet/rails5_spec.rb +++ /dev/null @@ -1,44 +0,0 @@ -require_relative '../spec_helper' - -describe "Rails 5" do - it "behaves correctly, not related to Rails 5 at all" do - Hatchet::Runner.new("ruby-getting-started", stack: "heroku-18").deploy do |app, heroku| - # Test BUNDLE_DISABLE_VERSION_CHECK works - expect(app.output).not_to include("The latest bundler is") - - # Test worker task only appears if the app has that rake task - worker_task = worker_task_for_app(app) - expect(worker_task).to be_nil - - run!(%Q{echo "task 'jobs:work' do ; end" >> Rakefile}) - app.commit! - - app.deploy do - worker_task = worker_task_for_app(app) - expect(worker_task["command"]).to eq("bundle exec rake jobs:work") - end - end - end - - def worker_task_for_app(app) - app - .api_rate_limit.call - .formation - .list(app.name) - .detect { |h| h["type"] == "worker" } - end - - it "blocks bads sprockets config with bad version" do - Hatchet::Runner.new( - "sprockets_asset_compile_true", - stack: "heroku-18", - allow_failure: true, - config: {'HEROKU_DEBUG_RAILS_RUNNER' => 'true'} - ).deploy do |app, heroku| - expect(app.output).to match("heroku.detecting.config.for.assets.compile=true") - expect(app.output).to match('A security vulnerability has been detected') - expect(app.output).to match('version "3.7.2"') - end - end -end - diff --git a/spec/hatchet/stack_spec.rb b/spec/hatchet/stack_spec.rb deleted file mode 100644 index bd3228bac..000000000 --- a/spec/hatchet/stack_spec.rb +++ /dev/null @@ -1,26 +0,0 @@ -require_relative "../spec_helper" - -describe "Stack Changes" do - xit "should reinstall gems on stack change" do - Hatchet::Runner.new('default_ruby', stack: "heroku-18").deploy do |app| - app.update_stack("heroku-20") - run!('git commit --allow-empty -m "heroku-20 migrate"') - - app.push! - - expect(app.output).to match("Installing rack") - expect(app.output).to match("Changing stack") - end - end - - it "should not reinstall gems if the stack did not change" do - Hatchet::Runner.new('default_ruby', stack: "heroku-20").deploy do |app| - app.update_stack("heroku-20") - run!(%Q{git commit --allow-empty -m "cedar migrate"}) - - app.push! - puts app.output - expect(app.output).to match("Using rack") - end - end -end diff --git a/spec/helpers/bundler_wrapper_spec.rb b/spec/helpers/bundler_wrapper_spec.rb index 6d6c7229d..7d3fe7ec4 100644 --- a/spec/helpers/bundler_wrapper_spec.rb +++ b/spec/helpers/bundler_wrapper_spec.rb @@ -54,10 +54,10 @@ def wrapper.topic(*args); end # Silence output in tests Bundler.with_unbundled_env do @bundler.install - expect(@bundler.ruby_version).to eq("ruby-2.5.1") + expect(@bundler.ruby_version).to include("ruby-2.5.1") ruby_version = LanguagePack::RubyVersion.new(@bundler.ruby_version, is_new: true) - expect(ruby_version.version_for_download).to eq("ruby-2.5.1") + expect(ruby_version.version_for_download).to include("ruby-2.5.1") end end end @@ -71,16 +71,5 @@ def wrapper.topic(*args); end # Silence output in tests end end end - - it "handles app with output in their Gemfile" do - Hatchet::App.new("problem_gemfile_version").in_directory_fork do |dir| - Bundler.with_unbundled_env do - @bundler.install - - run!(%{echo '\nputs "some output"\n' >> Gemfile}) - expect(@bundler.ruby_version).to eq("ruby-2.5.1") - end - end - end end end From 52393f80d02cf947ddae2c22fac4c0cb49b6f92f Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Mon, 24 Jul 2023 14:51:15 -0500 Subject: [PATCH 0919/1195] v255 (#1382) --- CHANGELOG.md | 5 +++++ changelogs/v255/jruby-9.2.2.0.md | 9 +++++++++ changelogs/v255/jruby-9.2.3.0.md | 9 +++++++++ lib/language_pack/version.rb | 2 +- 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 changelogs/v255/jruby-9.2.2.0.md create mode 100644 changelogs/v255/jruby-9.2.3.0.md diff --git a/CHANGELOG.md b/CHANGELOG.md index a274e40f5..6d6769e84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ ## Main (unreleased) +## v255 (2023/07/24) + +- JRuby 9.4.3.0 is now available +- JRuby 9.4.2.0 is now available + ## v254 (2023/05/12) - Default Ruby version is now 3.1.4 diff --git a/changelogs/v255/jruby-9.2.2.0.md b/changelogs/v255/jruby-9.2.2.0.md new file mode 100644 index 000000000..89d51ff55 --- /dev/null +++ b/changelogs/v255/jruby-9.2.2.0.md @@ -0,0 +1,9 @@ +## JRuby version 9.4.2.0 is now available + +[JRuby v9.4.2.0](/articles/ruby-support#ruby-versions) is now available on Heroku. To run your app using this version of Ruby, add the following `ruby` directive to your Gemfile: + +```ruby +ruby "3.1.0", engine: "jruby", engine_version: "9.4.2.0" +``` + +The JRuby release notes can be found on the [JRuby website](https://www.jruby.org/news). diff --git a/changelogs/v255/jruby-9.2.3.0.md b/changelogs/v255/jruby-9.2.3.0.md new file mode 100644 index 000000000..80c005193 --- /dev/null +++ b/changelogs/v255/jruby-9.2.3.0.md @@ -0,0 +1,9 @@ +## JRuby version 9.4.3.0 is now available + +[JRuby v9.4.3.0](/articles/ruby-support#ruby-versions) is now available on Heroku. To run your app using this version of Ruby, add the following `ruby` directive to your Gemfile: + +```ruby +ruby "3.1.4", engine: "jruby", engine_version: "9.4.3.0" +``` + +The JRuby release notes can be found on the [JRuby website](https://www.jruby.org/news). diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 183d995ed..35b4a59b9 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v254" + BUILDPACK_VERSION = "v255" end end From 516a3bee4ed0854fb787609a9b5954aaf8397726 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Fri, 4 Aug 2023 18:22:20 -0500 Subject: [PATCH 0920/1195] v256 (#1383) --- CHANGELOG.md | 4 ++++ lib/language_pack/version.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d6769e84..85c5b0d47 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Main (unreleased) +## v256 (2023/08/04) + +- Fix Ruby 2.5.7 download on Heroku-20 + ## v255 (2023/07/24) - JRuby 9.4.3.0 is now available diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 35b4a59b9..721bb2f93 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v255" + BUILDPACK_VERSION = "v256" end end From bf55cb4c5643efe46653a8d3aeab770d6cfd8d99 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Wed, 20 Sep 2023 11:31:41 -0500 Subject: [PATCH 0921/1195] v257 (#1388) --- CHANGELOG.md | 5 +++++ lib/language_pack/version.rb | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 85c5b0d47..6df8169d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ ## Main (unreleased) +## v257 (2023/09/20) + +- JRuby 9.3.11.0 is now available +- Ruby 3.3.0-preview2 is now available + ## v256 (2023/08/04) - Fix Ruby 2.5.7 download on Heroku-20 diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 721bb2f93..2ac29fcb7 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v256" + BUILDPACK_VERSION = "v257" end end From 5cfa07f0871d7112b4e8dd32df46dbbebb5b5a00 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Tue, 26 Sep 2023 13:19:38 -0500 Subject: [PATCH 0922/1195] v258 (#1389) --- CHANGELOG.md | 5 ++++- lib/language_pack/version.rb | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6df8169d2..bc0d745c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,10 +2,13 @@ ## Main (unreleased) +## v258 (2023/09/26) + +- Ruby 3.3.0-preview2 is now available + ## v257 (2023/09/20) - JRuby 9.3.11.0 is now available -- Ruby 3.3.0-preview2 is now available ## v256 (2023/08/04) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 2ac29fcb7..de158b987 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v257" + BUILDPACK_VERSION = "v258" end end From 9d5d8c4732b6962e12981f5948ca72d7b40dca0a Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Mon, 2 Oct 2023 13:52:06 -0500 Subject: [PATCH 0923/1195] v259 - re-release Ruby 3.3.0-preview2 and add tests (#1390) * Test `bundle platform --ruby` conversion The Ruby buildpack takes the output for `bundle platform --ruby` and converts that into a S3 url for download. This commit refactors that logic to make testing easier and adds tests for that conversion. * v259 --- CHANGELOG.md | 6 +++++- lib/language_pack/helpers/bundler_wrapper.rb | 9 +++++++-- lib/language_pack/version.rb | 2 +- spec/helpers/bundler_wrapper_spec.rb | 13 ++++++++++++- 4 files changed, 25 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bc0d745c5..1c6e1a11f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,10 +2,14 @@ ## Main (unreleased) -## v258 (2023/09/26) +## v259 (2023/10/02) - Ruby 3.3.0-preview2 is now available +## v258 (2023/09/26) + +- No changes + ## v257 (2023/09/20) - JRuby 9.3.11.0 is now available diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index a8440a3cf..552427858 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -142,10 +142,15 @@ def ruby_version # If there's a gem in the Gemfile (i.e. syntax error) emit error raise GemfileParseError.new(run("bundle check", user_env: true, env: env)) unless $?.success? - if output.match(/No ruby version specified/) + + self.class.platform_to_version(output) + end + + def self.platform_to_version(bundle_platform_output) + if bundle_platform_output.match(/No ruby version specified/) "" else - output.strip.sub('(', '').sub(')', '').sub(/(p-?\d+)/, ' \1').split.join('-') + bundle_platform_output.strip.sub('(', '').sub(')', '').sub(/(p-?\d+)/, ' \1').split.join('-') end end diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index de158b987..0928ed9da 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v258" + BUILDPACK_VERSION = "v259" end end diff --git a/spec/helpers/bundler_wrapper_spec.rb b/spec/helpers/bundler_wrapper_spec.rb index 7d3fe7ec4..64a82f324 100644 --- a/spec/helpers/bundler_wrapper_spec.rb +++ b/spec/helpers/bundler_wrapper_spec.rb @@ -1,7 +1,18 @@ require 'spec_helper' -describe "BundlerWrapper" do +describe "Bundle platform conversion" do + it "converts `bundle platform --ruby` for prerelease versions" do + actual = LanguagePack::Helpers::BundlerWrapper.platform_to_version("ruby 3.3.0.preview2") + expect(actual).to eq("ruby-3.3.0.preview2") + end + + it "converts `bundle platform --ruby` for released versions" do + actual = LanguagePack::Helpers::BundlerWrapper.platform_to_version("ruby 3.1.4") + expect(actual).to eq("ruby-3.1.4") + end +end +describe "BundlerWrapper" do before(:each) do if ENV['RUBYOPT'] @original_rubyopt = ENV['RUBYOPT'] From 6f08dba9d83432cd5ee146f25dd9d56075e360bf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Oct 2023 13:27:12 +0000 Subject: [PATCH 0924/1195] Bump actions/checkout from 3 to 4 (#1385) Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/check_changelog.yml | 2 +- .github/workflows/hatchet_app_cleaner.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check_changelog.yml b/.github/workflows/check_changelog.yml index 2c9b08ffc..81433dde6 100644 --- a/.github/workflows/check_changelog.yml +++ b/.github/workflows/check_changelog.yml @@ -15,7 +15,7 @@ jobs: !contains(github.event.pull_request.labels.*.name, 'dependencies') && !contains(github.event.pull_request.labels.*.name, 'automation') steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Check that CHANGELOG is touched run: | git fetch origin ${{ github.base_ref }} --depth 1 && \ diff --git a/.github/workflows/hatchet_app_cleaner.yml b/.github/workflows/hatchet_app_cleaner.yml index 4b93ac11f..a7298455c 100644 --- a/.github/workflows/hatchet_app_cleaner.yml +++ b/.github/workflows/hatchet_app_cleaner.yml @@ -19,7 +19,7 @@ jobs: HEROKU_DISABLE_AUTOUPDATE: 1 steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install Ruby and dependencies uses: ruby/setup-ruby@v1 with: From 595658639389d565076e6f06228fe21355fc7edc Mon Sep 17 00:00:00 2001 From: Ed Morley <501702+edmorley@users.noreply.github.com> Date: Mon, 16 Oct 2023 13:30:18 +0000 Subject: [PATCH 0925/1195] Group minor/patch version Ruby Dependabot updates into one PR (#1393) Ruby minor/patch dependencies will now be grouped, using the new Dependabot grouping feature: https://github.blog/changelog/2023-08-17-grouped-version-updates-by-semantic-version-level-for-dependabot/ This hasn't been enabled for the GitHub Actions dependencies, since they all use major pinning (since we only use the official actions like `actions/checkout`). The Dependabot config has now been set to monthly, for consistency with the other repos. In addition, the check changelog skipping strategy has been updated to use the `skip changelog` label for (a) explicitness, (b) to allow removing the label in situations where we realise a changelog entry is required, (c) for consistency with other repos. GUS-W-14303554. --- .github/dependabot.yml | 17 +++++++++++++++-- .github/workflows/check_changelog.yml | 16 +++++++--------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 3933d101e..8fcdec8d6 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -4,8 +4,21 @@ updates: directory: "/" open-pull-requests-limit: 1 # Limit concurrent CI runs from executing, do not remove schedule: - interval: "weekly" + interval: "monthly" + labels: + - "dependencies" + - "ruby" + - "skip changelog" + groups: + ruby-dependencies: + update-types: + - "minor" + - "patch" - package-ecosystem: "github-actions" directory: "/" schedule: - interval: "weekly" + interval: "monthly" + labels: + - "dependencies" + - "github actions" + - "skip changelog" diff --git a/.github/workflows/check_changelog.yml b/.github/workflows/check_changelog.yml index 81433dde6..c0cc43b77 100644 --- a/.github/workflows/check_changelog.yml +++ b/.github/workflows/check_changelog.yml @@ -2,20 +2,18 @@ name: Check Changelog on: pull_request: - types: [opened, reopened, edited, labeled, unlabeled, synchronize] + types: [opened, reopened, labeled, unlabeled, synchronize] + +permissions: + contents: read jobs: check-changelog: runs-on: ubuntu-latest - if: | - !contains(github.event.pull_request.body, '[skip changelog]') && - !contains(github.event.pull_request.body, '[changelog skip]') && - !contains(github.event.pull_request.body, '[skip ci]') && - !contains(github.event.pull_request.labels.*.name, 'skip changelog') && - !contains(github.event.pull_request.labels.*.name, 'dependencies') && - !contains(github.event.pull_request.labels.*.name, 'automation') + if: (!contains(github.event.pull_request.labels.*.name, 'skip changelog')) steps: - - uses: actions/checkout@v4 + - name: Checkout + uses: actions/checkout@v4 - name: Check that CHANGELOG is touched run: | git fetch origin ${{ github.base_ref }} --depth 1 && \ From 9b5dfe8c6333f9568b729618c072ebc6a201e1c7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Oct 2023 13:41:23 +0000 Subject: [PATCH 0926/1195] Bump the ruby-dependencies group with 6 updates (#1394) Bumps the ruby-dependencies group with 6 updates: | Package | From | To | | --- | --- | --- | | [rspec-core](https://github.com/rspec/rspec-core) | `3.12.1` | `3.12.2` | | [rspec-expectations](https://github.com/rspec/rspec-expectations) | `3.12.2` | `3.12.3` | | [excon](https://github.com/excon/excon) | `0.99.0` | `0.104.0` | | [parallel_tests](https://github.com/grosser/parallel_tests) | `4.0.0` | `4.3.0` | | [ci-queue](https://github.com/Shopify/ci-queue) | `0.24.2` | `0.37.0` | | [redis](https://github.com/redis/redis-rb) | `5.0.5` | `5.0.7` | Updates `rspec-core` from 3.12.1 to 3.12.2 - [Release notes](https://github.com/rspec/rspec-core/releases) - [Changelog](https://github.com/rspec/rspec-core/blob/main/Changelog.md) - [Commits](https://github.com/rspec/rspec-core/compare/v3.12.1...v3.12.2) Updates `rspec-expectations` from 3.12.2 to 3.12.3 - [Release notes](https://github.com/rspec/rspec-expectations/releases) - [Changelog](https://github.com/rspec/rspec-expectations/blob/main/Changelog.md) - [Commits](https://github.com/rspec/rspec-expectations/compare/v3.12.2...v3.12.3) Updates `excon` from 0.99.0 to 0.104.0 - [Changelog](https://github.com/excon/excon/blob/master/changelog.txt) - [Commits](https://github.com/excon/excon/compare/v0.99.0...v0.104.0) Updates `parallel_tests` from 4.0.0 to 4.3.0 - [Changelog](https://github.com/grosser/parallel_tests/blob/master/CHANGELOG.md) - [Commits](https://github.com/grosser/parallel_tests/compare/v4.0.0...v4.3.0) Updates `ci-queue` from 0.24.2 to 0.37.0 - [Release notes](https://github.com/Shopify/ci-queue/releases) - [Commits](https://github.com/Shopify/ci-queue/compare/v0.24.2...v0.37.0) Updates `redis` from 5.0.5 to 5.0.7 - [Changelog](https://github.com/redis/redis-rb/blob/master/CHANGELOG.md) - [Commits](https://github.com/redis/redis-rb/compare/v5.0.5...v5.0.7) --- updated-dependencies: - dependency-name: rspec-core dependency-type: direct:development update-type: version-update:semver-patch dependency-group: ruby-dependencies - dependency-name: rspec-expectations dependency-type: direct:development update-type: version-update:semver-patch dependency-group: ruby-dependencies - dependency-name: excon dependency-type: direct:development update-type: version-update:semver-minor dependency-group: ruby-dependencies - dependency-name: parallel_tests dependency-type: direct:development update-type: version-update:semver-minor dependency-group: ruby-dependencies - dependency-name: ci-queue dependency-type: direct:development update-type: version-update:semver-minor dependency-group: ruby-dependencies - dependency-name: redis dependency-type: direct:development update-type: version-update:semver-patch dependency-group: ruby-dependencies ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index d304163a9..6e80ed902 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,13 +1,13 @@ GEM remote: https://rubygems.org/ specs: - ci-queue (0.24.2) + ci-queue (0.37.0) citrus (3.0.2) - connection_pool (2.3.0) + connection_pool (2.4.1) dead_end (4.0.0) diff-lcs (1.5.0) erubis (2.7.0) - excon (0.99.0) + excon (0.104.0) heroics (0.1.2) erubis (~> 2.0) excon @@ -23,8 +23,8 @@ GEM json (2.6.3) moneta (1.0.0) multi_json (1.15.0) - parallel (1.22.1) - parallel_tests (4.0.0) + parallel (1.23.0) + parallel_tests (4.3.0) parallel platform-api (3.5.0) heroics (~> 0.1.1) @@ -32,19 +32,19 @@ GEM rate_throttle_client (~> 0.1.0) rake (13.0.6) rate_throttle_client (0.1.2) - redis (5.0.5) + redis (5.0.7) redis-client (>= 0.9.0) - redis-client (0.11.1) + redis-client (0.17.0) connection_pool rrrretry (1.0.0) - rspec-core (3.12.1) + rspec-core (3.12.2) rspec-support (~> 3.12.0) - rspec-expectations (3.12.2) + rspec-expectations (3.12.3) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) rspec-retry (0.6.2) rspec-core (> 3.3) - rspec-support (3.12.0) + rspec-support (3.12.1) thor (1.2.1) threaded (0.0.4) toml-rb (2.2.0) From 101d41da9a1c6acbfae658dd2ef45d6b7c800da3 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Mon, 23 Oct 2023 17:21:33 -0500 Subject: [PATCH 0927/1195] Release JRuby 9.4.4.0 (#1396) --- CHANGELOG.md | 4 ++++ changelogs/v260/jruby-9.4.4.0.md | 10 ++++++++++ lib/language_pack/version.rb | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 changelogs/v260/jruby-9.4.4.0.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c6e1a11f..b9e7c645e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Main (unreleased) +## v260 (2023/10/23) + +- JRuby 9.4.4.0 is now available + ## v259 (2023/10/02) - Ruby 3.3.0-preview2 is now available diff --git a/changelogs/v260/jruby-9.4.4.0.md b/changelogs/v260/jruby-9.4.4.0.md new file mode 100644 index 000000000..c0bc51df5 --- /dev/null +++ b/changelogs/v260/jruby-9.4.4.0.md @@ -0,0 +1,10 @@ +## JRuby version 9.4.4.0 is now available + +[JRuby v9.4.4.0](/articles/ruby-support#ruby-versions) is now available on Heroku. To run +your app using this version of Ruby, add the following `ruby` directive to your Gemfile: + +```ruby +ruby "3.1.4", engine: "jruby", engine_version: "9.4.4.0" +``` + +The JRuby release notes can be found on the [JRuby website](https://www.jruby.org/news). diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 0928ed9da..9888744be 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v259" + BUILDPACK_VERSION = "v260" end end From 1a836a79425835bff3eaca3a5c4bbbde67b107dd Mon Sep 17 00:00:00 2001 From: Colin Casey Date: Thu, 2 Nov 2023 14:27:56 -0300 Subject: [PATCH 0928/1195] Use Node.js Active LTS as default version (#1397) As of [2023-10-24](https://github.com/nodejs/node/blob/main/doc/changelogs/CHANGELOG_V20.md#2023-10-24-version-2090-iron-lts-richardlau), Node.js 20.x is now the LTS version. [W-14390811](https://gus.lightning.force.com/lightning/r/a07EE00001dRrFWYA0/view) --- CHANGELOG.md | 2 ++ lib/language_pack/helpers/nodebin.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b9e7c645e..db646031f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Main (unreleased) +* Default Node.js version now 20.9.0 + ## v260 (2023/10/23) - JRuby 9.4.4.0 is now available diff --git a/lib/language_pack/helpers/nodebin.rb b/lib/language_pack/helpers/nodebin.rb index 4e2c895a2..0bffcd3aa 100644 --- a/lib/language_pack/helpers/nodebin.rb +++ b/lib/language_pack/helpers/nodebin.rb @@ -2,7 +2,7 @@ class LanguagePack::Helpers::Nodebin def self.hardcoded_node_lts - version = "16.18.1" + version = "20.9.0" { "number" => version, "url" => "https://heroku-nodebin.s3.us-east-1.amazonaws.com/node/release/linux-x64/node-v#{version}-linux-x64.tar.gz" From 6c812ce70c04f5618c173ac355dbc245cb419d24 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 2 Nov 2023 12:33:32 -0500 Subject: [PATCH 0929/1195] Bump the ruby-dependencies group with 3 updates (#1398) Bumps the ruby-dependencies group with 3 updates: [rake](https://github.com/ruby/rake), [ci-queue](https://github.com/Shopify/ci-queue) and [redis](https://github.com/redis/redis-rb). Updates `rake` from 13.0.6 to 13.1.0 - [Release notes](https://github.com/ruby/rake/releases) - [Changelog](https://github.com/ruby/rake/blob/master/History.rdoc) - [Commits](https://github.com/ruby/rake/compare/v13.0.6...v13.1.0) Updates `ci-queue` from 0.37.0 to 0.38.0 - [Release notes](https://github.com/Shopify/ci-queue/releases) - [Commits](https://github.com/Shopify/ci-queue/compare/v0.37.0...v0.38.0) Updates `redis` from 5.0.7 to 5.0.8 - [Changelog](https://github.com/redis/redis-rb/blob/master/CHANGELOG.md) - [Commits](https://github.com/redis/redis-rb/compare/v5.0.7...v5.0.8) --- updated-dependencies: - dependency-name: rake dependency-type: direct:development update-type: version-update:semver-minor dependency-group: ruby-dependencies - dependency-name: ci-queue dependency-type: direct:development update-type: version-update:semver-minor dependency-group: ruby-dependencies - dependency-name: redis dependency-type: direct:development update-type: version-update:semver-patch dependency-group: ruby-dependencies ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 6e80ed902..48955d120 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ GEM remote: https://rubygems.org/ specs: - ci-queue (0.37.0) + ci-queue (0.38.0) citrus (3.0.2) connection_pool (2.4.1) dead_end (4.0.0) @@ -30,11 +30,11 @@ GEM heroics (~> 0.1.1) moneta (~> 1.0.0) rate_throttle_client (~> 0.1.0) - rake (13.0.6) + rake (13.1.0) rate_throttle_client (0.1.2) - redis (5.0.7) - redis-client (>= 0.9.0) - redis-client (0.17.0) + redis (5.0.8) + redis-client (>= 0.17.0) + redis-client (0.18.0) connection_pool rrrretry (1.0.0) rspec-core (3.12.2) From bf11893e2783f533b3ed26df21bfaa5d5829cde0 Mon Sep 17 00:00:00 2001 From: Ed Morley <501702+edmorley@users.noreply.github.com> Date: Thu, 2 Nov 2023 17:38:07 +0000 Subject: [PATCH 0930/1195] Exclude development-only files from packaged buildpack (#1392) Since these files/directories are not needed at build time. --- CHANGELOG.md | 3 ++- buildpack.toml | 12 +++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index db646031f..01e76b3ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,8 @@ ## Main (unreleased) -* Default Node.js version now 20.9.0 +- Exclude development-only files from the packaged buildpack +- Default Node.js version now 20.9.0 ## v260 (2023/10/23) diff --git a/buildpack.toml b/buildpack.toml index a0ec7cf45..918adc0e7 100644 --- a/buildpack.toml +++ b/buildpack.toml @@ -10,7 +10,17 @@ ruby_version = "3.1.4" [publish] [publish.Ignore] -files = ["spec/"] +files = [ + "changelogs/", + "spec/", + "Gemfile", + "Gemfile.lock", + "Rakefile", + "app.json", + "hatchet.json", + "hatchet.lock", + "package.toml", +] [[publish.Vendor]] url = "https://heroku-buildpack-ruby.s3.us-east-1.amazonaws.com/heroku-20/ruby-3.1.4.tgz" From 99eceae981a4c565630902dcd013d8b7952bc3ec Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Thu, 2 Nov 2023 13:36:46 -0500 Subject: [PATCH 0931/1195] v261 (#1399) * Node changelog * Add changelogs for JRuby Removing the line about excluding files as that's an internal detail that customers shouldn't notice. * v261 * Update link to latest Rails version [close #1373] --- CHANGELOG.md | 5 ++++- README.md | 2 +- changelogs/v261/jruby_9.3.13.0.md | 10 ++++++++++ changelogs/v261/jruby_9.4.5.0.md | 0 changelogs/v261/node_20_9_0.md | 8 ++++++++ lib/language_pack/version.rb | 2 +- 6 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 changelogs/v261/jruby_9.3.13.0.md create mode 100644 changelogs/v261/jruby_9.4.5.0.md create mode 100644 changelogs/v261/node_20_9_0.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 01e76b3ba..610248f02 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,10 @@ ## Main (unreleased) -- Exclude development-only files from the packaged buildpack +## v261 (2023/11/02) + +- JRuby 9.4.5.0 is now available +- JRuby 9.3.13.0 is now available - Default Node.js version now 20.9.0 ## v260 (2023/10/23) diff --git a/README.md b/README.md index 0b6ef1413..e300de875 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ For more information about using Ruby and buildpacks on Heroku, see these Dev Ce - [Heroku Ruby Support](https://devcenter.heroku.com/articles/ruby-support) - [Getting Started with Ruby on Heroku](https://devcenter.heroku.com/articles/getting-started-with-ruby) -- [Getting Started with Rails 4 on Heroku](https://devcenter.heroku.com/articles/getting-started-with-rails4) +- [Getting Started with Rails 7 on Heroku](https://devcenter.heroku.com/articles/getting-started-with-rails7) - [Buildpacks](https://devcenter.heroku.com/articles/buildpacks) - [Buildpack API](https://devcenter.heroku.com/articles/buildpack-api) diff --git a/changelogs/v261/jruby_9.3.13.0.md b/changelogs/v261/jruby_9.3.13.0.md new file mode 100644 index 000000000..45082f69e --- /dev/null +++ b/changelogs/v261/jruby_9.3.13.0.md @@ -0,0 +1,10 @@ +## JRuby version 9.3.13.0 is now available + +[JRuby v9.3.13.0](/articles/ruby-support#ruby-versions) is now available on Heroku. To run +your app using this version of Ruby, add the following `ruby` directive to your Gemfile: + +```ruby +ruby "2.6.8", engine: "jruby", engine_version: "9.3.13.0" +``` + +The JRuby release notes can be found on the [JRuby website](https://www.jruby.org/news). diff --git a/changelogs/v261/jruby_9.4.5.0.md b/changelogs/v261/jruby_9.4.5.0.md new file mode 100644 index 000000000..e69de29bb diff --git a/changelogs/v261/node_20_9_0.md b/changelogs/v261/node_20_9_0.md new file mode 100644 index 000000000..d260909bd --- /dev/null +++ b/changelogs/v261/node_20_9_0.md @@ -0,0 +1,8 @@ +## Ruby apps now default to Node version 20.9.0 + +Applications using the `heroku/ruby` buildpack that do not already have `node` installed by another buildpack (such as the `heroku/nodejs` +buildpack) will now receive: + +- Node.js version 20.9.0 (was previously 16.18.1) + +These versions and instructions on how to specify a specific version of these binaries can be found on the [installed binaries section of the Heroku Ruby Support page](https://devcenter.heroku.com/articles/ruby-support#installed-binaries). diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 9888744be..32d3f4d25 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v260" + BUILDPACK_VERSION = "v261" end end From d81113c57c9473cbe03ac41aaf88b3f68de227f1 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Thu, 2 Nov 2023 14:19:25 -0500 Subject: [PATCH 0932/1195] Fix missing changelog entry (#1400) --- changelogs/v261/jruby_9.4.5.0.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/changelogs/v261/jruby_9.4.5.0.md b/changelogs/v261/jruby_9.4.5.0.md index e69de29bb..df31b258c 100644 --- a/changelogs/v261/jruby_9.4.5.0.md +++ b/changelogs/v261/jruby_9.4.5.0.md @@ -0,0 +1,10 @@ +## JRuby version 9.4.5.0 is now available + +[JRuby v9.4.5.0](/articles/ruby-support#ruby-versions) is now available on Heroku. To run +your app using this version of Ruby, add the following `ruby` directive to your Gemfile: + +```ruby +ruby "3.1.4", engine: "jruby", engine_version: "9.4.5.0" +``` + +The JRuby release notes can be found on the [JRuby website](https://www.jruby.org/news). From 77c1ac34e7c1e8b45bf2af9008aa47d5eb783943 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Wed, 8 Nov 2023 12:30:51 -0600 Subject: [PATCH 0933/1195] Warn when using default node or yarn versions (#1401) * Warn when using default node or yarn versions Many developers don't realize they're using a default version. When it changes, like https://devcenter.heroku.com/changelog-items/2710, they're surprised to find that even a correctly committed `package.json` with a node engine declaration does not install the version they're expecting. This is because the Ruby build pack does not duplicate the Node build pack's version detection logic. The Ruby build pack installs a version of node for historical reasons. It pre-dates multi-build packs from when applications simply needed **a** version of node for execjs to function along with the Rails asset pipeline (sprockets). As the ecosystem has matured, our recommendations also change. We recommend not relying on this default behavior. It's worth noting that the CNB behavior (not yet available on Heroku) defers installing node to the nodes-engine build pack which is the ideal behavior so that there are not two independent paths for node support. * Add changelog notes --------- Co-authored-by: Richard Schneeman --- CHANGELOG.md | 3 +++ lib/language_pack/helpers/nodebin.rb | 13 ++++----- lib/language_pack/ruby.rb | 40 ++++++++++++++++++++++++++++ spec/hatchet/node_spec.rb | 3 +++ 4 files changed, 53 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 610248f02..d787c8bee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## Main (unreleased) +- Warn when relying on default Node.js or Yarn versions (https://github.com/heroku/heroku-buildpack-ruby/pull/1401) +- Warn when default Node.js or Yarn versions change (https://github.com/heroku/heroku-buildpack-ruby/pull/1401) + ## v261 (2023/11/02) - JRuby 9.4.5.0 is now available diff --git a/lib/language_pack/helpers/nodebin.rb b/lib/language_pack/helpers/nodebin.rb index 0bffcd3aa..1a5c194f9 100644 --- a/lib/language_pack/helpers/nodebin.rb +++ b/lib/language_pack/helpers/nodebin.rb @@ -1,19 +1,20 @@ require 'json' class LanguagePack::Helpers::Nodebin + NODE_VERSION = "20.9.0" + YARN_VERSION = "1.22.19" + def self.hardcoded_node_lts - version = "20.9.0" { - "number" => version, - "url" => "https://heroku-nodebin.s3.us-east-1.amazonaws.com/node/release/linux-x64/node-v#{version}-linux-x64.tar.gz" + "number" => NODE_VERSION, + "url" => "https://heroku-nodebin.s3.us-east-1.amazonaws.com/node/release/linux-x64/node-v#{NODE_VERSION}-linux-x64.tar.gz" } end def self.hardcoded_yarn - version = "1.22.19" { - "number" => version, - "url" => "https://heroku-nodebin.s3.us-east-1.amazonaws.com/yarn/release/yarn-v#{version}.tar.gz" + "number" => YARN_VERSION, + "url" => "https://heroku-nodebin.s3.us-east-1.amazonaws.com/yarn/release/yarn-v#{YARN_VERSION}.tar.gz" } end diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 81784e273..beb1b0f0d 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -1018,6 +1018,26 @@ def add_node_js_binary if Pathname(build_path).join("package.json").exist? || bundler.has_gem?('execjs') || bundler.has_gem?('webpacker') + + version = @node_installer.version + old_version = @metadata.fetch("default_node_version") { version } + + if version != version + warn(<<~WARNING, inline: true) + Default version of Node.js changed (#{old_version} to #{version}) + WARNING + end + + warn(<<~WARNING, inline: true) + Installing a default version (#{version}) of Node.js. + This version is not pinned and can change over time, causing unexpected failures. + + Heroku recommends placing the `heroku/nodejs` buildpack in front of + `heroku/ruby` to install a specific version of node: + + https://devcenter.heroku.com/articles/ruby-support#node-js-support + WARNING + [@node_installer.binary_path] else [] @@ -1028,6 +1048,26 @@ def add_yarn_binary return [] if yarn_preinstalled? if Pathname(build_path).join("yarn.lock").exist? || bundler.has_gem?('webpacker') + + version = @yarn_installer.version + old_version = @metadata.fetch("default_yarn_version") { version } + + if version != version + warn(<<~WARNING, inline: true) + Default version of Yarn changed (#{old_version} to #{version}) + WARNING + end + + warn(<<~WARNING, inline: true) + Installing a default version (#{version}) of Yarn + This version is not pinned and can change over time, causing unexpected failures. + + Heroku recommends placing the `heroku/nodejs` buildpack in front of + `heroku/ruby` to install a specific version of node: + + https://devcenter.heroku.com/articles/ruby-support#node-js-support + WARNING + [@yarn_installer.name] else [] diff --git a/spec/hatchet/node_spec.rb b/spec/hatchet/node_spec.rb index 7d58b22d2..fe816dc27 100644 --- a/spec/hatchet/node_spec.rb +++ b/spec/hatchet/node_spec.rb @@ -16,6 +16,9 @@ expect(app.output).to include("bin/node is the node directory") expect(app.output).to_not include(".heroku/node/bin/node is the node directory") + expect(app.output).to include("Installing a default version (#{LanguagePack::Helpers::Nodebin::YARN_VERSION}) of Yarn") + expect(app.output).to include("Installing a default version (#{LanguagePack::Helpers::Nodebin::NODE_VERSION}) of Node.js") + expect(app.run("which node")).to match("/app/bin/node") # We put node in bin/node expect(app.run("which yarn")).to match("/app/vendor/yarn-") # We put yarn in /app/vendor/yarn- end From 332aba4873ce50d97a621332f92c59faac9a2c48 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Wed, 8 Nov 2023 14:11:18 -0600 Subject: [PATCH 0934/1195] v262 and an update to the warning message (#1402) Co-authored-by: Richard Schneeman --- CHANGELOG.md | 2 ++ lib/language_pack/ruby.rb | 5 +++-- lib/language_pack/version.rb | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d787c8bee..e79994251 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Main (unreleased) +## v262 (2023/11/08) + - Warn when relying on default Node.js or Yarn versions (https://github.com/heroku/heroku-buildpack-ruby/pull/1401) - Warn when default Node.js or Yarn versions change (https://github.com/heroku/heroku-buildpack-ruby/pull/1401) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index beb1b0f0d..d03b9ac6c 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -1062,8 +1062,9 @@ def add_yarn_binary Installing a default version (#{version}) of Yarn This version is not pinned and can change over time, causing unexpected failures. - Heroku recommends placing the `heroku/nodejs` buildpack in front of - `heroku/ruby` to install a specific version of node: + Heroku recommends placing the `heroku/nodejs` buildpack in front of the `heroku/ruby` + buildpack as it offers more comprehensive Node.js support, including the ability to + customise the Node.js version: https://devcenter.heroku.com/articles/ruby-support#node-js-support WARNING diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 32d3f4d25..98fef1a97 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v261" + BUILDPACK_VERSION = "v262" end end From 9dc8ea4a775bbf7da5a3ad08903e41e25bee0ee0 Mon Sep 17 00:00:00 2001 From: Matt Larraz Date: Wed, 6 Dec 2023 05:50:36 -0500 Subject: [PATCH 0935/1195] Allow custom vendored Ruby URL (#1406) * Allow custom vendored Ruby URL Lets us provide our own custom set of vendored Ruby runtimes. Currently in use on our fork of this repo, but we'd like to merge it upstream. Fixes #1164. * Changelog * Correct changelog PR URL --------- Co-authored-by: Schneems Co-authored-by: Ed Morley <501702+edmorley@users.noreply.github.com> --- CHANGELOG.md | 2 ++ bin/support/download_ruby | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e79994251..0cfed7906 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Main (unreleased) +- Fix BUILDPACK_VENDOR_URL support (https://github.com/heroku/heroku-buildpack-ruby/pull/1406) + ## v262 (2023/11/08) - Warn when relying on default Node.js or Yarn versions (https://github.com/heroku/heroku-buildpack-ruby/pull/1401) diff --git a/bin/support/download_ruby b/bin/support/download_ruby index 37737ba8d..d3087b175 100755 --- a/bin/support/download_ruby +++ b/bin/support/download_ruby @@ -26,7 +26,7 @@ curl_retry_on_18() { regex=".*ruby_version = [\'\"]([0-9]+\.[0-9]+\.[0-9]+)[\'\"].*" if [[ $(cat "$BIN_DIR/../buildpack.toml") =~ $regex ]] then - heroku_buildpack_ruby_url="https://heroku-buildpack-ruby.s3.us-east-1.amazonaws.com/$STACK/ruby-${BASH_REMATCH[1]}.tgz" + heroku_buildpack_ruby_url="${BUILDPACK_VENDOR_URL:-https://heroku-buildpack-ruby.s3.us-east-1.amazonaws.com}/$STACK/ruby-${BASH_REMATCH[1]}.tgz" else echo "Could not detect ruby version to bootstrap" exit 1 From 453b13983b638d68d9d65ab89d36a2fc18128e4a Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Mon, 11 Dec 2023 10:33:20 -0600 Subject: [PATCH 0936/1195] v263 (#1411) - Release 3.3.0-rc1 - Release the BUILDPACK_VENDOR_URL fix GUS-W-14644302 --- CHANGELOG.md | 3 +++ changelogs/v263/ruby-330-rc1.md | 15 +++++++++++++++ lib/language_pack/version.rb | 2 +- 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 changelogs/v263/ruby-330-rc1.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 0cfed7906..ff18d7c02 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## Main (unreleased) +## v263 (2023/12/11) + +- Ruby 3.3.0-rc1 is now available (https://github.com/heroku/heroku-buildpack-ruby/pull/1411) - Fix BUILDPACK_VENDOR_URL support (https://github.com/heroku/heroku-buildpack-ruby/pull/1406) ## v262 (2023/11/08) diff --git a/changelogs/v263/ruby-330-rc1.md b/changelogs/v263/ruby-330-rc1.md new file mode 100644 index 000000000..56e74afe3 --- /dev/null +++ b/changelogs/v263/ruby-330-rc1.md @@ -0,0 +1,15 @@ +## Ruby version 3.3.0-rc1 is now available + +[Ruby v3.3.0-rc1](/articles/ruby-support#ruby-versions) is now available on Heroku. To run +your app using this version of Ruby, add the following `ruby` directive to your Gemfile: + +```ruby +ruby "3.3.0.rc1" +``` + +For more information on [Ruby 3.3.0-rc1, you can view the release announcement](https://www.ruby-lang.org/en/news/). + +Note: This version of Ruby is not suitable for production applications. + However, it can be used to test that your application is ready for + the official release of Ruby 3.3.0 and + to provide feedback to the Ruby core team. diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 98fef1a97..ba1f83000 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v262" + BUILDPACK_VERSION = "v263" end end From 8d2f6ca8d73e335cce34781935c095311f0737a1 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Mon, 25 Dec 2023 09:12:21 -0600 Subject: [PATCH 0937/1195] Ruby 3.3.0 release prep for Christmas (#1412) --- CHANGELOG.md | 4 ++++ lib/language_pack/version.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ff18d7c02..12140ce64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Main (unreleased) +## v264 (2023/12/25) + +- Ruby 3.3.0 is now available + ## v263 (2023/12/11) - Ruby 3.3.0-rc1 is now available (https://github.com/heroku/heroku-buildpack-ruby/pull/1411) diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index ba1f83000..d58bf44db 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v263" + BUILDPACK_VERSION = "v264" end end From b9c2bd02790ff18cbe75dc5b519edbcb3603a6c0 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Mon, 22 Jan 2024 10:21:41 -0600 Subject: [PATCH 0938/1195] Ruby 3.2.3 release (#1415) --- CHANGELOG.md | 4 ++++ changelogs/v265/ruby-323.md | 10 ++++++++++ lib/language_pack/version.rb | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 changelogs/v265/ruby-323.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 12140ce64..6de0f3b3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Main (unreleased) +## v265 (2024/01/22) + +- Ruby 3.2.3 is now available + ## v264 (2023/12/25) - Ruby 3.3.0 is now available diff --git a/changelogs/v265/ruby-323.md b/changelogs/v265/ruby-323.md new file mode 100644 index 000000000..dda99e999 --- /dev/null +++ b/changelogs/v265/ruby-323.md @@ -0,0 +1,10 @@ +## Ruby version 3.2.3 is now available + +[Ruby v3.2.3](/articles/ruby-support#ruby-versions) is now available on Heroku. To run +your app using this version of Ruby, add the following `ruby` directive to your Gemfile: + +```ruby +ruby "3.2.3" +``` + +For more information on [Ruby 3.2.3, you can view the release announcement](https://www.ruby-lang.org/en/news/). diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index d58bf44db..8cfd0ab17 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v264" + BUILDPACK_VERSION = "v265" end end From 3191009118b085bb4d2d30129c03cc3b65a725c4 Mon Sep 17 00:00:00 2001 From: Ed Morley <501702+edmorley@users.noreply.github.com> Date: Mon, 29 Jan 2024 20:07:01 +0000 Subject: [PATCH 0939/1195] Clean up CHANGELOG (#1416) So that it uses a style slightly more consistent with https://keepachangelog.com, so that future automation can update it for new releases more easily. GUS-W-14888899. --- CHANGELOG.md | 597 ++++++++++++++++++++++++++++----------------------- 1 file changed, 333 insertions(+), 264 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6de0f3b3b..9cb3c6071 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,210 +1,211 @@ # Changelog -## Main (unreleased) +## [Unreleased] -## v265 (2024/01/22) + +## [v265] - 2024-01-22 - Ruby 3.2.3 is now available -## v264 (2023/12/25) +## [v264] - 2023-12-25 - Ruby 3.3.0 is now available -## v263 (2023/12/11) +## [v263] - 2023-12-11 - Ruby 3.3.0-rc1 is now available (https://github.com/heroku/heroku-buildpack-ruby/pull/1411) - Fix BUILDPACK_VENDOR_URL support (https://github.com/heroku/heroku-buildpack-ruby/pull/1406) -## v262 (2023/11/08) +## [v262] - 2023-11-08 - Warn when relying on default Node.js or Yarn versions (https://github.com/heroku/heroku-buildpack-ruby/pull/1401) - Warn when default Node.js or Yarn versions change (https://github.com/heroku/heroku-buildpack-ruby/pull/1401) -## v261 (2023/11/02) +## [v261] - 2023-11-02 - JRuby 9.4.5.0 is now available - JRuby 9.3.13.0 is now available - Default Node.js version now 20.9.0 -## v260 (2023/10/23) +## [v260] - 2023-10-23 - JRuby 9.4.4.0 is now available -## v259 (2023/10/02) +## [v259] - 2023-10-02 - Ruby 3.3.0-preview2 is now available -## v258 (2023/09/26) +## [v258] - 2023-09-26 - No changes -## v257 (2023/09/20) +## [v257] - 2023-09-20 - JRuby 9.3.11.0 is now available -## v256 (2023/08/04) +## [v256] - 2023-08-04 - Fix Ruby 2.5.7 download on Heroku-20 -## v255 (2023/07/24) +## [v255] - 2023-07-24 - JRuby 9.4.3.0 is now available - JRuby 9.4.2.0 is now available -## v254 (2023/05/12) +## [v254] - 2023-05-12 - Default Ruby version is now 3.1.4 - Ruby 3.3.0-preview1 is now available -## v253 (2023/03/31) +## [v253] - 2023-03-31 - Ruby versions 2.7.8, 3.0.6, 3.1.4, 3.2.2 are now available -## v252 (2023/02/08) +## [v252] - 2023-02-08 * Ruby 3.2.1 is now available * JRuby 9.4.1.0 is now available -## v251 (2023/02/03) +## [v251] - 2023-02-03 * Jruby 9.3.10.0 is available -## v250 (2022/12/25) +## [v250] - 2022-12-25 * Ruby 3.2.0 is available -## v249 (2022/12/16) +## [v249] - 2022-12-16 * Apps with the environment variable `HEROKU_SKIP_DATABASE_PROVISION=1` set will no longer receive a database on the first push to a new Heroku app. This environment variable interface is not standard across other buildpacks and may be deprecated via warnings in the build output and changed in the future. -## v248 (2022/12/06) +## [v248] - 2022-12-06 * Ruby 3.2.0-rc1 is available -## v247 (2022/12/01) +## [v247] - 2022-12-01 * JRuby 9.3.7.0, 9.3.8.0, 9.3.9.0, 9.4.0.0 -## v246 (2022/11/29) +## [v246] - 2022-11-29 * Default Node.js version now 16.18.1 (https://github.com/heroku/heroku-buildpack-ruby/pull/1342) * Default Yarn version now 1.22.19 (https://github.com/heroku/heroku-buildpack-ruby/pull/1342) -## v245 (2022/11/16) +## [v245] - 2022-11-16 * Bump Bundler 2 wrapper to 2.3.25 (https://github.com/heroku/heroku-buildpack-ruby/pull/1337) -## v244 (2022/07/25) +## [v244] - 2022-07-25 * Default Ruby version is now 3.1.2 (https://github.com/heroku/heroku-buildpack-ruby/pull/1316) -## v243 (2022/06/14) +## [v243] - 2022-06-14 * Switch away from deprecated path-based S3 URLs (https://github.com/heroku/heroku-buildpack-ruby/pull/1311) * Adjust curl retry and connection timeout handling (https://github.com/heroku/heroku-buildpack-ruby/pull/1312) -## v242 (2022/06/07) +## [v242] - 2022-06-07 * Ensure `bin/release` exits zero if `tmp/heroku-buildpack-release-step.yml` does not exist (https://github.com/heroku/heroku-buildpack-ruby/pull/1309) * Bootstrap Ruby version used by the buildpack internals is updated to Ruby 3.1.2 (https://github.com/heroku/heroku-buildpack-ruby/pull/1310) -## v241 (2022/06/06) +## [v241] - 2022-06-06 * `bin/release` is re-written in bash, so it supports Heroku-22 (https://github.com/heroku/heroku-buildpack-ruby/pull/1308) * Download presence check now includes heroku-22 (https://github.com/heroku/heroku-buildpack-ruby/pull/1290) -## v240 (2022/04/05) +## [v240] - 2022-04-05 * Add initial support for heroku-22 (https://github.com/heroku/heroku-buildpack-ruby/pull/1289) * Bundler 2.x is now 2.3.10 (https://github.com/heroku/heroku-buildpack-ruby/pull/1296) -## v239 (2022/03/02) +## [v239] - 2022-03-02 * Rollback bundler 2.x change. Bundler 2.x is now back at 2.2.33 (https://github.com/heroku/heroku-buildpack-ruby/pull/1281) -## v238 (2022/03/02) +## [v238] - 2022-03-02 * Bundler 2.x is now 2.3.7 (https://github.com/heroku/heroku-buildpack-ruby/pull/1276) -## v237 (2022/02/24) +## [v237] - 2022-02-24 * Default Ruby version is now 3.0.3 (https://github.com/heroku/heroku-buildpack-ruby/pull/1270) -## v236 (2022/01/04) +## [v236] - 2022-01-04 * Fix deprecated rake tasks for Rails 7 on Heroku CI (https://github.com/heroku/heroku-buildpack-ruby/pull/1257) -## v235 (2022/01/03) +## [v235] - 2022-01-03 * Bundler 2.x is now 2.2.33 (https://github.com/heroku/heroku-buildpack-ruby/pull/1248) -## v234 (12/16/2021) +## [v234] - 2021-12-16 * Fix YML indentation from v233 (https://github.com/heroku/heroku-buildpack-ruby/pull/1252) -## v233 (12/16/2021) +## [v233] - 2021-12-16 * Default node version now 16.13.1, yarn is 1.22.17 (https://github.com/heroku/heroku-buildpack-ruby/pull/1238) * Default Ruby version is now 2.7.5 (https://github.com/heroku/heroku-buildpack-ruby/pull/1237) * Remove instrumentation and LPXC logic (https://github.com/heroku/heroku-buildpack-ruby/pull/1229) -## v232 (11/9/2021) +## [v232] - 2021-11-09 * Deactivate LPXC (https://github.com/heroku/heroku-buildpack-ruby/pull/1228) -## v231 (10/27/2021) +## [v231] - 2021-10-27 * Applications with `package.json` now get `nodejs` installed (https://github.com/heroku/heroku-buildpack-ruby/pull/1212) * Applications with `yarn.lock` now get `yarn` installed (https://github.com/heroku/heroku-buildpack-ruby/pull/1212) -## v230 (10/5/2021) +## [v230] - 2021-10-05 * Default Ruby version is now 2.7.4 (https://github.com/heroku/heroku-buildpack-ruby/pull/1193) -## v229 (8/30/2021) +## [v229] - 2021-08-30 * Fix interoperability with other Heroku buildpacks' `$WEB_CONCURRENCY` handling (https://github.com/heroku/heroku-buildpack-ruby/pull/1188) -## v228 (6/24/2021) +## [v228] - 2021-06-24 * Bundler 2.x is now 2.2.21 (https://github.com/heroku/heroku-buildpack-ruby/pull/1170) * Remove support for the Cedar-14 and Heroku-16 stacks (https://github.com/heroku/heroku-buildpack-ruby/pull/1163) -## v227 (4/19/2021) +## [v227] - 2021-04-19 * Bundler 2.x is now 2.2.16 (https://github.com/heroku/heroku-buildpack-ruby/pull/1150) -## v226 (4/13/2021) +## [v226] - 2021-04-13 * Bundler 2.x is now 2.2.15 (https://github.com/heroku/heroku-buildpack-ruby/pull/1144) -## v225 (2/25/2021) +## [v225] - 2021-02-25 * Bundler 2.x is now 2.2.11 (https://github.com/heroku/heroku-buildpack-ruby/pull/1132) -## v224 (2/24/2021) +## [v224] - 2021-02-24 * Ruby buildpack now relies on the JVM buildpack to install java for Jruby apps (https://github.com/heroku/heroku-buildpack-ruby/pull/1119) -## v223 (1/22/2021) +## [v223] - 2021-01-22 -* Fix Gemfile.lock read bug from preventing propper removal of BUNDLED WITH declaration (https://github.com/heroku/heroku-buildpack-ruby/pull/1108) +* Fix Gemfile.lock read bug from preventing proper removal of BUNDLED WITH declaration (https://github.com/heroku/heroku-buildpack-ruby/pull/1108) * Fail detection with a CNB-friendly exit code (https://github.com/heroku/heroku-buildpack-ruby/pull/1111) -## v222 (11/02/2020) +## [v222] - 2020-11-02 * CNB support for Heroku-20 (https://github.com/heroku/heroku-buildpack-ruby/pull/1096) -## v221 (10/22/2020) +## [v221] - 2020-10-22 * Remove excessive Active Storage warnings (https://github.com/heroku/heroku-buildpack-ruby/pull/1087) * Add Heroku-20 to the download presence check (https://github.com/heroku/heroku-buildpack-ruby/pull/1093) -## v220 (8/7/2020) +## [v220] - 2020-08-07 * BUNDLE_WITHOUT now accommodates values with single spaces (https://github.com/heroku/heroku-buildpack-ruby/pull/1083) -## v219 (8/6/2020) +## [v219] - 2020-08-06 * Fix double installation of bundler on CI runs when no test script is specified (https://github.com/heroku/heroku-buildpack-ruby/pull/1073) * Bundler 2.x is now 2.1.4 (https://github.com/heroku/heroku-buildpack-ruby/pull/1052) @@ -212,309 +213,309 @@ * Rake task "assets:clean" will not get called if it does not exist (https://github.com/heroku/heroku-buildpack-ruby/pull/1018) * CNB: Fix the `gems` layer not being made accessible by subsequent buildpacks (https://github.com/heroku/heroku-buildpack-ruby/pull/1033) -## v218 (7/13/2020) +## [v218] - 2020-07-13 * The rake binstub generated from compiling Ruby will no longer be placed in the local `bin/rake` location (https://github.com/heroku/heroku-buildpack-ruby/pull/1031) * A bug in 2.6.0, 2.6.1, 2.6.3 require a Ruby upgrade, a warning has been added (https://github.com/heroku/heroku-buildpack-ruby/pull/1015) -* The spring library is now disabled by setting the enviornment variable DISABLE_SPRING=1 (https://github.com/heroku/heroku-buildpack-ruby/pull/1017) +* The spring library is now disabled by setting the environment variable DISABLE_SPRING=1 (https://github.com/heroku/heroku-buildpack-ruby/pull/1017) * Warn when a bad "shebang" line in a binstub is detected (https://github.com/heroku/heroku-buildpack-ruby/pull/1014) * Default node version now 12.16.2, yarn is 1.22.4 (https://github.com/heroku/heroku-buildpack-ruby/pull/986) - ## v217 (7/2/2020) + ## [v217] - 2020-07-02 * Gracefully handle unrecognised stacks ([#982](https://github.com/heroku/heroku-buildpack-ruby/pull/982)) -## v216 (rolled back) +## [v216] (rolled back) -## v215 (4/9/2020) +## [v215] - 2020-04-09 * Fix bundler cache not being used in CI builds (https://github.com/heroku/heroku-buildpack-ruby/pull/978) -## v214 (4/2/2020) +## [v214] - 2020-04-02 * Default Ruby version is now 2.6.6 (https://github.com/heroku/heroku-buildpack-ruby/pull/974) * Fix regression. PATH value for `yarn` at runtime was relative instead of absolute (https://github.com/heroku/heroku-buildpack-ruby/pull/975) -## v213 (4/1/2020) +## [v213] - 2020-04-01 * Fix regression. PATH value for `ruby` at runtime was relative instead of absolute (https://github.com/heroku/heroku-buildpack-ruby/pull/973) -## v212 (3/26/2020) +## [v212] - 2020-03-26 * Cloud Native Buildpack support (https://github.com/heroku/heroku-buildpack-ruby/pull/888) -## v211 (3/12/2020) +## [v211] - 2020-03-12 * Fix issue where the wrong version of bundler is used on CI apps (https://github.com/heroku/heroku-buildpack-ruby/pull/961) * Remove libpq external dependency (https://github.com/heroku/heroku-buildpack-ruby/pull/959) -## v210 (3/6/2020) +## [v210] - 2020-03-06 * Fix version download error warning inversion logic (https://github.com/heroku/heroku-buildpack-ruby/pull/958) -## v209 (3/5/2020) +## [v209] - 2020-03-05 * Fix bug in version download error message logic (https://github.com/heroku/heroku-buildpack-ruby/pull/957) -## v208 (3/4/2020) +## [v208] - 2020-03-04 * Improve Ruby version download error messages (https://github.com/heroku/heroku-buildpack-ruby/pull/953) * Update default Ruby version to 2.6.5 (https://github.com/heroku/heroku-buildpack-ruby/pull/947) -## v207 (12/16/2019) +## [v207] - 2019-12-16 * Vendor in libpq 5.12.1 for Heroku-18 (https://github.com/heroku/heroku-buildpack-ruby/pull/936) * Remove possibilities of false exceptions being raised by removing `BUNDLED WITH` from the `Gemfile.lock` (https://github.com/heroku/heroku-buildpack-ruby/pull/928) -## v206 (10/15/2019) +## [v206] - 2019-10-15 * Default Ruby version for new apps is now 2.5.7 (https://github.com/heroku/heroku-buildpack-ruby/pull/926) * Using old and EOL versions of Ruby now generate warnings (https://github.com/heroku/heroku-buildpack-ruby/pull/864) -## v205 (9/24/2019) +## [v205] - 2019-09-24 * Update bundler 1.x to 1.17.3 (https://github.com/heroku/heroku-buildpack-ruby/pull/845) * Default `MALLOC_ARENA_MAX=2` for new applications (https://github.com/heroku/heroku-buildpack-ruby/pull/752) -## v204 (9/12/2019) +## [v204] - 2019-09-12 * Default Ruby version for new apps is now 2.5.6 (https://github.com/heroku/heroku-buildpack-ruby/pull/919) * Ensure that old binstubs are removed before new ones are generated (https://github.com/heroku/heroku-buildpack-ruby/pull/914) * Fix windows Gemfile.lock BUNDLED WITH support (https://github.com/heroku/heroku-buildpack-ruby/pull/898) -## v203 (8/20/2019) +## [v203] - 2019-08-20 * Make sure Rails 6 apps have a `tmp/pids` folder so they can boot (https://github.com/heroku/heroku-buildpack-ruby/pull/909) -## v202 (8/20/2019) +## [v202] - 2019-08-20 * Add support class for Rails 6 (https://github.com/heroku/heroku-buildpack-ruby/pull/908) -## v201 (6/23/2019) +## [v201] - 2019-06-23 * Set memory default for Node builds (https://github.com/heroku/heroku-buildpack-ruby/pull/861) * Default Ruby version is now 2.5.5, was previously 2.5.3 (https://github.com/heroku/heroku-buildpack-ruby/pull/863) * Default Node version is now 10.15.3 and default Yarn version is now 1.16.0 (https://github.com/heroku/heroku-buildpack-ruby/pull/884) * Bundler 2 now uses 2.0.2 (https://github.com/heroku/heroku-buildpack-ruby/pull/894) -## v200 (3/7/2019) +## [v200] - 2019-03-07 * Fix: Environment variables not being exported for other buildpacks in CI (https://github.com/heroku/heroku-buildpack-ruby/pull/858) * Ignore invalid byte encodings when detecting rails config (https://github.com/heroku/heroku-buildpack-ruby/pull/854) -## v199 (2/19/2019) +## v199 - 2019-02-19 * Add support for arbitrary Bundler major versions, most notably bundler 2 (https://github.com/heroku/heroku-buildpack-ruby/pull/850) -## v198 (1/17/2019) +## v198 - 2019-01-17 * Rev-default Ruby version to be the latest patch release of last years Ruby version 2.5.3 (https://github.com/heroku/heroku-buildpack-ruby/pull/846) * Allow apps to enable `RUBYOPT=--jit` (https://github.com/heroku/heroku-buildpack-ruby/pull/848) -## v197 (12/18/2018) +## v197 - 2018-12-18 * Upgrade node version (https://github.com/heroku/heroku-buildpack-ruby/pull/831) * Upgrade yarn version (https://github.com/heroku/heroku-buildpack-ruby/pull/832) -## v196 (10/31/2018) +## v196 - 2018-10-31 * Delete the sprockets temp directory for a smaller runtime slug if they are not building assets at runtime (https://github.com/heroku/heroku-buildpack-ruby/pull/812) -## v195 (10/18/2018) +## v195 - 2018-10-18 * Default Ruby version is now 2.4.5 (https://github.com/heroku/heroku-buildpack-ruby/pull/821) -## v194 (10/16/2018) +## v194 - 2018-10-16 * Do not add the `jobs:work` command if an app does not have that rake task available (https://github.com/heroku/heroku-buildpack-ruby/pull/810) -## v193 (9/14/2018) +## v193 - 2018-09-14 * Fix link (https://github.com/heroku/heroku-buildpack-ruby/pull/811) -## v192 (9/14/2018) +## v192 - 2018-09-14 * Add error messages when using unsupported Ruby versions on the Heroku-18 stack (https://github.com/heroku/heroku-buildpack-ruby/pull/809) -## v191 (8/23/2018) +## v191 - 2018-08-23 * Warn when `config.action_dispatch.x_sendfile_header` is set but apache and nginx are not being used (https://github.com/heroku/heroku-buildpack-ruby/pull/795) -## v190 (7/24/2018) +## v190 - 2018-07-24 * Support TAP output for Heroku CI (https://github.com/heroku/heroku-buildpack-ruby/pull/790). -## v189 (7/10/2018) +## v189 - 2018-07-10 * Colorize build failures and warnings. (https://github.com/heroku/heroku-buildpack-ruby/pull/788) -## v188 (6/26/2018) +## v188 - 2018-06-26 -* Fix rails config detect timeout. Addreses the process deadlock when detecting rails config that contains an infinite task. This was originally addressed in #770 but the implementation did not handle all cases. (#781) +* Fix rails config detect timeout. Addresses the process deadlock when detecting rails config that contains an infinite task. This was originally addressed in #770 but the implementation did not handle all cases. (#781) -## v187 (6/19/2018) +## v187 - 2018-06-19 * Prevent apps from deploying with known security vulnerability activated via config (#776) -## v186 (6/12/2018) +## v186 - 2018-06-12 * The Ruby buildpack can now detect Rails configuration in a project (#758 #770) -## v185 (5/31/2018) +## v185 - 2018-05-31 * The Ruby buildpack bootstrap Ruby version is now 2.5.1. This is not a customer facing feature (#765) -## v184 (5/30/2018) +## v184 - 2018-05-30 * Default Ruby version is now 2.4.4 (#734) -## v183 (4/26/2018) +## v183 - 2018-04-26 * Support for not yet released heroku-18 stack (#750) -## v182 (4/24/2018) +## v182 - 2018-04-24 * Do not warn when `rails runner` cannot be executed (#749) -## v181 (4/23/2018) +## v181 - 2018-04-23 -* The `active_storage` is not guranteed to be present (#748) +* The `active_storage` is not guaranteed to be present (#748) -## v180 (4/23/2018) +## v180 - 2018-04-23 * Fix case where user environment variables were not being used (#745) -## v179 (4/23/2018) +## v179 - 2018-04-23 * Emit warnings for Active Storage (#739) -## v178 (4/17/2018) +## v178 - 2018-04-17 * Use S3 directly instead of s3pository for Node downloads (#740) -## v177 (4/10/2018) +## v177 - 2018-04-10 * New apps that do not specify a Ruby version now get 2.3.7 (#732) * Bugfix: `bundle install` output no longer has an extra newline (#735) -* Bugfix: when deploying an application the `ruby` version specified in the Gemfile is available outide of the home directory (#733) +* Bugfix: when deploying an application the `ruby` version specified in the Gemfile is available outside of the home directory (#733) -## v176 (3/27/2018) +## v176 - 2018-03-27 * Node version upgraded to v8.9.4 (#714) * Yarn version upgraded to v1.5.1 (#714) * Fix issue with malformed UTF-8 string parsing (#724) -## v175 (03/21/2018) +## v175 - 2018-03-21 * Suggest users encountering a specific sprockets error in specific beta versions to upgrade (#718) * Log metrics for common failures (#716) -## v174 (02/13/2018) +## v174 - 2018-02-13 * Only set JAVA_HOME for Bundler when using JRuby (#649, @jkutner) -## v173 (12/22/2017) +## v173 - 2017-12-22 * Remove Bundler shim since Bundler 2.5.0 will not vendor Bundler (#645) -## v172 (12/22/2017) +## v172 - 2017-12-22 * updated Ruby 2.5.0 support + Bundler shim (#640) * Disable bundler version check (#632) * set JAVA_HOME to absolute path during `bundle install` (#631) -## v170 (10/19/2017) +## v170 - 2017-10-19 -* Compatiability for Ruby 2.5.0 preview 1 (#628) +* Compatibility for Ruby 2.5.0 preview 1 (#628) -## v169 (09/28/2017) +## v169 - 2017-09-28 * Yarn version upgraded to v1.0.2 -## v168 (08/14/2017) +## v168 - 2017-08-14 * Install Node when using either ExecJS _or_ Webpacker (#608) * Make installs more robust against temporary network issues by retrying failed downloads in `LanguagePack::Fetcher#fetch_untar`, which installs Rubies (#585) -## v167 (07/25/2016) +## v167 - 2016-07-25 * Update Bundler to 1.15.2 (#602) -## v166 (07/11/2017) +## v166 - 2017-07-11 * no changes from v165 -## v165 (07/11/2017) +## v165 - 2017-07-11 * Set `$JAVA_HOME` for JRuby apps during build (#593) * Update Node to 6.11.1 (#598) -## v164 (06/21/2017) +## v164 - 2017-06-21 * Update Bundler to 1.15.1 (#579) -## v163 (05/22/2017) +## v163 - 2017-05-22 * Fix CI rake tasks not running (#571) -## v162 (05/18/2017) +## v162 - 2017-05-18 -* Disable roubocop warnings for `heroku_clear_tasks` (#567) +* Disable RuboCop warnings for `heroku_clear_tasks` (#567) -## v161 (05/18/2017) +## v161 - 2017-05-18 * Ruby apps being run on CI are no longer expected to have Rails commands (#565) -## v160 (05/18/2017) +## v160 - 2017-05-18 * `bin/rails test` only gets called in CI for Rails 5+ apps * support `:sql` (structure) Rails schema for CI (#549) -## v159 (04/24/2017) +## v159 - 2017-04-24 * Blacklist JAVA_OPTS and JAVA_TOOL_OPTIONS during build (#559) -## v158 (04/12/2017) +## v158 - 2017-04-12 * Fix CI issue causing system Ruby to be used (#558) -## v157 (04/11/2017) +## v157 - 2017-04-11 * Fix "double ruby rainbow bug" caused by executing two `compile` actions on the same app (#553 & #555) -* Remove Ruby 1.8.7 compatiability to allow for #555. This version of Ruby has been EOL +* Remove Ruby 1.8.7 compatibility to allow for #555. This version of Ruby has been EOL for a long time. It is not available on Cedar-14 and Cedar-10 is EOL -## v156 (04/11/2017) +## v156 - 2017-04-11 * Update default Ruby version to 2.3.4. -## v155 (03/16/2017) +## v155 - 2017-03-16 * Yarn now installed for apps with `webpacker` gem (#547) -## v154 (03/01/2017) +## v154 - 2017-03-01 * Postgres database add-on will only be provisioned if app has a postgres driver in the `Gemfile`. (#535) * Fix regression, where JRuby patchlevel was being pulled from `Gemfile.lock` and used when not appropriate (#536) -## v153 (01/18/2017) +## v153 - 2017-01-18 * Fix regression, where defaults would override user env with rake (#528) -## v152 (01/18/2017) +## v152 - 2017-01-18 * Remove RAILS_GROUPS=assets from being set in .profile.d (#526) -## v151 (01/16/2017) +## v151 - 2017-01-16 * Upgrade to bundler 1.13.7 (#519) * Vendor Default Ruby to execute the buildpack (#515) * Heroku CI Support (#516) -## v150 (12/23/2016) +## v150 - 2016-12-23 * Allow deployment of pre-release rubies (preview and rc) with Bundler 1.13.6+. This is needed because the patch level is recorded in the gemfile as `-1` since it is not released yet. For example 2.4.0rc1 will show up in a `Gemfile.lock` like this: @@ -523,48 +524,48 @@ RUBY VERSION ruby 2.4.0p-1 ``` -## v149 (12/01/2016) +## v149 - 2016-12-01 * Guarantee we always show warning when upgrading bundler version. -## v148 (11/17/2016) +## v148 - 2016-11-17 * Default Ruby Version is 2.2.6 * Update libyaml to 0.1.7 for [CVE-2014-9130](https://devcenter.heroku.com/changelog-items/1016) -## v147 (11/15/2016) +## v147 - 2016-11-15 * Bump bundler to 1.13.6 [Bundler changelog](https://github.com/bundler/bundler/blob/v1.13.6/CHANGELOG.md). Allows for use of Ruby version operators. -## v146 (03/23/2016) +## v146 - 2016-03-23 * Warn when `.bundle/config` is checked in (#471) * Do not cache `.bundle/config` between builds (#471) * Set WEB_CONCURRENCY for M-Performance dynos using sensible defaults (#474) * Fix rake task detection in Rails apps actually fails builds (#475) -## v145 (03/08/2016) +## v145 - 2016-03-08 * Bump bundler to 1.11.2 [Bundler changelog](https://github.com/bundler/bundler/blob/master/CHANGELOG.md#1112-2015-12-15) (#461) * Rails 5 Support for logging to STDOUT via environment variable (#460) * Fail build when rake tasks cannot be detected in a Rails app (#462) -## v144 (02/01/2016) +## v144 - 2016-02-01 * Fix default ruby to actually be Ruby 2.2.4 (#456) -## v143 (01/28/2016) +## v143 - 2016-01-28 * Change default for new apps to Ruby 2.2.4 (#454) -## v142 (01/14/2016) +## v142 - 2016-01-14 * Added pgconfig jar to JDK for JRuby JDBC (#450) * Let API pick exact postgres plan (#449) * Follow redirects on `curl` command (#443) * Check for preinstalled JDK (#434) -## v141 (11/03/2015) +## v141 - 2015-11-03 * Support for custom JDK versions in system.properties (#423) * Fix nodejs buildpack integration (#429) @@ -572,35 +573,35 @@ RUBY VERSION * Warn when RAILS_ENV != production (https://devcenter.heroku.com/articles/deploying-to-a-custom-rails-environment) * Warn when using asset_sync (https://devcenter.heroku.com/articles/please-do-not-use-asset-sync) -## v140 (9/9/2015) +## v140 - 2015-09-09 * JRuby specific ruby error message (#412) -## v139 (8/31/2015) +## v139 - 2015-08-31 * Cached asset file should never take precedent over existing file (#402) * Do not write `database.yml` when using active record >= 4.1 (previously we only detected >= Rails 4.1) (#403) -## v138 (5/19/2015) +## v138 - 2015-05-19 * Bump bundler to 1.9.7 [Bundler changelog](https://github.com/bundler/bundler/blob/master/CHANGELOG.md#196-2015-05-02) (#378) -## v137 (5/11/2015) +## v137 - 2015-05-11 * Blacklist `JRUBY_OPTS`, use `JRUBY_BUILD_OPTS` to override build `JRUBY_OPTS`. (#384) * Revert `--dev` during JRuby build for now. (#384) -## v136 (5/6/2015) +## v136 - 2015-05-06 * JRUBY_BUILD_OPTS env var will override any build time jruby opts (#381) -## v135 (5/5/2015) +## v135 - 2015-05-05 * Support sprockets 3.0 manifest file naming convention (#367) * Set `--dev` by default for JRuby builds (but not at runtime). This optimizes the JVM for short process and is ideal for `bundle install` and asset precompiles. * Cleanup `.git` folders in the bundle directory after `bundle install`. -## v134 (3/1/2015) +## v134 - 2015-03-01 * JVM is now available on cedar-14, do not vendor in JVM based on individual gems. If customer needs a specific version they should use multibuildpack with java and ruby buildpacks. * Set a default value of WEB_CONCURRENCY based on dyno size when `SENSIBLE_DEFAULTS` environment variable is present. @@ -608,11 +609,11 @@ RUBY VERSION * Rails 4.2+ apps will have environment variable RAILS_SERVE_STATIC_FILES set to "enabled" by default #349 * Rails 5 apps now work on Heroku #349 -## v133 (1/22/2015) +## v133 - 2015-01-22 * Bump bundler to 1.7.12 which includes multiple fixes and support for block source declaration (https://github.com/bundler/bundler/blob/1-7-stable/CHANGELOG.md). -## v132 (1/21/2015) +## v132 - 2015-01-21 * Support multibuildpack export file (#319) * Auto set the JVM MAX HEAP based on dyno size for JRuby (#323) @@ -620,11 +621,11 @@ RUBY VERSION * Support system.properties file for specifying JDK in JRuby (#305) * Fix ruby version parsing to support JRuby 9.0.0.0.pre1 (#339) -## v131 (1/15/2015) +## v131 - 2015-01-15 -* Revert v130 due to lack of propper messaging around WEB_CONCURRENCY settings. +* Revert v130 due to lack of proper messaging around WEB_CONCURRENCY settings. -## v130 (1/15/2015) +## v130 - 2015-01-15 * Auto set WEB_CONCURRENCY based on dyno size if not already set. * Support multibuildpack export file (#319) @@ -632,58 +633,58 @@ RUBY VERSION * Use s3 based npmjs servers for node (#336) * Support system.properties file for specifying JDK in JRuby (#305) -## v129 (11/6/2014) +## v129 - 2014-11-06 * Fix asset caching bug (#300) -## v128 (11/4/2014) +## v128 - 2014-11-04 * Better cedar14 Ruby install error message -## v127 (9/18/2014) +## v127 - 2014-09-18 * rbx is now stack aware -## v126 (8/4/2014) +## v126 - 2014-08-04 * fix bundler cache clearing on ruby version change * vendor the jvm when yui-compressor is detected -## v125 (8/1/2014) +## v125 - 2014-08-01 * bump to node 0.10.30 on cedar-14 -## v124 (8/1/2014) +## v124 - 2014-08-01 * use node 0.10.29 on cedar-14 * properly use vendored jvm, so not to be dependent on java on the stack image -## v123 (7/25/2014) +## v123 - 2014-07-25 * fix permission denied edge cases when copying the bundler cache with minitest -## v122 (7/25/2014) +## v122 - 2014-07-25 * handle bundler cache for stack changes on existing apps -## v121 (6/30/2014) +## v121 - 2014-06-30 * on new apps, source default envs instead of replacing them * support different stacks for new apps -## v120 (6/16/2014) +## v120 - 2014-06-16 * Bump bundler to 1.6.3 which includes improved dependency resolver -## v119 (5/9/2014) +## v119 - 2014-05-09 * Temporarily disable default ruby cache -## v118 (5/6/2014) +## v118 - 2014-05-06 * Ruby version detection now loads user environment variables -## v117 (4/14/2014) +## v117 - 2014-04-14 Features: @@ -693,7 +694,7 @@ Bugfixes: * fix anvil use case of multibuildpack with node -## v116 (4/10/2014) +## v116 - 2014-04-10 Features: @@ -703,7 +704,7 @@ Bugfixes: * Revert back to Bundler 1.5.2 -## v115 (4/9/2014) +## v115 - 2014-04-09 Features: @@ -712,7 +713,7 @@ Bugfixes: * Add default process types to all apps deployed regardless of `Procfile` -## v114 (4/9/2014) +## v114 - 2014-04-09 Features: @@ -722,7 +723,7 @@ Features: Bugfixes: -## v113 (4/8/2014) +## v113 - 2014-04-08 Features: @@ -734,7 +735,7 @@ Bugfixes: * Don't double print "Running: rake assets:precompile" on Ruby apps -## v112 (3/27/2014) +## v112 - 2014-03-27 Features: @@ -743,7 +744,7 @@ Bugfixes: * compile psych with libyaml 0.1.6 for CVE-2014-2525 -## v111 (3/20/2014) +## v111 - 2014-03-20 Features: @@ -753,7 +754,7 @@ Bugfixes: * spelling -## v110 (3/20/2014) +## v110 - 2014-03-20 Features: @@ -761,7 +762,7 @@ Features: Bugfixes: -## v108 (2/27/2014) +## v108 - 2014-02-27 Features: @@ -771,13 +772,13 @@ Bugfixes: * don't let users step on themselves by replacing `env` in `$PATH` -## v107 (2/26/2014) +## v107 - 2014-02-26 Features: Bugfixes: -* more shellescaping bug fixes +* more shell escaping bug fixes ## v105 @@ -785,16 +786,16 @@ Bugfixes: Rollbacked to v103 -## v104 (2/26/2014) +## v104 - 2014-02-26 Features: Bugfixes: -* fix bugs in shellescaping (#231) +* fix bugs in shell escaping (#231) -## v103 (2/18/2014) +## v103 - 2014-02-18 Features: @@ -803,7 +804,7 @@ Features: Bugfixes: -## v102 (2/6/2014) +## v102 - 2014-02-06 Features: @@ -812,7 +813,7 @@ Bugfixes: * use blacklist of env vars, so users can't break the build process -## v101 (2/5/2014) +## v101 - 2014-02-05 Features: @@ -823,7 +824,7 @@ Bugfixes: * quote ponies env vars, so build doesn't break -## v100 (2/4/2014) +## v100 - 2014-02-04 Features: @@ -831,7 +832,7 @@ Bugfixes: * compile psych with libyaml 0.1.5 for CVE-2013-6393 -## v99 (2/4/2014) +## v99 - 2014-02-04 Features: @@ -840,7 +841,7 @@ Features: Bugfixes: -## v98 (1/30/2014) +## v98 - 2014-01-30 Features: @@ -849,7 +850,7 @@ Bugfixes: * Use vendored JDK binary during build -## v97 (1/30/2014) +## v97 - 2014-01-30 Features: @@ -858,7 +859,7 @@ Bugfixes: * Actually finalize method rename to `install_bundler_in_app` -## v96 (1/29/2014) +## v96 - 2014-01-29 Features: @@ -870,7 +871,7 @@ Bugfixes: Rollback to v93 -## v94 (1/29/2014) +## v94 - 2014-01-29 Features: @@ -878,7 +879,7 @@ Bugfixes: * Fixed `uninitialized constant Rake::DSL` error when running rake tasks on Ruby 1.9.2 -## v93 (01/28/2014) +## v93 - 2014-01-28 Features: @@ -886,7 +887,7 @@ Features: Bugfixes: -## v92 (01/27/2014) +## v92 - 2014-01-27 Features: @@ -895,7 +896,7 @@ Bugfixes: * Only display rake error messages if a `Rakefile` exists * when detecting for ruby version, don't use stderr messages -## v91 (01/16/2014) +## v91 - 2014-01-16 Features: @@ -904,7 +905,7 @@ Features: Bugfixes: -## v90 (01/09/2014) +## v90 - 2014-01-09 Features: @@ -912,7 +913,7 @@ Features: Bugfixes: -## v89 (01/09/2014) +## v89 - 2014-01-09 Features: @@ -920,7 +921,7 @@ Features: Bugfixes: -## v86 (12/11/2013) +## v86 - 2013-12-11 Features: @@ -929,7 +930,7 @@ Bugfixes: * Windows warnings will now display before bundle install, this prevents an un-resolvable `Gemfile` from erroring which previously prevented the warning roll up from being shown. When this happened the developer did not see that we are clearing the `Gemfile.lock` from the git repository when bundled on a windows machine. * Checks for `public/assets/manifest*.json` and `public/assets/manifest.yml` will now come before Rake task detection introduced in v85. -## v85 (12/05/2013) +## v85 - 2013-12-05 Features: @@ -939,7 +940,7 @@ Bugfixes: * Any errors in a Rakefile will now be explicitly shown as such instead of hidden in a `assets:precompile` task detection failure (#171) * Now using correct default "hobby" database #179 -## v84 (11/06/2013) +## v84 - 2013-11-06 Features: @@ -950,7 +951,7 @@ Bugfixes: * Fix default gem cache -## v83 (10/29/2013) +## v83 - 2013-10-29 Features: @@ -964,20 +965,20 @@ Bugfixes: * Errors in Gemfiles will no longer show up as bad ruby versions #36 * Fix warning warning libjffi-1.2.so on < JRuby 1.7.3 -## v82 (10/28/2013) +## v82 - 2013-10-28 Bugfixes: * Rails 3 deploys that do not successfully run `assets:precompile` will now fail. -## v81 (10/15/2013) +## v81 - 2013-10-15 Features: * add Default Bundler Cache for new Ruby 2.0.0 apps * use Virginia S3 bucket instead of Cloudfront -## v80 (9/23/2013) +## v80 - 2013-09-23 Features: @@ -986,16 +987,16 @@ Features: Bugfixes: -* Disable invoke dynamic on JRuby by default until JDK stabalizes it +* Disable invoke dynamic on JRuby by default until JDK stabilizes it -## v79 (9/3/2013) +## v79 - 2013-09-03 Bugfixes: * Remove LPXC debug output when `DEBUG` env var is set (#141) * Symlink ruby.exe, so Rails 4 bins work for Windows (#139) -## v78 (8/28/2013) +## v78 - 2013-08-28 Features: @@ -1005,19 +1006,19 @@ Bugfixes: * Fix issue #127 Race condition with LPXC -## v77 (8/5/2013) +## v77 - 2013-08-05 Features: * Force nokogiri to compile with system libs -## v76 (7/29/2013) +## v76 - 2013-07-29 Bugfixes: * fix request_id for instrumentation to follow standard -## v75 (7/29/2013) +## v75 - 2013-07-29 Features: @@ -1028,45 +1029,45 @@ Bugfixes: * OpenJDK version was rolled back, stop special casing JRuby 1.7.3. -## v74 (7/24/2013) +## v74 - 2013-07-24 Bugfixes: * Lock JRuby 1.7.3 and lower to older version of JDK due to -## v73 (7/23/2013) +## v73 - 2013-07-23 * Revert to v69 due to asset:precompile bugs -## v72 (7/23/2013) +## v72 - 2013-07-23 Bugfixes: * Fix rake task detection for Rails 3 (@hynkle, #118) -## v71 (7/18/2013) +## v71 - 2013-07-18 * Revert to v69 due to asset:precompile bugs -## v70 (7/18/2013) +## v70 - 2013-07-18 Bugfixes: * Don't silently fail rake task checks (@gabrielg, #34) -## v69 (7/16/2013) +## v69 - 2013-07-16 Bugfixes: * Add spacing to end of instrumentation -## v68 (7/16/2013) +## v68 - 2013-07-16 Features: * Log buildpack name and entering rails3/4 compile -## v67 (7/10/2013) +## v67 - 2013-07-10 Features: @@ -1078,13 +1079,13 @@ Bugfixes: * Don't print DEBUG messages for lxpc when env var is present * Fix ruby gemfile warning line for JRuby -## v66 (7/9/2013) +## v66 - 2013-07-09 Bugfixes: * Include logtoken properly -## v65 (7/9/2013) +## v65 - 2013-07-09 Features: @@ -1094,7 +1095,7 @@ Bugfixes: * Fix DATABASE_URL to use jdbc-postgres for JRuby (@jkrall, #116) -## v64 (6/19/2013) +## v64 - 2013-06-19 Features: @@ -1106,7 +1107,7 @@ Bugfixes: * fix sqlite3 error messaging detection -## v63 (6/17/2013) +## v63 - 2013-06-17 Features: @@ -1114,14 +1115,14 @@ Features: * Change default ruby to 2.0.0 * Stop using the stack image ruby and always vendor ruby -## v62 (5/21/2013) +## v62 - 2013-05-21 Bugfixes: * Correctly detect asset manifest files in Rails 4 * Fix jruby 1.8.7 bundler/psych require bug -## v61 (4/18/2013) +## v61 - 2013-04-18 Features: @@ -1131,62 +1132,62 @@ Bugfixes: * Rebuild bundler cache if rubygems 2 is detected. Bugfixes in later rubygems. -## v60 (4/17/2013) +## v60 - 2013-04-17 Security: * Disable Java RMI Remote Classloading for CVE-2013-1537, -## v59 (4/4/2013) +## v59 - 2013-04-04 Bugfixes: * Change JVM S3 bucket -## v58 (3/19/2013) +## v58 - 2013-03-19 Bugfixes: * Fix ruby 1.8.7 not being able to compile native extensions -## v57 (3/18/2013) +## v57 - 2013-03-18 Bugfixes: * Fix git gemspec bug in bundler -## v56 (3/11/2013) +## v56 - 2013-03-11 Bugfixes: * Upgrade bundler to 1.3.2 to fix --dry-clean/Would have removed bug in bundle clean, part 2. -## v55 (3/7/2013) +## v55 - 2013-03-07 Bugfixes: * Revert back to Bundler 1.3.0.pre.5, see https://gist.github.com/mattonrails/e063caf86962995e7ba0 -## v54 (3/7/2013) +## v54 - 2013-03-07 Bugfixes: * Upgrade bundler to 1.3.2 to fix --dry-clean/Would have removed bug in bundle clean -## v53 (3/6/2013) +## v53 - 2013-03-06 Bugfixes: * bin/detect for Rails 3 and 4 will use railties for detection vs the rails gem * bin/detect does not error out when Gemfile + Gemfile.lock are missing -## v52 (2/25/2013) +## v52 - 2013-02-25 Bugfixes: * Revert back to 1.3.0.pre.5 due to bundler warnings -## v51 (2/25/2013) +## v51 - 2013-02-25 Features: @@ -1197,39 +1198,39 @@ Bugfixes: * Better buildpack detection through Gemfile.lock gems -## v50 (1/31/2013) +## v50 - 2013-01-31 Features: * Restore ruby deploys back to normal -## v49 (1/30/2013) +## v49 - 2013-01-30 Features: * Re-enable ruby deploys for apps just using the heroku cache * Display ruby version change when busting the cache -## v48 (1/30/2013) +## v48 - 2013-01-30 Features: * Update deploy error message copy to link to status incident. -## v47 (1/30/2013) +## v47 - 2013-01-30 Features: * Disable ruby deploys due to rubygems.org compromise -## v46 (1/10/2013) +## v46 - 2013-01-10 Features: * Upgrade Bundler to 1.3.0.pre.5 * bundler binstubs now go in vendor/bundle/bin -## v45 (12/14/2012) +## v45 - 2012-12-14 Features: @@ -1237,87 +1238,87 @@ Features: * Enable Invoke Dynamic on JRuby by default * GEM_PATH is now updated on each push -## v44 (12/14/2012) +## v44 - 2012-12-14 Faulty Release -## v43 (12/13/2012) +## v43 - 2012-12-13 Features: * Upgrade Bundler to 1.3.0.pre.2 -## v42 (11/26/2012) +## v42 - 2012-11-26 Features: * Upgrade Bundler to 1.2.2 to fix Ruby 2.0.0/YAML issues -## v41 (11/1/2012) +## v41 - 2012-11-01 Features: * Enable ruby 2.0.0 support for testing -## v40 (10/14/2012) +## v40 - 2012-10-14 Features: * Cache version of the buildpack we used to deploy * Purge cache when v38 is detected -## v39 (10/14/2012) +## v39 - 2012-10-14 Bugfixes: * Don't display cache clearing message for new apps * Actually clear bundler cache on ruby version change -## v38 (10/14/2012) +## v38 - 2012-10-14 Bugfixes: * Stop bundle cache from continually growing -## v37 (10/12/2012) +## v37 - 2012-10-12 Bugfixes: * Remove temporary workaround from v36. * Clear bundler cache upon Ruby version change -## v36 (10/12/2012) +## v36 - 2012-10-12 Bugfixes: * Always clear the cache for ruby 1.9.3 as a temporary workaround due to the security upgrade -## v35 (9/19/2012) +## v35 - 2012-09-19 Features: * Upgrade to Bundler 1.2.1 * Display bundle clean output -* More resilent to rubygems.org API outages +* More resilient to rubygems.org API outages Bugfixes: * `bundle clean` works again -## v34 (8/30/2012) +## v34 - 2012-08-30 Features: * Upgrade to Bundler 1.2.0 -## v33 (8/9/2012) +## v33 - 2012-08-09 Features: * Upgrade to Bundler 1.2.0.rc.2 * vendor JDK7 for JRuby, but disable invoke dynamic -## v29 (7/19/2012) +## v29 - 2012-07-19 Features: @@ -1325,7 +1326,7 @@ Features: * sync stdout so that the buildpack streams even in non-interactive shells * Upgrade to Bundler 1.2.0.rc -## v28 (7/16/2012) +## v28 - 2012-07-16 Features: @@ -1336,39 +1337,39 @@ Bugfixes: * sqlite3 error gets displayed again -## v27 (6/14/2012) +## v27 - 2012-06-14 Bugfixes: * Remove `vendor/bundle` message only appears when dir actually exists -## v26 (6/14/2012) +## v26 - 2012-06-14 Features: * print message when assets:precompile finishes successfully * Remove `vendor/bundle` if user commits it to their git repo. -## v25 (6/12/2012) +## v25 - 2012-06-12 Features: * support "ruby-xxx-jruby-yyy" for jruby detection packages -## v24 (6/7/2012) +## v24 - 2012-06-07 Features: * removes bundler cache in the slug, to minimize slug size (@stevenh512, #16) * optimize push time with caching -## v23 (5/8/2012) +## v23 - 2012-05-08 Bugfixes: * fix ruby version bug with "fatal:-Not-a-git-repository" -## v22 (5/7/2012) +## v22 - 2012-05-07 Features: @@ -1379,25 +1380,25 @@ Deprecation: * ENV['RUBY_VERSION'] in favor of bundler's ruby DSL -## v21 (3/21/2012) +## v21 - 2012-03-21 Features: * bundler 1.1.2 -## v20 (3/12/2012) +## v20 - 2012-03-12 Features: * bundler 1.1.0 \o/ -## v19 (1/25/2012) +## v19 - 2012-01-25 Bugfixes: * fix native extension building for rbx 2.0.0dev -## v18 (1/18/2012) +## v18 - 2012-01-18 Features: @@ -1408,49 +1409,49 @@ Bugfixes: * force db password to be a string in the yaml file -## v17 (12/29/2011) +## v17 - 2011-12-29 Features: * bundler 1.1.rc.7 -## v16 (12/29/2011) +## v16 - 2011-12-29 Features: * pass DATABASE_URL to rails 3.1 assets:precompile rake task detection -## v15 (12/27/2011) +## v15 - 2011-12-27 Features: * bundler 1.1.rc.6 -## v14 (12/22/2011) +## v14 - 2011-12-22 Bugfixes: * stop freedom patching syck in ruby 1.9.3+ -## v13 (12/15/2011) +## v13 - 2011-12-15 Features: * bundler 1.1.rc.5 -## v12 (12/13/2011) +## v12 - 2011-12-13 Bugfixes: * syck workaround for yaml/psych issues -## v11 (12/12/2011) +## v11 - 2011-12-12 Features: * bundler 1.1.rc.3 -## v10 (11/23/2011) +## v10 - 2011-11-23 Features: @@ -1461,7 +1462,7 @@ Bugfixes: * don't show sqlite3 error if it's in a bundle without group on failed bundle install -## v9 (11/14/2011) +## v9 - 2011-11-14 Features: @@ -1472,13 +1473,13 @@ Bugfixes: * don't leave behind ruby_versions.yml -## v8 (11/8/2011) +## v8 - 2011-11-08 Features: * use vm as part of RUBY_VERSION -## v7 (11/8/2011) +## v7 - 2011-11-08 Features: @@ -1489,7 +1490,7 @@ Bugfixes: * move "bin/" to the front of the PATH, so apps can override existing bins -## v6 (11/2/2011) +## v6 - 2011-11-02 Features: @@ -1499,3 +1500,71 @@ Bugfixes: * Change gem detection to use lockfile parser * use `$RACK_ENV` when thin is detected for rack apps + +[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v265...HEAD +[v265]: https://github.com/heroku/heroku-buildpack-ruby/compare/v264...v265 +[v264]: https://github.com/heroku/heroku-buildpack-ruby/compare/v263...v264 +[v263]: https://github.com/heroku/heroku-buildpack-ruby/compare/v262...v263 +[v262]: https://github.com/heroku/heroku-buildpack-ruby/compare/v261...v262 +[v261]: https://github.com/heroku/heroku-buildpack-ruby/compare/v260...v261 +[v260]: https://github.com/heroku/heroku-buildpack-ruby/compare/v259...v260 +[v259]: https://github.com/heroku/heroku-buildpack-ruby/compare/v258...v259 +[v258]: https://github.com/heroku/heroku-buildpack-ruby/compare/v257...v258 +[v257]: https://github.com/heroku/heroku-buildpack-ruby/compare/v256...v257 +[v256]: https://github.com/heroku/heroku-buildpack-ruby/compare/v255...v256 +[v255]: https://github.com/heroku/heroku-buildpack-ruby/compare/v254...v255 +[v254]: https://github.com/heroku/heroku-buildpack-ruby/compare/v253...v254 +[v253]: https://github.com/heroku/heroku-buildpack-ruby/compare/v252...v253 +[v252]: https://github.com/heroku/heroku-buildpack-ruby/compare/v251...v252 +[v251]: https://github.com/heroku/heroku-buildpack-ruby/compare/v250...v251 +[v250]: https://github.com/heroku/heroku-buildpack-ruby/compare/v249...v250 +[v249]: https://github.com/heroku/heroku-buildpack-ruby/compare/v248...v249 +[v248]: https://github.com/heroku/heroku-buildpack-ruby/compare/v247...v248 +[v247]: https://github.com/heroku/heroku-buildpack-ruby/compare/v246...v247 +[v246]: https://github.com/heroku/heroku-buildpack-ruby/compare/v245...v246 +[v245]: https://github.com/heroku/heroku-buildpack-ruby/compare/v244...v245 +[v244]: https://github.com/heroku/heroku-buildpack-ruby/compare/v243...v244 +[v243]: https://github.com/heroku/heroku-buildpack-ruby/compare/v242...v243 +[v242]: https://github.com/heroku/heroku-buildpack-ruby/compare/v241...v242 +[v241]: https://github.com/heroku/heroku-buildpack-ruby/compare/v240...v241 +[v240]: https://github.com/heroku/heroku-buildpack-ruby/compare/v239...v240 +[v239]: https://github.com/heroku/heroku-buildpack-ruby/compare/v238...v239 +[v238]: https://github.com/heroku/heroku-buildpack-ruby/compare/v237...v238 +[v237]: https://github.com/heroku/heroku-buildpack-ruby/compare/v236...v237 +[v236]: https://github.com/heroku/heroku-buildpack-ruby/compare/v235...v236 +[v235]: https://github.com/heroku/heroku-buildpack-ruby/compare/v234...v235 +[v234]: https://github.com/heroku/heroku-buildpack-ruby/compare/v233...v234 +[v233]: https://github.com/heroku/heroku-buildpack-ruby/compare/v232...v233 +[v232]: https://github.com/heroku/heroku-buildpack-ruby/compare/v231...v232 +[v231]: https://github.com/heroku/heroku-buildpack-ruby/compare/v230...v231 +[v230]: https://github.com/heroku/heroku-buildpack-ruby/compare/v229...v230 +[v229]: https://github.com/heroku/heroku-buildpack-ruby/compare/v228...v229 +[v228]: https://github.com/heroku/heroku-buildpack-ruby/compare/v227...v228 +[v227]: https://github.com/heroku/heroku-buildpack-ruby/compare/v226...v227 +[v226]: https://github.com/heroku/heroku-buildpack-ruby/compare/v225...v226 +[v225]: https://github.com/heroku/heroku-buildpack-ruby/compare/v224...v225 +[v224]: https://github.com/heroku/heroku-buildpack-ruby/compare/v223...v224 +[v223]: https://github.com/heroku/heroku-buildpack-ruby/compare/v222...v223 +[v222]: https://github.com/heroku/heroku-buildpack-ruby/compare/v221...v222 +[v221]: https://github.com/heroku/heroku-buildpack-ruby/compare/v220...v221 +[v220]: https://github.com/heroku/heroku-buildpack-ruby/compare/v219...v220 +[v219]: https://github.com/heroku/heroku-buildpack-ruby/compare/v218...v219 +[v218]: https://github.com/heroku/heroku-buildpack-ruby/compare/v217...v218 +[v217]: https://github.com/heroku/heroku-buildpack-ruby/compare/v216...v217 +[v216]: https://github.com/heroku/heroku-buildpack-ruby/compare/v215...v216 +[v215]: https://github.com/heroku/heroku-buildpack-ruby/compare/v214...v215 +[v214]: https://github.com/heroku/heroku-buildpack-ruby/compare/v213...v214 +[v213]: https://github.com/heroku/heroku-buildpack-ruby/compare/v212...v213 +[v212]: https://github.com/heroku/heroku-buildpack-ruby/compare/v211...v212 +[v211]: https://github.com/heroku/heroku-buildpack-ruby/compare/v210...v211 +[v210]: https://github.com/heroku/heroku-buildpack-ruby/compare/v209...v210 +[v209]: https://github.com/heroku/heroku-buildpack-ruby/compare/v208...v209 +[v208]: https://github.com/heroku/heroku-buildpack-ruby/compare/v207...v208 +[v207]: https://github.com/heroku/heroku-buildpack-ruby/compare/v206...v207 +[v206]: https://github.com/heroku/heroku-buildpack-ruby/compare/v205...v206 +[v205]: https://github.com/heroku/heroku-buildpack-ruby/compare/v204...v205 +[v204]: https://github.com/heroku/heroku-buildpack-ruby/compare/v203...v204 +[v203]: https://github.com/heroku/heroku-buildpack-ruby/compare/v202...v203 +[v202]: https://github.com/heroku/heroku-buildpack-ruby/compare/v201...v202 +[v201]: https://github.com/heroku/heroku-buildpack-ruby/compare/v200...v201 +[v200]: https://github.com/heroku/heroku-buildpack-ruby/compare/v199...v200 From 534f015e375b57076899a9b5340dc875c83fd131 Mon Sep 17 00:00:00 2001 From: Ed Morley <501702+edmorley@users.noreply.github.com> Date: Mon, 29 Jan 2024 20:07:16 +0000 Subject: [PATCH 0940/1195] Use the new "Prepare release" GitHub Actions workflow (#1417) We now have a new reusable GitHub Actions workflow for preparing a new classic buildpack release: https://github.com/heroku/languages-github-actions/blob/main/.github/workflows/_classic-buildpack-prepare-release.yml This workflow works the same as the CNB version, except it does not need any version bump input, since we only every increment classic buildpack versions by one. This buildpack has a couple of additional update steps required for releases (such as editing a constant in `lib/language_pack/version.rb` and moving any unreleased changelogs to a versioned directory), which are performed using the optional `custom_update_command` input to the shared workflow. GUS-W-14901972. --- .github/workflows/prepare-release.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/prepare-release.yml diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml new file mode 100644 index 000000000..a54da42ad --- /dev/null +++ b/.github/workflows/prepare-release.yml @@ -0,0 +1,25 @@ +name: Prepare Release + +on: + workflow_dispatch: + +# Disable all GITHUB_TOKEN permissions, since the GitHub App token is used instead. +permissions: {} + +jobs: + prepare-release: + uses: heroku/languages-github-actions/.github/workflows/_classic-buildpack-prepare-release.yml@latest + secrets: inherit + with: + custom_update_command: | + sed --in-place --regexp-extended \ + --expression "s/v${OLD_VERSION}/v${NEW_VERSION}/" \ + lib/language_pack/version.rb + + if compgen -G 'changelogs/unreleased/*.md' > /dev/null; then + # The unreleased changelogs directory contains a `.gitkeep` file, so we have to + # copy the markdown files individually instead of renaming the directory. + NEW_CHANGELOG_DIR="changelogs/v${NEW_VERSION}/" + mkdir -p "${NEW_CHANGELOG_DIR}" + mv changelogs/unreleased/*.md "${NEW_CHANGELOG_DIR}" + fi From 7af975892a4bfb7a4f3752546be9946b0b045f72 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 2 Feb 2024 13:12:19 +0000 Subject: [PATCH 0941/1195] Bump the ruby-dependencies group with 4 updates (#1418) Bumps the ruby-dependencies group with 4 updates: [excon](https://github.com/excon/excon), [parallel_tests](https://github.com/grosser/parallel_tests), [json](https://github.com/flori/json) and [ci-queue](https://github.com/Shopify/ci-queue). Updates `excon` from 0.104.0 to 0.109.0 - [Changelog](https://github.com/excon/excon/blob/master/changelog.txt) - [Commits](https://github.com/excon/excon/compare/v0.104.0...v0.109.0) Updates `parallel_tests` from 4.3.0 to 4.4.0 - [Changelog](https://github.com/grosser/parallel_tests/blob/master/CHANGELOG.md) - [Commits](https://github.com/grosser/parallel_tests/compare/v4.3.0...v4.4.0) Updates `json` from 2.6.3 to 2.7.1 - [Release notes](https://github.com/flori/json/releases) - [Changelog](https://github.com/flori/json/blob/master/CHANGES.md) - [Commits](https://github.com/flori/json/compare/v2.6.3...v2.7.1) Updates `ci-queue` from 0.38.0 to 0.44.0 - [Release notes](https://github.com/Shopify/ci-queue/releases) - [Commits](https://github.com/Shopify/ci-queue/compare/v0.38.0...v0.44.0) --- updated-dependencies: - dependency-name: excon dependency-type: direct:development update-type: version-update:semver-minor dependency-group: ruby-dependencies - dependency-name: parallel_tests dependency-type: direct:development update-type: version-update:semver-minor dependency-group: ruby-dependencies - dependency-name: json dependency-type: direct:development update-type: version-update:semver-minor dependency-group: ruby-dependencies - dependency-name: ci-queue dependency-type: direct:development update-type: version-update:semver-minor dependency-group: ruby-dependencies ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 48955d120..b9fd360c4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,13 +1,13 @@ GEM remote: https://rubygems.org/ specs: - ci-queue (0.38.0) + ci-queue (0.44.0) citrus (3.0.2) connection_pool (2.4.1) dead_end (4.0.0) diff-lcs (1.5.0) erubis (2.7.0) - excon (0.104.0) + excon (0.109.0) heroics (0.1.2) erubis (~> 2.0) excon @@ -20,11 +20,11 @@ GEM rrrretry (~> 1) thor (~> 1) threaded (~> 0) - json (2.6.3) + json (2.7.1) moneta (1.0.0) multi_json (1.15.0) - parallel (1.23.0) - parallel_tests (4.3.0) + parallel (1.24.0) + parallel_tests (4.4.0) parallel platform-api (3.5.0) heroics (~> 0.1.1) From f8f498e394d5e129f755efc7d3df72a31cd3d42f Mon Sep 17 00:00:00 2001 From: Ed Morley <501702+edmorley@users.noreply.github.com> Date: Tue, 6 Feb 2024 08:24:28 +0000 Subject: [PATCH 0942/1195] Reduce team review request noise from CODEOWNERS (#1419) The `CODEOWNERS` file has been adjusted to request review from the primary repository maintainer for high-traffic files that are typically updated via automation, rather than requesting review from the whole team. This: - reduces team notification/review request noise for Dependabot and release automation PRs, given that other members on the team usually aren't going to look at such PRs anyway, and it only makes it harder for team members to see the review requests that are actually in their queue - retains the "team awareness" benefit of having the team see notifications for all other non-automated PRs - retains the UX benefit of having a reviewer be automatically selected In the scenarios where either the primary repository maintainer is away, or they are the person opening the PR (so can't request review from themselves), other team members will still be able to approve the PR with the changes I've made to the branch protection settings (unchecking "Require Code Owner Review", leaving "require approvals" enabled which can only be from teams with write access, which is only us. Plus for bonus points, the option to only permit merging from members of our team has also been enabled). For supported syntax, see: https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners GUS-W-14941625. --- .github/CODEOWNERS | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 0a44fdf7a..2fd0356d9 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,2 +1,9 @@ +# Default to requesting pull request reviews from the Heroku Languages team. * @heroku/languages -#ECCN:Open Source \ No newline at end of file + +# However, request review from the language owner instead for files that are updated +# by Dependabot or release automation, to reduce team review request noise. +CHANGELOG.md @schneems +Gemfile.lock @schneems +/changelogs/ @schneems +/lib/language_pack/version.rb @schneems From a3fc8c5916907304c94fce1ccc5c19fc307ce7ab Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Tue, 20 Feb 2024 10:44:16 -0600 Subject: [PATCH 0943/1195] Warn when using SENSIBLE_DEFAULTS (#1420) This feature provided a default WEB_CONCURRENCY value when SENSIBLE_DEFAULTS environment variable was set. This feature was experimental and never stabilized. It's not documented on devcenter and should not be relied on. There are cascading complications in setting a default WEB_CONCURRENCY value: - A static default is difficult to determine without more information from runtime. - Multiple build packs have conflicting defaults for setting WEB_CONCURRENCY. For example, if an app is deploying with the Ruby buildpack and then they add the python buildpack after it, the WEB_CONCURRENCY defaults from python would be applied instead of Ruby. - Changes in WEB_CONCURRENCY in the buildpack are not picked up by apps unless they deploy. --- CHANGELOG.md | 1 + lib/language_pack/ruby.rb | 14 ++++++++++++++ spec/hatchet/ruby_spec.rb | 7 ------- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9cb3c6071..fd6c5f86c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## [Unreleased] +- Officially deprecate SENSIBLE_DEFAULTS environment variable (https://github.com/heroku/heroku-buildpack-ruby/pull/1420) ## [v265] - 2024-01-22 diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index d03b9ac6c..b9574dba6 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -252,6 +252,20 @@ def ruby_version end def set_default_web_concurrency + warn(<<~WARNING) + Your application is using an undocumented feature SENSIBLE_DEFAULTS + + This feature is not supported and may be removed at any time. Please remove the SENSIBLE_DEFAULTS environment variable from your app. + + $ heroku config:unset SENSIBLE_DEFAULTS + + To configure your application's web concurrency, use the WEB_CONCURRENCY environment variable following this documentation: + + - https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#recommended-default-puma-process-and-thread-configuration + - https://devcenter.heroku.com/articles/h12-request-timeout-in-ruby-mri#puma-pool-usage + - https://help.heroku.com/88G3XLA6/what-is-an-acceptable-amount-of-dyno-load + WARNING + <<-EOF case $(ulimit -u) in 256) diff --git a/spec/hatchet/ruby_spec.rb b/spec/hatchet/ruby_spec.rb index ca200651b..947f9ceb8 100644 --- a/spec/hatchet/ruby_spec.rb +++ b/spec/hatchet/ruby_spec.rb @@ -296,11 +296,4 @@ expect(app.run("echo $WEB_CONCURRENCY", :heroku => {:env => "WEB_CONCURRENCY=0"}).strip).to eq("0") end end - - it "has defaults set with SENSIBLE_DEFAULTS on" do - config = { "SENSIBLE_DEFAULTS" => "1"} - Hatchet::Runner.new('default_ruby', stack: DEFAULT_STACK, config: config).deploy do |app| - expect(app.run("env")).to match("WEB_CONCURRENCY=") - end - end end From 0bd0a002f3b574f45db9c235a79875445a3e2fbd Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Tue, 20 Feb 2024 13:42:50 -0600 Subject: [PATCH 0944/1195] Fix prepare release script (#1423) There's no `OLD_VERSION`, it is `EXISTING_VERSION`: https://github.com/heroku/languages-github-actions/blob/main/README.md#classic-buildpack---prepare-release --- .github/workflows/prepare-release.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml index a54da42ad..2e6ff4c71 100644 --- a/.github/workflows/prepare-release.yml +++ b/.github/workflows/prepare-release.yml @@ -12,8 +12,10 @@ jobs: secrets: inherit with: custom_update_command: | + set -euo pipefail + sed --in-place --regexp-extended \ - --expression "s/v${OLD_VERSION}/v${NEW_VERSION}/" \ + --expression "s/v${EXISTING_VERSION}/v${NEW_VERSION}/" \ lib/language_pack/version.rb if compgen -G 'changelogs/unreleased/*.md' > /dev/null; then From e85bf11d8aa2a8ad55325ebffd92818b51d4c93d Mon Sep 17 00:00:00 2001 From: "heroku-linguist[bot]" <136119646+heroku-linguist[bot]@users.noreply.github.com> Date: Tue, 20 Feb 2024 20:02:44 +0000 Subject: [PATCH 0945/1195] Prepare release v266 (#1425) Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com> --- CHANGELOG.md | 6 +++++- lib/language_pack/version.rb | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fd6c5f86c..f2ae9282b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased] + +## [v266] - 2024-02-20 + - Officially deprecate SENSIBLE_DEFAULTS environment variable (https://github.com/heroku/heroku-buildpack-ruby/pull/1420) ## [v265] - 2024-01-22 @@ -1502,7 +1505,8 @@ Bugfixes: * Change gem detection to use lockfile parser * use `$RACK_ENV` when thin is detected for rack apps -[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v265...HEAD +[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v266...main +[v266]: https://github.com/heroku/heroku-buildpack-ruby/compare/v265...v266 [v265]: https://github.com/heroku/heroku-buildpack-ruby/compare/v264...v265 [v264]: https://github.com/heroku/heroku-buildpack-ruby/compare/v263...v264 [v263]: https://github.com/heroku/heroku-buildpack-ruby/compare/v262...v263 diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 8cfd0ab17..102e782eb 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v265" + BUILDPACK_VERSION = "v266" end end From a5f827b0eb8d57a2a96408c0705ae4365c42d955 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Tue, 20 Feb 2024 14:05:24 -0600 Subject: [PATCH 0946/1195] Clean up release automation (#1424) * Clean up release automation The scripts in .github/scripts were for CNB releases which have been moved over to https://github.com/heroku/buildpacks-ruby and have not been used for some time. The rake task to prepare releases has been moved to a GitHub action. The deploy task is still used, it's updated to work with the new standard CHANGELOG format. * Reinstate the release task Accidentally removed in the last commit * Remove "tarballer" It was used by the removed GitHub actions scripts --- .../scripts/release-workflow-package-push.sh | 44 --------- .../scripts/release-workflow-prepare-pr.sh | 94 ------------------- Rakefile | 40 +------- lib/rake/deploy_check.rb | 4 +- lib/rake/tarballer.rb | 52 ---------- spec/rake/deploy_check_spec.rb | 4 +- spec/rake/tarballer_spec.rb | 30 ------ 7 files changed, 5 insertions(+), 263 deletions(-) delete mode 100755 .github/scripts/release-workflow-package-push.sh delete mode 100755 .github/scripts/release-workflow-prepare-pr.sh delete mode 100644 lib/rake/tarballer.rb delete mode 100644 spec/rake/tarballer_spec.rb diff --git a/.github/scripts/release-workflow-package-push.sh b/.github/scripts/release-workflow-package-push.sh deleted file mode 100755 index 1b2fd8087..000000000 --- a/.github/scripts/release-workflow-package-push.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -# This script is an integral part of the release workflow: .github/workflows/release.yml -# It requires the following environment variables to function correctly: -# -# REQUESTED_BUILDPACK_ID - The ID of the buildpack to package and push to the container registry. - -while IFS="" read -r -d "" buildpack_toml_path; do - buildpack_id="$(yj -t <"${buildpack_toml_path}" | jq -r .buildpack.id)" - buildpack_version="$(yj -t <"${buildpack_toml_path}" | jq -r .buildpack.version)" - buildpack_docker_repository="$(yj -t <"${buildpack_toml_path}" | jq -r .metadata.release.docker.repository)" - buildpack_path=$(dirname "${buildpack_toml_path}") - buildpack_build_path="${buildpack_path}" - - if [[ $buildpack_id == "${REQUESTED_BUILDPACK_ID}" ]]; then - # Some buildpacks require a build step before packaging. If we detect a build.sh script, we execute it and - # modify the buildpack_build_path variable to point to the directory with the built buildpack instead. - if [[ -f "${buildpack_path}/build.sh" ]]; then - echo "Buildpack has build script, executing..." - "${buildpack_path}/build.sh" - echo "Build finished!" - - buildpack_build_path="${buildpack_path}/target" - fi - - image_name="${buildpack_docker_repository}:${buildpack_version}" - pack package-buildpack --config "${buildpack_build_path}/package.toml" --publish "${image_name}" - - # We might have local changes after building and/or shimming the buildpack. To ensure scripts down the pipeline - # work with a clean state, we reset all local changes here. - git reset --hard - git clean -fdx - - echo "::set-output name=id::${buildpack_id}" - echo "::set-output name=version::${buildpack_version}" - echo "::set-output name=path::${buildpack_path}" - echo "::set-output name=address::${buildpack_docker_repository}@$(crane digest "${image_name}")" - exit 0 - fi -done < <(find . -name buildpack.toml -print0) - -echo "Could not find requested buildpack with id ${REQUESTED_BUILDPACK_ID}!" -exit 1 diff --git a/.github/scripts/release-workflow-prepare-pr.sh b/.github/scripts/release-workflow-prepare-pr.sh deleted file mode 100755 index 59cd9c960..000000000 --- a/.github/scripts/release-workflow-prepare-pr.sh +++ /dev/null @@ -1,94 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -released_buildpack_id="${1:?}" -released_buildpack_version="${2:?}" -released_buildpack_image_address="${3:?}" - -released_buildpack_next_version=$( - echo "${released_buildpack_version}" | awk -F. -v OFS=. '{ $NF=sprintf("%d\n", ($NF+1)); printf $0 }' -) - -function escape_for_sed() { - echo "${1:?}" | sed 's/[]\/\[\.]/\\&/g' -} - -function is_meta_buildpack_with_dependency() { - local -r buildpack_toml_path="${1:?}" - local -r buildpack_id="${2:?}" - - yj -t <"${buildpack_toml_path}" | jq -e "[.order[]?.group[]?.id | select(. == \"${buildpack_id}\")] | length > 0" >/dev/null -} - -function package_toml_contains_image_address_root() { - local -r package_toml_path="${1:?}" - local -r image_address_root="${2:?}" - - yj -t <"${package_toml_path}" | jq -e "[.dependencies[].uri | select(startswith(\"${image_address_root}\"))] | length > 0" >/dev/null -} - -# This is the heading we're looking for when updating CHANGELOG.md files -unreleased_heading=$(escape_for_sed "## [Unreleased]") - -while IFS="" read -r -d "" buildpack_toml_path; do - buildpack_id="$(yj -t <"${buildpack_toml_path}" | jq -r .buildpack.id)" - buildpack_path="$(dirname "${buildpack_toml_path}")" - buildpack_package_toml_path="${buildpack_path}/package.toml" - buildpack_changelog_path="${buildpack_path}/CHANGELOG.md" - - jq_filter="." - - # Update the released buildpack itself - if [[ "${buildpack_id}" == "${released_buildpack_id}" ]]; then - if [[ -f "${buildpack_changelog_path}" ]]; then - new_version_heading=$(escape_for_sed "## [${released_buildpack_version}] $(date +%Y/%m/%d)") - sed -i "s/${unreleased_heading}/${unreleased_heading}\n\n${new_version_heading}/" "${buildpack_changelog_path}" - fi - - jq_filter=".buildpack.version = \"${released_buildpack_next_version}\"" - - # Update meta-buildpacks that have the released buildpack as a dependency - elif is_meta_buildpack_with_dependency "${buildpack_toml_path}" "${released_buildpack_id}"; then - # There are two cases of meta-buildpacks that reference the released buildpack: - # - # 1. The released buildpack is referenced by a local path. In this case, we need to update the reference to - # the next version, not the released version. - # 2. The released buildpack is referenced by a Docker address. In this case, we need to update the reference - # to the released version instead. - target_version_for_meta_buildpack="${released_buildpack_next_version}" - - released_buildpack_image_address_root="${released_buildpack_image_address%@*}" - if package_toml_contains_image_address_root "${buildpack_package_toml_path}" "${released_buildpack_image_address_root}"; then - target_version_for_meta_buildpack="${released_buildpack_version}" - - package_toml_filter=".dependencies[].uri |= if startswith(\"${released_buildpack_image_address_root}\") then \"${released_buildpack_image_address}\" else . end" - updated_package_toml=$(yj -t <"${buildpack_package_toml_path}" | jq "${package_toml_filter}" | yj -jt) - echo "${updated_package_toml}" >"${buildpack_package_toml_path}" - fi - - if [[ -f "${buildpack_changelog_path}" ]]; then - upgrade_entry=$( - escape_for_sed "* Upgraded \`${released_buildpack_id}\` to \`${target_version_for_meta_buildpack}\`" - ) - - sed -i "s/${unreleased_heading}/${unreleased_heading}\n${upgrade_entry}/" "${buildpack_changelog_path}" - fi - - jq_filter=$( - cat <<-EOF - .order |= map(.group |= map( - if .id == "${released_buildpack_id}" then - .version |= "${target_version_for_meta_buildpack}" - else - . - end - )) - EOF - ) - fi - - # Write the filtered buildpack.toml to disk... - updated=$(yj -t <"${buildpack_toml_path}" | jq "${jq_filter}" | yj -jt) - echo "${updated}" >"${buildpack_toml_path}" - -done < <(find . -name buildpack.toml -print0) diff --git a/Rakefile b/Rakefile index 1a46f363c..6220d0b7e 100644 --- a/Rakefile +++ b/Rakefile @@ -9,7 +9,6 @@ require 'hatchet/tasks' ENV["BUILDPACK_LOG_FILE"] ||= "tmp/buildpack.log" require_relative 'lib/rake/deploy_check' -require_relative 'lib/rake/tarballer' S3_BUCKET_REGION = "us-east-1" S3_BUCKET_NAME = "heroku-buildpack-ruby" @@ -68,39 +67,7 @@ end namespace :buildpack do desc "prepares the next version of the buildpack for release" task :prepare do - deploy = DeployCheck.new(github: "heroku/heroku-buildpack-ruby") - unreleased_changelogs = Pathname(__dir__).join("changelogs/unreleased").glob("*.md") - if unreleased_changelogs.empty? - puts "No devcenter changelog entries on disk in changelogs/unreleased" - else - next_changelog_dir = Pathname(__dir__).join("changelogs").join(deploy.next_version.to_s) - - next_changelog_dir.mkpath - - unreleased_changelogs.each do |source| - dest = next_changelog_dir.join(source.basename) - puts "Moving #{source} to #{dest}" - FileUtils.mv(source, dest) - end - end - - changelog_md = Pathname(__dir__).join("CHANGELOG.md") - contents = changelog_md.read - version_string = "## #{deploy.next_version}" - if contents.include?(version_string) - puts "Found an entry in CHANGELOG.md for #{version_string}" - else - new_section = "## Main (unreleased)\n\n#{version_string} (#{Time.now.strftime("%Y/%m/%d")})" - - puts "Writing to CHANGELOG.md:\n\n#{new_section}" - - changelog_md.write(contents.gsub("## Main (unreleased)", new_section)) - end - - version_rb = Pathname(__dir__).join("lib/language_pack/version.rb") - puts "Updating version.rb" - contents = version_rb.read.gsub(/BUILDPACK_VERSION = .*$/, %Q{BUILDPACK_VERSION = "#{deploy.next_version.to_s}"}) - version_rb.write(contents) + puts("Use https://github.com/heroku/heroku-buildpack-ruby/actions/workflows/prepare-release.yml") end desc "releases the next version of the buildpack" @@ -122,11 +89,6 @@ namespace :buildpack do puts "Releasing to heroku: `#{command}`" exec(command) end - desc "stage a tarball of the buildpack, this runs on github actions to deploy CNB" - task :tarball do - tarballer = Tarballer.new(name: "heroku-buildpack-ruby", directory: __dir__) - tarballer.call - end end desc "update plugins" diff --git a/lib/rake/deploy_check.rb b/lib/rake/deploy_check.rb index 63b00f03c..3cfeb6146 100644 --- a/lib/rake/deploy_check.rb +++ b/lib/rake/deploy_check.rb @@ -67,8 +67,8 @@ def check_branch!(name = "main") # Raises an error if the changelog does not have an entry with the designated version def check_changelog! - if !File.read("CHANGELOG.md").include?("## #{next_version}") - raise "Expected CHANGELOG.md to include #{next_version} but it did not" + if !File.read("CHANGELOG.md").include?("## [#{next_version}]") + raise "Expected CHANGELOG.md to include [#{next_version}] but it did not" end end diff --git a/lib/rake/tarballer.rb b/lib/rake/tarballer.rb deleted file mode 100644 index be87a68b3..000000000 --- a/lib/rake/tarballer.rb +++ /dev/null @@ -1,52 +0,0 @@ -require 'fileutils' -require 'pathname' - -$:.unshift File.join(__dir__, "..") # put lib on the path -require "language_pack/installers/heroku_ruby_installer" -require "language_pack/ruby_version" -require "language_pack/version" - -# This class takes a target directory (such as the buildpack) -# and tars it up so it's in a form ready to be run -# -# In addition to TAR logic it also vendors ruby versions so -# they don't need to be pulled at runtime -class Tarballer - STACKS = %W{heroku-20 heroku-22} - - def initialize(name: , directory: , io: STDOUT) - @name = name - @source_directory = Pathname.new(directory) - @version = LanguagePack::Base::BUILDPACK_VERSION - @dest_directory = @source_directory.join("buildpacks") - @dest_directory.mkpath - @io = io - end - - def call(stacks: STACKS) - Dir.mktmpdir do |tmpdir_base| - tmp_dir = Pathname.new(tmpdir_base).join(@name) - run! "cp -r #{@source_directory} #{tmp_dir}" - - Dir.chdir(tmp_dir) do |buildpack_dir| - stacks.each do |stack| - installer = LanguagePack::Installers::HerokuRubyInstaller.new(stack) - ruby_version = LanguagePack::RubyVersion.new("ruby-#{LanguagePack::RubyVersion::DEFAULT_VERSION_NUMBER}") - installer.fetch_unpack(ruby_version, "vendor/ruby/#{stack}") - end - run! "tar czf #{tmp_dir.join('.buildpack.tgz')} *" - end - - tar_destination = @dest_directory.join("heroku-buildpack-ruby-#{@version}.tgz") - @io.puts "Writing to #{tar_destination}" - - FileUtils.cp(tmp_dir.join('.buildpack.tgz'), tar_destination) - end - end - - private def run!(cmd) - out = `#{cmd}` - raise "Command: #{cmd} was expected to succeed but it did not. Output: #{out}" unless $?.success? - out - end -end diff --git a/spec/rake/deploy_check_spec.rb b/spec/rake/deploy_check_spec.rb index b9f97ae39..c2c85b0a9 100644 --- a/spec/rake/deploy_check_spec.rb +++ b/spec/rake/deploy_check_spec.rb @@ -139,9 +139,9 @@ def deploy.remote_tag_array; [ "v123" ] ; end run!("touch CHANGELOG.md") expect { deploy.check_changelog! - }.to raise_error(/Expected CHANGELOG.md to include v999/) + }.to raise_error(/Expected CHANGELOG.md to include \[v999\]/) - run!("echo '## v999' >> CHANGELOG.md") + run!("echo '## [v999]' >> CHANGELOG.md") deploy.check_changelog! end end diff --git a/spec/rake/tarballer_spec.rb b/spec/rake/tarballer_spec.rb deleted file mode 100644 index 89a982e5d..000000000 --- a/spec/rake/tarballer_spec.rb +++ /dev/null @@ -1,30 +0,0 @@ -require "spec_helper" -require "rake/tarballer" - -def real_entries(dir) - Dir.entries(dir) - [".", ".."] -end - -describe "tarballer" do - it "blerg" do - Dir.mktmpdir do |dir| - dir = Pathname.new(dir) - run!("echo 'foo' >> #{dir}/foo.txt") - run!("mkdir -p #{dir}/vendor/ruby") - - tarballer = Tarballer.new(name: 'heroku-buildpack-ruby', directory: dir, io: StringIO.new) - tarballer.call(stacks: ["heroku-18"]) - - # Test tar generated - tgz_name = "heroku-buildpack-ruby-#{LanguagePack::Base::BUILDPACK_VERSION}.tgz" - buildpacks_dir = real_entries("#{dir}/buildpacks") - expect(buildpacks_dir).to include(tgz_name) - - # Test tar contents - tgz_file = dir.join("buildpacks", tgz_name) - tar_contents = run!("tar -tvf #{tgz_file}").strip - expect(tar_contents).to include("vendor/ruby/heroku-18/bin/gem") - expect(tar_contents).to include("foo.txt") - end - end -end From 56ff138eea331620d3579370693dd39140a642cd Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Wed, 28 Feb 2024 12:05:06 -0600 Subject: [PATCH 0947/1195] Bundler versions 2.4.22 and 2.5.6 are now available for Ruby Applications (#1428) * ## Bundler versions 2.4.22 and 2.5.6 are now available for Ruby Applications The [Ruby Buildpack](https://devcenter.heroku.com/articles/ruby-support#libraries) now installs a version of bundler based on the major and minor version listed in the `Gemfile.lock` under the `BUNDLED WITH` key. Previously, it only used the major version. Now, this logic will be used: - `BUNDLED WITH` 1.x will receive bundler `1.17.3` - `BUNDLED WITH` 2.0.x to 2.3.x will receive bundler `2.3.25` - `BUNDLED WITH` 2.4.x will receive bundler `2.4.22` - `BUNDLED WITH` 2.5.x and above will receive bundler `2.5.6` It is strongly recommended that you have both a `RUBY VERSION` and `BUNDLED WITH` version listed in your `Gemfile.lock`. If you do not have those values, you can generate them and commit them to git: ``` $ bundle update --ruby $ git add Gemfile.lock $ git commit -m "Update Gemfile.lock" ``` Applications without these values specified in the `Gemfile.lock` may break unexpectedly when the defaults change. * Only match major versions with major logic Co-authored-by: Josh W Lewis --------- Co-authored-by: Josh W Lewis --- CHANGELOG.md | 2 + changelogs/unreleased/bundler_major_minor.md | 18 ++++ changelogs/unreleased/ruby_gemfile_lock.md | 15 +++ lib/language_pack/helpers/bundler_wrapper.rb | 100 +++++++++++++------ spec/helpers/bundler_wrapper_spec.rb | 35 ++++++- 5 files changed, 136 insertions(+), 34 deletions(-) create mode 100644 changelogs/unreleased/bundler_major_minor.md create mode 100644 changelogs/unreleased/ruby_gemfile_lock.md diff --git a/CHANGELOG.md b/CHANGELOG.md index f2ae9282b..ac80f23fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## [Unreleased] +- Bundler version installation is now based on both major and minor version (https://github.com/heroku/heroku-buildpack-ruby/pull/1428) +- Applications using bundler 2.4+ must now specify a ruby version in the Gemfile.lock or they will receive the default Ruby version (https://github.com/heroku/heroku-buildpack-ruby/pull/1428) ## [v266] - 2024-02-20 diff --git a/changelogs/unreleased/bundler_major_minor.md b/changelogs/unreleased/bundler_major_minor.md new file mode 100644 index 000000000..614a9c068 --- /dev/null +++ b/changelogs/unreleased/bundler_major_minor.md @@ -0,0 +1,18 @@ +## Bundler versions 2.4.22 and 2.5.6 are now available for Ruby Applications + +The [Ruby Buildpack](https://devcenter.heroku.com/articles/ruby-support#libraries) now installs a version of bundler based on the major and minor version listed in the `Gemfile.lock` under the `BUNDLED WITH` key. Previously, it only used the major version. Now, this logic will be used: + +- `BUNDLED WITH` 1.x will receive bundler `1.17.3` +- `BUNDLED WITH` 2.0.x to 2.3.x will receive bundler `2.3.25` +- `BUNDLED WITH` 2.4.x will receive bundler `2.4.22` +- `BUNDLED WITH` 2.5.x and above will receive bundler `2.5.6` + +It is strongly recommended that you have both a `RUBY VERSION` and `BUNDLED WITH` version listed in your `Gemfile.lock`. If you do not have those values, you can generate them and commit them to git: + +``` +$ bundle update --ruby +$ git add Gemfile.lock +$ git commit -m "Update Gemfile.lock" +``` + +Applications without these values specified in the `Gemfile.lock` may break unexpectedly when the defaults change. diff --git a/changelogs/unreleased/ruby_gemfile_lock.md b/changelogs/unreleased/ruby_gemfile_lock.md new file mode 100644 index 000000000..1d9e44101 --- /dev/null +++ b/changelogs/unreleased/ruby_gemfile_lock.md @@ -0,0 +1,15 @@ +## Ruby applications without a `RUBY VERSION` in the Gemfile.lock may receive a default Ruby version + +Previously, it was possible to specify a full version of Ruby in the `Gemfile` even if it was not present in the `Gemfile.lock`. The Ruby directive in the `Gemfile` was parsed by bundler and emitted via the command `bundle --platform ruby`. This behavior has changed with bundler `2.4+`, so only ruby versions listed in the `RUBY VERSION` key of the `Gemfile.lock` will be returned. If your application uses bundler 2.4+ and does not have a `RUBY VERSION` specified in the `Gemfile.lock`, it will receive a default version of Ruby. + +It is strongly recommended that you have both a `RUBY VERSION` and `BUNDLED WITH` version listed in your `Gemfile.lock`. If you do not have those values, you can generate them and commit them to git: + +``` +$ bundle update --ruby +$ git add Gemfile.lock +$ git commit -m "Update Gemfile.lock" +``` + +Applications without these values specified in the `Gemfile.lock` may break unexpectedly when the defaults change. + +If your app relies on specifying the ruby version in the `Gemfile` but not the `Gemfile.lock` and it is not yet using Bundler 2.4+, you may preserve this behavior by not upgrading the bundler version in your `Gemfile.lock`, however, this behavior is deprecated. It will be removed at a future date. It is recommended you lock your Ruby version now to avoid an unexpected breakage in the future. diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index 552427858..6caa5eca8 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -37,8 +37,38 @@ class LanguagePack::Helpers::BundlerWrapper BLESSED_BUNDLER_VERSIONS = {} BLESSED_BUNDLER_VERSIONS["1"] = "1.17.3" - BLESSED_BUNDLER_VERSIONS["2"] = "2.3.25" - BUNDLED_WITH_REGEX = /^BUNDLED WITH$(\r?\n) (?\d+)\.\d+\.\d+/m + # Heroku-20's oldest Ruby verison is 2.5.x which doesn't work with bundler 2.4 + BLESSED_BUNDLER_VERSIONS["2.3"] = "2.3.25" + BLESSED_BUNDLER_VERSIONS["2.4"] = "2.4.22" + BLESSED_BUNDLER_VERSIONS["2.5"] = "2.5.6" + BLESSED_BUNDLER_VERSIONS.default_proc = Proc.new do |hash, key| + if Gem::Version.new(key).segments.first == 1 + hash["1"] + elsif Gem::Version::new(key).segments.first == 2 + if Gem::Version.new(key) > Gem::Version.new("2.5") + hash["2.5"] + elsif Gem::Version.new(key) < Gem::Version.new("2.3") + hash["2.3"] + else + raise UnsupportedBundlerVersion.new(hash, key) + end + else + raise UnsupportedBundlerVersion.new(hash, key) + end + end + + def self.detect_bundler_version(contents: ) + version_match = contents.match(BUNDLED_WITH_REGEX) + if version_match + major = version_match[:major] + minor = version_match[:minor] + BLESSED_BUNDLER_VERSIONS["#{major}.#{minor}"] + else + BLESSED_BUNDLER_VERSIONS["1"] + end + end + + BUNDLED_WITH_REGEX = /^BUNDLED WITH$(\r?\n) (?\d+)\.(?\d+)\.\d+/m class GemfileParseError < BuildpackError def initialize(error) @@ -49,8 +79,8 @@ def initialize(error) end class UnsupportedBundlerVersion < BuildpackError - def initialize(version_hash, major) - msg = String.new("Your Gemfile.lock indicates you need bundler `#{major}.x`\n") + def initialize(version_hash, major_minor) + msg = String.new("Your Gemfile.lock indicates you need bundler `#{major_minor}.x`\n") msg << "which is not currently supported. You can deploy with bundler version:\n" version_hash.keys.each do |v| msg << " - `#{v}.x`\n" @@ -73,12 +103,14 @@ def initialize(options = {}) @fetcher = options[:fetcher] || LanguagePack::Fetcher.new(LanguagePack::Base::VENDOR_URL) # coupling @gemfile_path = options[:gemfile_path] || Pathname.new("./Gemfile") @gemfile_lock_path = Pathname.new("#{@gemfile_path}.lock") - detect_bundler_version_and_dir_name! - @bundler_path = options[:bundler_path] || @bundler_tmp.join(dir_name) - @bundler_tar = options[:bundler_tar] || "bundler/#{dir_name}.tgz" + @version = self.class.detect_bundler_version(contents: @gemfile_lock_path.read(mode: "rt")) + @dir_name = "bundler-#{@version}" + + @bundler_path = options[:bundler_path] || @bundler_tmp.join(@dir_name) + @bundler_tar = options[:bundler_tar] || "bundler/#{@dir_name}.tgz" @orig_bundle_gemfile = ENV['BUNDLE_GEMFILE'] - @path = Pathname.new("#{@bundler_path}/gems/#{dir_name}/lib") + @path = Pathname.new("#{@bundler_path}/gems/#{@dir_name}/lib") end def install @@ -126,7 +158,7 @@ def version end def dir_name - "bundler-#{version}" + @dir_name end def ruby_version @@ -143,7 +175,32 @@ def ruby_version # If there's a gem in the Gemfile (i.e. syntax error) emit error raise GemfileParseError.new(run("bundle check", user_env: true, env: env)) unless $?.success? - self.class.platform_to_version(output) + ruby_version = self.class.platform_to_version(output) + if ruby_version.nil? || ruby_version.empty? + if Gem::Version.new(self.version) > Gem::Version.new("2.3") + warn(<<~WARNING, inline: true) + No ruby version specified in the Gemfile.lock + + We could not determine the version of Ruby from your Gemfile.lock. + + $ bundle platform --ruby + #{output} + + $ bundle -v + #{run("bundle -v", user_env: true, env: env)} + + Ensure the above command outputs the version of Ruby you expect. If you have a ruby version specified in your Gemfile, you can update the Gemfile.lock by running the following command: + + $ bundle update --ruby + + Make sure you commit the results to git before attempting to deploy again: + + $ git add Gemfile.lock + $ git commit -m "update ruby version" + WARNING + end + end + ruby_version end def self.platform_to_version(bundle_platform_output) @@ -200,27 +257,4 @@ def parse_gemfile_lock Bundler::LockfileParser.new(gemfile_contents) end - def major_bundler_version - # https://rubular.com/r/jt9yj0aY7fU3hD - bundler_version_match = @gemfile_lock_path.read(mode: "rt").match(BUNDLED_WITH_REGEX) - - if bundler_version_match - bundler_version_match[:major] - else - "1" - end - end - - # You cannot use Bundler 2.x with a Gemfile.lock that points to a 1.x bundler - # version. The solution here is to read in the value set in the Gemfile.lock - # and download the "blessed" version with the same major version. - def detect_bundler_version_and_dir_name! - major = major_bundler_version - if BLESSED_BUNDLER_VERSIONS.key?(major) - @version = BLESSED_BUNDLER_VERSIONS[major] - else - raise UnsupportedBundlerVersion.new(BLESSED_BUNDLER_VERSIONS, major) - end - end - end diff --git a/spec/helpers/bundler_wrapper_spec.rb b/spec/helpers/bundler_wrapper_spec.rb index 64a82f324..c49abf8ad 100644 --- a/spec/helpers/bundler_wrapper_spec.rb +++ b/spec/helpers/bundler_wrapper_spec.rb @@ -12,7 +12,40 @@ end end -describe "BundlerWrapper" do +describe "Bundler version detection" do + it "supports minor versions" do + wrapper_klass = LanguagePack::Helpers::BundlerWrapper + version = wrapper_klass.detect_bundler_version(contents: "BUNDLED WITH\n 1.17.3") + expect(wrapper_klass::BLESSED_BUNDLER_VERSIONS.key?("1")).to be_truthy + expect(version).to eq(wrapper_klass::BLESSED_BUNDLER_VERSIONS["1"]) + + version = wrapper_klass.detect_bundler_version(contents: "BUNDLED WITH\n 2.2.7") + expect(wrapper_klass::BLESSED_BUNDLER_VERSIONS.key?("2.3")).to be_truthy + expect(version).to eq(wrapper_klass::BLESSED_BUNDLER_VERSIONS["2.3"]) + + version = wrapper_klass.detect_bundler_version(contents: "BUNDLED WITH\n 2.3.7") + expect(wrapper_klass::BLESSED_BUNDLER_VERSIONS.key?("2.3")).to be_truthy + expect(version).to eq(wrapper_klass::BLESSED_BUNDLER_VERSIONS["2.3"]) + + version = wrapper_klass.detect_bundler_version(contents: "BUNDLED WITH\n 2.4.7") + expect(wrapper_klass::BLESSED_BUNDLER_VERSIONS.key?("2.4")).to be_truthy + expect(version).to eq(wrapper_klass::BLESSED_BUNDLER_VERSIONS["2.4"]) + + version = wrapper_klass.detect_bundler_version(contents: "BUNDLED WITH\n 2.5.7") + expect(wrapper_klass::BLESSED_BUNDLER_VERSIONS.key?("2.5")).to be_truthy + expect(version).to eq(wrapper_klass::BLESSED_BUNDLER_VERSIONS["2.5"]) + + version = wrapper_klass.detect_bundler_version(contents: "BUNDLED WITH\n 2.6.7") + expect(wrapper_klass::BLESSED_BUNDLER_VERSIONS.key?("2.5")).to be_truthy + expect(version).to eq(wrapper_klass::BLESSED_BUNDLER_VERSIONS["2.5"]) + + expect { + wrapper_klass.detect_bundler_version(contents: "BUNDLED WITH\n 3.6.7") + }.to raise_error(wrapper_klass::UnsupportedBundlerVersion) + end +end + +describe "BundlerWrapper mutates rubyopt" do before(:each) do if ENV['RUBYOPT'] @original_rubyopt = ENV['RUBYOPT'] From 7866d1efbdc0e4d5f66caff2cdd7f83f76d4f8e0 Mon Sep 17 00:00:00 2001 From: "heroku-linguist[bot]" <136119646+heroku-linguist[bot]@users.noreply.github.com> Date: Wed, 28 Feb 2024 18:13:27 +0000 Subject: [PATCH 0948/1195] Prepare release v267 (#1429) Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com> --- CHANGELOG.md | 6 +++++- changelogs/{unreleased => v267}/bundler_major_minor.md | 0 changelogs/{unreleased => v267}/ruby_gemfile_lock.md | 0 lib/language_pack/version.rb | 2 +- 4 files changed, 6 insertions(+), 2 deletions(-) rename changelogs/{unreleased => v267}/bundler_major_minor.md (100%) rename changelogs/{unreleased => v267}/ruby_gemfile_lock.md (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac80f23fb..8e21eaa58 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased] + +## [v267] - 2024-02-28 + - Bundler version installation is now based on both major and minor version (https://github.com/heroku/heroku-buildpack-ruby/pull/1428) - Applications using bundler 2.4+ must now specify a ruby version in the Gemfile.lock or they will receive the default Ruby version (https://github.com/heroku/heroku-buildpack-ruby/pull/1428) @@ -1507,7 +1510,8 @@ Bugfixes: * Change gem detection to use lockfile parser * use `$RACK_ENV` when thin is detected for rack apps -[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v266...main +[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v267...main +[v267]: https://github.com/heroku/heroku-buildpack-ruby/compare/v266...v267 [v266]: https://github.com/heroku/heroku-buildpack-ruby/compare/v265...v266 [v265]: https://github.com/heroku/heroku-buildpack-ruby/compare/v264...v265 [v264]: https://github.com/heroku/heroku-buildpack-ruby/compare/v263...v264 diff --git a/changelogs/unreleased/bundler_major_minor.md b/changelogs/v267/bundler_major_minor.md similarity index 100% rename from changelogs/unreleased/bundler_major_minor.md rename to changelogs/v267/bundler_major_minor.md diff --git a/changelogs/unreleased/ruby_gemfile_lock.md b/changelogs/v267/ruby_gemfile_lock.md similarity index 100% rename from changelogs/unreleased/ruby_gemfile_lock.md rename to changelogs/v267/ruby_gemfile_lock.md diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 102e782eb..37b02edb5 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v266" + BUILDPACK_VERSION = "v267" end end From 14cfdccdaec9a14371cabd39956df7eb646fe1f9 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Tue, 16 Apr 2024 10:25:06 -0500 Subject: [PATCH 0949/1195] Remove RBX and "build" support - Stacked 2/3 (#1440) * Fix tests after bundler change The Ruby buildpack uses the Ruby buildpack on CI. When the bundler versions changed in https://github.com/heroku/heroku-buildpack-ruby/commit/56ff138eea331620d3579370693dd39140a642cd it also changed the behavior of these tests (which use the local bundler version). That means that after the buildpack was deployed, it retroactively meant that tests on main were failing. The issue with these tests is that they're using a feature of bundler that's been removed, specifically this change https://devcenter.heroku.com/changelog-items/2809. In these tests the Ruby version is specified in the Gemfile but not the Gemfile.lock: - Gemfile https://github.com/sharpstone/mri_193/blob/master/Gemfile - Gemfile.lock https://github.com/sharpstone/mri_193/blob/master/Gemfile.lock With the newer version of bundler, these tests now fail. To fix this tests will need to be updated or removed (based on their current relevance). * Clean up unused hatchet apps * Remove RBX and "build" support Rubinius is a Ruby implementation that was available to use on the platform a long time ago but has not been supported for some time: Ruby 1.9.2 requires a "build" branch of logic that can be removed as well. It is not on any existing stacks and was not present on Heroku-18: ``` $ curl -I https://heroku-buildpack-ruby.s3.us-east-1.amazonaws.com/heroku-18/ruby-2.5.7.tgz HTTP/1.1 200 OK x-amz-id-2: Hl89PTav6LfvU90vP97YsBc5DEBptax9s4PZU+3ubIrIUBY54lD0f2FXMOCgh9XQEQRU+5ia1x4= x-amz-request-id: KVDZM54WRBN5ASGT Date: Mon, 15 Apr 2024 15:55:27 GMT Last-Modified: Tue, 01 Oct 2019 14:46:30 GMT ETag: "93ff97625abfc6ccd1a071bb0fda8e66" x-amz-version-id: null Accept-Ranges: bytes Content-Type: Server: AmazonS3 Content-Length: 11995820 $ curl -I https://heroku-buildpack-ruby.s3.us-east-1.amazonaws.com/heroku-18/ruby-1.9.2.tgz HTTP/1.1 404 Not Found x-amz-request-id: 1NKVW4VD3T94T71R x-amz-id-2: tTow7CFW9BcWmAbkEWvrqPz5zJdsy7ry8Jm39v+EURa4RN/UpslBhhGf1iHzOrpJ4n1BJxiGGoI= Content-Type: application/xml Date: Mon, 15 Apr 2024 15:55:31 GMT Server: AmazonS3 ``` Other unused functionality that's being removed: - CDN support for downloading Ruby binaries. This provided no meaningful download improvement when deploying as the binaries are on S3 in the same data center. This was disabled a long time ago. - A "default cache" that was warmed with common gems for the most common Ruby version. This was effective at reducing "first build" time but the complexity exploded if we were to try and support N versions of Rails and M versions of Ruby for this feature. Additionally the community has moved to pre-built binaries for some expensive components such as nokogiri. * Update lib/language_pack/installers/heroku_ruby_installer.rb Co-authored-by: Josh W Lewis --------- Co-authored-by: Josh W Lewis --- CHANGELOG.md | 1 + Gemfile.lock | 2 +- Rakefile | 15 --- config/cdn.yml | 1 - hatchet.json | 8 +- hatchet.lock | 12 -- lib/language_pack.rb | 2 - lib/language_pack/fetcher.rb | 16 +-- lib/language_pack/helpers/bundler_wrapper.rb | 1 - .../helpers/download_presence.rb | 10 +- .../helpers/outdated_ruby_version.rb | 3 +- .../installers/heroku_ruby_installer.rb | 52 ++++++-- lib/language_pack/installers/rbx_installer.rb | 20 ---- .../installers/ruby_installer.rb | 53 -------- lib/language_pack/ruby.rb | 53 ++------ lib/language_pack/ruby_version.rb | 20 +--- lib/language_pack/test/ruby.rb | 2 +- spec/helpers/download_presence_spec.rb | 31 +++-- spec/helpers/outdated_ruby_version_spec.rb | 16 +-- spec/helpers/ruby_version_spec.rb | 113 ++++++++++-------- spec/installers/heroku_ruby_installer_spec.rb | 22 +--- spec/installers/rbx_installer_spec.rb | 20 ---- 22 files changed, 150 insertions(+), 323 deletions(-) delete mode 100644 config/cdn.yml delete mode 100644 lib/language_pack/installers/rbx_installer.rb delete mode 100644 lib/language_pack/installers/ruby_installer.rb delete mode 100644 spec/installers/rbx_installer_spec.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e21eaa58..4ef414361 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## [Unreleased] +- Remove unused Rubinius and Ruby 1.9.2 codepaths (https://github.com/heroku/heroku-buildpack-ruby/pull/1440) ## [v267] - 2024-02-28 diff --git a/Gemfile.lock b/Gemfile.lock index b9fd360c4..0f753a918 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -72,4 +72,4 @@ RUBY VERSION ruby 3.1.4p223 BUNDLED WITH - 2.3.10 + 2.5.8 diff --git a/Rakefile b/Rakefile index 6220d0b7e..4372a9bb7 100644 --- a/Rakefile +++ b/Rakefile @@ -106,21 +106,6 @@ task "gem:install", :gem, :version do |t, args| install_gem(gem, version) end -desc "generate ruby versions manifest" -task "ruby:manifest" do - require 'rexml/document' - require 'yaml' - - document = REXML::Document.new(`curl https://#{S3_BUCKET_NAME}.s3.#{S3_BUCKET_REGION}.amazonaws.com`) - rubies = document.elements.to_a("//Contents/Key").map {|node| node.text }.select {|text| text.match(/^(ruby|rbx|jruby)-\\\\d+\\\\.\\\\d+\\\\.\\\\d+(-p\\\\d+)?/) } - - Dir.mktmpdir("ruby_versions-") do |tmpdir| - name = 'ruby_versions.yml' - File.open(name, 'w') {|file| file.puts(rubies.to_yaml) } - sh("#{s3_tools_dir}/s3 put #{S3_BUCKET_NAME} #{name} #{name}") - end -end - begin require 'rspec/core/rake_task' diff --git a/config/cdn.yml b/config/cdn.yml deleted file mode 100644 index ed97d539c..000000000 --- a/config/cdn.yml +++ /dev/null @@ -1 +0,0 @@ ---- diff --git a/hatchet.json b/hatchet.json index 921ae7886..6968997e6 100644 --- a/hatchet.json +++ b/hatchet.json @@ -8,7 +8,6 @@ "sharpstone/default_with_rakefile" ], "bundler": [ - "sharpstone/bad_gemfile_on_platform", "sharpstone/problem_gemfile_version", "sharpstone/git_gemspec", "sharpstone/no_lockfile", @@ -17,10 +16,7 @@ ], "ruby": [ "sharpstone/ruby_version_does_not_exist", - "sharpstone/ruby_193_jruby_173", - "sharpstone/ruby_193_jruby_176", "sharpstone/ruby_193_jruby_17161_jdk7", - "sharpstone/ruby_193_bad_patch_cedar_14", "sharpstone/ruby_25", "sharpstone/jruby-minimal", "sharpstone/empty-procfile", @@ -34,9 +30,7 @@ "rack": [ "sharpstone/default_ruby", "sharpstone/mri_187_nokogiri", - "sharpstone/mri_192", - "sharpstone/mri_193", - "sharpstone/mri_200" + "sharpstone/mri_192" ], "rails_versions": [ "sharpstone/rails_lts_23_default_ruby", diff --git a/hatchet.lock b/hatchet.lock index c8fe801e9..b1fa5cbc5 100644 --- a/hatchet.lock +++ b/hatchet.lock @@ -1,6 +1,4 @@ --- -- - "./repos/bundler/bad_gemfile_on_platform" - - 5dd45c83631f58d121afb48b513016cc9e2d3432 - - "./repos/bundler/git_gemspec" - 7755e19caf122e1373bce73ffe9b333e9411d732 - - "./repos/bundler/no_lockfile" @@ -33,10 +31,6 @@ - 3fcce9c85bf560dba285cc385ae9845729195826 - - "./repos/rack/mri_192" - ef6b5ccf8aa2a8f5e3745934e3580dc0bd2d6d4b -- - "./repos/rack/mri_193" - - 2e9ed455517c57b0dc953f54fbf9fef641c7aadb -- - "./repos/rack/mri_200" - - f9922cbd9c6f44fdded54912f66038db37cb4b8f - - "./repos/rails_versions/active_storage_local" - 18853ba7dda61745995740b4ca6f5f90bbd8afba - - "./repos/rails_versions/active_storage_non_local" @@ -77,14 +71,8 @@ - f79860bc2866449fe065484f1542aaadd3f7cfd2 - - "./repos/ruby/libpq_connection_error" - c211c245f09d8335a520cd7a0b5360897d4988eb -- - "./repos/ruby/ruby_193_bad_patch_cedar_14" - - 6948c1460c596f08c4642d616ae73a45dc0ae51a - - "./repos/ruby/ruby_193_jruby_17161_jdk7" - c1b632f8a96cf9b902f5cdcd7a190d46544a8144 -- - "./repos/ruby/ruby_193_jruby_173" - - a08e8b2cc61d08bd611accaa455dbcbfff80f831 -- - "./repos/ruby/ruby_193_jruby_176" - - 9fcbc184cb386abc8784e9935d52d403e35c532c - - "./repos/ruby/ruby_25" - 0cb3df80d55b61e9417f2ac00adb06e15ae37982 - - "./repos/ruby/ruby_version_does_not_exist" diff --git a/lib/language_pack.rb b/lib/language_pack.rb index 05703038d..2e83d4e2d 100644 --- a/lib/language_pack.rb +++ b/lib/language_pack.rb @@ -31,9 +31,7 @@ def self.detect(*args) require "language_pack/helpers/bundler_wrapper" require "language_pack/helpers/outdated_ruby_version" require "language_pack/helpers/download_presence" -require "language_pack/installers/ruby_installer" require "language_pack/installers/heroku_ruby_installer" -require "language_pack/installers/rbx_installer" require "language_pack/ruby" require "language_pack/rack" diff --git a/lib/language_pack/fetcher.rb b/lib/language_pack/fetcher.rb index 37709edab..a4e491a87 100644 --- a/lib/language_pack/fetcher.rb +++ b/lib/language_pack/fetcher.rb @@ -6,11 +6,10 @@ class Fetcher class FetchError < StandardError; end include ShellHelpers - CDN_YAML_FILE = File.expand_path("../../../config/cdn.yml", __FILE__) - def initialize(host_url, stack = nil) - @config = load_config - @host_url = fetch_cdn(host_url) + def initialize(host_url, stack: nil) + @host_url = Pathname.new(host_url) + # File.basename prevents accidental directory traversal @host_url += File.basename(stack) if stack end @@ -50,14 +49,5 @@ def curl_timeout_in_seconds def curl_connect_timeout_in_seconds env('CURL_CONNECT_TIMEOUT') || 3 end - - def load_config - YAML.load_file(CDN_YAML_FILE) || {} - end - - def fetch_cdn(url) - url = @config[url] || url - Pathname.new(url) - end end end diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index 6caa5eca8..fe9bd70b8 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -256,5 +256,4 @@ def parse_gemfile_lock gemfile_contents = File.read(@gemfile_lock_path) Bundler::LockfileParser.new(gemfile_contents) end - end diff --git a/lib/language_pack/helpers/download_presence.rb b/lib/language_pack/helpers/download_presence.rb index 68e35d99b..ee8ae0cef 100644 --- a/lib/language_pack/helpers/download_presence.rb +++ b/lib/language_pack/helpers/download_presence.rb @@ -18,13 +18,13 @@ class LanguagePack::Helpers::DownloadPresence STACKS = ['heroku-20', 'heroku-22'] - def initialize(path, stacks: STACKS) - @path = path + def initialize(file_name:, stacks: STACKS) + @file_name = file_name @stacks = stacks @fetchers = [] @threads = [] @stacks.each do |stack| - @fetchers << LanguagePack::Fetcher.new(LanguagePack::Base::VENDOR_URL, stack) + @fetchers << LanguagePack::Fetcher.new(LanguagePack::Base::VENDOR_URL, stack: stack) end end @@ -43,7 +43,7 @@ def exists_on_next_stack?(current_stack: ) return false unless supported_stack?(current_stack: current_stack) next_index = @stacks.index(current_stack) + 1 - @threads[next_index] + @threads[next_index].value end def valid_stack_list @@ -67,7 +67,7 @@ def does_not_exist? def call @fetchers.map do |fetcher| @threads << Thread.new do - fetcher.exists?(@path, 3) + fetcher.exists?(@file_name, 3) end end end diff --git a/lib/language_pack/helpers/outdated_ruby_version.rb b/lib/language_pack/helpers/outdated_ruby_version.rb index 4d0348316..548503491 100644 --- a/lib/language_pack/helpers/outdated_ruby_version.rb +++ b/lib/language_pack/helpers/outdated_ruby_version.rb @@ -7,7 +7,7 @@ # ruby_version = LanguagePack::RubyVersion.new("ruby-2.2.5") # outdated = LanguagePack::Helpers::OutdatedRubyVersion.new( # current_ruby_version: ruby_version, -# fetcher: LanguagePack::Fetcher.new(LanguagePack::Base::VENDOR_URL, "heroku-20") +# fetcher: LanguagePack::Fetcher.new(LanguagePack::Base::VENDOR_URL, stack: "heroku-22") # ) # # outdated.call @@ -34,7 +34,6 @@ def initialize(current_ruby_version: , fetcher:) def can_check? return false if current_ruby_version.patchlevel_is_significant? - return false if current_ruby_version.rbx? return false if current_ruby_version.jruby? true diff --git a/lib/language_pack/installers/heroku_ruby_installer.rb b/lib/language_pack/installers/heroku_ruby_installer.rb index e306c812b..ebd52b371 100644 --- a/lib/language_pack/installers/heroku_ruby_installer.rb +++ b/lib/language_pack/installers/heroku_ruby_installer.rb @@ -1,25 +1,55 @@ -require 'language_pack/installers/ruby_installer' require 'language_pack/base' require 'language_pack/shell_helpers' -class LanguagePack::Installers::HerokuRubyInstaller - include LanguagePack::ShellHelpers, LanguagePack::Installers::RubyInstaller +module LanguagePack::Installers; end +class LanguagePack::Installers::HerokuRubyInstaller BASE_URL = LanguagePack::Base::VENDOR_URL + BIN_DIR = Pathname("bin") + + include LanguagePack::ShellHelpers + attr_reader :fetcher - def initialize(stack) - @fetcher = LanguagePack::Fetcher.new(BASE_URL, stack) + def initialize(stack: ) + @fetcher = LanguagePack::Fetcher.new(BASE_URL, stack: stack) end - def fetch_unpack(ruby_version, install_dir, build = false) + def install(ruby_version, install_dir) + fetch_unpack(ruby_version, install_dir) + setup_binstubs(install_dir) + end + + def fetch_unpack(ruby_version, install_dir) FileUtils.mkdir_p(install_dir) Dir.chdir(install_dir) do - file = "#{ruby_version.version_for_download}.tgz" - if build - file.sub!("ruby", "ruby-build") + @fetcher.fetch_untar("#{ruby_version.version_for_download}.tgz") + end + end + + private def setup_binstubs(install_dir) + BIN_DIR.mkpath + run("ln -s ruby #{install_dir}/bin/ruby.exe") + + install_pathname = Pathname.new(install_dir) + Dir["#{install_dir}/bin/*"].each do |vendor_bin| + # for Ruby 2.6.0+ don't symlink the Bundler bin so our shim works + next if vendor_bin.include?("bundle") + + # The bin/rake binstub generated when compiling ruby does not load bundler + # which can cause unexpected failures. Deleting this binstub allows two things: + # + # - If the app includes a custom binstub allows it to be used + # - If the app does not include a custom binstub, then it will fall back to vendor/bundle/bin/rake + # which is generated by bundler + # + # Discussion: https://github.com/heroku/heroku-buildpack-ruby/issues/1025#issuecomment-653102430 + next if vendor_bin.include?("rake") + + if install_pathname.absolute? + run("ln -s #{vendor_bin} #{BIN_DIR}") + else + run("ln -s ../#{vendor_bin} #{BIN_DIR}") end - @fetcher.fetch_untar(file) end end end - diff --git a/lib/language_pack/installers/rbx_installer.rb b/lib/language_pack/installers/rbx_installer.rb deleted file mode 100644 index 800f92d3a..000000000 --- a/lib/language_pack/installers/rbx_installer.rb +++ /dev/null @@ -1,20 +0,0 @@ -require "language_pack/installers/ruby_installer" -require "language_pack/shell_helpers" - -class LanguagePack::Installers::RbxInstaller - include LanguagePack::ShellHelpers, LanguagePack::Installers::RubyInstaller - - BASE_URL = "https://rubinius-binaries-rubinius-com.s3.us-west-2.amazonaws.com/ubuntu/14.04/x86_64/" - - def initialize(stack) - @fetcher = LanguagePack::Fetcher.new(BASE_URL) - end - - def fetch_unpack(ruby_version, install_dir) - file = "#{ruby_version.version_for_download}.tar.bz2" - @fetcher.fetch_bunzip2(file) - FileUtils.mv(Dir.glob("rubinius/#{ruby_version.engine_version}/*"), ".") - FileUtils.rm_rf("rubinius") - end -end - diff --git a/lib/language_pack/installers/ruby_installer.rb b/lib/language_pack/installers/ruby_installer.rb deleted file mode 100644 index 08714631e..000000000 --- a/lib/language_pack/installers/ruby_installer.rb +++ /dev/null @@ -1,53 +0,0 @@ -require "language_pack/shell_helpers" -module LanguagePack::Installers; end - -# This is a base module that is later included by other -# classes such as LanguagePack::Installers::HerokuRubyInstaller -# -module LanguagePack::Installers::RubyInstaller - include LanguagePack::ShellHelpers - - attr_reader :fetcher - - DEFAULT_BIN_DIR = "bin" - - def self.installer(ruby_version) - if ruby_version.rbx? - LanguagePack::Installers::RbxInstaller - else - LanguagePack::Installers::HerokuRubyInstaller - end - end - - def install(ruby_version, install_dir) - fetch_unpack(ruby_version, install_dir) - setup_binstubs(install_dir) - end - - def setup_binstubs(install_dir) - FileUtils.mkdir_p DEFAULT_BIN_DIR - run("ln -s ruby #{install_dir}/bin/ruby.exe") - - install_pathname = Pathname.new(install_dir) - Dir["#{install_dir}/bin/*"].each do |vendor_bin| - # for Ruby 2.6.0+ don't symlink the Bundler bin so our shim works - next if vendor_bin.include?("bundle") - - # The bin/rake binstub generated when compiling ruby does not load bundler - # which can cause unexpected failures. Deleting this binstub allows two things: - # - # - If the app includes a custom binstub allows it to be used - # - If the app does not include a custom binstub, then it will fall back to vendor/bundle/bin/rake - # which is generated by bundler - # - # Discussion: https://github.com/heroku/heroku-buildpack-ruby/issues/1025#issuecomment-653102430 - next if vendor_bin.include?("rake") - - if install_pathname.absolute? - run("ln -s #{vendor_bin} #{DEFAULT_BIN_DIR}") - else - run("ln -s ../#{vendor_bin} #{DEFAULT_BIN_DIR}") - end - end - end -end diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index b9574dba6..4086d3885 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -17,7 +17,6 @@ class LanguagePack::Ruby < LanguagePack::Base NAME = "ruby" LIBYAML_VERSION = "0.1.7" LIBYAML_PATH = "libyaml-#{LIBYAML_VERSION}" - RBX_BASE_URL = "http://binaries.rubini.us/heroku" NODE_BP_PATH = "vendor/node/bin" Layer = LanguagePack::Helpers::Layer @@ -38,8 +37,6 @@ def bundler def initialize(*args) super(*args) - @fetchers[:mri] = LanguagePack::Fetcher.new(VENDOR_URL, @stack) - @fetchers[:rbx] = LanguagePack::Fetcher.new(RBX_BASE_URL, @stack) @node_installer = LanguagePack::Helpers::NodeInstaller.new @yarn_installer = LanguagePack::Helpers::YarnInstaller.new end @@ -86,7 +83,7 @@ def compile remove_vendor_bundle warn_bundler_upgrade warn_bad_binstubs - install_ruby(slug_vendor_ruby, build_ruby_path) + install_ruby(slug_vendor_ruby) setup_language_pack_environment( ruby_layer_path: File.expand_path("."), gem_layer_path: File.expand_path("."), @@ -230,12 +227,6 @@ def slug_vendor_ruby "vendor/#{ruby_version.version_without_patchlevel}" end - # the absolute path of the build ruby to use during the buildpack - # @return [String] resulting path - def build_ruby_path - "/tmp/#{ruby_version.version_without_patchlevel}" - end - # fetch the ruby version from bundler # @return [String, nil] returns the ruby version if detected or nil if none is detected def ruby_version @@ -518,23 +509,24 @@ def warn_outdated_minor # install the vendored ruby # @return [Boolean] true if it installs the vendored ruby and false otherwise - def install_ruby(install_path, build_ruby_path = nil) + def install_ruby(install_path) # Could do a compare operation to avoid re-downloading ruby return false unless ruby_version - installer = LanguagePack::Installers::RubyInstaller.installer(ruby_version).new(@stack) - @ruby_download_check = LanguagePack::Helpers::DownloadPresence.new(ruby_version.file_name) - @ruby_download_check.call + installer = LanguagePack::Installers::HerokuRubyInstaller.new( + stack: @stack, + ) - if ruby_version.build? - installer.fetch_unpack(ruby_version, build_ruby_path, true) - end + @ruby_download_check = LanguagePack::Helpers::DownloadPresence.new( + file_name: ruby_version.file_name, + ) + @ruby_download_check.call installer.install(ruby_version, install_path) @outdated_version_check = LanguagePack::Helpers::OutdatedRubyVersion.new( current_ruby_version: ruby_version, - fetcher: installer.fetcher + fetcher: installer.fetcher, ) @outdated_version_check.call @@ -620,9 +612,7 @@ def new_app? # @return [String] resulting path or empty string if ruby is not vendored def ruby_install_binstub_path(ruby_layer_path = ".") @ruby_install_binstub_path ||= - if ruby_version.build? - "#{build_ruby_path}/bin" - elsif ruby_version + if ruby_version "#{ruby_layer_path}/#{slug_vendor_ruby}/bin" else "" @@ -693,20 +683,6 @@ def uninstall_binary(path) FileUtils.rm File.join('bin', File.basename(path)), :force => true end - def load_default_cache? - new_app? && ruby_version.default? - end - - # loads a default bundler cache for new apps to speed up initial bundle installs - def load_default_cache - if false # load_default_cache? - puts "New app detected loading default bundler cache" - patchlevel = run("ruby -e 'puts RUBY_PATCHLEVEL'").strip - cache_name = "#{LanguagePack::RubyVersion::DEFAULT_VERSION}-p#{patchlevel}-default-cache" - @fetchers[:buildpack].fetch_untar("#{cache_name}.tgz") - end - end - # remove `vendor/bundle` that comes from the git repo # in case there are native ext. # users should be using `bundle pack` instead. @@ -837,12 +813,7 @@ def build_bundler puts "Bundle completed (#{"%.2f" % bundle_time}s)" log "bundle", :status => "success" puts "Cleaning up the bundler cache." - # Only show bundle clean output when not using default cache - if load_default_cache? - run("bundle clean > /dev/null", user_env: true, env: env_vars) - else - pipe("bundle clean", out: "2> /dev/null", user_env: true, env: env_vars) - end + pipe("bundle clean", out: "2> /dev/null", user_env: true, env: env_vars) @bundler_cache.store # Keep gem cache out of the slug diff --git a/lib/language_pack/ruby_version.rb b/lib/language_pack/ruby_version.rb index 3d5c17fc3..58c25c1d0 100644 --- a/lib/language_pack/ruby_version.rb +++ b/lib/language_pack/ruby_version.rb @@ -52,9 +52,7 @@ def ruby_192_or_lower? # https://github.com/bundler/bundler/issues/4621 def version_for_download - if rbx? - "rubinius-#{engine_version}" - elsif patchlevel_is_significant? && @patchlevel && @patchlevel.sub(/p/, '').to_i >= 0 + if patchlevel_is_significant? && @patchlevel && @patchlevel.sub(/p/, '').to_i >= 0 @version else version_without_patchlevel @@ -62,9 +60,7 @@ def version_for_download end def file_name - file = "#{version_for_download}.tgz" - file.sub!("ruby", "ruby-build") if build? - file + "#{version_for_download}.tgz" end # Before Ruby 2.1 patch releases were done via patchlevel i.e. 1.9.3-p426 versus 1.9.3-p448 @@ -87,18 +83,6 @@ def jruby? engine == :jruby end - # determine if we're using rbx - # @return [Boolean] true if we are and false if we aren't - def rbx? - engine == :rbx - end - - # determines if a build ruby is required - # @return [Boolean] true if a build ruby is required - def build? - engine == :ruby && %w(1.8.7 1.9.2).include?(ruby_version) - end - # convert to a Gemfile ruby DSL incantation # @return [String] the string representation of the Gemfile ruby DSL def to_gemfile diff --git a/lib/language_pack/test/ruby.rb b/lib/language_pack/test/ruby.rb index 43498d67e..e3a2f25c7 100644 --- a/lib/language_pack/test/ruby.rb +++ b/lib/language_pack/test/ruby.rb @@ -9,7 +9,7 @@ def compile Dir.chdir(build_path) remove_vendor_bundle warn_bad_binstubs - install_ruby(slug_vendor_ruby, build_ruby_path) + install_ruby(slug_vendor_ruby) setup_language_pack_environment( ruby_layer_path: File.expand_path("."), gem_layer_path: File.expand_path("."), diff --git a/spec/helpers/download_presence_spec.rb b/spec/helpers/download_presence_spec.rb index 30a5959ad..7d3780621 100644 --- a/spec/helpers/download_presence_spec.rb +++ b/spec/helpers/download_presence_spec.rb @@ -3,23 +3,22 @@ describe LanguagePack::Helpers::DownloadPresence do it "knows if exists on the next stack" do download = LanguagePack::Helpers::DownloadPresence.new( - 'ruby-1.9.3.tgz', - stacks: ['cedar-14', 'heroku-16', 'heroku-18'] + file_name: 'ruby-3.1.4.tgz', + stacks: ['heroku-20', 'heroku-22'], ) download.call - expect(download.next_stack(current_stack: "cedar-14")).to eq("heroku-16") - expect(download.next_stack(current_stack: "heroku-16")).to eq("heroku-18") - expect(download.next_stack(current_stack: "heroku-18")).to be_falsey + expect(download.next_stack(current_stack: "heroku-20")).to eq("heroku-22") + expect(download.next_stack(current_stack: "heroku-22")).to be_falsey - expect(download.exists_on_next_stack?(current_stack:"cedar-14")).to be_truthy + expect(download.exists_on_next_stack?(current_stack:"heroku-20")).to be_truthy end it "detects when a package is present on higher stacks" do download = LanguagePack::Helpers::DownloadPresence.new( - 'ruby-2.6.5.tgz', - stacks: ['cedar-14', 'heroku-16', 'heroku-18'] + file_name: 'ruby-2.6.5.tgz', + stacks: ['cedar-14', 'heroku-16', 'heroku-18'], ) download.call @@ -33,8 +32,8 @@ it "detects when a package is not present on higher stacks" do download = LanguagePack::Helpers::DownloadPresence.new( - 'ruby-1.9.3.tgz', - stacks: ['cedar-14', 'heroku-16', 'heroku-18'] + file_name: 'ruby-1.9.3.tgz', + stacks: ['cedar-14', 'heroku-16', 'heroku-18'], ) download.call @@ -45,8 +44,8 @@ it "detects when a package is present on two stacks but not a third" do download = LanguagePack::Helpers::DownloadPresence.new( - 'ruby-2.3.0.tgz', - stacks: ['cedar-14', 'heroku-16', 'heroku-18'] + file_name: 'ruby-2.3.0.tgz', + stacks: ['cedar-14', 'heroku-16', 'heroku-18'], ) download.call @@ -57,8 +56,8 @@ it "detects when a package does not exist" do download = LanguagePack::Helpers::DownloadPresence.new( - 'does-not-exist.tgz', - stacks: ['cedar-14', 'heroku-16', 'heroku-18'] + file_name: 'does-not-exist.tgz', + stacks: ['cedar-14', 'heroku-16', 'heroku-18'], ) download.call @@ -69,7 +68,7 @@ it "detects default ruby version" do download = LanguagePack::Helpers::DownloadPresence.new( - "ruby-3.1.1.tgz", + file_name: "ruby-3.1.1.tgz", ) download.call @@ -80,7 +79,7 @@ it "handles the current stack not being in the known stacks list" do download = LanguagePack::Helpers::DownloadPresence.new( - "#{LanguagePack::RubyVersion::DEFAULT_VERSION}.tgz", + file_name: "#{LanguagePack::RubyVersion::DEFAULT_VERSION}.tgz", ) download.call diff --git a/spec/helpers/outdated_ruby_version_spec.rb b/spec/helpers/outdated_ruby_version_spec.rb index 69db8925f..63e5ffaaf 100644 --- a/spec/helpers/outdated_ruby_version_spec.rb +++ b/spec/helpers/outdated_ruby_version_spec.rb @@ -2,7 +2,9 @@ describe LanguagePack::Helpers::OutdatedRubyVersion do let(:stack) { "heroku-16" } - let(:fetcher) { LanguagePack::Fetcher.new(LanguagePack::Base::VENDOR_URL, stack) } + let(:fetcher) { + LanguagePack::Fetcher.new(LanguagePack::Base::VENDOR_URL, stack: stack) + } it "finds the latest version on a stack" do ruby_version = LanguagePack::RubyVersion.new("ruby-2.2.5") @@ -29,18 +31,6 @@ expect(outdated.latest_minor_version?).to be_truthy end - it "Doesn't do anything when using a patch significant version" do - ruby_version = LanguagePack::RubyVersion.new("ruby-1.9.3p123") - outdated = LanguagePack::Helpers::OutdatedRubyVersion.new( - current_ruby_version: ruby_version, - fetcher: fetcher - ) - - outdated.call - expect(outdated.can_check?).to eq(false) - expect(outdated.suggested_ruby_minor_version).to eq(nil) - end - it "recommends a non EOL version of Ruby" do ruby_version_one = LanguagePack::RubyVersion.new("ruby-2.1.10") ruby_version_two = LanguagePack::RubyVersion.new("ruby-2.2.10") diff --git a/spec/helpers/ruby_version_spec.rb b/spec/helpers/ruby_version_spec.rb index 46a8d28cb..ffad5a5f6 100644 --- a/spec/helpers/ruby_version_spec.rb +++ b/spec/helpers/ruby_version_spec.rb @@ -60,20 +60,6 @@ expect(ruby_version.warn_ruby_26_bundler?).to be false end - it "correctly sets ruby version for bundler specified versions" do - Hatchet::App.new("mri_193").in_directory_fork do |dir| - Bundler.with_unbundled_env do - ruby_version = LanguagePack::RubyVersion.new(@bundler.install.ruby_version, is_new: true) - version_number = "1.9.3" - version = "ruby-#{version_number}" - expect(ruby_version.version_without_patchlevel).to eq(version) - expect(ruby_version.engine_version).to eq(version_number) - expect(ruby_version.to_gemfile).to eq("ruby '#{version_number}'") - expect(ruby_version.engine).to eq(:ruby) - end - end - end - it "correctly sets default ruby versions" do Hatchet::App.new("default_ruby").in_directory_fork do |dir| Bundler.with_unbundled_env do @@ -89,60 +75,83 @@ end end - it "correctly sets default legacy version" do - Hatchet::App.new("default_ruby").in_directory_fork do |dir| + it "detects Ruby from Gemfile.lock" do + Hatchet::App.new("default_ruby").in_directory_fork do |_| + dir = Pathname(Dir.pwd) Bundler.with_unbundled_env do - ruby_version = LanguagePack::RubyVersion.new(@bundler.install.ruby_version, is_new: false) - version_number = LanguagePack::RubyVersion::LEGACY_VERSION_NUMBER - version = LanguagePack::RubyVersion::LEGACY_VERSION - expect(ruby_version.version_without_patchlevel).to eq(version) - expect(ruby_version.engine_version).to eq(version_number) - expect(ruby_version.to_gemfile).to eq("ruby '#{version_number}'") - expect(ruby_version.engine).to eq(:ruby) - end - end - end + dir.join("Gemfile").write(<<~EOF) + source "https://rubygems.org" + + gem 'rake' + ruby '3.2.3' + EOF + dir.join("Gemfile.lock").write(<<~EOF) + GEM + remote: https://rubygems.org/ + specs: + rake (13.2.1) + + PLATFORMS + arm64-darwin-22 + ruby + x86_64-linux + + DEPENDENCIES + rake + + RUBY VERSION + ruby 3.2.3p157 + + BUNDLED WITH + 2.4.19 + EOF - it "detects Ruby 2.0.0" do - Hatchet::App.new("mri_200").in_directory_fork do |dir| - Bundler.with_unbundled_env do ruby_version = LanguagePack::RubyVersion.new(@bundler.install.ruby_version, is_new: true) - version_number = "2.0.0" + version_number = "3.2.3" version = "ruby-#{version_number}" expect(ruby_version.version_without_patchlevel).to eq(version) expect(ruby_version.engine_version).to eq(version_number) - expect(ruby_version.to_gemfile).to eq("ruby '#{version_number}'") expect(ruby_version.engine).to eq(:ruby) end end end - it "detects non mri engines" do - Hatchet::App.new("ruby_193_jruby_173").in_directory_fork do |dir| + Hatchet::App.new("default_ruby").in_directory_fork do |_| + dir = Pathname(Dir.pwd) Bundler.with_unbundled_env do - ruby_version = LanguagePack::RubyVersion.new(@bundler.install.ruby_version, is_new: true) - version_number = "1.9.3" - engine_version = "1.7.3" - engine = :jruby - version = "ruby-#{version_number}-#{engine}-#{engine_version}" - to_gemfile = "ruby '#{version_number}', :engine => '#{engine}', :engine_version => '#{engine_version}'" - expect(ruby_version.version_without_patchlevel).to eq(version) + dir.join("Gemfile").write(<<~EOF) + source "https://rubygems.org" + + ruby '2.6.8', engine: 'jruby', engine_version: '9.3.6.0' + EOF + dir.join("Gemfile.lock").write(<<~EOF) + GEM + remote: https://rubygems.org/ + specs: + PLATFORMS + java + + DEPENDENCIES + + RUBY VERSION + ruby 2.6.8p001 (jruby 9.3.6.0) + + BUNDLED WITH + 2.3.25 + EOF + + ruby_version = LanguagePack::RubyVersion.new( + @bundler.install.ruby_version, + is_new: true + ) + version_number = "2.6.8" + engine_version = "9.3.6.0" + engine = :jruby + expect(ruby_version.version_without_patchlevel).to eq("ruby-#{version_number}-#{engine}-#{engine_version}") expect(ruby_version.engine_version).to eq(engine_version) - expect(ruby_version.to_gemfile).to eq(to_gemfile) expect(ruby_version.engine).to eq(engine) end end end - - it "surfaces error message from bundler" do - bundle_error_msg = "Zomg der was a problem in da gemfile" - error_klass = LanguagePack::Helpers::BundlerWrapper::GemfileParseError - Hatchet::App.new("bad_gemfile_on_platform").in_directory_fork do |dir| - Bundler.with_unbundled_env do - @bundler = LanguagePack::Helpers::BundlerWrapper.new().install - expect { LanguagePack::RubyVersion.new(@bundler.ruby_version) }.to raise_error(error_klass, /#{Regexp.escape(bundle_error_msg)}/) - end - end - end end diff --git a/spec/installers/heroku_ruby_installer_spec.rb b/spec/installers/heroku_ruby_installer_spec.rb index 2fa788a69..3f37e99c1 100644 --- a/spec/installers/heroku_ruby_installer_spec.rb +++ b/spec/installers/heroku_ruby_installer_spec.rb @@ -1,7 +1,9 @@ require "spec_helper" describe LanguagePack::Installers::HerokuRubyInstaller do - let(:installer) { LanguagePack::Installers::HerokuRubyInstaller.new("cedar-14") } + let(:installer) { LanguagePack::Installers::HerokuRubyInstaller.new( + stack: "cedar-14" + ) } let(:ruby_version) { LanguagePack::RubyVersion.new("ruby-2.3.3") } describe "#fetch_unpack" do @@ -14,26 +16,9 @@ end end end - - context "build rubies" do - let(:ruby_version) { LanguagePack::RubyVersion.new("ruby-1.9.2") } - - it "should fetch and unpack the build ruby" do - Dir.mktmpdir do |dir| - Dir.chdir(dir) do - installer.fetch_unpack(ruby_version, dir, true) - - expect(File.read("lib/ruby/1.9.1/x86_64-linux/rbconfig.rb")).to include(%q{CONFIG["prefix"] = (TOPDIR || DESTDIR + "/tmp/ruby-1.9.2")}) - expect(File).to exist("bin/ruby") - end - end - end - - end end describe "#install" do - it "should install ruby and setup binstubs" do Dir.mktmpdir do |dir| Dir.chdir(dir) do @@ -45,6 +30,5 @@ end end end - end end diff --git a/spec/installers/rbx_installer_spec.rb b/spec/installers/rbx_installer_spec.rb deleted file mode 100644 index d446ed5d1..000000000 --- a/spec/installers/rbx_installer_spec.rb +++ /dev/null @@ -1,20 +0,0 @@ -require "spec_helper" - -describe LanguagePack::Installers::RbxInstaller do - let(:installer) { LanguagePack::Installers::RbxInstaller.new("cedar-14") } - let(:ruby_version) { LanguagePack::RubyVersion.new("ruby-2.3.1-rbx-3.69") } - - describe "#fetch_unpack" do - - it "should fetch and unpack rbx" do - Dir.mktmpdir do |dir| - Dir.chdir(dir) do - installer.fetch_unpack(ruby_version, dir) - - expect(File).to exist("bin/ruby") - end - end - end - - end -end From 935fd0feb34a0a5584afdd0384a9a4d526c5e1e3 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Wed, 17 Apr 2024 11:37:32 -0500 Subject: [PATCH 0950/1195] Support Heroku-24 and multi-arch (#1439) Heroku-24 base image supports two architectures amd64 and arm64. We've built binaries for these two architectures https://github.com/heroku/docker-heroku-ruby-builder/pull/38. Effectively this means that the s3 bucket that holds the Ruby binaries has an additional folder. Previously files were at `/ruby-.tgz` now they are at `//ruby-.tgz` but only for `heroku-24` and future stacks moving forward. To support multiple architectures, the buildpack needs to detect the current architecture and whether or not the current stack supports multiple architectures. Beyond downloading binaries, the buildpack is aware of the S3 structure to travers version numbers in order to warn customers when a newer version of a ruby version is available. We also warn customers if their current Ruby version is not available on the next stack. This behavior is implemented and tested in this commit, however we're not turning on warnings for `heroku-24` yet as customers cannot currently use it. --- CHANGELOG.md | 1 + lib/language_pack/base.rb | 17 +++++++ lib/language_pack/fetcher.rb | 3 +- .../helpers/download_presence.rb | 8 +++- .../helpers/outdated_ruby_version.rb | 1 + .../installers/heroku_ruby_installer.rb | 8 +++- lib/language_pack/ruby.rb | 4 ++ spec/helpers/download_presence_spec.rb | 46 +++++++++++++++++++ spec/helpers/outdated_ruby_version_spec.rb | 32 +++++++++++++ spec/installers/heroku_ruby_installer_spec.rb | 10 ++-- 10 files changed, 122 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ef414361..88e9e7b3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## [Unreleased] +- Heroku-24 stack initial support. Includes multi-architecture (arm64/amd64) logic that has not been tested on the platform (https://github.com/heroku/heroku-buildpack-ruby/pull/1439) - Remove unused Rubinius and Ruby 1.9.2 codepaths (https://github.com/heroku/heroku-buildpack-ruby/pull/1440) ## [v267] - 2024-02-28 diff --git a/lib/language_pack/base.rb b/lib/language_pack/base.rb index 135e88aea..82187e162 100644 --- a/lib/language_pack/base.rb +++ b/lib/language_pack/base.rb @@ -20,6 +20,8 @@ class LanguagePack::Base VENDOR_URL = ENV['BUILDPACK_VENDOR_URL'] || "https://heroku-buildpack-ruby.s3.us-east-1.amazonaws.com" DEFAULT_LEGACY_STACK = "cedar" ROOT_DIR = File.expand_path("../../..", __FILE__) + MULTI_ARCH_STACKS = ["heroku-24"] + KNOWN_ARCHITECTURES = ["amd64", "arm64"] attr_reader :build_path, :cache, :stack @@ -35,10 +37,25 @@ def initialize(build_path, cache_path = nil, layer_dir=nil) @id = Digest::SHA1.hexdigest("#{Time.now.to_f}-#{rand(1000000)}")[0..10] @fetchers = {:buildpack => LanguagePack::Fetcher.new(VENDOR_URL) } @layer_dir = layer_dir + @arch = get_arch Dir.chdir build_path end + def get_arch + command = "dpkg --print-architecture" + arch = run!(command, silent: true).strip + + if !KNOWN_ARCHITECTURES.include?(arch) + raise <<~EOF + Architecture '#{arch}' returned from command `#{command}` is unknown. + Known architectures include: #{KNOWN_ARCHITECTURES.inspect}" + EOF + end + + arch + end + def self.===(build_path) raise "must subclass" end diff --git a/lib/language_pack/fetcher.rb b/lib/language_pack/fetcher.rb index a4e491a87..f16390720 100644 --- a/lib/language_pack/fetcher.rb +++ b/lib/language_pack/fetcher.rb @@ -7,10 +7,11 @@ class FetchError < StandardError; end include ShellHelpers - def initialize(host_url, stack: nil) + def initialize(host_url, stack: nil, arch: nil) @host_url = Pathname.new(host_url) # File.basename prevents accidental directory traversal @host_url += File.basename(stack) if stack + @host_url += File.basename(arch) if arch end def exists?(path, max_attempts = 1) diff --git a/lib/language_pack/helpers/download_presence.rb b/lib/language_pack/helpers/download_presence.rb index ee8ae0cef..18e865656 100644 --- a/lib/language_pack/helpers/download_presence.rb +++ b/lib/language_pack/helpers/download_presence.rb @@ -18,13 +18,17 @@ class LanguagePack::Helpers::DownloadPresence STACKS = ['heroku-20', 'heroku-22'] - def initialize(file_name:, stacks: STACKS) + def initialize(file_name:, arch: , multi_arch_stacks:, stacks: STACKS ) @file_name = file_name @stacks = stacks @fetchers = [] @threads = [] @stacks.each do |stack| - @fetchers << LanguagePack::Fetcher.new(LanguagePack::Base::VENDOR_URL, stack: stack) + if multi_arch_stacks.include?(stack) + @fetchers << LanguagePack::Fetcher.new(LanguagePack::Base::VENDOR_URL, stack: stack, arch: arch) + else + @fetchers << LanguagePack::Fetcher.new(LanguagePack::Base::VENDOR_URL, stack: stack) + end end end diff --git a/lib/language_pack/helpers/outdated_ruby_version.rb b/lib/language_pack/helpers/outdated_ruby_version.rb index 548503491..9f23f0c7d 100644 --- a/lib/language_pack/helpers/outdated_ruby_version.rb +++ b/lib/language_pack/helpers/outdated_ruby_version.rb @@ -8,6 +8,7 @@ # outdated = LanguagePack::Helpers::OutdatedRubyVersion.new( # current_ruby_version: ruby_version, # fetcher: LanguagePack::Fetcher.new(LanguagePack::Base::VENDOR_URL, stack: "heroku-22") +# fetcher: LanguagePack::Fetcher.new(LanguagePack::Base::VENDOR_URL, stack: "heroku-22", arch: "amd64") # ) # # outdated.call diff --git a/lib/language_pack/installers/heroku_ruby_installer.rb b/lib/language_pack/installers/heroku_ruby_installer.rb index ebd52b371..2b2d4b976 100644 --- a/lib/language_pack/installers/heroku_ruby_installer.rb +++ b/lib/language_pack/installers/heroku_ruby_installer.rb @@ -10,8 +10,12 @@ class LanguagePack::Installers::HerokuRubyInstaller include LanguagePack::ShellHelpers attr_reader :fetcher - def initialize(stack: ) - @fetcher = LanguagePack::Fetcher.new(BASE_URL, stack: stack) + def initialize(stack: , multi_arch_stacks: , arch: ) + if multi_arch_stacks.include?(stack) + @fetcher = LanguagePack::Fetcher.new(BASE_URL, stack: stack, arch: arch) + else + @fetcher = LanguagePack::Fetcher.new(BASE_URL, stack: stack) + end end def install(ruby_version, install_dir) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 4086d3885..4a3009b7e 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -514,11 +514,15 @@ def install_ruby(install_path) return false unless ruby_version installer = LanguagePack::Installers::HerokuRubyInstaller.new( + multi_arch_stacks: MULTI_ARCH_STACKS, stack: @stack, + arch: @arch ) @ruby_download_check = LanguagePack::Helpers::DownloadPresence.new( + multi_arch_stacks: MULTI_ARCH_STACKS, file_name: ruby_version.file_name, + arch: @arch ) @ruby_download_check.call diff --git a/spec/helpers/download_presence_spec.rb b/spec/helpers/download_presence_spec.rb index 7d3780621..7d0da9651 100644 --- a/spec/helpers/download_presence_spec.rb +++ b/spec/helpers/download_presence_spec.rb @@ -1,10 +1,44 @@ require "spec_helper" describe LanguagePack::Helpers::DownloadPresence do + it "handles multi-arch transitions for files that exist" do + download = LanguagePack::Helpers::DownloadPresence.new( + multi_arch_stacks: ["heroku-24"], + file_name: 'ruby-3.1.4.tgz', + stacks: ["heroku-22", "heroku-24"], + arch: "amd64" + ) + + download.call + + expect(download.next_stack(current_stack: "heroku-22")).to eq("heroku-24") + expect(download.next_stack(current_stack: "heroku-24")).to be_falsey + + expect(download.exists_on_next_stack?(current_stack:"heroku-22")).to be_truthy + end + + it "handles multi-arch transitions for files that do not exist" do + download = LanguagePack::Helpers::DownloadPresence.new( + multi_arch_stacks: ["heroku-24"], + file_name: 'ruby-3.0.5.tgz', + stacks: ["heroku-20", "heroku-24"], + arch: "amd64" + ) + + download.call + + expect(download.next_stack(current_stack: "heroku-20")).to eq("heroku-24") + expect(download.next_stack(current_stack: "heroku-24")).to be_falsey + + expect(download.exists_on_next_stack?(current_stack:"heroku-20")).to be_falsey + end + it "knows if exists on the next stack" do download = LanguagePack::Helpers::DownloadPresence.new( + multi_arch_stacks: [], file_name: 'ruby-3.1.4.tgz', stacks: ['heroku-20', 'heroku-22'], + arch: nil ) download.call @@ -17,8 +51,10 @@ it "detects when a package is present on higher stacks" do download = LanguagePack::Helpers::DownloadPresence.new( + multi_arch_stacks: [], file_name: 'ruby-2.6.5.tgz', stacks: ['cedar-14', 'heroku-16', 'heroku-18'], + arch: nil ) download.call @@ -32,8 +68,10 @@ it "detects when a package is not present on higher stacks" do download = LanguagePack::Helpers::DownloadPresence.new( + multi_arch_stacks: [], file_name: 'ruby-1.9.3.tgz', stacks: ['cedar-14', 'heroku-16', 'heroku-18'], + arch: nil ) download.call @@ -44,8 +82,10 @@ it "detects when a package is present on two stacks but not a third" do download = LanguagePack::Helpers::DownloadPresence.new( + multi_arch_stacks: [], file_name: 'ruby-2.3.0.tgz', stacks: ['cedar-14', 'heroku-16', 'heroku-18'], + arch: nil ) download.call @@ -56,8 +96,10 @@ it "detects when a package does not exist" do download = LanguagePack::Helpers::DownloadPresence.new( + multi_arch_stacks: [], file_name: 'does-not-exist.tgz', stacks: ['cedar-14', 'heroku-16', 'heroku-18'], + arch: nil ) download.call @@ -68,7 +110,9 @@ it "detects default ruby version" do download = LanguagePack::Helpers::DownloadPresence.new( + multi_arch_stacks: [], file_name: "ruby-3.1.1.tgz", + arch: nil ) download.call @@ -79,7 +123,9 @@ it "handles the current stack not being in the known stacks list" do download = LanguagePack::Helpers::DownloadPresence.new( + multi_arch_stacks: [], file_name: "#{LanguagePack::RubyVersion::DEFAULT_VERSION}.tgz", + arch: nil ) download.call diff --git a/spec/helpers/outdated_ruby_version_spec.rb b/spec/helpers/outdated_ruby_version_spec.rb index 63e5ffaaf..d932f80cb 100644 --- a/spec/helpers/outdated_ruby_version_spec.rb +++ b/spec/helpers/outdated_ruby_version_spec.rb @@ -6,6 +6,38 @@ LanguagePack::Fetcher.new(LanguagePack::Base::VENDOR_URL, stack: stack) } + it "handles amd ↗️ architecture on heroku-24" do + ruby_version = LanguagePack::RubyVersion.new("ruby-3.1.0") + fetcher = LanguagePack::Fetcher.new( + LanguagePack::Base::VENDOR_URL, + stack: "heroku-24", + arch: "amd64" + ) + outdated = LanguagePack::Helpers::OutdatedRubyVersion.new( + current_ruby_version: ruby_version, + fetcher: fetcher + ) + + outdated.call + expect(outdated.suggested_ruby_minor_version).to eq("3.1.4") + end + + it "handles arm 💪 architecture on heroku-24" do + ruby_version = LanguagePack::RubyVersion.new("ruby-3.1.0") + fetcher = LanguagePack::Fetcher.new( + LanguagePack::Base::VENDOR_URL, + stack: "heroku-24", + arch: "arm64" + ) + outdated = LanguagePack::Helpers::OutdatedRubyVersion.new( + current_ruby_version: ruby_version, + fetcher: fetcher + ) + + outdated.call + expect(outdated.suggested_ruby_minor_version).to eq("3.1.4") + end + it "finds the latest version on a stack" do ruby_version = LanguagePack::RubyVersion.new("ruby-2.2.5") outdated = LanguagePack::Helpers::OutdatedRubyVersion.new( diff --git a/spec/installers/heroku_ruby_installer_spec.rb b/spec/installers/heroku_ruby_installer_spec.rb index 3f37e99c1..faf0f87e5 100644 --- a/spec/installers/heroku_ruby_installer_spec.rb +++ b/spec/installers/heroku_ruby_installer_spec.rb @@ -1,9 +1,13 @@ require "spec_helper" describe LanguagePack::Installers::HerokuRubyInstaller do - let(:installer) { LanguagePack::Installers::HerokuRubyInstaller.new( - stack: "cedar-14" - ) } + let(:installer) { + LanguagePack::Installers::HerokuRubyInstaller.new( + multi_arch_stacks: [], + stack: "cedar-14", + arch: nil, + ) + } let(:ruby_version) { LanguagePack::RubyVersion.new("ruby-2.3.3") } describe "#fetch_unpack" do From 5ce2c2eb026d4c72d0df82cb1bfc028bc2e2bb7b Mon Sep 17 00:00:00 2001 From: "heroku-linguist[bot]" <136119646+heroku-linguist[bot]@users.noreply.github.com> Date: Wed, 17 Apr 2024 18:42:25 +0000 Subject: [PATCH 0951/1195] Prepare release v268 (#1442) Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com> --- CHANGELOG.md | 6 +++++- lib/language_pack/version.rb | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 88e9e7b3f..3d957b0ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased] + +## [v268] - 2024-04-17 + - Heroku-24 stack initial support. Includes multi-architecture (arm64/amd64) logic that has not been tested on the platform (https://github.com/heroku/heroku-buildpack-ruby/pull/1439) - Remove unused Rubinius and Ruby 1.9.2 codepaths (https://github.com/heroku/heroku-buildpack-ruby/pull/1440) @@ -1512,7 +1515,8 @@ Bugfixes: * Change gem detection to use lockfile parser * use `$RACK_ENV` when thin is detected for rack apps -[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v267...main +[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v268...main +[v268]: https://github.com/heroku/heroku-buildpack-ruby/compare/v267...v268 [v267]: https://github.com/heroku/heroku-buildpack-ruby/compare/v266...v267 [v266]: https://github.com/heroku/heroku-buildpack-ruby/compare/v265...v266 [v265]: https://github.com/heroku/heroku-buildpack-ruby/compare/v264...v265 diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 37b02edb5..35eaf2369 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v267" + BUILDPACK_VERSION = "v268" end end From 397b8f8f00d9cd15c38aa7329bffbb7526cb0cc7 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Mon, 22 Apr 2024 12:29:50 -0500 Subject: [PATCH 0952/1195] Deprecate beta CNB support (#1445) * Deprecate beta CNB support CNB support was introduced into this buildpack as an experiment. The experiment is over, anyone wanting to use the official CNB (still in "preview" support) should use https://github.com/heroku/buildpacks-ruby * Apply suggestions from code review Co-authored-by: Josh W Lewis --------- Co-authored-by: Josh W Lewis --- CHANGELOG.md | 1 + bin/build | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d957b0ef..c82fb2871 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## [Unreleased] +- Deprecate CNB support in this buildpack; CNB support for Ruby is provided by [heroku/buildpacks-ruby](https://github.com/heroku/buildpacks-ruby) instead (https://github.com/heroku/heroku-buildpack-ruby/pull/1445) ## [v268] - 2024-04-17 diff --git a/bin/build b/bin/build index 016645c90..16cecbdd7 100755 --- a/bin/build +++ b/bin/build @@ -8,10 +8,18 @@ APP_DIR=$(pwd) BIN_DIR=$(cd $(dirname $0); pwd) BUILDPACK_DIR=$(dirname $BIN_DIR) -# legacy buildpack uses $STACK +# legacy buildpack uses $STACK export STACK=$CNB_STACK_ID source "$BIN_DIR/support/bash_functions.sh" heroku_buildpack_ruby_install_ruby "$BIN_DIR" "$BUILDPACK_DIR" +cat<&2 + The CNB implementation in this buildpack is no longer maintained + + The heroku/heroku-ruby-buildpack previously implemented the Cloud Native Buildpack \(CNB\) spec beta support, however this functionality is no longer supported or maintained. + + The Heroku Ruby CNB is now at https://github.com/heroku/buildpacks-ruby. See https://github.com/heroku/buildpacks for more information on using the Heroku CNB builder. To avoid interruptions switch to the new CNB as soon as possible. +EOF + $heroku_buildpack_ruby_dir/bin/ruby $BIN_DIR/support/ruby_build $APP_DIR $LAYERS_DIR $PLATFORM_DIR $PLAN From 6dc229ca83866e43d71b3d10a97d4929d85170ba Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Mon, 22 Apr 2024 15:07:31 -0500 Subject: [PATCH 0953/1195] Introduce shell check on CI (#1444) --- .github/workflows/ci.yml | 22 ++++++++++++++++++++++ bin/build | 14 +++++++++----- bin/compile | 12 ++++++++---- bin/detect | 5 ++--- bin/support/bash_functions.sh | 23 +++++++++-------------- bin/support/download_ruby | 6 +++++- bin/test | 12 ++++++++---- bin/test-compile | 12 ++++++++---- 8 files changed, 71 insertions(+), 35 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..b251477f8 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,22 @@ +name: CI + +on: + push: + # Avoid duplicate builds on PRs. + branches: + - main + pull_request: + +permissions: + contents: read + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Run ShellCheck bin top level + run: | + shellcheck bin/support/bash_functions.sh bin/support/download_ruby -x && + shellcheck bin/build bin/compile bin/detect bin/release bin/test bin/test-compile -x diff --git a/bin/build b/bin/build index 16cecbdd7..5a6d0f4ec 100755 --- a/bin/build +++ b/bin/build @@ -2,17 +2,17 @@ LAYERS_DIR=$1 PLATFORM_DIR=$2 -ENV_DIR="$PLATFORM_DIR/env" +_ENV_DIR="$PLATFORM_DIR/env" PLAN=$3 APP_DIR=$(pwd) -BIN_DIR=$(cd $(dirname $0); pwd) -BUILDPACK_DIR=$(dirname $BIN_DIR) +BIN_DIR=$(cd "$(dirname "$0")" || exit; pwd) # absolute path +BUILDPACK_DIR=$(dirname "$BIN_DIR") # legacy buildpack uses $STACK export STACK=$CNB_STACK_ID +# shellcheck source=bin/support/bash_functions.sh source "$BIN_DIR/support/bash_functions.sh" -heroku_buildpack_ruby_install_ruby "$BIN_DIR" "$BUILDPACK_DIR" cat<&2 The CNB implementation in this buildpack is no longer maintained @@ -22,4 +22,8 @@ cat<&2 The Heroku Ruby CNB is now at https://github.com/heroku/buildpacks-ruby. See https://github.com/heroku/buildpacks for more information on using the Heroku CNB builder. To avoid interruptions switch to the new CNB as soon as possible. EOF -$heroku_buildpack_ruby_dir/bin/ruby $BIN_DIR/support/ruby_build $APP_DIR $LAYERS_DIR $PLATFORM_DIR $PLAN +bootstrap_ruby_dir=$(install_bootstrap_ruby "$BIN_DIR" "$BUILDPACK_DIR") +export PATH="$bootstrap_ruby_dir/bin/:$PATH" +unset GEM_PATH + +"$bootstrap_ruby_dir"/bin/ruby "$BIN_DIR/support/ruby_build" "$APP_DIR" "$LAYERS_DIR" "$PLATFORM_DIR" "$PLAN" diff --git a/bin/compile b/bin/compile index e7926be25..30bd8da0c 100755 --- a/bin/compile +++ b/bin/compile @@ -5,11 +5,15 @@ BUILD_DIR=$1 CACHE_DIR=$2 ENV_DIR=$3 -BIN_DIR=$(cd $(dirname $0); pwd) -BUILDPACK_DIR=$(dirname $BIN_DIR) +BIN_DIR=$(cd "$(dirname "$0")" || exit; pwd) # absolute path +BUILDPACK_DIR=$(dirname "$BIN_DIR") +# shellcheck source=bin/support/bash_functions.sh source "$BIN_DIR/support/bash_functions.sh" -heroku_buildpack_ruby_install_ruby "$BIN_DIR" "$BUILDPACK_DIR" + +bootstrap_ruby_dir=$(install_bootstrap_ruby "$BIN_DIR" "$BUILDPACK_DIR") +export PATH="$bootstrap_ruby_dir/bin/:$PATH" +unset GEM_PATH if detect_needs_java "$BUILD_DIR"; then cat </dev/null 2>&1 + curl_retry_on_18 -s --fail --retry 3 --retry-connrefused --connect-timeout "${CURL_CONNECT_TIMEOUT:-3}" "$url" | tar xvz -C "$dir" >/dev/null 2>&1 else git clone "$url" "$dir" >/dev/null 2>&1 fi @@ -138,7 +133,7 @@ compile_buildpack_v2() # check if the buildpack left behind an environment for subsequent ones if [ -e "$dir/export" ]; then set +u # http://redsymbol.net/articles/unofficial-bash-strict-mode/#sourcing-nonconforming-document - # shellcheck disable=SC1090 + # shellcheck disable=SC1091 source "$dir/export" set -u # http://redsymbol.net/articles/unofficial-bash-strict-mode/#sourcing-nonconforming-document fi diff --git a/bin/support/download_ruby b/bin/support/download_ruby index d3087b175..9edf00106 100755 --- a/bin/support/download_ruby +++ b/bin/support/download_ruby @@ -12,6 +12,9 @@ set -eu BIN_DIR=$1 RUBY_BOOTSTRAP_DIR=$2 +# Stack is set by codon, listed here so shellcheck knows about it +STACK=${STACK:-} + curl_retry_on_18() { local ec=18; local attempts=0; @@ -28,13 +31,14 @@ if [[ $(cat "$BIN_DIR/../buildpack.toml") =~ $regex ]] then heroku_buildpack_ruby_url="${BUILDPACK_VENDOR_URL:-https://heroku-buildpack-ruby.s3.us-east-1.amazonaws.com}/$STACK/ruby-${BASH_REMATCH[1]}.tgz" else + heroku_buildpack_ruby_url="" echo "Could not detect ruby version to bootstrap" exit 1 fi mkdir -p "$RUBY_BOOTSTRAP_DIR" -curl_retry_on_18 --fail --retry 3 --retry-connrefused --connect-timeout ${CURL_CONNECT_TIMEOUT:-3} --silent --location -o "$RUBY_BOOTSTRAP_DIR/ruby.tgz" "$heroku_buildpack_ruby_url" || { +curl_retry_on_18 --fail --retry 3 --retry-connrefused --connect-timeout "${CURL_CONNECT_TIMEOUT:-3}" --silent --location -o "$RUBY_BOOTSTRAP_DIR/ruby.tgz" "$heroku_buildpack_ruby_url" || { cat< Date: Tue, 23 Apr 2024 09:25:49 -0500 Subject: [PATCH 0954/1195] Fix heroku-24 bootstrap ruby support (#1446) * Fix heroku-24 bootstrap ruby support The Ruby buildpack needs Ruby to run. For the heroku-24 stack the location of ruby binaries changed to include an architecture specifier (amd64/arm64) but the logic for bootstrapping a Ruby version was not updated. * Apply suggestions from code review Co-authored-by: Ed Morley <501702+edmorley@users.noreply.github.com> * Only vendor required binaries Classic build packs do not support ARM for now so we don't need to vendor it. * Make shellcheck happy * Fix stack/base-image name --------- Co-authored-by: Ed Morley <501702+edmorley@users.noreply.github.com> --- CHANGELOG.md | 1 + bin/support/bash_functions.sh | 10 +++++++++- bin/support/download_ruby | 15 ++++++++++++++- buildpack.toml | 4 ++++ spec/helpers/config_spec.rb | 17 +++++++++++++++++ 5 files changed, 45 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c82fb2871..34f64710d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## [Unreleased] +- Fix Heroku-24 Ruby buildpack bootstrapping logic (https://github.com/heroku/heroku-buildpack-ruby/pull/1446) - Deprecate CNB support in this buildpack; CNB support for Ruby is provided by [heroku/buildpacks-ruby](https://github.com/heroku/buildpacks-ruby) instead (https://github.com/heroku/heroku-buildpack-ruby/pull/1445) ## [v268] - 2024-04-17 diff --git a/bin/support/bash_functions.sh b/bin/support/bash_functions.sh index 39764ea62..67e86daff 100755 --- a/bin/support/bash_functions.sh +++ b/bin/support/bash_functions.sh @@ -30,7 +30,15 @@ install_bootstrap_ruby() { local bin_dir=$1 local buildpack_dir=$2 - local heroku_buildpack_ruby_dir="$buildpack_dir/vendor/ruby/$STACK" + + # Multi-arch aware stack support + if [ "$STACK" == "heroku-24" ]; then + local arch + arch=$(dpkg --print-architecture) + local heroku_buildpack_ruby_dir="$buildpack_dir/vendor/ruby/$STACK/$arch" + else + local heroku_buildpack_ruby_dir="$buildpack_dir/vendor/ruby/$STACK" + fi # The -d flag checks to see if a file exists and is a directory. # This directory may be non-empty if a previous compile has diff --git a/bin/support/download_ruby b/bin/support/download_ruby index 9edf00106..81522de35 100755 --- a/bin/support/download_ruby +++ b/bin/support/download_ruby @@ -25,11 +25,24 @@ curl_retry_on_18() { return $ec } +ruby_url() { + local stack=$1 + local version=$2 + + if [ "$stack" == "heroku-24" ]; then + local arch + arch=$(dpkg --print-architecture) + echo "${BUILDPACK_VENDOR_URL:-https://heroku-buildpack-ruby.s3.us-east-1.amazonaws.com}/$stack/$arch/ruby-$version.tgz" + else + echo "${BUILDPACK_VENDOR_URL:-https://heroku-buildpack-ruby.s3.us-east-1.amazonaws.com}/$stack/ruby-$version.tgz" + fi +} + # Pull ruby version out of buildpack.toml to be used with bootstrapping regex=".*ruby_version = [\'\"]([0-9]+\.[0-9]+\.[0-9]+)[\'\"].*" if [[ $(cat "$BIN_DIR/../buildpack.toml") =~ $regex ]] then - heroku_buildpack_ruby_url="${BUILDPACK_VENDOR_URL:-https://heroku-buildpack-ruby.s3.us-east-1.amazonaws.com}/$STACK/ruby-${BASH_REMATCH[1]}.tgz" + heroku_buildpack_ruby_url=$(ruby_url "$STACK" "${BASH_REMATCH[1]}") else heroku_buildpack_ruby_url="" echo "Could not detect ruby version to bootstrap" diff --git a/buildpack.toml b/buildpack.toml index 918adc0e7..7c72034f4 100644 --- a/buildpack.toml +++ b/buildpack.toml @@ -30,6 +30,10 @@ dir = "vendor/ruby/heroku-20" url = "https://heroku-buildpack-ruby.s3.us-east-1.amazonaws.com/heroku-22/ruby-3.1.4.tgz" dir = "vendor/ruby/heroku-22" +[[publish.Vendor]] +url = "https://heroku-buildpack-ruby.s3.us-east-1.amazonaws.com/heroku-24/amd64/ruby-3.1.4.tgz" +dir = "vendor/ruby/amd64/heroku-24" + [[stacks]] id = "heroku-20" diff --git a/spec/helpers/config_spec.rb b/spec/helpers/config_spec.rb index 102f433ea..c044c9dd4 100644 --- a/spec/helpers/config_spec.rb +++ b/spec/helpers/config_spec.rb @@ -19,4 +19,21 @@ expect(bootstrap_version).to be >= default_version end + + it "doesn't contain unexpected entries" do + require 'toml-rb' + config = TomlRB.load_file("buildpack.toml") + + urls = config["publish"]["Vendor"].map {|h| h["url"] if h["dir"] != "." }.compact + heroku_20 = urls.find_all {|url| url.include?("heroku-20") } + expect(heroku_20.length).to eq(1) + + heroku_22 = urls.find_all {|url| url.include?("heroku-22") } + expect(heroku_22.length).to eq(1) + + heroku_24 = urls.find_all {|url| url.include?("heroku-24") } + expect(heroku_24.length).to eq(1) + + expect(urls.length).to eq(3) + end end From 0a4a04f61d89b5aae2e6658b9f8a90a250db7d7f Mon Sep 17 00:00:00 2001 From: "heroku-linguist[bot]" <136119646+heroku-linguist[bot]@users.noreply.github.com> Date: Tue, 23 Apr 2024 14:31:38 +0000 Subject: [PATCH 0955/1195] Prepare release v269 (#1448) Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com> --- CHANGELOG.md | 6 +++++- lib/language_pack/version.rb | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 34f64710d..4c9988a33 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased] + +## [v269] - 2024-04-23 + - Fix Heroku-24 Ruby buildpack bootstrapping logic (https://github.com/heroku/heroku-buildpack-ruby/pull/1446) - Deprecate CNB support in this buildpack; CNB support for Ruby is provided by [heroku/buildpacks-ruby](https://github.com/heroku/buildpacks-ruby) instead (https://github.com/heroku/heroku-buildpack-ruby/pull/1445) @@ -1517,7 +1520,8 @@ Bugfixes: * Change gem detection to use lockfile parser * use `$RACK_ENV` when thin is detected for rack apps -[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v268...main +[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v269...main +[v269]: https://github.com/heroku/heroku-buildpack-ruby/compare/v268...v269 [v268]: https://github.com/heroku/heroku-buildpack-ruby/compare/v267...v268 [v267]: https://github.com/heroku/heroku-buildpack-ruby/compare/v266...v267 [v266]: https://github.com/heroku/heroku-buildpack-ruby/compare/v265...v266 diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 35eaf2369..626897620 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v268" + BUILDPACK_VERSION = "v269" end end From a0f97319beb307f0592f0541d35d1a90925bbeff Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Tue, 23 Apr 2024 12:36:06 -0500 Subject: [PATCH 0956/1195] Release Ruby 3.0.7, 3.1.5, 3.2.4, and 3.3.1 (#1449) --- CHANGELOG.md | 1 + .../unreleased/ruby_versions_307_315_324_331.md | 13 +++++++++++++ spec/helpers/outdated_ruby_version_spec.rb | 4 ++-- 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 changelogs/unreleased/ruby_versions_307_315_324_331.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c9988a33..0ef5877b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## [Unreleased] +- Ruby versions 3.0.7, 3.1.5, 3.2.4, and 3.3.1 are now available on Heroku (https://github.com/heroku/heroku-buildpack-ruby/pull/1449) ## [v269] - 2024-04-23 diff --git a/changelogs/unreleased/ruby_versions_307_315_324_331.md b/changelogs/unreleased/ruby_versions_307_315_324_331.md new file mode 100644 index 000000000..dfe2375c4 --- /dev/null +++ b/changelogs/unreleased/ruby_versions_307_315_324_331.md @@ -0,0 +1,13 @@ +# Ruby versions 3.0.7, 3.1.5, 3.2.4, 3.3.1 are now available + +The following Ruby versions are now available on the Heroku platform: + +- Ruby 3.0.7 +- Ruby 3.1.5 +- Ruby 3.2.4 +- Ruby 3.3.1 + +The latest versions are on the [Ruby support page](https://devcenter.heroku.com/articles/ruby-support). + +> note +> [Ruby 3.0.x is now EOL](https://www.ruby-lang.org/en/news/2024/04/23/ruby-3-0-7-released/) and therefore is no longer within Heroku's support policy. Heroku strongly recommends upgrading to Ruby 3.1.x or later. diff --git a/spec/helpers/outdated_ruby_version_spec.rb b/spec/helpers/outdated_ruby_version_spec.rb index d932f80cb..d8409d3c9 100644 --- a/spec/helpers/outdated_ruby_version_spec.rb +++ b/spec/helpers/outdated_ruby_version_spec.rb @@ -19,7 +19,7 @@ ) outdated.call - expect(outdated.suggested_ruby_minor_version).to eq("3.1.4") + expect(outdated.suggested_ruby_minor_version).to eq("3.1.5") end it "handles arm 💪 architecture on heroku-24" do @@ -35,7 +35,7 @@ ) outdated.call - expect(outdated.suggested_ruby_minor_version).to eq("3.1.4") + expect(outdated.suggested_ruby_minor_version).to eq("3.1.5") end it "finds the latest version on a stack" do From fd6585411cbf86d363ad0824f53d8edba1d7afed Mon Sep 17 00:00:00 2001 From: "heroku-linguist[bot]" <136119646+heroku-linguist[bot]@users.noreply.github.com> Date: Tue, 23 Apr 2024 17:42:13 +0000 Subject: [PATCH 0957/1195] Prepare release v270 (#1450) Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com> --- CHANGELOG.md | 6 +++++- .../{unreleased => v270}/ruby_versions_307_315_324_331.md | 0 lib/language_pack/version.rb | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) rename changelogs/{unreleased => v270}/ruby_versions_307_315_324_331.md (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ef5877b0..374258ff1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased] + +## [v270] - 2024-04-23 + - Ruby versions 3.0.7, 3.1.5, 3.2.4, and 3.3.1 are now available on Heroku (https://github.com/heroku/heroku-buildpack-ruby/pull/1449) ## [v269] - 2024-04-23 @@ -1521,7 +1524,8 @@ Bugfixes: * Change gem detection to use lockfile parser * use `$RACK_ENV` when thin is detected for rack apps -[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v269...main +[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v270...main +[v270]: https://github.com/heroku/heroku-buildpack-ruby/compare/v269...v270 [v269]: https://github.com/heroku/heroku-buildpack-ruby/compare/v268...v269 [v268]: https://github.com/heroku/heroku-buildpack-ruby/compare/v267...v268 [v267]: https://github.com/heroku/heroku-buildpack-ruby/compare/v266...v267 diff --git a/changelogs/unreleased/ruby_versions_307_315_324_331.md b/changelogs/v270/ruby_versions_307_315_324_331.md similarity index 100% rename from changelogs/unreleased/ruby_versions_307_315_324_331.md rename to changelogs/v270/ruby_versions_307_315_324_331.md diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 626897620..6ce69e246 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v269" + BUILDPACK_VERSION = "v270" end end From f7813cf3f4fcdcfb777db2b511bddfd7a671dab6 Mon Sep 17 00:00:00 2001 From: Victor Fernandez Date: Fri, 24 May 2024 08:28:15 -0600 Subject: [PATCH 0958/1195] With Propshaft migration from Sprockets version retrieval causes issue (#1452) * make reference to sprockets unnnecesary * added changelog entry --- CHANGELOG.md | 2 ++ lib/language_pack/rails3.rb | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 374258ff1..455f6d8c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## [Unreleased] +- Fix issue with sprockets reference being nil when + propshaft gem is used instead (https://github.com/heroku/heroku-buildpack-ruby/pull/1452) ## [v270] - 2024-04-23 diff --git a/lib/language_pack/rails3.rb b/lib/language_pack/rails3.rb index b80661b14..33d02c1d3 100644 --- a/lib/language_pack/rails3.rb +++ b/lib/language_pack/rails3.rb @@ -134,7 +134,9 @@ def has_nginx? def sprocket_version_upgrade_needed # Due to https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-3760 sprockets_version = bundler.gem_version('sprockets') - if sprockets_version < Gem::Version.new("2.12.5") + if sprockets_version.nil? + return false + elsif sprockets_version < Gem::Version.new("2.12.5") return "2.12.5" elsif sprockets_version > Gem::Version.new("3") && sprockets_version < Gem::Version.new("3.7.2") From 1c691ff13e282b2aa83b926f89a78be2372870ea Mon Sep 17 00:00:00 2001 From: "heroku-linguist[bot]" <136119646+heroku-linguist[bot]@users.noreply.github.com> Date: Fri, 24 May 2024 18:09:56 +0000 Subject: [PATCH 0959/1195] Prepare release v271 (#1455) Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com> --- CHANGELOG.md | 6 +++++- lib/language_pack/version.rb | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 455f6d8c0..452b849cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased] + +## [v271] - 2024-05-24 + - Fix issue with sprockets reference being nil when propshaft gem is used instead (https://github.com/heroku/heroku-buildpack-ruby/pull/1452) @@ -1526,7 +1529,8 @@ Bugfixes: * Change gem detection to use lockfile parser * use `$RACK_ENV` when thin is detected for rack apps -[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v270...main +[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v271...main +[v271]: https://github.com/heroku/heroku-buildpack-ruby/compare/v270...v271 [v270]: https://github.com/heroku/heroku-buildpack-ruby/compare/v269...v270 [v269]: https://github.com/heroku/heroku-buildpack-ruby/compare/v268...v269 [v268]: https://github.com/heroku/heroku-buildpack-ruby/compare/v267...v268 diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 6ce69e246..c6c9f7bd9 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v270" + BUILDPACK_VERSION = "v271" end end From 4f8837043f95980f8530b281bb87597ff2a3db38 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Mon, 3 Jun 2024 12:02:13 -0500 Subject: [PATCH 0960/1195] Documents ruby releases (#1454) --- CHANGELOG.md | 3 +++ spec/helpers/outdated_ruby_version_spec.rb | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 452b849cf..c18144a26 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased] +- Ruby 3.4.0-preview1 is now available +- Ruby 3.1.6 and 3.3.2 are now available +- JRuby 9.4.7.0, 9.4.6.0, and 9.3.14.0 are now available ## [v271] - 2024-05-24 diff --git a/spec/helpers/outdated_ruby_version_spec.rb b/spec/helpers/outdated_ruby_version_spec.rb index d8409d3c9..410fd1ff3 100644 --- a/spec/helpers/outdated_ruby_version_spec.rb +++ b/spec/helpers/outdated_ruby_version_spec.rb @@ -19,7 +19,7 @@ ) outdated.call - expect(outdated.suggested_ruby_minor_version).to eq("3.1.5") + expect(outdated.suggested_ruby_minor_version).to eq("3.1.6") end it "handles arm 💪 architecture on heroku-24" do @@ -35,7 +35,7 @@ ) outdated.call - expect(outdated.suggested_ruby_minor_version).to eq("3.1.5") + expect(outdated.suggested_ruby_minor_version).to eq("3.1.6") end it "finds the latest version on a stack" do From e72c034cfcf857508bf4570154511b604fcf044f Mon Sep 17 00:00:00 2001 From: "heroku-linguist[bot]" <136119646+heroku-linguist[bot]@users.noreply.github.com> Date: Mon, 3 Jun 2024 17:23:52 +0000 Subject: [PATCH 0961/1195] Prepare release v271 (#1462) Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com> --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c18144a26..0734c647c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased] + +## [v271] - 2024-06-03 + - Ruby 3.4.0-preview1 is now available - Ruby 3.1.6 and 3.3.2 are now available - JRuby 9.4.7.0, 9.4.6.0, and 9.3.14.0 are now available @@ -1534,6 +1537,7 @@ Bugfixes: [unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v271...main [v271]: https://github.com/heroku/heroku-buildpack-ruby/compare/v270...v271 +[v271]: https://github.com/heroku/heroku-buildpack-ruby/compare/v270...v271 [v270]: https://github.com/heroku/heroku-buildpack-ruby/compare/v269...v270 [v269]: https://github.com/heroku/heroku-buildpack-ruby/compare/v268...v269 [v268]: https://github.com/heroku/heroku-buildpack-ruby/compare/v267...v268 From 8559194e2606d05160ad0a117e30207733733309 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Mon, 3 Jun 2024 14:35:33 -0500 Subject: [PATCH 0962/1195] v271 was previously prepared but never released (#1463) This update reflects the actual release dates and associated changes. --- CHANGELOG.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0734c647c..3e45aeab8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,9 +8,6 @@ - Ruby 3.4.0-preview1 is now available - Ruby 3.1.6 and 3.3.2 are now available - JRuby 9.4.7.0, 9.4.6.0, and 9.3.14.0 are now available - -## [v271] - 2024-05-24 - - Fix issue with sprockets reference being nil when propshaft gem is used instead (https://github.com/heroku/heroku-buildpack-ruby/pull/1452) From a373fb3c7114c00239fcfa070f650e0c1db64e29 Mon Sep 17 00:00:00 2001 From: Ed Morley <501702+edmorley@users.noreply.github.com> Date: Thu, 13 Jun 2024 01:00:16 +0100 Subject: [PATCH 0963/1195] Remove experimental CNB support (#1464) The buildpack in this repo is primarily a classic Heroku buildpack, however, as part of the initial exploration into CNBs had experimental CNB support added some time ago. However, the maintained Ruby CNB now exists in a separate repo: https://github.com/heroku/buildpacks-ruby The experimental CNB support in this repo doesn't actually work any more since the buildpack API version it implements (v0.2) isn't supported by modern `lifecycle` versions - and attempts at building encounter this error: ``` ERROR: failed to set API for Buildpack 'heroku/ruby@0.1.4': buildpack API version '0.2' is incompatible with the lifecycle ``` In addition, it's not even possible to use this repo with a CNB build without having cloned it locally, since: 1. The CNB parts are no longer published 2. The old CNB release assets were deleted a year or so ago: https://github.com/heroku/heroku-buildpack-ruby/releases 3. Pack/lifecycle doesn't support cloning Git URLs. 4. Attempting to use a buildpack URL pointing at the GitHub gzip archive fails due to GitHub's nesting of the repo inside a subdirectory: ``` $ pack build --builder heroku/builder:22 --buildpack https://github.com/heroku/heroku-buildpack-ruby/archive/refs/heads/main.tar.gz ruby-test ... Downloading from https://github.com/heroku/heroku-buildpack-ruby/archive/refs/heads/main.tar.gz 93.2 KB/-1 B ERROR: failed to build: downloading buildpack: extracting from https://github.com/heroku/heroku-buildpack-ruby/archive/refs/heads/main.tar.gz: reading buildpack: reading buildpack.toml: could not find entry path 'buildpack.toml': not exist ``` Given both the Buildpack API error, and the GitHub URL issues no one is using the CNB implementation here, and so its dead code that should be removed to prevent confusion (eg over where the CNB lives). A deprecation warning was previously added in #1445 (though as above it's unlikely anyone even saw that message, since the build was already erroring before it gets that far). --- .github/workflows/ci.yml | 2 +- CHANGELOG.md | 1 + bin/build | 29 ------ bin/detect | 12 +-- bin/support/ruby_build | 31 ------ buildpack.toml | 19 ---- lib/language_pack/base.rb | 107 ++++--------------- lib/language_pack/helpers/layer.rb | 61 ----------- lib/language_pack/rails2.rb | 6 -- lib/language_pack/ruby.rb | 89 +++------------- package.toml | 2 - vendor/toml.rb | 159 ----------------------------- 12 files changed, 37 insertions(+), 481 deletions(-) delete mode 100755 bin/build delete mode 100755 bin/support/ruby_build delete mode 100644 lib/language_pack/helpers/layer.rb delete mode 100644 package.toml delete mode 100644 vendor/toml.rb diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b251477f8..3e819163b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,4 +19,4 @@ jobs: - name: Run ShellCheck bin top level run: | shellcheck bin/support/bash_functions.sh bin/support/download_ruby -x && - shellcheck bin/build bin/compile bin/detect bin/release bin/test bin/test-compile -x + shellcheck bin/compile bin/detect bin/release bin/test bin/test-compile -x diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e45aeab8..32d4b2a43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## [Unreleased] +- Remove experimental CNB support. For official CNB support use [heroku/buildpacks-ruby](https://github.com/heroku/buildpacks-ruby) instead. (https://github.com/heroku/heroku-buildpack-ruby/pull/1464) ## [v271] - 2024-06-03 diff --git a/bin/build b/bin/build deleted file mode 100755 index 5a6d0f4ec..000000000 --- a/bin/build +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env bash - -LAYERS_DIR=$1 -PLATFORM_DIR=$2 -_ENV_DIR="$PLATFORM_DIR/env" -PLAN=$3 -APP_DIR=$(pwd) -BIN_DIR=$(cd "$(dirname "$0")" || exit; pwd) # absolute path -BUILDPACK_DIR=$(dirname "$BIN_DIR") - -# legacy buildpack uses $STACK -export STACK=$CNB_STACK_ID - -# shellcheck source=bin/support/bash_functions.sh -source "$BIN_DIR/support/bash_functions.sh" - -cat<&2 - The CNB implementation in this buildpack is no longer maintained - - The heroku/heroku-ruby-buildpack previously implemented the Cloud Native Buildpack \(CNB\) spec beta support, however this functionality is no longer supported or maintained. - - The Heroku Ruby CNB is now at https://github.com/heroku/buildpacks-ruby. See https://github.com/heroku/buildpacks for more information on using the Heroku CNB builder. To avoid interruptions switch to the new CNB as soon as possible. -EOF - -bootstrap_ruby_dir=$(install_bootstrap_ruby "$BIN_DIR" "$BUILDPACK_DIR") -export PATH="$bootstrap_ruby_dir/bin/:$PATH" -unset GEM_PATH - -"$bootstrap_ruby_dir"/bin/ruby "$BIN_DIR/support/ruby_build" "$APP_DIR" "$LAYERS_DIR" "$PLATFORM_DIR" "$PLAN" diff --git a/bin/detect b/bin/detect index 83ad9437c..e25db8c44 100755 --- a/bin/detect +++ b/bin/detect @@ -1,18 +1,10 @@ #!/bin/sh -if [ -z "$CNB_STACK_ID" ]; then - # v2 API - APP_DIR=$1 -else - _PLATFORM_DIR=$1 - _PLAN=$2 - # v3 API - APP_DIR=$(pwd) -fi +APP_DIR=$1 if [ -f "$APP_DIR/Gemfile" ]; then echo "Ruby" exit 0 else - exit 100 + exit 1 fi diff --git a/bin/support/ruby_build b/bin/support/ruby_build deleted file mode 100755 index ddcb77edf..000000000 --- a/bin/support/ruby_build +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env ruby - -# This script compiles an application so it can run on Heroku. -# It will install the application's specified version of Ruby, it's dependencies -# and certain framework specific requirements (such as calling `rake assets:precompile` -# for rails apps). You can see all features described in the devcenter -# https://devcenter.heroku.com/articles/ruby-support -$stdout.sync = true - -$:.unshift File.expand_path("../../../lib", __FILE__) -require "language_pack" -require "language_pack/shell_helpers" - -APP_DIR=ARGV[0] -LAYER_DIR=ARGV[1] -PLATFORM_DIR=ARGV[2] -ENV_DIR="#{PLATFORM_DIR}/env" -PLAN=ARGV[3] - -begin - LanguagePack::ShellHelpers.initialize_env(ENV_DIR) - if pack = LanguagePack.detect(ARGV[0], nil, LAYER_DIR) - pack.topic("Compiling #{pack.name}") - pack.log("compile") do - pack.build - end - end -rescue Exception => e - LanguagePack::ShellHelpers.display_error_and_exit(e) -end - diff --git a/buildpack.toml b/buildpack.toml index 7c72034f4..0bcaf7851 100644 --- a/buildpack.toml +++ b/buildpack.toml @@ -1,10 +1,5 @@ -api = "0.2" - [buildpack] -id = "heroku/ruby" -version = "0.1.4" name = "Ruby" -homepage = "https://github.com/heroku/heroku-buildpack-ruby" ruby_version = "3.1.4" [publish] @@ -19,7 +14,6 @@ files = [ "app.json", "hatchet.json", "hatchet.lock", - "package.toml", ] [[publish.Vendor]] @@ -33,16 +27,3 @@ dir = "vendor/ruby/heroku-22" [[publish.Vendor]] url = "https://heroku-buildpack-ruby.s3.us-east-1.amazonaws.com/heroku-24/amd64/ruby-3.1.4.tgz" dir = "vendor/ruby/amd64/heroku-24" - -[[stacks]] -id = "heroku-20" - -[[stacks]] -id = "heroku-22" - -[metadata] - -[metadata.release] - -[metadata.release.docker] -repository = "public.ecr.aws/heroku-buildpacks/heroku-ruby-buildpack" diff --git a/lib/language_pack/base.rb b/lib/language_pack/base.rb index 82187e162..c57ae0324 100644 --- a/lib/language_pack/base.rb +++ b/lib/language_pack/base.rb @@ -5,7 +5,6 @@ require "language_pack/shell_helpers" require "language_pack/cache" require "language_pack/helpers/bundler_cache" -require "language_pack/helpers/layer" require "language_pack/metadata" require "language_pack/fetcher" @@ -28,7 +27,7 @@ class LanguagePack::Base # changes directory to the build_path # @param [String] the path of the build dir # @param [String] the path of the cache dir this is nil during detect and release - def initialize(build_path, cache_path = nil, layer_dir=nil) + def initialize(build_path, cache_path = nil) @build_path = build_path @stack = ENV.fetch("STACK") @cache = LanguagePack::Cache.new(cache_path) @@ -36,7 +35,6 @@ def initialize(build_path, cache_path = nil, layer_dir=nil) @bundler_cache = LanguagePack::BundlerCache.new(@cache, @stack) @id = Digest::SHA1.hexdigest("#{Time.now.to_f}-#{rand(1000000)}")[0..10] @fetchers = {:buildpack => LanguagePack::Fetcher.new(VENDOR_URL) } - @layer_dir = layer_dir @arch = get_arch Dir.chdir build_path @@ -103,24 +101,6 @@ def compile mcount "success" end - def build - write_release_toml - Kernel.puts "" - warnings.each do |warning| - Kernel.puts "\e[1m\e[33m###### WARNING:\e[0m"# Bold yellow - Kernel.puts "" - puts warning - Kernel.puts "" - Kernel.puts "" - end - if deprecations.any? - topic "DEPRECATIONS:" - puts @deprecations.join("\n") - end - Kernel.puts "" - mcount "success" - end - def build_release release = {} release["addons"] = default_addons @@ -130,29 +110,6 @@ def build_release release end - def write_release_toml - release = build_release - - layer = LanguagePack::Helpers::Layer.new(@layer_dir, "env", launch: true) - FileUtils.mkdir_p("#{layer.path}/env.launch") - release["config_vars"].each do |key, value| - File.open("#{layer.path}/env.launch/#{key.upcase}.override", 'w') do |f| - f.write(value) - end - end - - release_toml = release["default_process_types"].map do |type, command| - < Date: Thu, 13 Jun 2024 09:12:46 -0500 Subject: [PATCH 0964/1195] Default Ruby version to 3.1.6 (#1466) --- CHANGELOG.md | 2 ++ Gemfile.lock | 4 ++-- buildpack.toml | 8 ++++---- changelogs/unreleased/default_ruby.md | 3 +++ lib/language_pack/ruby_version.rb | 4 ++-- 5 files changed, 13 insertions(+), 8 deletions(-) create mode 100644 changelogs/unreleased/default_ruby.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 32d4b2a43..30d182e07 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ ## [Unreleased] - Remove experimental CNB support. For official CNB support use [heroku/buildpacks-ruby](https://github.com/heroku/buildpacks-ruby) instead. (https://github.com/heroku/heroku-buildpack-ruby/pull/1464) +- Default Ruby version is now 3.1.6 (https://github.com/heroku/heroku-buildpack-ruby/pull/1466) +- Ruby 3.3.3 is now available ## [v271] - 2024-06-03 diff --git a/Gemfile.lock b/Gemfile.lock index 0f753a918..265e653ab 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -69,7 +69,7 @@ DEPENDENCIES toml-rb RUBY VERSION - ruby 3.1.4p223 + ruby 3.1.6p260 BUNDLED WITH - 2.5.8 + 2.5.11 diff --git a/buildpack.toml b/buildpack.toml index 0bcaf7851..3a4090ef2 100644 --- a/buildpack.toml +++ b/buildpack.toml @@ -1,6 +1,6 @@ [buildpack] name = "Ruby" -ruby_version = "3.1.4" +ruby_version = "3.1.6" [publish] @@ -17,13 +17,13 @@ files = [ ] [[publish.Vendor]] -url = "https://heroku-buildpack-ruby.s3.us-east-1.amazonaws.com/heroku-20/ruby-3.1.4.tgz" +url = "https://heroku-buildpack-ruby.s3.us-east-1.amazonaws.com/heroku-20/ruby-3.1.6.tgz" dir = "vendor/ruby/heroku-20" [[publish.Vendor]] -url = "https://heroku-buildpack-ruby.s3.us-east-1.amazonaws.com/heroku-22/ruby-3.1.4.tgz" +url = "https://heroku-buildpack-ruby.s3.us-east-1.amazonaws.com/heroku-22/ruby-3.1.6.tgz" dir = "vendor/ruby/heroku-22" [[publish.Vendor]] -url = "https://heroku-buildpack-ruby.s3.us-east-1.amazonaws.com/heroku-24/amd64/ruby-3.1.4.tgz" +url = "https://heroku-buildpack-ruby.s3.us-east-1.amazonaws.com/heroku-24/amd64/ruby-3.1.6.tgz" dir = "vendor/ruby/amd64/heroku-24" diff --git a/changelogs/unreleased/default_ruby.md b/changelogs/unreleased/default_ruby.md new file mode 100644 index 000000000..a06f083bb --- /dev/null +++ b/changelogs/unreleased/default_ruby.md @@ -0,0 +1,3 @@ +## Default Ruby version for new apps is now 3.1.6 + +The [default Ruby version for new Ruby applications is 3.1.6](https://devcenter.heroku.com/articles/ruby-support#default-ruby-version-for-new-apps). You’ll only get the default if the application does not specify a ruby version. diff --git a/lib/language_pack/ruby_version.rb b/lib/language_pack/ruby_version.rb index 58c25c1d0..70ba0886e 100644 --- a/lib/language_pack/ruby_version.rb +++ b/lib/language_pack/ruby_version.rb @@ -12,8 +12,8 @@ def initialize(output = "") end end - BOOTSTRAP_VERSION_NUMBER = "3.1.4".freeze - DEFAULT_VERSION_NUMBER = "3.1.4".freeze + BOOTSTRAP_VERSION_NUMBER = "3.1.6".freeze + DEFAULT_VERSION_NUMBER = "3.1.6".freeze DEFAULT_VERSION = "ruby-#{DEFAULT_VERSION_NUMBER}".freeze LEGACY_VERSION_NUMBER = "1.9.2".freeze LEGACY_VERSION = "ruby-#{LEGACY_VERSION_NUMBER}".freeze From 168cb5d556f154e4eba57c797d04b18a4d8b354c Mon Sep 17 00:00:00 2001 From: "heroku-linguist[bot]" <136119646+heroku-linguist[bot]@users.noreply.github.com> Date: Thu, 13 Jun 2024 14:24:33 +0000 Subject: [PATCH 0965/1195] Prepare release v272 (#1467) Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com> --- CHANGELOG.md | 6 +++++- changelogs/{unreleased => v272}/default_ruby.md | 0 lib/language_pack/version.rb | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) rename changelogs/{unreleased => v272}/default_ruby.md (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 30d182e07..b0d63e656 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased] + +## [v272] - 2024-06-13 + - Remove experimental CNB support. For official CNB support use [heroku/buildpacks-ruby](https://github.com/heroku/buildpacks-ruby) instead. (https://github.com/heroku/heroku-buildpack-ruby/pull/1464) - Default Ruby version is now 3.1.6 (https://github.com/heroku/heroku-buildpack-ruby/pull/1466) - Ruby 3.3.3 is now available @@ -1535,7 +1538,8 @@ Bugfixes: * Change gem detection to use lockfile parser * use `$RACK_ENV` when thin is detected for rack apps -[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v271...main +[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v272...main +[v272]: https://github.com/heroku/heroku-buildpack-ruby/compare/v271...v272 [v271]: https://github.com/heroku/heroku-buildpack-ruby/compare/v270...v271 [v271]: https://github.com/heroku/heroku-buildpack-ruby/compare/v270...v271 [v270]: https://github.com/heroku/heroku-buildpack-ruby/compare/v269...v270 diff --git a/changelogs/unreleased/default_ruby.md b/changelogs/v272/default_ruby.md similarity index 100% rename from changelogs/unreleased/default_ruby.md rename to changelogs/v272/default_ruby.md diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index c6c9f7bd9..b9a7ea4df 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v271" + BUILDPACK_VERSION = "v272" end end From cf25ace0e09675e744603962e12451943ce979be Mon Sep 17 00:00:00 2001 From: Stella Yang <43301578+lilacstella@users.noreply.github.com> Date: Wed, 19 Jun 2024 10:26:33 -0700 Subject: [PATCH 0966/1195] add a test to check that this runs on heroku-24 (#1468) expect new line at the end of the `which` command output by stripping it to satisfy the test using the getting started fixture as expected by the current spec file Co-authored-by: Richard Schneeman --- spec/hatchet/getting_started_spec.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spec/hatchet/getting_started_spec.rb b/spec/hatchet/getting_started_spec.rb index 7a732d61a..f31bad042 100644 --- a/spec/hatchet/getting_started_spec.rb +++ b/spec/hatchet/getting_started_spec.rb @@ -6,4 +6,10 @@ expect(app.run("ls tmp/cache/assets")).to_not match("sprockets") end end + + it "works on Heroku-24" do + Hatchet::Runner.new("ruby-getting-started", stack: "heroku-24").deploy do |app| + expect(app.run("which ruby").strip).to eq("/app/bin/ruby") + end + end end From 03a7f545f415d46131c8bc6adb615ea256be4db5 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Fri, 21 Jun 2024 09:50:26 -0500 Subject: [PATCH 0967/1195] Let bundler >= 2.2 handle windows platform (#1469) * Let bundler >= 2.2 handle windows platform Fixes #1157 Because it has support for multiple platforms in Gemfile.lock. So deleting Gemfile.lock when one of the platforms is windows is not good. Bundler's error message tells the user how to handle it. ``` Your bundle only supports platforms ["mingw"] but your local platform is x86_64-linux. Add the current platform to the lockfile with `bundle lock --add-platform x86_64-linux` and try again. ``` * Test and document Windows bundler 2.2+ behavior * Update changelogs/unreleased/windows_gemfile.md Co-authored-by: Ed Morley <501702+edmorley@users.noreply.github.com> --------- Co-authored-by: Rune Philosof <57357936+runephilosof-abtion@users.noreply.github.com> Co-authored-by: Ed Morley <501702+edmorley@users.noreply.github.com> --- CHANGELOG.md | 1 + changelogs/unreleased/windows_gemfile.md | 67 ++++++++++++++++++++ lib/language_pack/helpers/bundler_wrapper.rb | 6 ++ lib/language_pack/ruby.rb | 39 ++++++++---- spec/helpers/bundler_wrapper_spec.rb | 22 +++++++ 5 files changed, 122 insertions(+), 13 deletions(-) create mode 100644 changelogs/unreleased/windows_gemfile.md diff --git a/CHANGELOG.md b/CHANGELOG.md index b0d63e656..f8a0fee0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## [Unreleased] +- Native Gemfile.lock support for Windows Ruby users with Bundler 2.2+ (https://github.com/heroku/heroku-buildpack-ruby/pull/1469) ## [v272] - 2024-06-13 diff --git a/changelogs/unreleased/windows_gemfile.md b/changelogs/unreleased/windows_gemfile.md new file mode 100644 index 000000000..53ca84f16 --- /dev/null +++ b/changelogs/unreleased/windows_gemfile.md @@ -0,0 +1,67 @@ +## Native Gemfile.lock support for Windows Ruby users with Bundler 2.2+ + +Ruby applications that use Windows and Bundler 2.2+ will no longer have their `Gemfile.lock` deleted and re-generated on deployment. Instead, they will rely on Bundler 2.2+'s support for multiple platforms to correctly resolve dependencies. We recommend any Windows Ruby user to upgrade their Bundler version in the `Gemfile.lock` to Bundler 2.2+ to take advantage of this behavior: + +> note +> The leading `>` indicates a command prompt and should not be copied. + +``` +> gem install bundler +> bundle update --bundler +> git add Gemfile.lock +> git commit -m "Upgrade bundler" +``` + +This change is reflected in the [Deploying a Ruby Project Generated on Windows](https://devcenter.heroku.com/articles/bundler-windows-gemfile) Dev Center article. More information on the history of the behavior can be found [on this GitHub issue](https://github.com/heroku/heroku-buildpack-ruby/issues/1157). + + diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index fe9bd70b8..93377083f 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -222,6 +222,12 @@ def needs_ruby_global_append_path? Gem::Version.new(@version) < Gem::Version.new("2.1.4") end + # Bundler 2.2 introduced support for multiple "platforms" in the Gemfile.lock + # For more information see https://github.com/heroku/heroku-buildpack-ruby/issues/1157 + def supports_multiple_platforms? + Gem::Version.new(@version) >= Gem::Version.new("2.2") + end + def bundler_version_escape_valve! topic("Removing BUNDLED WITH version in the Gemfile.lock") contents = File.read(@gemfile_lock_path, mode: "rt") diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 1991ea5d2..284a69e5e 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -694,19 +694,32 @@ def build_bundler end if bundler.windows_gemfile_lock? - log("bundle", "has_windows_gemfile_lock") - - File.unlink("Gemfile.lock") - ENV.delete("BUNDLE_DEPLOYMENT") - - warn(<<~WARNING, inline: true) - Removing `Gemfile.lock` because it was generated on Windows. - Bundler will do a full resolve so native gems are handled properly. - This may result in unexpected gem versions being used in your app. - In rare occasions Bundler may not be able to resolve your dependencies at all. - - https://devcenter.heroku.com/articles/bundler-windows-gemfile - WARNING + if bundler.supports_multiple_platforms? + puts "Windows `Gemfile.lock` detected, bundler #{@bundler.version} supports multiple platforms, no action taken." + else + File.unlink("Gemfile.lock") + ENV.delete("BUNDLE_DEPLOYMENT") + + warn(<<~WARNING, inline: true) + Removing `Gemfile.lock` because it was generated on Windows. + + Bundler will do a full resolve so native gems are handled properly. + This may result in unexpected gem versions being used in your app. + In rare occasions Bundler may not be able to resolve your dependencies at all. + + Upgrade to bundler version 2.2 or higher to skip this behavior and use built in support + for multiple platforms. Running these commands below (after the `>`) in a command prompt + should resolve this warning: + + > gem install bundler + > bundle update --bundler + > git add Gemfile.lock + > git commit -m "Upgrade bundler" + + For more information see: + https://devcenter.heroku.com/articles/bundler-windows-gemfile + WARNING + end end bundle_command = String.new("") diff --git a/spec/helpers/bundler_wrapper_spec.rb b/spec/helpers/bundler_wrapper_spec.rb index c49abf8ad..a1b25951c 100644 --- a/spec/helpers/bundler_wrapper_spec.rb +++ b/spec/helpers/bundler_wrapper_spec.rb @@ -45,6 +45,28 @@ end end +describe "Multiple platform detection" do + it "reports true on bundler 2.2+" do + Dir.mktmpdir do |dir| + gemfile = Pathname(dir).join("Gemfile") + lockfile = Pathname(dir).join("Gemfile.lock").tap {|p| p.write("BUNDLED WITH\n 2.5.7") } + + bundler = LanguagePack::Helpers::BundlerWrapper.new(gemfile_path: gemfile) + expect(bundler.supports_multiple_platforms?).to be_truthy + end + end + + it "reports false on bundler prior to 2.2" do + Dir.mktmpdir do |dir| + gemfile = Pathname(dir).join("Gemfile") + lockfile = Pathname(dir).join("Gemfile.lock").tap {|p| p.write("BUNDLED WITH\n 1.15.2") } + + bundler = LanguagePack::Helpers::BundlerWrapper.new(gemfile_path: gemfile) + expect(bundler.supports_multiple_platforms?).to be_falsey + end + end +end + describe "BundlerWrapper mutates rubyopt" do before(:each) do if ENV['RUBYOPT'] From 4d2621c7dedff3edc95ee809d1cd71d6186fb796 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 21 Jun 2024 15:01:08 +0000 Subject: [PATCH 0968/1195] Bump the ruby-dependencies group across 1 directory with 9 updates (#1471) Bumps the ruby-dependencies group with 8 updates in the / directory: | Package | From | To | | --- | --- | --- | | [heroku_hatchet](https://github.com/heroku/hatchet) | `8.0.2` | `8.0.4` | | [rspec-core](https://github.com/rspec/rspec-core) | `3.12.2` | `3.13.0` | | [excon](https://github.com/excon/excon) | `0.109.0` | `0.110.0` | | [rake](https://github.com/ruby/rake) | `13.1.0` | `13.2.1` | | [parallel_tests](https://github.com/grosser/parallel_tests) | `4.4.0` | `4.7.1` | | [json](https://github.com/flori/json) | `2.7.1` | `2.7.2` | | [ci-queue](https://github.com/Shopify/ci-queue) | `0.44.0` | `0.55.0` | | [redis](https://github.com/redis/redis-rb) | `5.0.8` | `5.2.0` | Updates `heroku_hatchet` from 8.0.2 to 8.0.4 - [Changelog](https://github.com/heroku/hatchet/blob/main/CHANGELOG.md) - [Commits](https://github.com/heroku/hatchet/compare/v8.0.2...v8.0.4) Updates `rspec-core` from 3.12.2 to 3.13.0 - [Release notes](https://github.com/rspec/rspec-core/releases) - [Changelog](https://github.com/rspec/rspec-core/blob/main/Changelog.md) - [Commits](https://github.com/rspec/rspec-core/compare/v3.12.2...v3.13.0) Updates `rspec-expectations` from 3.12.3 to 3.13.1 - [Release notes](https://github.com/rspec/rspec-expectations/releases) - [Changelog](https://github.com/rspec/rspec-expectations/blob/main/Changelog.md) - [Commits](https://github.com/rspec/rspec-expectations/compare/v3.12.3...v3.13.1) Updates `excon` from 0.109.0 to 0.110.0 - [Changelog](https://github.com/excon/excon/blob/master/changelog.txt) - [Commits](https://github.com/excon/excon/compare/v0.109.0...v0.110.0) Updates `rake` from 13.1.0 to 13.2.1 - [Release notes](https://github.com/ruby/rake/releases) - [Changelog](https://github.com/ruby/rake/blob/master/History.rdoc) - [Commits](https://github.com/ruby/rake/compare/v13.1.0...v13.2.1) Updates `parallel_tests` from 4.4.0 to 4.7.1 - [Changelog](https://github.com/grosser/parallel_tests/blob/master/CHANGELOG.md) - [Commits](https://github.com/grosser/parallel_tests/compare/v4.4.0...v4.7.1) Updates `json` from 2.7.1 to 2.7.2 - [Release notes](https://github.com/flori/json/releases) - [Changelog](https://github.com/flori/json/blob/master/CHANGES.md) - [Commits](https://github.com/flori/json/compare/v2.7.1...v2.7.2) Updates `ci-queue` from 0.44.0 to 0.55.0 - [Release notes](https://github.com/Shopify/ci-queue/releases) - [Commits](https://github.com/Shopify/ci-queue/compare/v0.44.0...v0.55.0) Updates `redis` from 5.0.8 to 5.2.0 - [Changelog](https://github.com/redis/redis-rb/blob/master/CHANGELOG.md) - [Commits](https://github.com/redis/redis-rb/compare/v5.0.8...v5.2.0) --- updated-dependencies: - dependency-name: heroku_hatchet dependency-type: direct:development update-type: version-update:semver-patch dependency-group: ruby-dependencies - dependency-name: rspec-core dependency-type: direct:development update-type: version-update:semver-minor dependency-group: ruby-dependencies - dependency-name: rspec-expectations dependency-type: direct:development update-type: version-update:semver-minor dependency-group: ruby-dependencies - dependency-name: excon dependency-type: direct:development update-type: version-update:semver-minor dependency-group: ruby-dependencies - dependency-name: rake dependency-type: direct:development update-type: version-update:semver-minor dependency-group: ruby-dependencies - dependency-name: parallel_tests dependency-type: direct:development update-type: version-update:semver-minor dependency-group: ruby-dependencies - dependency-name: json dependency-type: direct:development update-type: version-update:semver-patch dependency-group: ruby-dependencies - dependency-name: ci-queue dependency-type: direct:development update-type: version-update:semver-minor dependency-group: ruby-dependencies - dependency-name: redis dependency-type: direct:development update-type: version-update:semver-minor dependency-group: ruby-dependencies ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 265e653ab..5c0085fa5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,51 +1,53 @@ GEM remote: https://rubygems.org/ specs: - ci-queue (0.44.0) + base64 (0.2.0) + ci-queue (0.55.0) citrus (3.0.2) connection_pool (2.4.1) dead_end (4.0.0) diff-lcs (1.5.0) erubis (2.7.0) - excon (0.109.0) - heroics (0.1.2) + excon (0.110.0) + heroics (0.1.3) + base64 erubis (~> 2.0) excon moneta multi_json (>= 1.9.2) webrick - heroku_hatchet (8.0.2) + heroku_hatchet (8.0.4) excon (~> 0) platform-api (~> 3) rrrretry (~> 1) thor (~> 1) threaded (~> 0) - json (2.7.1) + json (2.7.2) moneta (1.0.0) multi_json (1.15.0) - parallel (1.24.0) - parallel_tests (4.4.0) + parallel (1.25.1) + parallel_tests (4.7.1) parallel - platform-api (3.5.0) + platform-api (3.7.0) heroics (~> 0.1.1) moneta (~> 1.0.0) rate_throttle_client (~> 0.1.0) - rake (13.1.0) + rake (13.2.1) rate_throttle_client (0.1.2) - redis (5.0.8) - redis-client (>= 0.17.0) - redis-client (0.18.0) + redis (5.2.0) + redis-client (>= 0.22.0) + redis-client (0.22.2) connection_pool rrrretry (1.0.0) - rspec-core (3.12.2) - rspec-support (~> 3.12.0) - rspec-expectations (3.12.3) + rspec-core (3.13.0) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.1) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.12.0) + rspec-support (~> 3.13.0) rspec-retry (0.6.2) rspec-core (> 3.3) - rspec-support (3.12.1) - thor (1.2.1) + rspec-support (3.13.1) + thor (1.3.1) threaded (0.0.4) toml-rb (2.2.0) citrus (~> 3.0, > 3.0) From 640b216d4d496587100c673512f9c6bdc25c19b4 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Tue, 25 Jun 2024 17:19:37 -0500 Subject: [PATCH 0969/1195] Add platform information to windows support docs (#1473) * Add platform information to windows support docs Update windows docs to specify how to add Heroku's platform to the Gemfile.lock. In https://github.com/heroku/heroku-buildpack-ruby/pull/1469 the behavior changed for Windows users. However if they're depending on a platform specific gem and they don't have the `x86_64-linux` platform locked then their dependency resolution will not use that information and their deploy will fail with a message saying to run those commands. By adding the instructions into the descanter article, warning message, and changelog entry there's a better chance windows users will succeed on their first deploy after https://github.com/heroku/heroku-buildpack-ruby/pull/1469 ## Commands breakdown Install the latest bundler version at the system level: ``` > gem install bundler ``` Update the current project to explicitly use the latest version of bundler: ``` > bundle update --bundler ``` Ensure that both `ruby` and `x86_64-linux` platforms are specified in the `Gemfile.lock`: ``` > bundle lock --add-platform ruby > bundle lock --add-platform x86_64-linux ``` Ensure bundler has resolved dependencies with all platforms in mind: ``` > bundle install ``` Commit the results to git: ``` > git add Gemfile.lock > git commit -m "Upgrade bundler" ``` * Fix variable access for windows users Reported in https://github.com/heroku/heroku-buildpack-ruby/issues/1472, the code was using an instance variable that does not exist so it raises an error. The `bundler` call is both a class and instance method https://github.com/heroku/heroku-buildpack-ruby/blob/4d2621c7dedff3edc95ee809d1cd71d6186fb796/lib/language_pack/ruby.rb#L27-L33. Internally it's stored as a class instance variable https://www.ruby-lang.org/en/documentation/faq/8/ so the data can be shared between the class and instances. The fix is to use `bundler` instead of `@bundler`. The test exercises and asserts that codepath was executed. Close https://github.com/heroku/heroku-buildpack-ruby/issues/1472 * Update warning message to be less confusing Based on this conversation https://github.com/heroku/heroku-buildpack-ruby/pull/1469#discussion_r1652055072 --- changelogs/unreleased/windows_gemfile.md | 8 +++++- lib/language_pack/ruby.rb | 5 +++- spec/hatchet/ruby_spec.rb | 34 ++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/changelogs/unreleased/windows_gemfile.md b/changelogs/unreleased/windows_gemfile.md index 53ca84f16..19920e449 100644 --- a/changelogs/unreleased/windows_gemfile.md +++ b/changelogs/unreleased/windows_gemfile.md @@ -8,6 +8,9 @@ Ruby applications that use Windows and Bundler 2.2+ will no longer have their `G ``` > gem install bundler > bundle update --bundler +> bundle lock --add-platform ruby +> bundle lock --add-platform x86_64-linux +> bundle install > git add Gemfile.lock > git commit -m "Upgrade bundler" ``` @@ -55,11 +58,14 @@ Heroku supports deploying applications developed on Windows, but [production dyn ``` > gem install bundler > bundle update --bundler +> bundle lock --add-platform ruby +> bundle lock --add-platform x86_64-linux +> bundle install > git add Gemfile.lock > git commit -m "Upgrade bundler" ``` -Windows applications using bundler 2.2+ will rely on bundler's support for multiple platforms to find and install an appropriate version. +After running these commands, Windows applications using bundler 2.2+ will rely on bundler's support for multiple platforms to find and install an appropriate version. ## Windows support with bundler before 2.2 diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 284a69e5e..ced465dc4 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -695,7 +695,7 @@ def build_bundler if bundler.windows_gemfile_lock? if bundler.supports_multiple_platforms? - puts "Windows `Gemfile.lock` detected, bundler #{@bundler.version} supports multiple platforms, no action taken." + puts "Windows platform detected, preserving `Gemfile.lock` (#{bundler.version} >= 2.2)" else File.unlink("Gemfile.lock") ENV.delete("BUNDLE_DEPLOYMENT") @@ -713,6 +713,9 @@ def build_bundler > gem install bundler > bundle update --bundler + > bundle lock --add-platform ruby + > bundle lock --add-platform x86_64-linux + > bundle install > git add Gemfile.lock > git commit -m "Upgrade bundler" diff --git a/spec/hatchet/ruby_spec.rb b/spec/hatchet/ruby_spec.rb index 947f9ceb8..e221c4205 100644 --- a/spec/hatchet/ruby_spec.rb +++ b/spec/hatchet/ruby_spec.rb @@ -1,6 +1,40 @@ require_relative '../spec_helper' describe "Ruby apps" do + describe "with mingw platform" do + it "is detected as a Windows app" do + Hatchet::Runner.new("default_ruby").tap do |app| + app.before_deploy do + Pathname("Gemfile").write(<<~'EOF') + source "https://rubygems.org" + + gem "rake" + EOF + + Pathname("Gemfile.lock").write(<<~'EOF') + GEM + remote: https://rubygems.org/ + specs: + rake (13.2.1) + + PLATFORMS + x86-mingw32 + ruby + + DEPENDENCIES + rake + + BUNDLED WITH + 2.5.9 + EOF + end + + app.deploy do + expect(app.output).to include("Windows platform detected, preserving `Gemfile.lock`") + end + end + end + end # https://github.com/heroku/heroku-buildpack-ruby/issues/1025 describe "bin/rake binstub" do From d7dc5720c55f0f47dd4a1752dc67bd11872b9988 Mon Sep 17 00:00:00 2001 From: "heroku-linguist[bot]" <136119646+heroku-linguist[bot]@users.noreply.github.com> Date: Wed, 26 Jun 2024 17:14:05 +0000 Subject: [PATCH 0970/1195] Prepare release v273 (#1475) Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com> --- CHANGELOG.md | 6 +++++- changelogs/{unreleased => v273}/windows_gemfile.md | 0 lib/language_pack/version.rb | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) rename changelogs/{unreleased => v273}/windows_gemfile.md (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index f8a0fee0b..c28681561 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased] + +## [v273] - 2024-06-26 + - Native Gemfile.lock support for Windows Ruby users with Bundler 2.2+ (https://github.com/heroku/heroku-buildpack-ruby/pull/1469) ## [v272] - 2024-06-13 @@ -1539,7 +1542,8 @@ Bugfixes: * Change gem detection to use lockfile parser * use `$RACK_ENV` when thin is detected for rack apps -[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v272...main +[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v273...main +[v273]: https://github.com/heroku/heroku-buildpack-ruby/compare/v272...v273 [v272]: https://github.com/heroku/heroku-buildpack-ruby/compare/v271...v272 [v271]: https://github.com/heroku/heroku-buildpack-ruby/compare/v270...v271 [v271]: https://github.com/heroku/heroku-buildpack-ruby/compare/v270...v271 diff --git a/changelogs/unreleased/windows_gemfile.md b/changelogs/v273/windows_gemfile.md similarity index 100% rename from changelogs/unreleased/windows_gemfile.md rename to changelogs/v273/windows_gemfile.md diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index b9a7ea4df..da1b7e700 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v272" + BUILDPACK_VERSION = "v273" end end From f2dae742887e1586ca9c886b72e786e53bf34a00 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Fri, 28 Jun 2024 10:13:38 -0500 Subject: [PATCH 0971/1195] Jruby 9.3.15.0 (#1476) --- CHANGELOG.md | 1 + changelogs/unreleased/jruby_93150.md | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 changelogs/unreleased/jruby_93150.md diff --git a/CHANGELOG.md b/CHANGELOG.md index c28681561..a93917dfa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## [Unreleased] +- JRuby 9.3.15.0 is now available (https://github.com/heroku/heroku-buildpack-ruby/pull/1476) ## [v273] - 2024-06-26 diff --git a/changelogs/unreleased/jruby_93150.md b/changelogs/unreleased/jruby_93150.md new file mode 100644 index 000000000..cdc0821f1 --- /dev/null +++ b/changelogs/unreleased/jruby_93150.md @@ -0,0 +1,18 @@ +## JRuby version 9.3.15.0 is now available + +[JRuby v9.3.15.0](/articles/ruby-support#ruby-versions) is now available on Heroku. To run +your app using this version of Ruby, add the following `ruby` directive to your Gemfile: + +```ruby +ruby "2.6.8", engine: "jruby", engine_version: "9.3.15.0" +``` + +The JRuby release notes can be found on the [JRuby website](https://www.jruby.org/news). + + From 276b143c94711e18d925dc074e4775775b139f7f Mon Sep 17 00:00:00 2001 From: "heroku-linguist[bot]" <136119646+heroku-linguist[bot]@users.noreply.github.com> Date: Fri, 28 Jun 2024 15:37:53 +0000 Subject: [PATCH 0972/1195] Prepare release v274 (#1477) Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com> --- CHANGELOG.md | 6 +++++- changelogs/{unreleased => v274}/jruby_93150.md | 0 lib/language_pack/version.rb | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) rename changelogs/{unreleased => v274}/jruby_93150.md (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index a93917dfa..70039a45d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased] + +## [v274] - 2024-06-28 + - JRuby 9.3.15.0 is now available (https://github.com/heroku/heroku-buildpack-ruby/pull/1476) ## [v273] - 2024-06-26 @@ -1543,7 +1546,8 @@ Bugfixes: * Change gem detection to use lockfile parser * use `$RACK_ENV` when thin is detected for rack apps -[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v273...main +[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v274...main +[v274]: https://github.com/heroku/heroku-buildpack-ruby/compare/v273...v274 [v273]: https://github.com/heroku/heroku-buildpack-ruby/compare/v272...v273 [v272]: https://github.com/heroku/heroku-buildpack-ruby/compare/v271...v272 [v271]: https://github.com/heroku/heroku-buildpack-ruby/compare/v270...v271 diff --git a/changelogs/unreleased/jruby_93150.md b/changelogs/v274/jruby_93150.md similarity index 100% rename from changelogs/unreleased/jruby_93150.md rename to changelogs/v274/jruby_93150.md diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index da1b7e700..bcfcc5a21 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v273" + BUILDPACK_VERSION = "v274" end end From ba21c05cfea5d81f900a6a26de54ad00e9f52cdc Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Wed, 3 Jul 2024 09:57:54 -0500 Subject: [PATCH 0973/1195] JRuby 9.4.8.0 (#1479) --- CHANGELOG.md | 1 + changelogs/unreleased/jruby-9.4.8.0.md | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 changelogs/unreleased/jruby-9.4.8.0.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 70039a45d..04de86bc1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## [Unreleased] +- JRuby 9.4.8.0 is now available (https://github.com/heroku/heroku-buildpack-ruby/pull/1479) ## [v274] - 2024-06-28 diff --git a/changelogs/unreleased/jruby-9.4.8.0.md b/changelogs/unreleased/jruby-9.4.8.0.md new file mode 100644 index 000000000..53d205557 --- /dev/null +++ b/changelogs/unreleased/jruby-9.4.8.0.md @@ -0,0 +1,10 @@ +## JRuby version 9.4.8.0 is now available + +[JRuby v9.4.8.0](/articles/ruby-support#ruby-versions) is now available on Heroku. To run +your app using this version of Ruby, add the following `ruby` directive to your Gemfile: + +```ruby +ruby "3.1.4", engine: "jruby", engine_version: "9.4.8.0" +``` + +The JRuby release notes can be found on the [JRuby website](https://www.jruby.org/news). From d38926cd12fa01fd5920a9413387f0e38fd8c13b Mon Sep 17 00:00:00 2001 From: "heroku-linguist[bot]" <136119646+heroku-linguist[bot]@users.noreply.github.com> Date: Wed, 3 Jul 2024 16:12:32 +0000 Subject: [PATCH 0974/1195] Prepare release v275 (#1480) Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com> --- CHANGELOG.md | 6 +++++- changelogs/{unreleased => v275}/jruby-9.4.8.0.md | 0 lib/language_pack/version.rb | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) rename changelogs/{unreleased => v275}/jruby-9.4.8.0.md (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 04de86bc1..f99732fc9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased] + +## [v275] - 2024-07-03 + - JRuby 9.4.8.0 is now available (https://github.com/heroku/heroku-buildpack-ruby/pull/1479) ## [v274] - 2024-06-28 @@ -1547,7 +1550,8 @@ Bugfixes: * Change gem detection to use lockfile parser * use `$RACK_ENV` when thin is detected for rack apps -[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v274...main +[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v275...main +[v275]: https://github.com/heroku/heroku-buildpack-ruby/compare/v274...v275 [v274]: https://github.com/heroku/heroku-buildpack-ruby/compare/v273...v274 [v273]: https://github.com/heroku/heroku-buildpack-ruby/compare/v272...v273 [v272]: https://github.com/heroku/heroku-buildpack-ruby/compare/v271...v272 diff --git a/changelogs/unreleased/jruby-9.4.8.0.md b/changelogs/v275/jruby-9.4.8.0.md similarity index 100% rename from changelogs/unreleased/jruby-9.4.8.0.md rename to changelogs/v275/jruby-9.4.8.0.md diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index bcfcc5a21..bae3eb7d7 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v274" + BUILDPACK_VERSION = "v275" end end From b2865dad2a702179a6306c6861a2d2be23cd9f9e Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Mon, 8 Jul 2024 21:24:11 -0500 Subject: [PATCH 0975/1195] Ruby 3.3.4 is now available (#1482) --- CHANGELOG.md | 1 + changelogs/unreleased/ruby_3.3.4.md | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 changelogs/unreleased/ruby_3.3.4.md diff --git a/CHANGELOG.md b/CHANGELOG.md index f99732fc9..eb4a0f55d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## [Unreleased] +- Ruby 3.3.4 is now available (https://github.com/heroku/heroku-buildpack-ruby/pull/1482) ## [v275] - 2024-07-03 diff --git a/changelogs/unreleased/ruby_3.3.4.md b/changelogs/unreleased/ruby_3.3.4.md new file mode 100644 index 000000000..4a35190b5 --- /dev/null +++ b/changelogs/unreleased/ruby_3.3.4.md @@ -0,0 +1,10 @@ +## Ruby version 3.3.4 is now available + +[Ruby v3.3.4](/articles/ruby-support#ruby-versions) is now available on Heroku. To run +your app using this version of Ruby, add the following `ruby` directive to your Gemfile: + +```ruby +ruby "3.3.4" +``` + +For more information on [Ruby 3.3.4, you can view the release announcement](https://www.ruby-lang.org/en/news/). From 857e5f8c8f2af530dfa3d2add9c67f96d2c1e421 Mon Sep 17 00:00:00 2001 From: "heroku-linguist[bot]" <136119646+heroku-linguist[bot]@users.noreply.github.com> Date: Tue, 9 Jul 2024 02:34:03 +0000 Subject: [PATCH 0976/1195] Prepare release v276 (#1483) Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com> --- CHANGELOG.md | 6 +++++- changelogs/{unreleased => v276}/ruby_3.3.4.md | 0 lib/language_pack/version.rb | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) rename changelogs/{unreleased => v276}/ruby_3.3.4.md (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index eb4a0f55d..7dd01e53e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased] + +## [v276] - 2024-07-09 + - Ruby 3.3.4 is now available (https://github.com/heroku/heroku-buildpack-ruby/pull/1482) ## [v275] - 2024-07-03 @@ -1551,7 +1554,8 @@ Bugfixes: * Change gem detection to use lockfile parser * use `$RACK_ENV` when thin is detected for rack apps -[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v275...main +[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v276...main +[v276]: https://github.com/heroku/heroku-buildpack-ruby/compare/v275...v276 [v275]: https://github.com/heroku/heroku-buildpack-ruby/compare/v274...v275 [v274]: https://github.com/heroku/heroku-buildpack-ruby/compare/v273...v274 [v273]: https://github.com/heroku/heroku-buildpack-ruby/compare/v272...v273 diff --git a/changelogs/unreleased/ruby_3.3.4.md b/changelogs/v276/ruby_3.3.4.md similarity index 100% rename from changelogs/unreleased/ruby_3.3.4.md rename to changelogs/v276/ruby_3.3.4.md diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index bae3eb7d7..ff85468b8 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v275" + BUILDPACK_VERSION = "v276" end end From 9a1729e908177f2e23c7d3c318a0058062df33fb Mon Sep 17 00:00:00 2001 From: Ed Morley <501702+edmorley@users.noreply.github.com> Date: Tue, 9 Jul 2024 11:28:42 +0100 Subject: [PATCH 0977/1195] Stop bundling bootstrap Ruby (#1481) Since this buildpack is written in Ruby, it needs a Ruby installation to be installed in order to run. As such, during buildpack compile, a bootstrap Ruby is downloaded and installed. As a performance optimisation, this bootstrap Ruby was vendored into the buildpack archive published to the Buildpack Registry, via the `[[publish.Vendor]]` entries in `buildpack.toml`. Since Ruby installs are OS-specific, this meant bundling three copies of Ruby, even though only one would ever be used. With the old build system this was still a net benefit, since the official language buildpacks would be downloaded in advance when a build worker first booted. However, with the new build system architecture, the build system workers are no longer booted en-mass in advance, but instead started on demand. This means there is no worker idle time, and so speculative downloading of possibly-needed assets no longer makes sense. As such, the bundling of multiple copies of Ruby in the buildpack registry archive has now been removed. This not only makes non-Ruby builds faster (since they have no need for a Ruby installation at all), but will also speed up Ruby builds, since they'll only need to download one bootstrap Ruby (for their specific stack), rather than a version for every stack. GUS-W-16184923. --- CHANGELOG.md | 1 + bin/support/bash_functions.sh | 9 +++------ buildpack.toml | 14 -------------- spec/helpers/config_spec.rb | 22 ---------------------- 4 files changed, 4 insertions(+), 42 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7dd01e53e..fedcb8ed4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## [Unreleased] +- Stop bundling bootstrap Ruby for each stack inside the buildpack archive on the buildpack registry (https://github.com/heroku/heroku-buildpack-ruby/pull/1481) ## [v276] - 2024-07-09 diff --git a/bin/support/bash_functions.sh b/bin/support/bash_functions.sh index 67e86daff..bb07b9f3d 100755 --- a/bin/support/bash_functions.sh +++ b/bin/support/bash_functions.sh @@ -11,7 +11,7 @@ curl_retry_on_18() { } # This function will install a version of Ruby onto the -# system for the buidlpack to use. It coordinates download +# system for the buildpack to use. It coordinates download # and setting appropriate env vars for execution # # Example: @@ -25,7 +25,7 @@ curl_retry_on_18() { # # This function relies on the env var `$STACK` being set. This # is set in codon outside of the buildpack. An example of a stack -# would be "cedar-14". +# would be "heroku-24". install_bootstrap_ruby() { local bin_dir=$1 @@ -42,10 +42,7 @@ install_bootstrap_ruby() # The -d flag checks to see if a file exists and is a directory. # This directory may be non-empty if a previous compile has - # already placed a Ruby executable here. Also - # when the buildpack is deployed we vendor a ruby executable - # at this location so it doesn't have to be downloaded for - # every app compile + # already placed a Ruby executable here. if [ ! -d "$heroku_buildpack_ruby_dir" ]; then heroku_buildpack_ruby_dir=$(mktemp -d) # bootstrap ruby diff --git a/buildpack.toml b/buildpack.toml index 3a4090ef2..253627574 100644 --- a/buildpack.toml +++ b/buildpack.toml @@ -2,8 +2,6 @@ name = "Ruby" ruby_version = "3.1.6" -[publish] - [publish.Ignore] files = [ "changelogs/", @@ -15,15 +13,3 @@ files = [ "hatchet.json", "hatchet.lock", ] - -[[publish.Vendor]] -url = "https://heroku-buildpack-ruby.s3.us-east-1.amazonaws.com/heroku-20/ruby-3.1.6.tgz" -dir = "vendor/ruby/heroku-20" - -[[publish.Vendor]] -url = "https://heroku-buildpack-ruby.s3.us-east-1.amazonaws.com/heroku-22/ruby-3.1.6.tgz" -dir = "vendor/ruby/heroku-22" - -[[publish.Vendor]] -url = "https://heroku-buildpack-ruby.s3.us-east-1.amazonaws.com/heroku-24/amd64/ruby-3.1.6.tgz" -dir = "vendor/ruby/amd64/heroku-24" diff --git a/spec/helpers/config_spec.rb b/spec/helpers/config_spec.rb index c044c9dd4..437725745 100644 --- a/spec/helpers/config_spec.rb +++ b/spec/helpers/config_spec.rb @@ -7,11 +7,6 @@ bootstrap_version = config["buildpack"]["ruby_version"] expect(bootstrap_version).to eq(LanguagePack::RubyVersion::BOOTSTRAP_VERSION_NUMBER) - urls = config["publish"]["Vendor"].map {|h| h["url"] if h["dir"] != "." }.compact - urls.each do |url| - expect(url.include?(bootstrap_version)).to be_truthy, "expected #{url.inspect} to include #{bootstrap_version.inspect} but it did not" - end - expect(`ruby -v`).to match(Regexp.escape(LanguagePack::RubyVersion::BOOTSTRAP_VERSION_NUMBER)) bootstrap_version = Gem::Version.new(LanguagePack::RubyVersion::BOOTSTRAP_VERSION_NUMBER) @@ -19,21 +14,4 @@ expect(bootstrap_version).to be >= default_version end - - it "doesn't contain unexpected entries" do - require 'toml-rb' - config = TomlRB.load_file("buildpack.toml") - - urls = config["publish"]["Vendor"].map {|h| h["url"] if h["dir"] != "." }.compact - heroku_20 = urls.find_all {|url| url.include?("heroku-20") } - expect(heroku_20.length).to eq(1) - - heroku_22 = urls.find_all {|url| url.include?("heroku-22") } - expect(heroku_22.length).to eq(1) - - heroku_24 = urls.find_all {|url| url.include?("heroku-24") } - expect(heroku_24.length).to eq(1) - - expect(urls.length).to eq(3) - end end From 28a74e5d522c4ae501af1edb42e1e16d322b34e4 Mon Sep 17 00:00:00 2001 From: "heroku-linguist[bot]" <136119646+heroku-linguist[bot]@users.noreply.github.com> Date: Thu, 11 Jul 2024 09:02:41 +0000 Subject: [PATCH 0978/1195] Prepare release v277 (#1484) Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com> --- CHANGELOG.md | 6 +++++- lib/language_pack/version.rb | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fedcb8ed4..caf087c20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased] + +## [v277] - 2024-07-11 + - Stop bundling bootstrap Ruby for each stack inside the buildpack archive on the buildpack registry (https://github.com/heroku/heroku-buildpack-ruby/pull/1481) ## [v276] - 2024-07-09 @@ -1555,7 +1558,8 @@ Bugfixes: * Change gem detection to use lockfile parser * use `$RACK_ENV` when thin is detected for rack apps -[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v276...main +[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v277...main +[v277]: https://github.com/heroku/heroku-buildpack-ruby/compare/v276...v277 [v276]: https://github.com/heroku/heroku-buildpack-ruby/compare/v275...v276 [v275]: https://github.com/heroku/heroku-buildpack-ruby/compare/v274...v275 [v274]: https://github.com/heroku/heroku-buildpack-ruby/compare/v273...v274 diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index ff85468b8..1a73ba36a 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v276" + BUILDPACK_VERSION = "v277" end end From 216c5be51430f5f9eeed2c4992a113e8309efdf4 Mon Sep 17 00:00:00 2001 From: Josh W Lewis Date: Mon, 5 Aug 2024 11:59:23 -0500 Subject: [PATCH 0979/1195] Ruby 3.2.5 is now available (#1488) --- CHANGELOG.md | 1 + changelogs/unreleased/ruby_3.2.5.md | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 changelogs/unreleased/ruby_3.2.5.md diff --git a/CHANGELOG.md b/CHANGELOG.md index caf087c20..e1bc7f7bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## [Unreleased] +- Ruby 3.2.5 is now available (https://github.com/heroku/heroku-buildpack-ruby/pull/1488) ## [v277] - 2024-07-11 diff --git a/changelogs/unreleased/ruby_3.2.5.md b/changelogs/unreleased/ruby_3.2.5.md new file mode 100644 index 000000000..e1a140f81 --- /dev/null +++ b/changelogs/unreleased/ruby_3.2.5.md @@ -0,0 +1,10 @@ +## Ruby version 3.2.5 is now available + +[Ruby v3.2.5](/articles/ruby-support#ruby-versions) is now available on Heroku. To run +your app using this version of Ruby, add the following `ruby` directive to your Gemfile: + +```ruby +ruby "3.2.5" +``` + +For more information on [Ruby 3.2.5, you can view the release announcement](https://www.ruby-lang.org/en/news/). From d643ce7d69227946743589a80dd68cf06b41987c Mon Sep 17 00:00:00 2001 From: "heroku-linguist[bot]" <136119646+heroku-linguist[bot]@users.noreply.github.com> Date: Mon, 5 Aug 2024 17:40:37 +0000 Subject: [PATCH 0980/1195] Prepare release v278 (#1489) Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com> --- CHANGELOG.md | 6 +++++- changelogs/{unreleased => v278}/ruby_3.2.5.md | 0 lib/language_pack/version.rb | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) rename changelogs/{unreleased => v278}/ruby_3.2.5.md (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index e1bc7f7bb..704300f89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased] + +## [v278] - 2024-08-05 + - Ruby 3.2.5 is now available (https://github.com/heroku/heroku-buildpack-ruby/pull/1488) ## [v277] - 2024-07-11 @@ -1559,7 +1562,8 @@ Bugfixes: * Change gem detection to use lockfile parser * use `$RACK_ENV` when thin is detected for rack apps -[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v277...main +[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v278...main +[v278]: https://github.com/heroku/heroku-buildpack-ruby/compare/v277...v278 [v277]: https://github.com/heroku/heroku-buildpack-ruby/compare/v276...v277 [v276]: https://github.com/heroku/heroku-buildpack-ruby/compare/v275...v276 [v275]: https://github.com/heroku/heroku-buildpack-ruby/compare/v274...v275 diff --git a/changelogs/unreleased/ruby_3.2.5.md b/changelogs/v278/ruby_3.2.5.md similarity index 100% rename from changelogs/unreleased/ruby_3.2.5.md rename to changelogs/v278/ruby_3.2.5.md diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 1a73ba36a..0f1e34b11 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v277" + BUILDPACK_VERSION = "v278" end end From 91419df60485276fff3187cbcfda8d68ff70143e Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Tue, 3 Sep 2024 20:34:02 -0500 Subject: [PATCH 0981/1195] Ruby 3.3.5 (#1491) --- CHANGELOG.md | 1 + changelogs/unreleased/ruby-3.3.5.md | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 changelogs/unreleased/ruby-3.3.5.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 704300f89..9b22a7ee9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## [Unreleased] +- Ruby 3.3.5 is now available (https://github.com/heroku/heroku-buildpack-ruby/pull/1491) ## [v278] - 2024-08-05 diff --git a/changelogs/unreleased/ruby-3.3.5.md b/changelogs/unreleased/ruby-3.3.5.md new file mode 100644 index 000000000..abce00f2d --- /dev/null +++ b/changelogs/unreleased/ruby-3.3.5.md @@ -0,0 +1,10 @@ +## Ruby version 3.3.5 is now available + +[Ruby v3.3.5](/articles/ruby-support#ruby-versions) is now available on Heroku. To run +your app using this version of Ruby, add the following `ruby` directive to your Gemfile: + +```ruby +ruby "3.3.5" +``` + +For more information on [Ruby 3.3.5, you can view the release announcement](https://www.ruby-lang.org/en/news/). From 5fc57092a991af0af158c121b331e75eff05aa8c Mon Sep 17 00:00:00 2001 From: "heroku-linguist[bot]" <136119646+heroku-linguist[bot]@users.noreply.github.com> Date: Wed, 4 Sep 2024 12:21:48 +0000 Subject: [PATCH 0982/1195] Prepare release v279 (#1492) Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com> --- CHANGELOG.md | 6 +++++- changelogs/{unreleased => v279}/ruby-3.3.5.md | 0 lib/language_pack/version.rb | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) rename changelogs/{unreleased => v279}/ruby-3.3.5.md (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b22a7ee9..da33c7f75 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased] + +## [v279] - 2024-09-04 + - Ruby 3.3.5 is now available (https://github.com/heroku/heroku-buildpack-ruby/pull/1491) ## [v278] - 2024-08-05 @@ -1563,7 +1566,8 @@ Bugfixes: * Change gem detection to use lockfile parser * use `$RACK_ENV` when thin is detected for rack apps -[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v278...main +[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v279...main +[v279]: https://github.com/heroku/heroku-buildpack-ruby/compare/v278...v279 [v278]: https://github.com/heroku/heroku-buildpack-ruby/compare/v277...v278 [v277]: https://github.com/heroku/heroku-buildpack-ruby/compare/v276...v277 [v276]: https://github.com/heroku/heroku-buildpack-ruby/compare/v275...v276 diff --git a/changelogs/unreleased/ruby-3.3.5.md b/changelogs/v279/ruby-3.3.5.md similarity index 100% rename from changelogs/unreleased/ruby-3.3.5.md rename to changelogs/v279/ruby-3.3.5.md diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 0f1e34b11..a04cb997b 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v278" + BUILDPACK_VERSION = "v279" end end From 1acf46d36754373a8ee36652b1190be1aad72b8b Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Tue, 8 Oct 2024 01:38:15 -0500 Subject: [PATCH 0983/1195] Ruby 3.4.0-preview2 (#1496) --- CHANGELOG.md | 1 + changelogs/unreleased/ruby-340-preview2.md | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 changelogs/unreleased/ruby-340-preview2.md diff --git a/CHANGELOG.md b/CHANGELOG.md index da33c7f75..4915f81ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## [Unreleased] +- Ruby 3.4.0 is now available (https://github.com/heroku/heroku-buildpack-ruby/pull/1496) ## [v279] - 2024-09-04 diff --git a/changelogs/unreleased/ruby-340-preview2.md b/changelogs/unreleased/ruby-340-preview2.md new file mode 100644 index 000000000..353e9ad00 --- /dev/null +++ b/changelogs/unreleased/ruby-340-preview2.md @@ -0,0 +1,16 @@ +## Ruby version 3.4.0-preview2 is now available + +[Ruby v3.4.0-preview2](/articles/ruby-support#ruby-versions) is now available on Heroku. To run +your app using this version of Ruby, add the following `ruby` directive to your Gemfile: + +```ruby +ruby "3.4.0.preview2" +``` + +For more information on [Ruby 3.4.0-preview2, you can view the release announcement](https://www.ruby-lang.org/en/news/). + +> Note +> This version of Ruby is not suitable for production applications. +> However, it can be used to test that your application is ready for +> the official release of Ruby 3.4.0 and +> to provide feedback to the Ruby core team. From 081297f625c689f0d4ba6cc7415487d3561fa905 Mon Sep 17 00:00:00 2001 From: "heroku-linguist[bot]" <136119646+heroku-linguist[bot]@users.noreply.github.com> Date: Tue, 8 Oct 2024 16:22:51 +0000 Subject: [PATCH 0984/1195] Prepare release v280 (#1497) Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com> --- CHANGELOG.md | 6 +++++- changelogs/{unreleased => v280}/ruby-340-preview2.md | 0 lib/language_pack/version.rb | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) rename changelogs/{unreleased => v280}/ruby-340-preview2.md (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4915f81ad..9dbef889b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased] + +## [v280] - 2024-10-08 + - Ruby 3.4.0 is now available (https://github.com/heroku/heroku-buildpack-ruby/pull/1496) ## [v279] - 2024-09-04 @@ -1567,7 +1570,8 @@ Bugfixes: * Change gem detection to use lockfile parser * use `$RACK_ENV` when thin is detected for rack apps -[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v279...main +[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v280...main +[v280]: https://github.com/heroku/heroku-buildpack-ruby/compare/v279...v280 [v279]: https://github.com/heroku/heroku-buildpack-ruby/compare/v278...v279 [v278]: https://github.com/heroku/heroku-buildpack-ruby/compare/v277...v278 [v277]: https://github.com/heroku/heroku-buildpack-ruby/compare/v276...v277 diff --git a/changelogs/unreleased/ruby-340-preview2.md b/changelogs/v280/ruby-340-preview2.md similarity index 100% rename from changelogs/unreleased/ruby-340-preview2.md rename to changelogs/v280/ruby-340-preview2.md diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index a04cb997b..ec465d7e4 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v279" + BUILDPACK_VERSION = "v280" end end From 56199b28b9a6de9cb7a33cb3c44097ffb81b66be Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Tue, 8 Oct 2024 12:57:49 -0500 Subject: [PATCH 0985/1195] Add ARM support for NodeJS (#1499) * ARM support for NodeJS * Changelog whitespace * Inject architecture Relying on the format of RUBY_PLATFORM is a little surprising. This allows us to test if we want and reuses the existing architecture logic for consistency. * Update changelog link * Test node installer with all known architectures * Apply suggestions from code review Co-authored-by: Ed Morley <501702+edmorley@users.noreply.github.com> --------- Co-authored-by: Matt Larraz Co-authored-by: Ed Morley <501702+edmorley@users.noreply.github.com> --- CHANGELOG.md | 1 + lib/language_pack/helpers/node_installer.rb | 11 +++-------- lib/language_pack/helpers/nodebin.rb | 9 +++++---- lib/language_pack/ruby.rb | 2 +- spec/helpers/node_installer_spec.rb | 14 ++++++++------ 5 files changed, 18 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9dbef889b..88070a949 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## [Unreleased] +- Support Node.js on ARM builds (https://github.com/heroku/heroku-buildpack-ruby/pull/1499) ## [v280] - 2024-10-08 diff --git a/lib/language_pack/helpers/node_installer.rb b/lib/language_pack/helpers/node_installer.rb index 16e7eb9d9..218d1c8b3 100644 --- a/lib/language_pack/helpers/node_installer.rb +++ b/lib/language_pack/helpers/node_installer.rb @@ -1,15 +1,15 @@ class LanguagePack::Helpers::NodeInstaller attr_reader :version - def initialize - nodebin = LanguagePack::Helpers::Nodebin.node_lts + def initialize(arch: ) + nodebin = LanguagePack::Helpers::Nodebin.node_lts(arch: arch) @version = nodebin["number"] @url = nodebin["url"] @fetcher = LanguagePack::Fetcher.new("") end def binary_path - node_folder(@version) + File.basename(@url).delete_suffix(".tar.gz") end def install @@ -27,9 +27,4 @@ def install FileUtils.mv("#{dir}/#{node_bin}", ".") end end - - private - def node_folder(version) - "node-v#{version}-linux-x64" - end end diff --git a/lib/language_pack/helpers/nodebin.rb b/lib/language_pack/helpers/nodebin.rb index 1a5c194f9..7632e8366 100644 --- a/lib/language_pack/helpers/nodebin.rb +++ b/lib/language_pack/helpers/nodebin.rb @@ -4,10 +4,11 @@ class LanguagePack::Helpers::Nodebin NODE_VERSION = "20.9.0" YARN_VERSION = "1.22.19" - def self.hardcoded_node_lts + def self.hardcoded_node_lts(arch: ) + arch = "x64" if arch == "amd64" { "number" => NODE_VERSION, - "url" => "https://heroku-nodebin.s3.us-east-1.amazonaws.com/node/release/linux-x64/node-v#{NODE_VERSION}-linux-x64.tar.gz" + "url" => "https://nodejs.org/download/release/v#{NODE_VERSION}/node-v#{NODE_VERSION}-linux-#{arch}.tar.gz", } end @@ -18,8 +19,8 @@ def self.hardcoded_yarn } end - def self.node_lts - hardcoded_node_lts + def self.node_lts(arch: ) + hardcoded_node_lts(arch: arch) end def self.yarn diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index ced465dc4..65612d7b5 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -34,7 +34,7 @@ def bundler def initialize(*args) super(*args) - @node_installer = LanguagePack::Helpers::NodeInstaller.new + @node_installer = LanguagePack::Helpers::NodeInstaller.new(arch: @arch) @yarn_installer = LanguagePack::Helpers::YarnInstaller.new end diff --git a/spec/helpers/node_installer_spec.rb b/spec/helpers/node_installer_spec.rb index dff419669..3ba393bb2 100644 --- a/spec/helpers/node_installer_spec.rb +++ b/spec/helpers/node_installer_spec.rb @@ -2,13 +2,15 @@ describe LanguagePack::Helpers::NodeInstaller do describe "#install" do - it "should extract a node binary" do - Dir.mktmpdir do |dir| - Dir.chdir(dir) do - installer = LanguagePack::Helpers::NodeInstaller.new - installer.install + LanguagePack::Base::KNOWN_ARCHITECTURES.each do |arch| + it "should extract a node binary on #{arch}" do + Dir.mktmpdir do |dir| + Dir.chdir(dir) do + installer = LanguagePack::Helpers::NodeInstaller.new(arch: "arm64") + installer.install - expect(File.exist?("node")).to be(true) + expect(File.exist?("node")).to be(true) + end end end end From 633a1d170155c279e4a5803fc8352d93108ec1b9 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Wed, 9 Oct 2024 14:58:55 -0500 Subject: [PATCH 0986/1195] Add Rails 8 support (#1498) Pulling in https://github.com/heroku/heroku-buildpack-ruby/pull/1490 for testing and modification. Removes the original tests as they're using Rails 7 fixtures. Adds a changelog entry Co-authored-by: chaadow --- CHANGELOG.md | 1 + lib/language_pack.rb | 3 ++- lib/language_pack/rails7.rb | 3 +-- lib/language_pack/rails8.rb | 14 ++++++++++++++ spec/hatchet/rails7_spec.rb | 2 +- spec/hatchet/rails8_spec.rb | 4 ++++ 6 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 lib/language_pack/rails8.rb create mode 100644 spec/hatchet/rails8_spec.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index 88070a949..3de65e859 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## [Unreleased] +- Add detection support for Rails 8 (https://github.com/heroku/heroku-buildpack-ruby/pull/1498) - Support Node.js on ARM builds (https://github.com/heroku/heroku-buildpack-ruby/pull/1499) ## [v280] - 2024-10-08 diff --git a/lib/language_pack.rb b/lib/language_pack.rb index 2e83d4e2d..546194803 100644 --- a/lib/language_pack.rb +++ b/lib/language_pack.rb @@ -12,7 +12,7 @@ module Helpers def self.detect(*args) Dir.chdir(args.first) - pack = [ NoLockfile, Rails7, Rails6, Rails5, Rails42, Rails41, Rails4, Rails3, Rails2, Rack, Ruby ].detect do |klass| + pack = [ NoLockfile, Rails8, Rails7, Rails6, Rails5, Rails42, Rails41, Rails4, Rails3, Rails2, Rack, Ruby ].detect do |klass| klass.use? end @@ -44,4 +44,5 @@ def self.detect(*args) require "language_pack/rails5" require "language_pack/rails6" require "language_pack/rails7" +require "language_pack/rails8" require "language_pack/no_lockfile" diff --git a/lib/language_pack/rails7.rb b/lib/language_pack/rails7.rb index bc0094c8c..77deb99be 100644 --- a/lib/language_pack/rails7.rb +++ b/lib/language_pack/rails7.rb @@ -8,8 +8,7 @@ def self.use? rails_version = bundler.gem_version('railties') return false unless rails_version is_rails = rails_version >= Gem::Version.new('7.a') && - rails_version < Gem::Version.new('8.0.0') + rails_version < Gem::Version.new('8.a') return is_rails end end - diff --git a/lib/language_pack/rails8.rb b/lib/language_pack/rails8.rb new file mode 100644 index 000000000..4930bea14 --- /dev/null +++ b/lib/language_pack/rails8.rb @@ -0,0 +1,14 @@ +require 'securerandom' +require "language_pack" +require "language_pack/rails7" + +class LanguagePack::Rails8 < LanguagePack::Rails7 + # @return [Boolean] true if it's a Rails 8.x app + def self.use? + rails_version = bundler.gem_version('railties') + return false unless rails_version + is_rails = rails_version >= Gem::Version.new('8.a') && + rails_version < Gem::Version.new('9.a') + return is_rails + end +end diff --git a/spec/hatchet/rails7_spec.rb b/spec/hatchet/rails7_spec.rb index af9da0d6a..1cea712e2 100644 --- a/spec/hatchet/rails7_spec.rb +++ b/spec/hatchet/rails7_spec.rb @@ -1,6 +1,6 @@ require_relative '../spec_helper' -describe "Rails 6" do +describe "Rails 7" do it "should detect successfully" do Hatchet::App.new('rails-jsbundling').in_directory_fork do expect(LanguagePack::Rails6.use?).to eq(false) diff --git a/spec/hatchet/rails8_spec.rb b/spec/hatchet/rails8_spec.rb new file mode 100644 index 000000000..92afaf574 --- /dev/null +++ b/spec/hatchet/rails8_spec.rb @@ -0,0 +1,4 @@ +require_relative '../spec_helper' + +describe "Rails 8" do +end From 2d79340bd51e5a21f28f253c5c069a74f37111fa Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Fri, 1 Nov 2024 12:03:14 -0500 Subject: [PATCH 0987/1195] Ruby v3.2.6 (#1504) --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3de65e859..ed894687a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ - Add detection support for Rails 8 (https://github.com/heroku/heroku-buildpack-ruby/pull/1498) - Support Node.js on ARM builds (https://github.com/heroku/heroku-buildpack-ruby/pull/1499) +## [v280] - 2024-11-01 + +- Ruby 3.2.6 is now available (https://github.com/heroku/heroku-buildpack-ruby/pull/1504) + ## [v280] - 2024-10-08 - Ruby 3.4.0 is now available (https://github.com/heroku/heroku-buildpack-ruby/pull/1496) From f93958d90f8e37f8661b7cfa44f7f4acf4cfd659 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Wed, 6 Nov 2024 10:19:50 -0600 Subject: [PATCH 0988/1195] JRuby version 9.4.9.0 (#1506) --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ed894687a..991e26160 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ - Add detection support for Rails 8 (https://github.com/heroku/heroku-buildpack-ruby/pull/1498) - Support Node.js on ARM builds (https://github.com/heroku/heroku-buildpack-ruby/pull/1499) +## [v280] - 2024-11-06 + +- JRuby 9.4.9.0 is now available (https://github.com/heroku/heroku-buildpack-ruby/pull/1506) + ## [v280] - 2024-11-01 - Ruby 3.2.6 is now available (https://github.com/heroku/heroku-buildpack-ruby/pull/1504) From 9faca50e574039ed944c16f0d4b928cfbb567ab6 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Thu, 7 Nov 2024 08:56:04 -0600 Subject: [PATCH 0989/1195] Ruby 3.3.6 (#1511) --- CHANGELOG.md | 1 + changelogs/unreleased/ruby-336.md | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 changelogs/unreleased/ruby-336.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 991e26160..11cd01b1b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## [Unreleased] +- Ruby 3.3.6 is now available (https://github.com/heroku/heroku-buildpack-ruby/pull/1511) - Add detection support for Rails 8 (https://github.com/heroku/heroku-buildpack-ruby/pull/1498) - Support Node.js on ARM builds (https://github.com/heroku/heroku-buildpack-ruby/pull/1499) diff --git a/changelogs/unreleased/ruby-336.md b/changelogs/unreleased/ruby-336.md new file mode 100644 index 000000000..9af79b538 --- /dev/null +++ b/changelogs/unreleased/ruby-336.md @@ -0,0 +1,10 @@ +## Ruby version 3.3.6 is now available + +[Ruby v3.3.6](/articles/ruby-support#ruby-versions) is now available on Heroku. To run +your app using this version of Ruby, add the following `ruby` directive to your Gemfile: + +```ruby +ruby "3.3.6" +``` + +For more information on [Ruby 3.3.6, you can view the release announcement](https://www.ruby-lang.org/en/news/). From 0e4f994ded1618c366b57197d446e09542214efa Mon Sep 17 00:00:00 2001 From: "heroku-linguist[bot]" <136119646+heroku-linguist[bot]@users.noreply.github.com> Date: Thu, 7 Nov 2024 15:00:31 +0000 Subject: [PATCH 0990/1195] Prepare release v281 (#1512) Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com> --- CHANGELOG.md | 6 +++++- changelogs/{unreleased => v281}/ruby-336.md | 0 lib/language_pack/version.rb | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) rename changelogs/{unreleased => v281}/ruby-336.md (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 11cd01b1b..fa0148793 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased] + +## [v281] - 2024-11-07 + - Ruby 3.3.6 is now available (https://github.com/heroku/heroku-buildpack-ruby/pull/1511) - Add detection support for Rails 8 (https://github.com/heroku/heroku-buildpack-ruby/pull/1498) - Support Node.js on ARM builds (https://github.com/heroku/heroku-buildpack-ruby/pull/1499) @@ -1581,7 +1584,8 @@ Bugfixes: * Change gem detection to use lockfile parser * use `$RACK_ENV` when thin is detected for rack apps -[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v280...main +[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v281...main +[v281]: https://github.com/heroku/heroku-buildpack-ruby/compare/v280...v281 [v280]: https://github.com/heroku/heroku-buildpack-ruby/compare/v279...v280 [v279]: https://github.com/heroku/heroku-buildpack-ruby/compare/v278...v279 [v278]: https://github.com/heroku/heroku-buildpack-ruby/compare/v277...v278 diff --git a/changelogs/unreleased/ruby-336.md b/changelogs/v281/ruby-336.md similarity index 100% rename from changelogs/unreleased/ruby-336.md rename to changelogs/v281/ruby-336.md diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index ec465d7e4..82778b71b 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v280" + BUILDPACK_VERSION = "v281" end end From 8d656c6d623b8b746b4f1575570e3f3d588f8c54 Mon Sep 17 00:00:00 2001 From: Josh W Lewis Date: Fri, 8 Nov 2024 12:03:55 -0600 Subject: [PATCH 0991/1195] Update Node.js default to 22.11.0 (#1503) * Update Node.js default to 22.11.0 * Update changelog for Node.js defaults * Add missing dot! Co-authored-by: Ed Morley <501702+edmorley@users.noreply.github.com> * Node yarn changelog for #1503 (#1514) --------- Co-authored-by: Ed Morley <501702+edmorley@users.noreply.github.com> Co-authored-by: Richard Schneeman --- CHANGELOG.md | 2 ++ changelogs/unreleased/node-yarn.md | 8 ++++++++ lib/language_pack/helpers/nodebin.rb | 4 ++-- 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 changelogs/unreleased/node-yarn.md diff --git a/CHANGELOG.md b/CHANGELOG.md index fa0148793..408c95ec5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## [Unreleased] +- Default Node.js version now 22.11.0 (https://github.com/heroku/heroku-buildpack-ruby/pull/1503) +- Default Yarn version now 1.22.22 (https://github.com/heroku/heroku-buildpack-ruby/pull/1503) ## [v281] - 2024-11-07 diff --git a/changelogs/unreleased/node-yarn.md b/changelogs/unreleased/node-yarn.md new file mode 100644 index 000000000..b469a66de --- /dev/null +++ b/changelogs/unreleased/node-yarn.md @@ -0,0 +1,8 @@ +## Ruby apps now default to Node version 22.11.0 and Yarn version 1.22.22 + +Applications using the `heroku/ruby` buildpack that do not have a version of Node installed by another buildpack (such as the `heroku/nodejs` buildpack) will now receive: + +- Node version 22.11.0 +- Yarn version 1.22.22 + +These versions and instructions on how to specify a specific version of these binaries can be found on the [installed binaries section of the Heroku Ruby Support page](https://devcenter.heroku.com/articles/ruby-support#installed-binaries). diff --git a/lib/language_pack/helpers/nodebin.rb b/lib/language_pack/helpers/nodebin.rb index 7632e8366..c71398658 100644 --- a/lib/language_pack/helpers/nodebin.rb +++ b/lib/language_pack/helpers/nodebin.rb @@ -1,8 +1,8 @@ require 'json' class LanguagePack::Helpers::Nodebin - NODE_VERSION = "20.9.0" - YARN_VERSION = "1.22.19" + NODE_VERSION = "22.11.0" + YARN_VERSION = "1.22.22" def self.hardcoded_node_lts(arch: ) arch = "x64" if arch == "amd64" From e791d739b74bcb47401e4d74dcaf615559b4d887 Mon Sep 17 00:00:00 2001 From: "heroku-linguist[bot]" <136119646+heroku-linguist[bot]@users.noreply.github.com> Date: Fri, 8 Nov 2024 18:10:12 +0000 Subject: [PATCH 0992/1195] Prepare release v282 (#1515) Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com> --- CHANGELOG.md | 6 +++++- changelogs/{unreleased => v282}/node-yarn.md | 0 lib/language_pack/version.rb | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) rename changelogs/{unreleased => v282}/node-yarn.md (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 408c95ec5..d90f3dec3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased] + +## [v282] - 2024-11-08 + - Default Node.js version now 22.11.0 (https://github.com/heroku/heroku-buildpack-ruby/pull/1503) - Default Yarn version now 1.22.22 (https://github.com/heroku/heroku-buildpack-ruby/pull/1503) @@ -1586,7 +1589,8 @@ Bugfixes: * Change gem detection to use lockfile parser * use `$RACK_ENV` when thin is detected for rack apps -[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v281...main +[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v282...main +[v282]: https://github.com/heroku/heroku-buildpack-ruby/compare/v281...v282 [v281]: https://github.com/heroku/heroku-buildpack-ruby/compare/v280...v281 [v280]: https://github.com/heroku/heroku-buildpack-ruby/compare/v279...v280 [v279]: https://github.com/heroku/heroku-buildpack-ruby/compare/v278...v279 diff --git a/changelogs/unreleased/node-yarn.md b/changelogs/v282/node-yarn.md similarity index 100% rename from changelogs/unreleased/node-yarn.md rename to changelogs/v282/node-yarn.md diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 82778b71b..68b4135c2 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v281" + BUILDPACK_VERSION = "v282" end end From adc448458d8dcd334893f05db4d939873382637f Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Mon, 11 Nov 2024 17:21:21 -0600 Subject: [PATCH 0993/1195] Roll back node & yarn updates (#1518) There's an issue with the way that yarn is packaged that caused #1516 due to behavior introduced in #1503. This commit reverts to the old node/yarn versions until we can fix the underlying bug. --- CHANGELOG.md | 4 ++-- lib/language_pack/helpers/nodebin.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d90f3dec3..eb4119a51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,8 +5,8 @@ ## [v282] - 2024-11-08 -- Default Node.js version now 22.11.0 (https://github.com/heroku/heroku-buildpack-ruby/pull/1503) -- Default Yarn version now 1.22.22 (https://github.com/heroku/heroku-buildpack-ruby/pull/1503) +- [Rolled back] Default Node.js version now 22.11.0 (https://github.com/heroku/heroku-buildpack-ruby/pull/1503) +- [Rolled back] Default Yarn version now 1.22.22 (https://github.com/heroku/heroku-buildpack-ruby/pull/1503) ## [v281] - 2024-11-07 diff --git a/lib/language_pack/helpers/nodebin.rb b/lib/language_pack/helpers/nodebin.rb index c71398658..7632e8366 100644 --- a/lib/language_pack/helpers/nodebin.rb +++ b/lib/language_pack/helpers/nodebin.rb @@ -1,8 +1,8 @@ require 'json' class LanguagePack::Helpers::Nodebin - NODE_VERSION = "22.11.0" - YARN_VERSION = "1.22.22" + NODE_VERSION = "20.9.0" + YARN_VERSION = "1.22.19" def self.hardcoded_node_lts(arch: ) arch = "x64" if arch == "amd64" From a3f4f66c97a359921cd6820b1d30037744e883e2 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Wed, 13 Nov 2024 09:11:46 -0600 Subject: [PATCH 0994/1195] Fix tests not executing (#1517) * Emit log order Issue #1505 spells out a problem where it appears ci-queue does not fail even when the test suite is broken. I'm unsure why this happens. To debug I'm emitting the tests that run so I can audit to make sure `rspec ./spec/helpers/yarn_installer_spec.rb:6` is executed. If it's not, then I need to diagnose why. If it is, then perhaps there some ordering bug that's affecting the outcome. * Update CI-queue * Update redis version * Use branch of ci-queue --- Gemfile | 2 +- Gemfile.lock | 14 +++++++++++--- app.json | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index c887ccc55..593368af1 100644 --- a/Gemfile +++ b/Gemfile @@ -13,7 +13,7 @@ group :development, :test do gem "parallel_tests" gem 'rspec-retry' gem 'json' - gem 'ci-queue' + gem 'ci-queue', github: "schneems/ci-queue", branch: "schneems/allow-hosted-redis" gem 'redis' gem 'dead_end' end diff --git a/Gemfile.lock b/Gemfile.lock index 5c0085fa5..41807c869 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,8 +1,15 @@ +GIT + remote: https://github.com/schneems/ci-queue.git + revision: 285353ba8bc58e1b2ed02dedf55730400c27e32b + branch: schneems/allow-hosted-redis + specs: + ci-queue (0.58.0) + logger + GEM remote: https://rubygems.org/ specs: base64 (0.2.0) - ci-queue (0.55.0) citrus (3.0.2) connection_pool (2.4.1) dead_end (4.0.0) @@ -23,6 +30,7 @@ GEM thor (~> 1) threaded (~> 0) json (2.7.2) + logger (1.6.1) moneta (1.0.0) multi_json (1.15.0) parallel (1.25.1) @@ -34,7 +42,7 @@ GEM rate_throttle_client (~> 0.1.0) rake (13.2.1) rate_throttle_client (0.1.2) - redis (5.2.0) + redis (5.3.0) redis-client (>= 0.22.0) redis-client (0.22.2) connection_pool @@ -57,7 +65,7 @@ PLATFORMS ruby DEPENDENCIES - ci-queue + ci-queue! dead_end excon heroku_hatchet diff --git a/app.json b/app.json index f0c801d15..514ddad23 100644 --- a/app.json +++ b/app.json @@ -20,7 +20,7 @@ }, "scripts": { "test-setup": "bundle exec rake hatchet:setup_ci", - "test": "bundle exec rspec-queue --max-requeues=3 --timeout 180 --queue $REDIS_URL || { cat log/test_order.log; $(exit 1); }" + "test": "bundle exec rspec-queue --max-requeues=3 --timeout 180 --queue $REDIS_URL --format documentation || { cat log/test_order.log; $(exit 1); }" }, "buildpacks": [ { From 55ee089e506578847c76e85fd2dea86c0b47aaa5 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Thu, 14 Nov 2024 09:49:05 -0600 Subject: [PATCH 0995/1195] Fix failure installing yarn 1.22.22 (#1519) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix failure installing yarn 1.22.22 In #1516 there were reported build failures: ``` remote: -----> Installing node-v22.11.0-linux-x64 remote: -----> Installing yarn-v1.22.22 remote: remote: ! remote: ! No such file or directory @ rb_file_s_rename - (/tmp/d20241108-1032-vggdc3/yarn-v1.22.22, yarn-v1.22.22) remote: ! remote: /tmp/tmp.l8hWafbPfJ/lib/ruby/3.1.0/fileutils.rb:541:in `rename': No such file or directory @ rb_file_s_rename - (/tmp/d20241108-1032-vggdc3/yarn-v1.22.22, yarn-v1.22.22) (Errno::ENOENT) remote: from /tmp/tmp.l8hWafbPfJ/lib/ruby/3.1.0/fileutils.rb:541:in `block in mv' remote: from /tmp/tmp.l8hWafbPfJ/lib/ruby/3.1.0/fileutils.rb:1577:in `block in fu_each_src_dest' remote: from /tmp/tmp.l8hWafbPfJ/lib/ruby/3.1.0/fileutils.rb:1593:in `fu_each_src_dest0' remote: from /tmp/tmp.l8hWafbPfJ/lib/ruby/3.1.0/fileutils.rb:1575:in `fu_each_src_dest' remote: from /tmp/tmp.l8hWafbPfJ/lib/ruby/3.1.0/fileutils.rb:532:in `mv' remote: from /tmp/codon/tmp/buildpacks/50d5eddf222a9b7326028041d4e6509f915ccf2c/lib/language_pack/helpers/yarn_installer.rb:27:in `block in install' remote: from /tmp/tmp.l8hWafbPfJ/lib/ruby/3.1.0/tmpdir.rb:96:in `mktmpdir' ``` This is because older versions of the yarn package have a top level directory that looks like this: ``` yarn-v1.22.19/ ``` But yarn 1.22.22 has a directory named "package" instead: ``` package/ ``` To work around this naming issue we can use `--strip 1` tar flag to remove the top level directory. From gnutar manfiles https://www.gnu.org/software/tar/manual/tar.html: ``` ‘--strip-components=number’ Strip given number of leading components from file names before extraction. For example, suppose you have archived whole ‘/usr’ hierarchy to a tar archive named ‘usr.tar’. Among other files, this archive contains ‘usr/include/stdlib.h’, which you wish to extract to the current working directory. To do so, you type: $ tar -xf usr.tar --strip=2 usr/include/stdlib.h The option ‘--strip=2’ instructs tar to strip the two leading components (‘usr/’ and ‘include/’) off the file name. If you add the ‘--verbose’ (‘-v’) option to the invocation above, you will note that the verbose listing still contains the full file name, with the two removed components still in place. This can be inconvenient, so tar provides a special option for altering this behavior: ``` * Default to strip 0 instead of true From the feedback: > Minor - maybe the default for strip_components should be 0 instead of false? From this signature, I would expect that if I want it to strip components I would pass true instead of false but that would produce an invalid command. --- CHANGELOG.md | 2 ++ changelogs/{v282 => unreleased}/node-yarn.md | 0 lib/language_pack/fetcher.rb | 5 +++-- lib/language_pack/helpers/yarn_installer.rb | 4 ++-- 4 files changed, 7 insertions(+), 4 deletions(-) rename changelogs/{v282 => unreleased}/node-yarn.md (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index eb4119a51..ac6a6da7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## [Unreleased] +- Default Node.js version now 22.11.0 (https://github.com/heroku/heroku-buildpack-ruby/pull/1503) +- Default Yarn version now 1.22.22 (https://github.com/heroku/heroku-buildpack-ruby/pull/1503) ## [v282] - 2024-11-08 diff --git a/changelogs/v282/node-yarn.md b/changelogs/unreleased/node-yarn.md similarity index 100% rename from changelogs/v282/node-yarn.md rename to changelogs/unreleased/node-yarn.md diff --git a/lib/language_pack/fetcher.rb b/lib/language_pack/fetcher.rb index f16390720..d2a79c2e5 100644 --- a/lib/language_pack/fetcher.rb +++ b/lib/language_pack/fetcher.rb @@ -26,9 +26,10 @@ def fetch(path) run!(curl, error_class: FetchError) end - def fetch_untar(path, files_to_extract = nil) + def fetch_untar(path, files_to_extract = nil, strip_components: 0) curl = curl_command("#{@host_url.join(path)} -s -o") - run! "#{curl} - | tar zxf - #{files_to_extract}", + tar_cmd = ["tar zxf - #{files_to_extract}", "--strip #{strip_components}"] + run! "#{curl} - | #{tar_cmd.join(" ")}", error_class: FetchError, max_attempts: 3 end diff --git a/lib/language_pack/helpers/yarn_installer.rb b/lib/language_pack/helpers/yarn_installer.rb index 49a4e777c..2aae36f2a 100644 --- a/lib/language_pack/helpers/yarn_installer.rb +++ b/lib/language_pack/helpers/yarn_installer.rb @@ -21,10 +21,10 @@ def binary_path def install Dir.mktmpdir do |dir| Dir.chdir(dir) do - @fetcher.fetch_untar(@url) + @fetcher.fetch_untar(@url, strip_components: 1) end - FileUtils.mv(File.join(dir, name), name) + FileUtils.cp_r(dir, name) end end end From 83a67ef1436f2bde87701d296b48a36e43cdadd0 Mon Sep 17 00:00:00 2001 From: "heroku-linguist[bot]" <136119646+heroku-linguist[bot]@users.noreply.github.com> Date: Thu, 14 Nov 2024 16:29:18 +0000 Subject: [PATCH 0996/1195] Prepare release v283 (#1520) Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com> --- CHANGELOG.md | 6 +++++- changelogs/{unreleased => v283}/node-yarn.md | 0 lib/language_pack/version.rb | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) rename changelogs/{unreleased => v283}/node-yarn.md (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac6a6da7b..6cd7f3119 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased] + +## [v283] - 2024-11-14 + - Default Node.js version now 22.11.0 (https://github.com/heroku/heroku-buildpack-ruby/pull/1503) - Default Yarn version now 1.22.22 (https://github.com/heroku/heroku-buildpack-ruby/pull/1503) @@ -1591,7 +1594,8 @@ Bugfixes: * Change gem detection to use lockfile parser * use `$RACK_ENV` when thin is detected for rack apps -[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v282...main +[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v283...main +[v283]: https://github.com/heroku/heroku-buildpack-ruby/compare/v282...v283 [v282]: https://github.com/heroku/heroku-buildpack-ruby/compare/v281...v282 [v281]: https://github.com/heroku/heroku-buildpack-ruby/compare/v280...v281 [v280]: https://github.com/heroku/heroku-buildpack-ruby/compare/v279...v280 diff --git a/changelogs/unreleased/node-yarn.md b/changelogs/v283/node-yarn.md similarity index 100% rename from changelogs/unreleased/node-yarn.md rename to changelogs/v283/node-yarn.md diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 68b4135c2..859857c01 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v282" + BUILDPACK_VERSION = "v283" end end From b17267f49cff2b62988c2446addb7b06057b8fae Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Fri, 15 Nov 2024 09:23:04 -0600 Subject: [PATCH 0997/1195] Re-apply Node 22.11.0 and yarn 1.22.22 defaults (#1521) --- CHANGELOG.md | 5 +++-- changelogs/{v283 => unreleased}/node-yarn.md | 0 lib/language_pack/helpers/nodebin.rb | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) rename changelogs/{v283 => unreleased}/node-yarn.md (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6cd7f3119..f6327c70e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,11 +2,12 @@ ## [Unreleased] +- Default Node.js version now 22.11.0 (https://github.com/heroku/heroku-buildpack-ruby/pull/1503) +- Default Yarn version now 1.22.22 (https://github.com/heroku/heroku-buildpack-ruby/pull/1503) ## [v283] - 2024-11-14 -- Default Node.js version now 22.11.0 (https://github.com/heroku/heroku-buildpack-ruby/pull/1503) -- Default Yarn version now 1.22.22 (https://github.com/heroku/heroku-buildpack-ruby/pull/1503) +- No customer facing changes ## [v282] - 2024-11-08 diff --git a/changelogs/v283/node-yarn.md b/changelogs/unreleased/node-yarn.md similarity index 100% rename from changelogs/v283/node-yarn.md rename to changelogs/unreleased/node-yarn.md diff --git a/lib/language_pack/helpers/nodebin.rb b/lib/language_pack/helpers/nodebin.rb index 7632e8366..c71398658 100644 --- a/lib/language_pack/helpers/nodebin.rb +++ b/lib/language_pack/helpers/nodebin.rb @@ -1,8 +1,8 @@ require 'json' class LanguagePack::Helpers::Nodebin - NODE_VERSION = "20.9.0" - YARN_VERSION = "1.22.19" + NODE_VERSION = "22.11.0" + YARN_VERSION = "1.22.22" def self.hardcoded_node_lts(arch: ) arch = "x64" if arch == "amd64" From abd7281af5734358c2144cd5b4267af4728336b8 Mon Sep 17 00:00:00 2001 From: "heroku-linguist[bot]" <136119646+heroku-linguist[bot]@users.noreply.github.com> Date: Fri, 15 Nov 2024 15:35:15 +0000 Subject: [PATCH 0998/1195] Prepare release v284 (#1522) Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com> --- CHANGELOG.md | 6 +++++- changelogs/{unreleased => v284}/node-yarn.md | 0 lib/language_pack/version.rb | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) rename changelogs/{unreleased => v284}/node-yarn.md (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index f6327c70e..6a4ff2050 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased] + +## [v284] - 2024-11-15 + - Default Node.js version now 22.11.0 (https://github.com/heroku/heroku-buildpack-ruby/pull/1503) - Default Yarn version now 1.22.22 (https://github.com/heroku/heroku-buildpack-ruby/pull/1503) @@ -1595,7 +1598,8 @@ Bugfixes: * Change gem detection to use lockfile parser * use `$RACK_ENV` when thin is detected for rack apps -[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v283...main +[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v284...main +[v284]: https://github.com/heroku/heroku-buildpack-ruby/compare/v283...v284 [v283]: https://github.com/heroku/heroku-buildpack-ruby/compare/v282...v283 [v282]: https://github.com/heroku/heroku-buildpack-ruby/compare/v281...v282 [v281]: https://github.com/heroku/heroku-buildpack-ruby/compare/v280...v281 diff --git a/changelogs/unreleased/node-yarn.md b/changelogs/v284/node-yarn.md similarity index 100% rename from changelogs/unreleased/node-yarn.md rename to changelogs/v284/node-yarn.md diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 859857c01..05ab999c2 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v283" + BUILDPACK_VERSION = "v284" end end From 8187b74201f2c19f8b5bf7c6972ea0a6a02dfd4d Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Thu, 21 Nov 2024 13:27:14 -0600 Subject: [PATCH 0999/1195] Fix build timeouts with node/yarn by setting UV_USE_IO_URING=0 by default (#1523) * Set UV_USE_IO_URING=0 by default Default `UV_USE_IO_URING=0` due to build timeouts This mirrors a change by the nodejs buildpack: https://github.com/heroku/heroku-buildpack-nodejs/pull/1347 The Ruby buildpack needs this because we can install node/yarn without the `heroku/nodejs` buildpack, however this behavior triggers a warning and is generally advised against. * Only set UV_USE_IO_URING=0 at build (not runtime) * Make UV_USE_IO_URING=0 available for other buildpacks --- CHANGELOG.md | 1 + lib/language_pack/ruby.rb | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a4ff2050..dd6a66278 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## [Unreleased] +- Default `UV_USE_IO_URING=0` due to build timeouts [context](https://github.com/heroku/heroku-buildpack-nodejs/pull/1347) (https://github.com/heroku/heroku-buildpack-ruby/pull/1523) ## [v284] - 2024-11-15 diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 65612d7b5..bdb72bdb6 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -964,6 +964,11 @@ def add_node_js_binary version = @node_installer.version old_version = @metadata.fetch("default_node_version") { version } + # Make available for `rake assets:precompile` and other sub-shells + ENV["UV_USE_IO_URING"] ||= "0" + # Make available to future buildpacks (export), but not runtime (profile.d) + set_export_default "UV_USE_IO_URING", "0" + if version != version warn(<<~WARNING, inline: true) Default version of Node.js changed (#{old_version} to #{version}) @@ -994,6 +999,11 @@ def add_yarn_binary version = @yarn_installer.version old_version = @metadata.fetch("default_yarn_version") { version } + # Make available for `rake assets:precompile` and other sub-shells + ENV["UV_USE_IO_URING"] ||= "0" + # Make available to future buildpacks (export), but not runtime (profile.d) + set_export_default "UV_USE_IO_URING", "0" + if version != version warn(<<~WARNING, inline: true) Default version of Yarn changed (#{old_version} to #{version}) From bfb911a08784901edf0263a17aa97e938e75807d Mon Sep 17 00:00:00 2001 From: "heroku-linguist[bot]" <136119646+heroku-linguist[bot]@users.noreply.github.com> Date: Thu, 21 Nov 2024 19:38:39 +0000 Subject: [PATCH 1000/1195] Prepare release v285 (#1524) Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com> --- CHANGELOG.md | 6 +++++- lib/language_pack/version.rb | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dd6a66278..0938eb156 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased] + +## [v285] - 2024-11-21 + - Default `UV_USE_IO_URING=0` due to build timeouts [context](https://github.com/heroku/heroku-buildpack-nodejs/pull/1347) (https://github.com/heroku/heroku-buildpack-ruby/pull/1523) ## [v284] - 2024-11-15 @@ -1599,7 +1602,8 @@ Bugfixes: * Change gem detection to use lockfile parser * use `$RACK_ENV` when thin is detected for rack apps -[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v284...main +[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v285...main +[v285]: https://github.com/heroku/heroku-buildpack-ruby/compare/v284...v285 [v284]: https://github.com/heroku/heroku-buildpack-ruby/compare/v283...v284 [v283]: https://github.com/heroku/heroku-buildpack-ruby/compare/v282...v283 [v282]: https://github.com/heroku/heroku-buildpack-ruby/compare/v281...v282 diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 05ab999c2..162bb64a0 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v284" + BUILDPACK_VERSION = "v285" end end From b1c482c8dd72a20c6e1682165266751b8a5a88f8 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Thu, 5 Dec 2024 15:53:42 -0600 Subject: [PATCH 1001/1195] Fix tests to work with `sharpstone/default_ruby` (#1527) * Update bundler version for jruby app Fixes: ``` Hatchet::App::FailedDeployError Could not deploy 'hatchet-t-741ea26fdf' (default_ruby) using 'Hatchet::GitApp' at path: './repos/rack/default_ruby' if this was expected add `allow_failure: true` to your deploy hash. Buildpack: nil Repo: https://git.heroku.com/hatchet-t-741ea26fdf.git output: remote: Updated 5 paths from 3dac5f9 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/ci-queue-dec3 remote: -----> Ruby app detected remote: remote: ## Warning: Your app needs java remote: remote: The Ruby buildpack determined your app needs java installed remote: we recommend you add the jvm buildpack to your application: remote: remote: $ heroku buildpacks:add heroku/jvm --index=1 remote: remote: -----> Installing Java remote: remote: -----> Downloading Buildpack: heroku/jvm remote: -----> Detected Framework: JVM Common remote: remote: ! WARNING: No OpenJDK version specified remote: Your application does not explicitly specify an OpenJDK remote: version. OpenJDK 1.8 will be installed. remote: remote: This default version will change at some point. Your remote: application might fail to build with the new version. We remote: recommend explicitly setting the required OpenJDK version for remote: your application. remote: remote: To set the OpenJDK version, add or edit the system.properties remote: file in the root directory of your application to contain: remote: remote: java.runtime.version = 1.8 remote: remote: remote: -----> Installing OpenJDK 1.8... done remote: -----> Installing bundler 1.17.3 remote: -----> Removing BUNDLED WITH version in the Gemfile.lock remote: -----> Compiling Ruby/Rack remote: -----> Using Ruby version: ruby-2.5.7-jruby-9.2.13.0 remote: -----> Installing dependencies using bundler 1.17.3 remote: Running: BUNDLE_WITHOUT='development:test' BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 BUNDLE_GLOBAL_PATH_APPENDS_RUBY_SCOPE=1 bundle install -j4 remote: You are trying to install in deployment mode after changing remote: your Gemfile. Run `bundle install` elsewhere and add the remote: updated Gemfile.lock to version control. remote: remote: If this is a development machine, remove the /tmp/build_3b0d62e8/Gemfile freeze remote: by running `bundle install --no-deployment`. remote: remote: Bundler is unlocking ruby remote: remote: You have added to the Gemfile: remote: * webrick remote: Bundler Output: You are trying to install in deployment mode after changing remote: your Gemfile. Run `bundle install` elsewhere and add the remote: updated Gemfile.lock to version control. remote: remote: If this is a development machine, remove the /tmp/build_3b0d62e8/Gemfile freeze remote: by running `bundle install --no-deployment`. remote: remote: Bundler is unlocking ruby remote: remote: You have added to the Gemfile: remote: * webrick remote: remote: ! remote: ! Failed to install gems via Bundler. remote: ! remote: ! Push rejected, failed to compile Ruby app. remote: remote: ! Push failed remote: ! remote: ! ## Warning - The same version of this code has already been built: df7a92f56ea636831f28033356791f2ba6ba0ef0 remote: ! remote: ! We have detected that you have triggered a build from source code with version df7a92f56ea636831f28033356791f2ba6ba0ef0 remote: ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch. remote: ! remote: ! If you are developing on a branch and deploying via git you must run: remote: ! remote: ! git push heroku :main remote: ! remote: ! This article goes into details on the behavior: remote: ! https://devcenter.heroku.com/articles/duplicate-build-version remote: remote: Verifying deploy... remote: remote: ! Push rejected to hatchet-t-741ea26fdf. remote: To https://git.heroku.com/hatchet-t-741ea26fdf.git ! [remote rejected] HEAD -> main (pre-receive hook declined) error: failed to push some refs to 'https://git.heroku.com/hatchet-t-741ea26fdf.git' /app/vendor/bundle/ruby/3.1.0/gems/heroku_hatchet-8.0.4/lib/hatchet/git_app.rb:36:in `git_push_heroku_yall' /app/vendor/bundle/ruby/3.1.0/gems/heroku_hatchet-8.0.4/lib/hatchet/git_app.rb:13:in `block in push_without_retry!' /app/vendor/bundle/ruby/3.1.0/gems/heroku_hatchet-8.0.4/lib/hatchet/shell_throttle.rb:28:in `block (2 levels) in call' /app/vendor/bundle/ruby/3.1.0/gems/heroku_hatchet-8.0.4/lib/hatchet/shell_throttle.rb:27:in `catch' /app/vendor/bundle/ruby/3.1.0/gems/heroku_hatchet-8.0.4/lib/hatchet/shell_throttle.rb:27:in `block in call' ``` https://dashboard.heroku.com/pipelines/ac057663-170b-4bdd-99d0-87560eb3a570/tests/2165 * Update jruby version for bundler support ``` remote: -----> Installing dependencies using bundler 2.5.6 remote: Running: BUNDLE_WITHOUT='development:test' BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 bundle install -j4 remote: NoMethodError: undefined method `union' for ["BUNDLE_JOBS"]:Array remote: all at /tmp/build_0e08ea51/vendor/bundle/jruby/2.5.0/gems/bundler-2.5.6/lib/bundler/settings.rb:169 remote: report at /tmp/build_0e08ea51/vendor/bundle/jruby/2.5.0/gems/bundler-2.5.6/lib/bundler/env.rb:20 remote: request_issue_report_for at /tmp/build_0e08ea51/vendor/bundle/jruby/2.5.0/gems/bundler-2.5.6/lib/bundler/friendly_errors.rb:71 remote: log_error at /tmp/build_0e08ea51/vendor/bundle/jruby/2.5.0/gems/bundler-2.5.6/lib/bundler/friendly_errors.rb:50 remote: with_friendly_errors at /tmp/build_0e08ea51/vendor/bundle/jruby/2.5.0/gems/bundler-2.5.6/lib/bundler/friendly_errors.rb:123 remote:
at /tmp/build_0e08ea51/vendor/bundle/jruby/2.5.0/gems/bundler-2.5.6/exe/bundle:20 remote: load at org/jruby/RubyKernel.java:1009 remote:
at /tmp/build_0e08ea51/vendor/bundle/jruby/2.5.0/bin/bundle:25 remote: Bundler Output: NoMethodError: undefined method `union' for ["BUNDLE_JOBS"]:Array remote: all at /tmp/build_0e08ea51/vendor/bundle/jruby/2.5.0/gems/bundler-2.5.6/lib/bundler/settings.rb:169 remote: report at /tmp/build_0e08ea51/vendor/bundle/jruby/2.5.0/gems/bundler-2.5.6/lib/bundler/env.rb:20 remote: request_issue_report_for at /tmp/build_0e08ea51/vendor/bundle/jruby/2.5.0/gems/bundler-2.5.6/lib/bundler/friendly_errors.rb:71 remote: log_error at /tmp/build_0e08ea51/vendor/bundle/jruby/2.5.0/gems/bundler-2.5.6/lib/bundler/friendly_errors.rb:50 remote: with_friendly_errors at /tmp/build_0e08ea51/vendor/bundle/jruby/2.5.0/gems/bundler-2.5.6/lib/bundler/friendly_errors.rb:123 remote:
at /tmp/build_0e08ea51/vendor/bundle/jruby/2.5.0/gems/bundler-2.5.6/exe/bundle:20 remote: load at org/jruby/RubyKernel.java:1009 remote:
at /tmp/build_0e08ea51/vendor/bundle/jruby/2.5.0/bin/bundle:25 ``` * Update test to not be on deprecated stack * Update gem versions * Inspect ruby version instead of jar file From https://github.com/heroku/heroku-buildpack-java/blob/b3c51f94de6a43bc656b777bc84ef2a9451371aa/test/spec/java_spec.rb#L78 > OpenJDK versions > 9 do not have the jre/lib/ext directory where we drop the pgconfig.jar This test was added by Joe in https://github.com/heroku/heroku-buildpack-ruby/commit/248b30a420766fa3ec2e0b29581571e6089f7aee later I moved to not having a separate track for installing JVM https://github.com/heroku/heroku-buildpack-ruby/commit/648a14986020ae6c681dbbba0895fe6bb542d5fd so I removed the logic for installing a pgconfig.jar and relied on the buildpack. According to the JVM buildpack it's no longer in this updated version. It seems the original PR was using this to test that installation logic. While we no longer need to do that (as the logic is part of the `heroku/jvm` buildpack) I wanted to preserve calling a `heroku run` to assert something about the dyno that would indicate that jruby was installed as we expect. --- spec/hatchet/rubies_spec.rb | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/spec/hatchet/rubies_spec.rb b/spec/hatchet/rubies_spec.rb index 22e029111..55e7c23b0 100644 --- a/spec/hatchet/rubies_spec.rb +++ b/spec/hatchet/rubies_spec.rb @@ -13,15 +13,16 @@ end describe "Ruby versions" do - it "should deploy jdk on heroku-20" do - Hatchet::Runner.new("default_ruby", stack: "heroku-20").tap do |app| + it "should deploy jdk on heroku-24" do + Hatchet::Runner.new("default_ruby", stack: "heroku-24").tap do |app| app.before_deploy do |app| Pathname("Gemfile.lock").write(<<~EOM) GEM remote: https://rubygems.org/ specs: - rack (2.2.2) - rake (13.0.1) + rack (3.1.8) + rake (13.2.1) + webrick (1.9.1) PLATFORMS java @@ -29,10 +30,13 @@ DEPENDENCIES rack rake - + webrick RUBY VERSION - ruby 2.5.7p0 (jruby 9.2.13.0) + ruby 3.1.4p0 (jruby 9.4.8.0) + + BUNDLED WITH + 2.5.23 EOM Pathname("Rakefile").write(<<~'EOM') @@ -50,7 +54,7 @@ app.push! expect(app.output).to match("JRUBY_OPTS is: --dev") - expect(app.run("ls .jdk/jre/lib/ext/")).to match("pgconfig.jar") + expect(app.run("ruby -v")).to match("jruby") end end end From 278f9e8d8b361d438e884cb692614104adbbd1fe Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Thu, 5 Dec 2024 16:06:48 -0600 Subject: [PATCH 1002/1195] Use non-forked ci-queue gem (#1526) Should work on hosted redis now https://github.com/Shopify/ci-queue/pull/294 --- Gemfile | 2 +- Gemfile.lock | 14 ++++---------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/Gemfile b/Gemfile index 593368af1..c887ccc55 100644 --- a/Gemfile +++ b/Gemfile @@ -13,7 +13,7 @@ group :development, :test do gem "parallel_tests" gem 'rspec-retry' gem 'json' - gem 'ci-queue', github: "schneems/ci-queue", branch: "schneems/allow-hosted-redis" + gem 'ci-queue' gem 'redis' gem 'dead_end' end diff --git a/Gemfile.lock b/Gemfile.lock index 41807c869..86917b001 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,15 +1,9 @@ -GIT - remote: https://github.com/schneems/ci-queue.git - revision: 285353ba8bc58e1b2ed02dedf55730400c27e32b - branch: schneems/allow-hosted-redis - specs: - ci-queue (0.58.0) - logger - GEM remote: https://rubygems.org/ specs: base64 (0.2.0) + ci-queue (0.59.0) + logger citrus (3.0.2) connection_pool (2.4.1) dead_end (4.0.0) @@ -30,7 +24,7 @@ GEM thor (~> 1) threaded (~> 0) json (2.7.2) - logger (1.6.1) + logger (1.6.2) moneta (1.0.0) multi_json (1.15.0) parallel (1.25.1) @@ -65,7 +59,7 @@ PLATFORMS ruby DEPENDENCIES - ci-queue! + ci-queue dead_end excon heroku_hatchet From e189a638fd65581afabf3d30e345d4c9212f5497 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Fri, 13 Dec 2024 09:51:39 -0600 Subject: [PATCH 1003/1195] Ruby 3.4.0-rc1 (#1528) * Ruby 3.4.0-rc1 * Update CHANGELOG.md Co-authored-by: Rune Soerensen --------- Co-authored-by: Rune Soerensen --- CHANGELOG.md | 1 + changelogs/unreleased/3.4.0-rc1.md | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 changelogs/unreleased/3.4.0-rc1.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 0938eb156..376293f00 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## [Unreleased] +- Ruby 3.4.0-rc1 is now available (https://github.com/heroku/heroku-buildpack-ruby/pull/1528) ## [v285] - 2024-11-21 diff --git a/changelogs/unreleased/3.4.0-rc1.md b/changelogs/unreleased/3.4.0-rc1.md new file mode 100644 index 000000000..46c7cf703 --- /dev/null +++ b/changelogs/unreleased/3.4.0-rc1.md @@ -0,0 +1,15 @@ +## Ruby version 3.4.0-rc1 is now available + +[Ruby v3.4.0-rc1](/articles/ruby-support#ruby-versions) is now available on Heroku. To run +your app using this version of Ruby, add the following `ruby` directive to your Gemfile: + +```ruby +ruby "3.3.0.rc1" +``` + +For more information on [Ruby 3.4.0-rc1, you can view the release announcement](https://www.ruby-lang.org/en/news/). + +> Note: This version of Ruby is not suitable for production applications. +> However, it can be used to test that your application is ready for +> the official release of Ruby 3.4.0 and +> to provide feedback to the Ruby core team. From c3494fee9ee28c7fdb60720b1e9410df40c5f0b9 Mon Sep 17 00:00:00 2001 From: "heroku-linguist[bot]" <136119646+heroku-linguist[bot]@users.noreply.github.com> Date: Fri, 13 Dec 2024 16:45:00 +0000 Subject: [PATCH 1004/1195] Prepare release v286 (#1529) Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com> --- CHANGELOG.md | 6 +++++- changelogs/{unreleased => v286}/3.4.0-rc1.md | 0 lib/language_pack/version.rb | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) rename changelogs/{unreleased => v286}/3.4.0-rc1.md (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 376293f00..d39e5be90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased] + +## [v286] - 2024-12-13 + - Ruby 3.4.0-rc1 is now available (https://github.com/heroku/heroku-buildpack-ruby/pull/1528) ## [v285] - 2024-11-21 @@ -1603,7 +1606,8 @@ Bugfixes: * Change gem detection to use lockfile parser * use `$RACK_ENV` when thin is detected for rack apps -[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v285...main +[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v286...main +[v286]: https://github.com/heroku/heroku-buildpack-ruby/compare/v285...v286 [v285]: https://github.com/heroku/heroku-buildpack-ruby/compare/v284...v285 [v284]: https://github.com/heroku/heroku-buildpack-ruby/compare/v283...v284 [v283]: https://github.com/heroku/heroku-buildpack-ruby/compare/v282...v283 diff --git a/changelogs/unreleased/3.4.0-rc1.md b/changelogs/v286/3.4.0-rc1.md similarity index 100% rename from changelogs/unreleased/3.4.0-rc1.md rename to changelogs/v286/3.4.0-rc1.md diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 162bb64a0..e401a7d61 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v285" + BUILDPACK_VERSION = "v286" end end From a4a9ac9b99fd4526ae7fb1768df1f428f6103b9e Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Fri, 13 Dec 2024 11:29:04 -0600 Subject: [PATCH 1005/1195] Update changelog (#1530) --- changelogs/v286/3.4.0-rc1.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/changelogs/v286/3.4.0-rc1.md b/changelogs/v286/3.4.0-rc1.md index 46c7cf703..c26eed3c8 100644 --- a/changelogs/v286/3.4.0-rc1.md +++ b/changelogs/v286/3.4.0-rc1.md @@ -1,15 +1,15 @@ ## Ruby version 3.4.0-rc1 is now available -[Ruby v3.4.0-rc1](/articles/ruby-support#ruby-versions) is now available on Heroku. To run -your app using this version of Ruby, add the following `ruby` directive to your Gemfile: +[Ruby v3.4.0-rc1](/articles/ruby-support-reference#ruby-versions) is now available on Heroku. To run your app using this version of Ruby, add the following `ruby` directive to your Gemfile: ```ruby -ruby "3.3.0.rc1" +ruby "3.4.0.rc1" ``` For more information on [Ruby 3.4.0-rc1, you can view the release announcement](https://www.ruby-lang.org/en/news/). -> Note: This version of Ruby is not suitable for production applications. +> Note +> This version of Ruby is not suitable for production applications. > However, it can be used to test that your application is ready for > the official release of Ruby 3.4.0 and > to provide feedback to the Ruby core team. From dd401008f8ff387219d6c3b00526a9aff6393ac3 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Wed, 25 Dec 2024 07:37:38 -0600 Subject: [PATCH 1006/1195] Stage Ruby 3.4.0 (#1531) * Stage Ruby 3.4.0 Ruby 3.4.0 will be released on Christmas. This PR is for pre-approval. It will be held for merge until December 25th, 2024. * Update CHANGELOG.md --- CHANGELOG.md | 2 ++ changelogs/unreleased/ruby_3.4.0.md | 9 +++++++++ 2 files changed, 11 insertions(+) create mode 100644 changelogs/unreleased/ruby_3.4.0.md diff --git a/CHANGELOG.md b/CHANGELOG.md index d39e5be90..d59f78a97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## [Unreleased] +- Ruby 3.4.0 is now available (https://github.com/heroku/heroku-buildpack-ruby/pull/1531) +- Ruby 3.4.1 is now available (https://github.com/heroku/heroku-buildpack-ruby/pull/1531) ## [v286] - 2024-12-13 diff --git a/changelogs/unreleased/ruby_3.4.0.md b/changelogs/unreleased/ruby_3.4.0.md new file mode 100644 index 000000000..b63ee6503 --- /dev/null +++ b/changelogs/unreleased/ruby_3.4.0.md @@ -0,0 +1,9 @@ +## Ruby version 3.4.0 is now available + +[Ruby v3.4.0](/articles/ruby-support-reference#ruby-versions) is now available on Heroku. To run your app using this version of Ruby, add the following `ruby` directive to your Gemfile: + +```ruby +ruby "3.4.0" +``` + +For more information on [Ruby 3.4.0, you can view the release announcement](https://www.ruby-lang.org/en/news/). From 5ea0ef80a7bf59e29af77f809886baaee2300e6b Mon Sep 17 00:00:00 2001 From: "heroku-linguist[bot]" <136119646+heroku-linguist[bot]@users.noreply.github.com> Date: Wed, 25 Dec 2024 13:53:59 +0000 Subject: [PATCH 1007/1195] Prepare release v287 (#1532) Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com> --- CHANGELOG.md | 6 +++++- changelogs/{unreleased => v287}/ruby_3.4.0.md | 0 lib/language_pack/version.rb | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) rename changelogs/{unreleased => v287}/ruby_3.4.0.md (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index d59f78a97..9678d7362 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased] + +## [v287] - 2024-12-25 + - Ruby 3.4.0 is now available (https://github.com/heroku/heroku-buildpack-ruby/pull/1531) - Ruby 3.4.1 is now available (https://github.com/heroku/heroku-buildpack-ruby/pull/1531) @@ -1608,7 +1611,8 @@ Bugfixes: * Change gem detection to use lockfile parser * use `$RACK_ENV` when thin is detected for rack apps -[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v286...main +[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v287...main +[v287]: https://github.com/heroku/heroku-buildpack-ruby/compare/v286...v287 [v286]: https://github.com/heroku/heroku-buildpack-ruby/compare/v285...v286 [v285]: https://github.com/heroku/heroku-buildpack-ruby/compare/v284...v285 [v284]: https://github.com/heroku/heroku-buildpack-ruby/compare/v283...v284 diff --git a/changelogs/unreleased/ruby_3.4.0.md b/changelogs/v287/ruby_3.4.0.md similarity index 100% rename from changelogs/unreleased/ruby_3.4.0.md rename to changelogs/v287/ruby_3.4.0.md diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index e401a7d61..1143c73e1 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v286" + BUILDPACK_VERSION = "v287" end end From 4fa49f504af96a43f34aaaaf47295214d637a8c3 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Mon, 6 Jan 2025 11:03:00 -0600 Subject: [PATCH 1008/1195] Add bundler 2.6.2 and update bundler 2.5.23 (#1535) * Add Download support for Bundler 2.6.x Bundler 2.6.2 is the latest release of Bundler 2.6.x. This commit adds download support for that version. * Add Bundler 2.5.23 support This commit adds support for downloading bundler 2.5.23 for applications with Bundler 2.5.x in their `Gemfile.lock`. * Changelog links * Test bundler version greater than behavior Add test to assert versions greater than 2.6 will receive 2.6 --- CHANGELOG.md | 2 ++ changelogs/unreleased/bundler_2.5.23.md | 15 +++++++++++++++ changelogs/unreleased/bundler_2.6.x_support.md | 15 +++++++++++++++ lib/language_pack/helpers/bundler_wrapper.rb | 7 ++++--- spec/helpers/bundler_wrapper_spec.rb | 8 ++++++-- 5 files changed, 42 insertions(+), 5 deletions(-) create mode 100644 changelogs/unreleased/bundler_2.5.23.md create mode 100644 changelogs/unreleased/bundler_2.6.x_support.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 9678d7362..30eb99c36 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## [Unreleased] +- Ruby apps using bundler 2.6+ will now receive bundler 2.6.2 (https://github.com/heroku/heroku-buildpack-ruby/pull/1535) +- Ruby apps using bundler 2.5.x will now receive bundler 2.5.23 (https://github.com/heroku/heroku-buildpack-ruby/pull/1535) ## [v287] - 2024-12-25 diff --git a/changelogs/unreleased/bundler_2.5.23.md b/changelogs/unreleased/bundler_2.5.23.md new file mode 100644 index 000000000..9267483f4 --- /dev/null +++ b/changelogs/unreleased/bundler_2.5.23.md @@ -0,0 +1,15 @@ +## Bundler version 2.5.23 is now available for Ruby Applications + +The [Ruby Buildpack](https://devcenter.heroku.com/articles/ruby-support#libraries) installs a version of bundler based on the major and minor version listed in the `Gemfile.lock` under the `BUNDLED WITH` key: + +- `BUNDLED WITH` 2.5.x will receive bundler `2.5.23` + +It is strongly recommended that you have both a `RUBY VERSION` and `BUNDLED WITH` version listed in your `Gemfile.lock`. If you do not have those values, you can generate them and commit them to git: + +``` +$ bundle update --ruby +$ git add Gemfile.lock +$ git commit -m "Update Gemfile.lock" +``` + +Applications without these values specified in the `Gemfile.lock` may break unexpectedly when the defaults change. diff --git a/changelogs/unreleased/bundler_2.6.x_support.md b/changelogs/unreleased/bundler_2.6.x_support.md new file mode 100644 index 000000000..e9d131563 --- /dev/null +++ b/changelogs/unreleased/bundler_2.6.x_support.md @@ -0,0 +1,15 @@ +## Bundler version 2.6.2 is now available for Ruby Applications + +The [Ruby Buildpack](https://devcenter.heroku.com/articles/ruby-support#libraries) installs a version of bundler based on the major and minor version listed in the `Gemfile.lock` under the `BUNDLED WITH` key: + +- `BUNDLED WITH` 2.6.x and above will receive bundler `2.6.2` + +It is strongly recommended that you have both a `RUBY VERSION` and `BUNDLED WITH` version listed in your `Gemfile.lock`. If you do not have those values, you can generate them and commit them to git: + +``` +$ bundle update --ruby +$ git add Gemfile.lock +$ git commit -m "Update Gemfile.lock" +``` + +Applications without these values specified in the `Gemfile.lock` may break unexpectedly when the defaults change. diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index 93377083f..64d030cfe 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -40,13 +40,14 @@ class LanguagePack::Helpers::BundlerWrapper # Heroku-20's oldest Ruby verison is 2.5.x which doesn't work with bundler 2.4 BLESSED_BUNDLER_VERSIONS["2.3"] = "2.3.25" BLESSED_BUNDLER_VERSIONS["2.4"] = "2.4.22" - BLESSED_BUNDLER_VERSIONS["2.5"] = "2.5.6" + BLESSED_BUNDLER_VERSIONS["2.5"] = "2.5.23" + BLESSED_BUNDLER_VERSIONS["2.6"] = "2.6.2" BLESSED_BUNDLER_VERSIONS.default_proc = Proc.new do |hash, key| if Gem::Version.new(key).segments.first == 1 hash["1"] elsif Gem::Version::new(key).segments.first == 2 - if Gem::Version.new(key) > Gem::Version.new("2.5") - hash["2.5"] + if Gem::Version.new(key) > Gem::Version.new("2.6") + hash["2.6"] elsif Gem::Version.new(key) < Gem::Version.new("2.3") hash["2.3"] else diff --git a/spec/helpers/bundler_wrapper_spec.rb b/spec/helpers/bundler_wrapper_spec.rb index a1b25951c..3a7fdca33 100644 --- a/spec/helpers/bundler_wrapper_spec.rb +++ b/spec/helpers/bundler_wrapper_spec.rb @@ -36,8 +36,12 @@ expect(version).to eq(wrapper_klass::BLESSED_BUNDLER_VERSIONS["2.5"]) version = wrapper_klass.detect_bundler_version(contents: "BUNDLED WITH\n 2.6.7") - expect(wrapper_klass::BLESSED_BUNDLER_VERSIONS.key?("2.5")).to be_truthy - expect(version).to eq(wrapper_klass::BLESSED_BUNDLER_VERSIONS["2.5"]) + expect(wrapper_klass::BLESSED_BUNDLER_VERSIONS.key?("2.6")).to be_truthy + expect(version).to eq(wrapper_klass::BLESSED_BUNDLER_VERSIONS["2.6"]) + + version = wrapper_klass.detect_bundler_version(contents: "BUNDLED WITH\n 2.999.7") + expect(wrapper_klass::BLESSED_BUNDLER_VERSIONS.key?("2.6")).to be_truthy + expect(version).to eq(wrapper_klass::BLESSED_BUNDLER_VERSIONS["2.6"]) expect { wrapper_klass.detect_bundler_version(contents: "BUNDLED WITH\n 3.6.7") From f56b1f49929123a505b8294ea8f3472aaaf56ffd Mon Sep 17 00:00:00 2001 From: "heroku-linguist[bot]" <136119646+heroku-linguist[bot]@users.noreply.github.com> Date: Mon, 6 Jan 2025 18:10:58 +0000 Subject: [PATCH 1009/1195] Prepare release v288 (#1536) Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com> --- CHANGELOG.md | 6 +++++- changelogs/{unreleased => v288}/bundler_2.5.23.md | 0 changelogs/{unreleased => v288}/bundler_2.6.x_support.md | 0 lib/language_pack/version.rb | 2 +- 4 files changed, 6 insertions(+), 2 deletions(-) rename changelogs/{unreleased => v288}/bundler_2.5.23.md (100%) rename changelogs/{unreleased => v288}/bundler_2.6.x_support.md (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 30eb99c36..a496c1900 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased] + +## [v288] - 2025-01-06 + - Ruby apps using bundler 2.6+ will now receive bundler 2.6.2 (https://github.com/heroku/heroku-buildpack-ruby/pull/1535) - Ruby apps using bundler 2.5.x will now receive bundler 2.5.23 (https://github.com/heroku/heroku-buildpack-ruby/pull/1535) @@ -1613,7 +1616,8 @@ Bugfixes: * Change gem detection to use lockfile parser * use `$RACK_ENV` when thin is detected for rack apps -[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v287...main +[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v288...main +[v288]: https://github.com/heroku/heroku-buildpack-ruby/compare/v287...v288 [v287]: https://github.com/heroku/heroku-buildpack-ruby/compare/v286...v287 [v286]: https://github.com/heroku/heroku-buildpack-ruby/compare/v285...v286 [v285]: https://github.com/heroku/heroku-buildpack-ruby/compare/v284...v285 diff --git a/changelogs/unreleased/bundler_2.5.23.md b/changelogs/v288/bundler_2.5.23.md similarity index 100% rename from changelogs/unreleased/bundler_2.5.23.md rename to changelogs/v288/bundler_2.5.23.md diff --git a/changelogs/unreleased/bundler_2.6.x_support.md b/changelogs/v288/bundler_2.6.x_support.md similarity index 100% rename from changelogs/unreleased/bundler_2.6.x_support.md rename to changelogs/v288/bundler_2.6.x_support.md diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 1143c73e1..fcec48d6b 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v287" + BUILDPACK_VERSION = "v288" end end From de383370df8452fcaa32981464ccb8bda582c5e7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 Jan 2025 18:13:49 +0000 Subject: [PATCH 1010/1195] Bump webrick from 1.8.1 to 1.8.2 (#1501) Bumps [webrick](https://github.com/ruby/webrick) from 1.8.1 to 1.8.2. - [Release notes](https://github.com/ruby/webrick/releases) - [Commits](https://github.com/ruby/webrick/compare/v1.8.1...v1.8.2) --- updated-dependencies: - dependency-name: webrick dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 86917b001..4def54426 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -53,7 +53,7 @@ GEM threaded (0.0.4) toml-rb (2.2.0) citrus (~> 3.0, > 3.0) - webrick (1.8.1) + webrick (1.8.2) PLATFORMS ruby From 6320b5e03a1a0e77446203d835d0a574817e0251 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Fri, 17 Jan 2025 11:13:28 -0600 Subject: [PATCH 1011/1195] Ruby 3.3.7 (#1538) --- CHANGELOG.md | 1 + changelogs/unreleased/ruby-3-3-7.md | 9 +++++++++ 2 files changed, 10 insertions(+) create mode 100644 changelogs/unreleased/ruby-3-3-7.md diff --git a/CHANGELOG.md b/CHANGELOG.md index a496c1900..96034ade2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## [Unreleased] +- Ruby 3.3.7 is now available (https://github.com/heroku/heroku-buildpack-ruby/pull/1538) ## [v288] - 2025-01-06 diff --git a/changelogs/unreleased/ruby-3-3-7.md b/changelogs/unreleased/ruby-3-3-7.md new file mode 100644 index 000000000..75a40f185 --- /dev/null +++ b/changelogs/unreleased/ruby-3-3-7.md @@ -0,0 +1,9 @@ +## Ruby version 3.3.7 is now available + +[Ruby v3.3.7](/articles/ruby-support#ruby-versions) is now available on Heroku. To run your app using this version of Ruby, add the following `ruby` directive to your Gemfile: + +```ruby +ruby "3.3.7" +``` + +For more information on [Ruby 3.3.7, you can view the release announcement](https://www.ruby-lang.org/en/news/). From 3ecf6192769ddd1a71d2ab40c04d7fa5756d7db0 Mon Sep 17 00:00:00 2001 From: "heroku-linguist[bot]" <136119646+heroku-linguist[bot]@users.noreply.github.com> Date: Fri, 17 Jan 2025 17:57:38 +0000 Subject: [PATCH 1012/1195] Prepare release v289 (#1539) Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com> --- CHANGELOG.md | 6 +++++- changelogs/{unreleased => v289}/ruby-3-3-7.md | 0 lib/language_pack/version.rb | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) rename changelogs/{unreleased => v289}/ruby-3-3-7.md (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 96034ade2..52c64b83c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased] + +## [v289] - 2025-01-17 + - Ruby 3.3.7 is now available (https://github.com/heroku/heroku-buildpack-ruby/pull/1538) ## [v288] - 2025-01-06 @@ -1617,7 +1620,8 @@ Bugfixes: * Change gem detection to use lockfile parser * use `$RACK_ENV` when thin is detected for rack apps -[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v288...main +[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v289...main +[v289]: https://github.com/heroku/heroku-buildpack-ruby/compare/v288...v289 [v288]: https://github.com/heroku/heroku-buildpack-ruby/compare/v287...v288 [v287]: https://github.com/heroku/heroku-buildpack-ruby/compare/v286...v287 [v286]: https://github.com/heroku/heroku-buildpack-ruby/compare/v285...v286 diff --git a/changelogs/unreleased/ruby-3-3-7.md b/changelogs/v289/ruby-3-3-7.md similarity index 100% rename from changelogs/unreleased/ruby-3-3-7.md rename to changelogs/v289/ruby-3-3-7.md diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index fcec48d6b..ae9e41982 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v288" + BUILDPACK_VERSION = "v289" end end From fc8ae12a033f80f9bc7904ee5783f5e320f57104 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Thu, 23 Jan 2025 11:38:43 -0600 Subject: [PATCH 1013/1195] Jruby 9.4.10.0 (#1540) --- CHANGELOG.md | 1 + changelogs/unreleased/jruby-9.4.10.0.md | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 changelogs/unreleased/jruby-9.4.10.0.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 52c64b83c..f70f7ab90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## [Unreleased] +- JRuby 9.4.10.0 is now available (https://github.com/heroku/heroku-buildpack-ruby/pull/1540) ## [v289] - 2025-01-17 diff --git a/changelogs/unreleased/jruby-9.4.10.0.md b/changelogs/unreleased/jruby-9.4.10.0.md new file mode 100644 index 000000000..2cfa8465b --- /dev/null +++ b/changelogs/unreleased/jruby-9.4.10.0.md @@ -0,0 +1,10 @@ +## JRuby version 9.4.10.0 is now available + +[JRuby v9.4.10.0](/articles/ruby-support-reference#ruby-versions) is now available on Heroku. To run +your app using this version of Ruby, add the following `ruby` directive to your Gemfile: + +```ruby +ruby "3.1.4", engine: "jruby", engine_version: "9.4.10.0" +``` + +The JRuby release notes can be found on the [JRuby website](https://www.jruby.org/news). From 2233d6c88448e1a3cf0f681f50504eb0393fc340 Mon Sep 17 00:00:00 2001 From: "heroku-linguist[bot]" <136119646+heroku-linguist[bot]@users.noreply.github.com> Date: Thu, 23 Jan 2025 20:03:04 +0000 Subject: [PATCH 1014/1195] Prepare release v290 (#1541) Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com> --- CHANGELOG.md | 6 +++++- changelogs/{unreleased => v290}/jruby-9.4.10.0.md | 0 lib/language_pack/version.rb | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) rename changelogs/{unreleased => v290}/jruby-9.4.10.0.md (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index f70f7ab90..260a1baed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased] + +## [v290] - 2025-01-23 + - JRuby 9.4.10.0 is now available (https://github.com/heroku/heroku-buildpack-ruby/pull/1540) ## [v289] - 2025-01-17 @@ -1621,7 +1624,8 @@ Bugfixes: * Change gem detection to use lockfile parser * use `$RACK_ENV` when thin is detected for rack apps -[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v289...main +[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v290...main +[v290]: https://github.com/heroku/heroku-buildpack-ruby/compare/v289...v290 [v289]: https://github.com/heroku/heroku-buildpack-ruby/compare/v288...v289 [v288]: https://github.com/heroku/heroku-buildpack-ruby/compare/v287...v288 [v287]: https://github.com/heroku/heroku-buildpack-ruby/compare/v286...v287 diff --git a/changelogs/unreleased/jruby-9.4.10.0.md b/changelogs/v290/jruby-9.4.10.0.md similarity index 100% rename from changelogs/unreleased/jruby-9.4.10.0.md rename to changelogs/v290/jruby-9.4.10.0.md diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index ae9e41982..715436397 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v289" + BUILDPACK_VERSION = "v290" end end From 9c06658123bbc231f436b4ce2c06ab4d72bbe84a Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Thu, 30 Jan 2025 08:52:00 -0600 Subject: [PATCH 1015/1195] JRuby 9.4.11.0 (#1542) --- CHANGELOG.md | 1 + changelogs/unreleased/jruby-9.4.11.0.md | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 changelogs/unreleased/jruby-9.4.11.0.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 260a1baed..9a45438e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## [Unreleased] +- JRuby 9.4.11.0 is now available (https://github.com/heroku/heroku-buildpack-ruby/pull/1542) ## [v290] - 2025-01-23 diff --git a/changelogs/unreleased/jruby-9.4.11.0.md b/changelogs/unreleased/jruby-9.4.11.0.md new file mode 100644 index 000000000..a4bc9607c --- /dev/null +++ b/changelogs/unreleased/jruby-9.4.11.0.md @@ -0,0 +1,10 @@ +## JRuby version 9.4.11.0 is now available + +[JRuby v9.4.11.0](/articles/ruby-support-reference#ruby-versions) is now available on Heroku. To run +your app using this version of Ruby, add the following `ruby` directive to your Gemfile: + +```ruby +ruby "3.1.4", engine: "jruby", engine_version: "9.4.11.0" +``` + +The JRuby release notes can be found on the [JRuby website](https://www.jruby.org/news). From a8de3fc58ff931e082e67b0d71608876f6718185 Mon Sep 17 00:00:00 2001 From: "heroku-linguist[bot]" <136119646+heroku-linguist[bot]@users.noreply.github.com> Date: Thu, 30 Jan 2025 15:01:03 +0000 Subject: [PATCH 1016/1195] Prepare release v291 (#1543) Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com> --- CHANGELOG.md | 6 +++++- changelogs/{unreleased => v291}/jruby-9.4.11.0.md | 0 lib/language_pack/version.rb | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) rename changelogs/{unreleased => v291}/jruby-9.4.11.0.md (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a45438e0..e75f4c05e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased] + +## [v291] - 2025-01-30 + - JRuby 9.4.11.0 is now available (https://github.com/heroku/heroku-buildpack-ruby/pull/1542) ## [v290] - 2025-01-23 @@ -1625,7 +1628,8 @@ Bugfixes: * Change gem detection to use lockfile parser * use `$RACK_ENV` when thin is detected for rack apps -[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v290...main +[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v291...main +[v291]: https://github.com/heroku/heroku-buildpack-ruby/compare/v290...v291 [v290]: https://github.com/heroku/heroku-buildpack-ruby/compare/v289...v290 [v289]: https://github.com/heroku/heroku-buildpack-ruby/compare/v288...v289 [v288]: https://github.com/heroku/heroku-buildpack-ruby/compare/v287...v288 diff --git a/changelogs/unreleased/jruby-9.4.11.0.md b/changelogs/v291/jruby-9.4.11.0.md similarity index 100% rename from changelogs/unreleased/jruby-9.4.11.0.md rename to changelogs/v291/jruby-9.4.11.0.md diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 715436397..d90aa4eaa 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v290" + BUILDPACK_VERSION = "v291" end end From 72606f75abb996b6198842961cecf3f82c715fa6 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Mon, 10 Feb 2025 15:10:22 -0600 Subject: [PATCH 1017/1195] Ruby 3.2.7 (#1545) --- CHANGELOG.md | 2 ++ changelogs/unreleased/ruby-3.2.7.md | 9 +++++++++ 2 files changed, 11 insertions(+) create mode 100644 changelogs/unreleased/ruby-3.2.7.md diff --git a/CHANGELOG.md b/CHANGELOG.md index e75f4c05e..abe9b2168 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## [Unreleased] +- Ruby 3.2.7 is now available (https://github.com/heroku/heroku-buildpack-ruby/pull/1545) + ## [v291] - 2025-01-30 diff --git a/changelogs/unreleased/ruby-3.2.7.md b/changelogs/unreleased/ruby-3.2.7.md new file mode 100644 index 000000000..1219f91be --- /dev/null +++ b/changelogs/unreleased/ruby-3.2.7.md @@ -0,0 +1,9 @@ +## Ruby version 3.2.7 is now available + +[Ruby v3.2.7](/articles/ruby-support#ruby-versions) is now available on Heroku. To run your app using this version of Ruby, add the following `ruby` directive to your Gemfile: + +```ruby +ruby "3.2.7" +``` + +For more information on [Ruby 3.2.7, you can view the release announcement](https://www.ruby-lang.org/en/news/). From 95663b929006f9cc21cbf6f6a1378a11cdf67211 Mon Sep 17 00:00:00 2001 From: "heroku-linguist[bot]" <136119646+heroku-linguist[bot]@users.noreply.github.com> Date: Mon, 10 Feb 2025 21:17:02 +0000 Subject: [PATCH 1018/1195] Prepare release v292 (#1546) Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com> --- CHANGELOG.md | 6 +++++- changelogs/{unreleased => v292}/ruby-3.2.7.md | 0 lib/language_pack/version.rb | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) rename changelogs/{unreleased => v292}/ruby-3.2.7.md (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index abe9b2168..735a7c7ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased] + +## [v292] - 2025-02-10 + - Ruby 3.2.7 is now available (https://github.com/heroku/heroku-buildpack-ruby/pull/1545) @@ -1630,7 +1633,8 @@ Bugfixes: * Change gem detection to use lockfile parser * use `$RACK_ENV` when thin is detected for rack apps -[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v291...main +[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v292...main +[v292]: https://github.com/heroku/heroku-buildpack-ruby/compare/v291...v292 [v291]: https://github.com/heroku/heroku-buildpack-ruby/compare/v290...v291 [v290]: https://github.com/heroku/heroku-buildpack-ruby/compare/v289...v290 [v289]: https://github.com/heroku/heroku-buildpack-ruby/compare/v288...v289 diff --git a/changelogs/unreleased/ruby-3.2.7.md b/changelogs/v292/ruby-3.2.7.md similarity index 100% rename from changelogs/unreleased/ruby-3.2.7.md rename to changelogs/v292/ruby-3.2.7.md diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index d90aa4eaa..5b14bd18a 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v291" + BUILDPACK_VERSION = "v292" end end From 6c8fb9a56a4d5b3c2a1933f13bb45b12b32f5518 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Sat, 15 Feb 2025 16:08:38 -0700 Subject: [PATCH 1019/1195] Ruby 3.4.2 (#1548) --- CHANGELOG.md | 1 + changelogs/unreleased/ruby-3.4.2.md | 9 +++++++++ 2 files changed, 10 insertions(+) create mode 100644 changelogs/unreleased/ruby-3.4.2.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 735a7c7ec..4b36044ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## [Unreleased] +- Ruby 3.4.2 is now available (https://github.com/heroku/heroku-buildpack-ruby/pull/1548) ## [v292] - 2025-02-10 diff --git a/changelogs/unreleased/ruby-3.4.2.md b/changelogs/unreleased/ruby-3.4.2.md new file mode 100644 index 000000000..6527e6497 --- /dev/null +++ b/changelogs/unreleased/ruby-3.4.2.md @@ -0,0 +1,9 @@ +## Ruby version 3.4.2 is now available + +[Ruby v3.4.2](/articles/ruby-support#ruby-versions) is now available on Heroku. To run your app using this version of Ruby, add the following `ruby` directive to your Gemfile: + +```ruby +ruby "3.4.2" +``` + +For more information on [Ruby 3.4.2, you can view the release announcement](https://www.ruby-lang.org/en/news/). From fb393cb46e23ab809e21daeef2a97cbd5f04a370 Mon Sep 17 00:00:00 2001 From: "heroku-linguist[bot]" <136119646+heroku-linguist[bot]@users.noreply.github.com> Date: Sat, 15 Feb 2025 23:17:45 +0000 Subject: [PATCH 1020/1195] Prepare release v293 (#1549) Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com> --- CHANGELOG.md | 6 +++++- changelogs/{unreleased => v293}/ruby-3.4.2.md | 0 lib/language_pack/version.rb | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) rename changelogs/{unreleased => v293}/ruby-3.4.2.md (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b36044ab..c0e8cab36 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased] + +## [v293] - 2025-02-15 + - Ruby 3.4.2 is now available (https://github.com/heroku/heroku-buildpack-ruby/pull/1548) ## [v292] - 2025-02-10 @@ -1634,7 +1637,8 @@ Bugfixes: * Change gem detection to use lockfile parser * use `$RACK_ENV` when thin is detected for rack apps -[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v292...main +[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v293...main +[v293]: https://github.com/heroku/heroku-buildpack-ruby/compare/v292...v293 [v292]: https://github.com/heroku/heroku-buildpack-ruby/compare/v291...v292 [v291]: https://github.com/heroku/heroku-buildpack-ruby/compare/v290...v291 [v290]: https://github.com/heroku/heroku-buildpack-ruby/compare/v289...v290 diff --git a/changelogs/unreleased/ruby-3.4.2.md b/changelogs/v293/ruby-3.4.2.md similarity index 100% rename from changelogs/unreleased/ruby-3.4.2.md rename to changelogs/v293/ruby-3.4.2.md diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 5b14bd18a..07af45d2f 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v292" + BUILDPACK_VERSION = "v293" end end From 28638de7baec74764dd4cc50397b0d45da29cd06 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Mon, 3 Mar 2025 16:11:44 -0600 Subject: [PATCH 1021/1195] Add a mechanism for documenting Ruby versions via automation (#1551) * Add a mechanism for documenting Ruby versions via automation Our current deploy process looks like this for releasing a Ruby version: - Manually make a PR to the Ruby buildpack with the version in the changelog - Get it approved by another engineer - PreRelease the buildpack via automation - Merge the pre-release PR - Pull changes locally and run deploy command `bundle exec rake buildpack:release` - Then trigger S3 changes via running automations on https://github.com/heroku/docker-heroku-ruby-builder In the future there's a desire to have the https://github.com/heroku/docker-heroku-ruby-builder generate an "inventory" file that tracks binary checksums and then the buildpack will require a PR to utilize new versions. However, that's a non-trivial amount of work and Ruby versions keep getting released on Fridays when I'm on vacation and no one else is around. With this change the process can look like this: - Trigger this new workflow which updates the CHANGELOG.md and runs the pre-release automation in one - Merge that PR - Pull changes locally and run deploy command `bundle exec rake buildpack:release` - Then trigger S3 changes via running automations on https://github.com/heroku/docker-heroku-ruby-builder Which is a substantial workflow savings. This task can be removed once we implement the full inventory workflow (sometime in the vague future), but this is a quality of life upgrade for the short term. * Apply suggestions from code review Co-authored-by: Ed Morley <501702+edmorley@users.noreply.github.com> --------- Co-authored-by: Ed Morley <501702+edmorley@users.noreply.github.com> --- .github/workflows/document_ruby_version.yml | 43 +++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/document_ruby_version.yml diff --git a/.github/workflows/document_ruby_version.yml b/.github/workflows/document_ruby_version.yml new file mode 100644 index 000000000..2febb94f0 --- /dev/null +++ b/.github/workflows/document_ruby_version.yml @@ -0,0 +1,43 @@ +name: Add Ruby version to changelog && prepare release +run-name: "Add ${{ inputs.is_jruby && 'J' || ''}}Ruby ${{ inputs.ruby_version }} to the CHANGELOG.md and prepare a release" + +on: + workflow_dispatch: + inputs: + ruby_version: + description: "The Ruby version to announce" + type: string + required: true + is_jruby: + description: "JRuby release? (as opposed to MRI)" + type: boolean + default: false + required: false + +# Disable all GITHUB_TOKEN permissions, since the GitHub App token is used instead. +permissions: {} + +jobs: + prepare-release: + uses: heroku/languages-github-actions/.github/workflows/_classic-buildpack-prepare-release.yml@latest + secrets: inherit + with: + custom_update_command: | + set -euo pipefail + + sed --in-place '/## \[Unreleased\]/a\ + \ + - ${{ inputs.is_jruby && 'J' || ''}}Ruby ${{inputs.ruby_version}} is now available + ' CHANGELOG.md + + sed --in-place --regexp-extended \ + --expression "s/v${EXISTING_VERSION}/v${NEW_VERSION}/" \ + lib/language_pack/version.rb + + if compgen -G 'changelogs/unreleased/*.md' > /dev/null; then + # The unreleased changelogs directory contains a `.gitkeep` file, so we have to + # copy the markdown files individually instead of renaming the directory. + NEW_CHANGELOG_DIR="changelogs/v${NEW_VERSION}/" + mkdir -p "${NEW_CHANGELOG_DIR}" + mv changelogs/unreleased/*.md "${NEW_CHANGELOG_DIR}" + fi From b3ccc41885135ae495c604a512b523c81241914d Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Wed, 5 Mar 2025 15:00:26 -0600 Subject: [PATCH 1022/1195] Add the ruby version to the current release (#1555) * Add the ruby version to the current release This task runs after the new version is injected into the CHANGELOG. That means that if we add something under "unreleased" at this point, then it shows up in the wrong section. This commit fixes it. * Remove extra trailing newline --- .github/workflows/document_ruby_version.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/document_ruby_version.yml b/.github/workflows/document_ruby_version.yml index 2febb94f0..8eda9a650 100644 --- a/.github/workflows/document_ruby_version.yml +++ b/.github/workflows/document_ruby_version.yml @@ -24,11 +24,11 @@ jobs: with: custom_update_command: | set -euo pipefail + DATE_TODAY="$(date --utc --iso-8601)" - sed --in-place '/## \[Unreleased\]/a\ - \ - - ${{ inputs.is_jruby && 'J' || ''}}Ruby ${{inputs.ruby_version}} is now available - ' CHANGELOG.md + sed --in-place "/## \[v${NEW_VERSION}\] - ${DATE_TODAY}/a\\ + \\ + - ${{ inputs.is_jruby && 'J' || ''}}Ruby ${{inputs.ruby_version}} is now available" CHANGELOG.md sed --in-place --regexp-extended \ --expression "s/v${EXISTING_VERSION}/v${NEW_VERSION}/" \ From b43aab5c5da5d75f087fd977eec400c46c05fbd5 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Wed, 19 Mar 2025 09:01:01 -0500 Subject: [PATCH 1023/1195] Update default Ruby version to 3.3.7 (#1534) * Update default Ruby version to 3.3.6 The latest Ruby is now 3.4.x. Our ideal default policy is to use the latest release of the prior year's version. This PR updates to the latest Ruby 3.3.x version which is 3.3.6. * Update to non-deprecated method * Ruby 3.3.7 is now the default * Update test apps * s/exists?/exist?/ Fixes: ``` -----> Building on the Heroku-24 stack -----> Fetching https://github.com/heroku/heroku-buildpack-ruby#schneems/default-ruby-336 buildpack... buildpack downloaded -----> Ruby app detected ! ! undefined method `exists?' for class Dir ! /tmp/buildpacks/55030ecaa578151bf5924184e8750b99212faef5/lib/language_pack/helpers/bundler_wrapper.rb:242:in `fetch_bundler': undefined method `exists?' for class Dir (NoMethodError) return true if Dir.exists?(bundler_path) ^^^^^^^^ Did you mean? exist? ``` * Update tests * Bundler default version now 2.3.x Bundler 1.x is not able to run with Ruby 3.3 in some circumstances: ``` remote: ! There was an error parsing your Gemfile, we cannot continue remote: ! /tmp/d20250127-138-l8vq2r/bundler-1.17.3/gems/bundler-1.17.3/lib/bundler/shared_helpers.rb:29:in `root': undefined method `untaint' for an instance of Pathname (NoMethodError) remote: ! remote: ! Pathname.new(gemfile).untaint.expand_path.parent ``` This commit updates the default bundler version to 2.3.x. * Update older rails versions in tests * Update example to default bundler version * Update fixtures * Update fixtures * Remove unused test * Remove test This asserts that we ignore invalid or incorrect patch numbers i.e. p0 in the gem file.lock is not correct: ``` RUBY VERSION ruby 2.5.1p0 ``` We don't really need to keep and maintain this fixture. * Fix an error * Fix spec * Remove bundler 1.x spec This no longer builds on the platform: ``` remote: ! There was an error parsing your Gemfile, we cannot continue remote: ! /tmp/d20250204-129-9ld2nw/bundler-1.17.3/gems/bundler-1.17.3/lib/bundler/shared_helpers.rb:29:in `root': undefined method `untaint' for an instance of Pathname (NoMethodError) remote: ! remote: ! Pathname.new(gemfile).untaint.expand_path.parent remote: ! ^^^^^^^^ remote: ! from /tmp/d20250204-129-9ld2nw/bundler-1.17.3/gems/bundler-1.17.3/lib/bundler.rb:234:in `root' remote: ! from /tmp/d20250204-129-9ld2nw/bundler-1.17.3/gems/bundler-1.17.3/lib/bundler.rb:246:in `app_config_path' ``` * Fix fetcher spec and test all bundler versions * Update fixture * CI apps that use the database need one * Fix test * Fix tests * Change command so it works on bsdtar (hopefully gnutar tar too, but we will find out one way or another). * Update tests * Update fixtures * Fix missing repo * Update tests * Update test * Update fixture * Fix test * Fix test * Update fixture * Update fixtures * Remove-un-needed version write * Allow heredoc to use interpolation * Update fixtures * Fix ruby version * Update test * Update fixture * Update fixtures * Adjust test addon * Fix Rails 7 sql/schema test In Rails 7 the tasks converged into one --- CHANGELOG.md | 2 + Gemfile | 2 +- Gemfile.lock | 2 +- buildpack.toml | 2 +- changelogs/unreleased/bundler_default.md | 13 +++++ changelogs/unreleased/default_ruby.md | 3 ++ hatchet.json | 32 +++--------- hatchet.lock | 52 +++++--------------- lib/language_pack/base.rb | 2 +- lib/language_pack/cache.rb | 2 +- lib/language_pack/fetcher.rb | 2 +- lib/language_pack/helpers/bundler_wrapper.rb | 10 ++-- lib/language_pack/metadata.rb | 2 +- lib/language_pack/no_lockfile.rb | 2 +- lib/language_pack/rails3.rb | 2 +- lib/language_pack/ruby.rb | 10 ++-- lib/language_pack/ruby_version.rb | 4 +- lib/language_pack/shell_helpers.rb | 2 +- lib/language_pack/test/rails7.rb | 2 +- spec/hatchet/bundler_spec.rb | 25 ---------- spec/hatchet/ci_spec.rb | 44 ++++++++++++----- spec/hatchet/rails23_spec.rb | 4 -- spec/hatchet/rails3_spec.rb | 3 +- spec/hatchet/rails4_spec.rb | 9 ++-- spec/hatchet/rails6_spec.rb | 2 +- spec/hatchet/rubies_spec.rb | 21 +++----- spec/hatchet/ruby_spec.rb | 41 ++++++--------- spec/helpers/bundler_wrapper_spec.rb | 15 +----- spec/helpers/fetcher_spec.rb | 19 ++++--- spec/helpers/outdated_ruby_version_spec.rb | 4 +- spec/helpers/rails_runner_spec.rb | 2 +- spec/helpers/ruby_version_spec.rb | 3 ++ spec/helpers/shell_spec.rb | 2 +- spec/spec_helper.rb | 20 +++++++- 34 files changed, 165 insertions(+), 197 deletions(-) create mode 100644 changelogs/unreleased/bundler_default.md create mode 100644 changelogs/unreleased/default_ruby.md diff --git a/CHANGELOG.md b/CHANGELOG.md index c0e8cab36..21f63b4a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## [Unreleased] +- Default Ruby version is now 3.3.7 (https://github.com/heroku/heroku-buildpack-ruby/pull/1534) +- Default bundler version (when no version present in the `Gemfile.lock`) is now bundler `2.3.x` which is currently `2.3.25` (https://github.com/heroku/heroku-buildpack-ruby/pull/1534) ## [v293] - 2025-02-15 diff --git a/Gemfile b/Gemfile index c887ccc55..8aa727aa0 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ source "https://rubygems.org" git_source(:github) { |repo| "https://github.com/#{repo}.git" } -ruby '>= 3.1', '< 3.3' +ruby "3.3.7" group :development, :test do gem "toml-rb" diff --git a/Gemfile.lock b/Gemfile.lock index 4def54426..c4490f416 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -73,7 +73,7 @@ DEPENDENCIES toml-rb RUBY VERSION - ruby 3.1.6p260 + ruby 3.3.7p260 BUNDLED WITH 2.5.11 diff --git a/buildpack.toml b/buildpack.toml index 253627574..0a19ee586 100644 --- a/buildpack.toml +++ b/buildpack.toml @@ -1,6 +1,6 @@ [buildpack] name = "Ruby" -ruby_version = "3.1.6" +ruby_version = "3.3.7" [publish.Ignore] files = [ diff --git a/changelogs/unreleased/bundler_default.md b/changelogs/unreleased/bundler_default.md new file mode 100644 index 000000000..03f692719 --- /dev/null +++ b/changelogs/unreleased/bundler_default.md @@ -0,0 +1,13 @@ +## Ruby applications with no specified bundler versions now receive Bundler 2.x + +Previously applications with no `BUNDLED WITH` in their `Gemfile.lock` would receive bundler `1.x`. They will now receive the new [default bundler version](https://devcenter.heroku.com/articles/ruby-support-reference#default-bundler-version) `2.3.x`. + +It is strongly recommended that you have both a `RUBY VERSION` and `BUNDLED WITH` version listed in your `Gemfile.lock`. If you do not have those values, you can generate them and commit them to git: + +``` +$ bundle update --ruby +$ git add Gemfile.lock +$ git commit -m "Update Gemfile.lock" +``` + +Applications without these values specified in the `Gemfile.lock` may break unexpectedly when the defaults change. diff --git a/changelogs/unreleased/default_ruby.md b/changelogs/unreleased/default_ruby.md new file mode 100644 index 000000000..9aaf2a5fc --- /dev/null +++ b/changelogs/unreleased/default_ruby.md @@ -0,0 +1,3 @@ +## Default Ruby version for new apps is now 3.3.7 + +The [default Ruby version for new Ruby applications is 3.3.7](https://devcenter.heroku.com/articles/ruby-support#default-ruby-version-for-new-apps). You’ll only get the default if the application does not specify a ruby version. diff --git a/hatchet.json b/hatchet.json index 6968997e6..9f60b5ee9 100644 --- a/hatchet.json +++ b/hatchet.json @@ -4,44 +4,31 @@ "sharpstone/asset_precompile_pass", "sharpstone/asset_precompile_not_found", "sharpstone/no_rakefile", - "sharpstone/bad_rakefile", - "sharpstone/default_with_rakefile" + "sharpstone/bad_rakefile" ], "bundler": [ - "sharpstone/problem_gemfile_version", "sharpstone/git_gemspec", "sharpstone/no_lockfile", - "sharpstone/sqlite3_gemfile", - "sharpstone/nokogiri_160" + "sharpstone/sqlite3_gemfile" ], "ruby": [ "sharpstone/ruby_version_does_not_exist", - "sharpstone/ruby_193_jruby_17161_jdk7", - "sharpstone/ruby_25", "sharpstone/jruby-minimal", "sharpstone/empty-procfile", - "sharpstone/bad_ruby_version", - "sharpstone/activerecord41_scaffold", - "sharpstone/libpq_connection_error" - ], - "jruby": [ - "sharpstone/jruby_naether" + "sharpstone/bad_ruby_version" ], "rack": [ - "sharpstone/default_ruby", - "sharpstone/mri_187_nokogiri", - "sharpstone/mri_192" + "sharpstone/default_ruby" ], "rails_versions": [ "sharpstone/rails_lts_23_default_ruby", "sharpstone/rails3_default_ruby", "sharpstone/rails4_windows_mri193", "sharpstone/rails42_default_ruby", - "sharpstone/active_storage_non_local", - "sharpstone/active_storage_local", - "sharpstone/sprockets_asset_compile_true", "sharpstone/rails61", - "sharpstone/rails-jsbundling" + "sharpstone/rails-jsbundling", + "sharpstone/rails_8_ruby_schema", + "sharpstone/rails_8_sql_schema" ], "heroku": [ "heroku/ruby-getting-started" @@ -50,10 +37,7 @@ "sharpstone/minimal_webpacker" ], "ci": [ - "sharpstone/rails5_ruby_schema_format", "sharpstone/heroku-ci-json-example", - "sharpstone/rails5_sql_schema_format", - "sharpstone/ruby_no_rails_test", - "sharpstone/activerecord_rake_tasks_does_not_exist" + "sharpstone/ruby_no_rails_test" ] } diff --git a/hatchet.lock b/hatchet.lock index b1fa5cbc5..cf21facff 100644 --- a/hatchet.lock +++ b/hatchet.lock @@ -3,52 +3,34 @@ - 7755e19caf122e1373bce73ffe9b333e9411d732 - - "./repos/bundler/no_lockfile" - 1947ce9a9c276d5df1c323b2ad78d1d85c7ab4c0 -- - "./repos/bundler/nokogiri_160" - - d9a761776be43e1c685f98ef13c6ef1ee0292267 -- - "./repos/bundler/problem_gemfile_version" - - abc25a7b582a720b99148a1c8753d0d7452254bb - - "./repos/bundler/sqlite3_gemfile" - 116db685f54dae18f703b3beb90e64fdbddb048d -- - "./repos/ci/activerecord_rake_tasks_does_not_exist" - - a6b711be6921cf7a0aa4e31269c37965799ea110 - - "./repos/ci/heroku-ci-json-example" - - 4e5410a7381f486ba3df7739e02e52f32fdd4dda -- - "./repos/ci/rails5_ruby_schema_format" - - 8b8a3a7850bdba29bdefc70c0f80f35a9e6c96ae -- - "./repos/ci/rails5_sql_schema_format" - - ee81b300a1019b47bbcaec0a512932df7dc23bc0 + - 728cc99c8e80290cc07441d61a8bcd4596e696fb - - "./repos/ci/ruby_no_rails_test" - - 3916137106d59b008b67d738abe6a1438f8fbde6 + - c5925ab061f65433ec5dcbc890975f580e74c5ce - - "./repos/heroku/ruby-getting-started" - main -- - "./repos/jruby/jruby_naether" - - 4a11f8af5a3cca21f3659394e5bbac3cca9b6a2c - - "./repos/node/minimal_webpacker" - - 9152fec98df59a0bf8a5478ed428841ee135acbb + - d659577a612b12ddb44ce34e28124c025ecb22f3 - - "./repos/rack/default_ruby" - master -- - "./repos/rack/mri_187_nokogiri" - - 3fcce9c85bf560dba285cc385ae9845729195826 -- - "./repos/rack/mri_192" - - ef6b5ccf8aa2a8f5e3745934e3580dc0bd2d6d4b -- - "./repos/rails_versions/active_storage_local" - - 18853ba7dda61745995740b4ca6f5f90bbd8afba -- - "./repos/rails_versions/active_storage_non_local" - - 86dddf0127043abba1cb2890590a1d38f111edbd - - "./repos/rails_versions/rails-jsbundling" - - c58178e061d9846386ca34ea31c99f6e6bb8dbf7 + - 50e9fdf7c3a37623c676989ddebac4ee5349734b - - "./repos/rails_versions/rails3_default_ruby" - - a6b44db674c0d3538633989295e2cfd5e8e1ba0d + - 984b6d02353519251c2d1e885bf8914a2584f26a - - "./repos/rails_versions/rails42_default_ruby" - - dfa0f0133dafa62064968ea2efb6432f54350138 + - fbdaf031823f09d1514ec1d55dcb04ca2f4264ca - - "./repos/rails_versions/rails4_windows_mri193" - f4c7b6209835050468bbb87827acf652b8f4d8ce - - "./repos/rails_versions/rails61" - - e896f51e679eaf2204aa4fab6d038103fc622aed + - 47828a3e8c79b7869ca0d9a3afa4be065fa46e96 +- - "./repos/rails_versions/rails_8_ruby_schema" + - a993a3f00c8e09f733bc3b783f7e37148d0af1d4 +- - "./repos/rails_versions/rails_8_sql_schema" + - d5089812196931e858a97119de1640a86825a272 - - "./repos/rails_versions/rails_lts_23_default_ruby" - - 7178b2f97d3b2b3170b390d997dcb212dd52cd30 -- - "./repos/rails_versions/sprockets_asset_compile_true" - - 6f3aa208046a5c79e84fc272f52f5ebb7b775755 + - f3597fd6f0887763eb65ec2f83a5e9a5155d5625 - - "./repos/rake/asset_precompile_fail" - 16f7834331d6bb3fc5c284130b14eb1ff74d99d5 - - "./repos/rake/asset_precompile_not_found" @@ -57,23 +39,13 @@ - ce976c727d9f477957c499f39f4cf9603c378103 - - "./repos/rake/bad_rakefile" - 3cb9c7bf6494c59bd25fa74c2aa4531119e12a46 -- - "./repos/rake/default_with_rakefile" - - c6e0c4db8dcccb47e11d496e17adbc2dafc80dd8 - - "./repos/rake/no_rakefile" - d2ec2084b825218418dac54bd6276ac896b31cdd -- - "./repos/ruby/activerecord41_scaffold" - - 6e4662c44b49e2c3c9429f00e7e7f4708142b03f - - "./repos/ruby/bad_ruby_version" - 7bf3470265a87ea6361640aa4bfce6ce3b743520 - - "./repos/ruby/empty-procfile" - 7cae0aae424c2028b81b5d37ee24d42db8e545b9 - - "./repos/ruby/jruby-minimal" - f79860bc2866449fe065484f1542aaadd3f7cfd2 -- - "./repos/ruby/libpq_connection_error" - - c211c245f09d8335a520cd7a0b5360897d4988eb -- - "./repos/ruby/ruby_193_jruby_17161_jdk7" - - c1b632f8a96cf9b902f5cdcd7a190d46544a8144 -- - "./repos/ruby/ruby_25" - - 0cb3df80d55b61e9417f2ac00adb06e15ae37982 - - "./repos/ruby/ruby_version_does_not_exist" - 9b6ad8e3b4fa7850393a5f232bb40ff3cd414d8b diff --git a/lib/language_pack/base.rb b/lib/language_pack/base.rb index c57ae0324..c0fdea319 100644 --- a/lib/language_pack/base.rb +++ b/lib/language_pack/base.rb @@ -112,7 +112,7 @@ def build_release def write_release_yaml release = build_release - FileUtils.mkdir("tmp") unless File.exists?("tmp") + FileUtils.mkdir("tmp") unless File.exist?("tmp") File.open("tmp/heroku-buildpack-release-step.yml", 'w') do |f| f.write(release.to_yaml) end diff --git a/lib/language_pack/cache.rb b/lib/language_pack/cache.rb index 9862e22ac..18754a408 100644 --- a/lib/language_pack/cache.rb +++ b/lib/language_pack/cache.rb @@ -87,6 +87,6 @@ def cache_copy(from,to) def exists?(path) return unless @cache_base - File.exists?(@cache_base + path) + File.exist?(@cache_base + path) end end diff --git a/lib/language_pack/fetcher.rb b/lib/language_pack/fetcher.rb index d2a79c2e5..4f1edd891 100644 --- a/lib/language_pack/fetcher.rb +++ b/lib/language_pack/fetcher.rb @@ -28,7 +28,7 @@ def fetch(path) def fetch_untar(path, files_to_extract = nil, strip_components: 0) curl = curl_command("#{@host_url.join(path)} -s -o") - tar_cmd = ["tar zxf - #{files_to_extract}", "--strip #{strip_components}"] + tar_cmd = ["tar", "--strip-components=#{strip_components}", "-xzf", "- #{files_to_extract}"] run! "#{curl} - | #{tar_cmd.join(" ")}", error_class: FetchError, max_attempts: 3 diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index 64d030cfe..47ee08d84 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -42,6 +42,10 @@ class LanguagePack::Helpers::BundlerWrapper BLESSED_BUNDLER_VERSIONS["2.4"] = "2.4.22" BLESSED_BUNDLER_VERSIONS["2.5"] = "2.5.23" BLESSED_BUNDLER_VERSIONS["2.6"] = "2.6.2" + + DEFAULT_VERSION = BLESSED_BUNDLER_VERSIONS["2.3"] + + # Convert arbitrary `..x` versions BLESSED_BUNDLER_VERSIONS.default_proc = Proc.new do |hash, key| if Gem::Version.new(key).segments.first == 1 hash["1"] @@ -65,7 +69,7 @@ def self.detect_bundler_version(contents: ) minor = version_match[:minor] BLESSED_BUNDLER_VERSIONS["#{major}.#{minor}"] else - BLESSED_BUNDLER_VERSIONS["1"] + DEFAULT_VERSION end end @@ -91,7 +95,7 @@ def initialize(version_hash, major_minor) msg << "\n" msg << "```\n" msg << "BUNDLED WITH\n" - msg << " #{version_hash["1"]}\n" + msg << " #{DEFAULT_VERSION}\n" msg << "```\n" super msg end @@ -239,7 +243,7 @@ def bundler_version_escape_valve! private def fetch_bundler - return true if Dir.exists?(bundler_path) + return true if Dir.exist?(bundler_path) topic("Installing bundler #{@version}") bundler_version_escape_valve! diff --git a/lib/language_pack/metadata.rb b/lib/language_pack/metadata.rb index 56ab27e53..85388b05d 100644 --- a/lib/language_pack/metadata.rb +++ b/lib/language_pack/metadata.rb @@ -26,7 +26,7 @@ def read(key) def exists?(key) full_key = "#{FOLDER}/#{key}" - File.exists?(full_key) && !Dir.exists?(full_key) + File.exist?(full_key) && !Dir.exist?(full_key) end alias_method :include?, :exists? diff --git a/lib/language_pack/no_lockfile.rb b/lib/language_pack/no_lockfile.rb index 0bee9accb..552c6fb9d 100644 --- a/lib/language_pack/no_lockfile.rb +++ b/lib/language_pack/no_lockfile.rb @@ -3,7 +3,7 @@ class LanguagePack::NoLockfile < LanguagePack::Ruby def self.use? - !File.exists?("Gemfile.lock") + !File.exist?("Gemfile.lock") end def name diff --git a/lib/language_pack/rails3.rb b/lib/language_pack/rails3.rb index 33d02c1d3..7d6d1641e 100644 --- a/lib/language_pack/rails3.rb +++ b/lib/language_pack/rails3.rb @@ -169,7 +169,7 @@ def install_plugins # runs the tasks for the Rails 3.1 asset pipeline def run_assets_precompile_rake_task log("assets_precompile") do - if File.exists?("public/assets/manifest.yml") + if File.exist?("public/assets/manifest.yml") puts "Detected manifest.yml, assuming assets were compiled locally" return true end diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index bdb72bdb6..08d963ccb 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -629,7 +629,7 @@ def uninstall_binary(path) # users should be using `bundle pack` instead. # https://github.com/heroku/heroku-buildpack-ruby/issues/21 def remove_vendor_bundle - if File.exists?("vendor/bundle") + if File.exist?("vendor/bundle") warn(<<-WARNING) Removing `vendor/bundle`. Checking in `vendor/bundle` is not supported. Please remove this directory @@ -1130,7 +1130,7 @@ def valid_bundler_cache?(path, metadata) end # fix bug from v37 deploy - if File.exists?("#{path}/vendor/ruby_version") + if File.exist?("#{path}/vendor/ruby_version") puts "Broken cache detected. Purging build cache." cache.clear("vendor") FileUtils.rm_rf("#{path}/vendor/ruby_version") @@ -1148,7 +1148,7 @@ def valid_bundler_cache?(path, metadata) end # fix git gemspec bug from Bundler 1.3.0+ upgrade - if File.exists?(bundler_cache) && !metadata.include?(:bundler_version) && !run("find #{path}/vendor/bundle/*/*/bundler/gems/*/ -name *.gemspec").include?("No such file or directory") + if File.exist?(bundler_cache) && !metadata.include?(:bundler_version) && !run("find #{path}/vendor/bundle/*/*/bundler/gems/*/ -name *.gemspec").include?("No such file or directory") return [false, "Old bundler cache detected. Clearing bundler cache."] end @@ -1220,7 +1220,7 @@ def load_bundler_cache end # fix bug from v37 deploy - if File.exists?("vendor/ruby_version") + if File.exist?("vendor/ruby_version") puts "Broken cache detected. Purging build cache." cache.clear("vendor") FileUtils.rm_rf("vendor/ruby_version") @@ -1237,7 +1237,7 @@ def load_bundler_cache end # fix git gemspec bug from Bundler 1.3.0+ upgrade - if File.exists?(bundler_cache) && !@metadata.exists?(bundler_version_cache) && !run("find vendor/bundle/*/*/bundler/gems/*/ -name *.gemspec").include?("No such file or directory") + if File.exist?(bundler_cache) && !@metadata.exists?(bundler_version_cache) && !run("find vendor/bundle/*/*/bundler/gems/*/ -name *.gemspec").include?("No such file or directory") puts "Old bundler cache detected. Clearing bundler cache." purge_bundler_cache end diff --git a/lib/language_pack/ruby_version.rb b/lib/language_pack/ruby_version.rb index 70ba0886e..1628b6cc3 100644 --- a/lib/language_pack/ruby_version.rb +++ b/lib/language_pack/ruby_version.rb @@ -12,8 +12,8 @@ def initialize(output = "") end end - BOOTSTRAP_VERSION_NUMBER = "3.1.6".freeze - DEFAULT_VERSION_NUMBER = "3.1.6".freeze + BOOTSTRAP_VERSION_NUMBER = "3.3.7".freeze + DEFAULT_VERSION_NUMBER = "3.3.7".freeze DEFAULT_VERSION = "ruby-#{DEFAULT_VERSION_NUMBER}".freeze LEGACY_VERSION_NUMBER = "1.9.2".freeze LEGACY_VERSION = "ruby-#{LEGACY_VERSION_NUMBER}".freeze diff --git a/lib/language_pack/shell_helpers.rb b/lib/language_pack/shell_helpers.rb index 54d11d67f..0b1e380dc 100644 --- a/lib/language_pack/shell_helpers.rb +++ b/lib/language_pack/shell_helpers.rb @@ -255,7 +255,7 @@ def puts(message) end $stdout.flush - rescue ArgumentError => e + rescue ArgumentError, Encoding::CompatibilityError => e error_message = e.message raise e if error_message !~ /invalid byte sequence/ diff --git a/lib/language_pack/test/rails7.rb b/lib/language_pack/test/rails7.rb index 3af3c5010..97fd20ea8 100644 --- a/lib/language_pack/test/rails7.rb +++ b/lib/language_pack/test/rails7.rb @@ -4,6 +4,6 @@ class LanguagePack::Rails7 # Rails removed the db:schema:load_if_ruby and `db:structure:load_if_sql` tasks # they've been replaced by `db:schema:load` instead def db_prepare_test_rake_tasks - ["db:schema:load", "db:migrate"].map {|name| rake.task(name) } + ["db:schema:load", "db:migrate"].map { |name| rake.task(name) } end end diff --git a/spec/hatchet/bundler_spec.rb b/spec/hatchet/bundler_spec.rb index e343e1ed6..8d8a122ae 100644 --- a/spec/hatchet/bundler_spec.rb +++ b/spec/hatchet/bundler_spec.rb @@ -9,29 +9,4 @@ end end end - - it "deploys with version 1.x" do - abi_version = LanguagePack::RubyVersion::DEFAULT_VERSION_NUMBER.dup - abi_version[-1] = "0" # turn 2.6.6 into 2.6.0 - pending("Must enable HATCHET_EXPENSIVE_MODE") unless ENV["HATCHET_EXPENSIVE_MODE"] - - Hatchet::Runner.new("default_ruby").tap do |app| - app.before_deploy do - run!(%Q{printf "\nBUNDLED WITH\n 1.0.1\n" >> Gemfile.lock}) - end - app.deploy do - expect(app.output).to match("Installing dependencies using bundler 1.") - expect(app.output).to match("BUNDLE_GLOBAL_PATH_APPENDS_RUBY_SCOPE=1") - - # app.run_multi("ls vendor/bundle/ruby/#{abi_version}/gems") do |ls_output| - # expect(ls_output).to match("rake-") - # end - - app.run("which -a rake") do |which_rake| - expect(which_rake).to include("/app/vendor/bundle/bin/rake") - expect(which_rake).to include("/app/vendor/bundle/ruby/#{abi_version}/bin/rake") - end - end - end - end end diff --git a/spec/hatchet/ci_spec.rb b/spec/hatchet/ci_spec.rb index d2330e8fd..599fe372f 100644 --- a/spec/hatchet/ci_spec.rb +++ b/spec/hatchet/ci_spec.rb @@ -10,24 +10,46 @@ end end - it "Works with Rails 5 ruby schema apps" do - Hatchet::Runner.new("rails5_ruby_schema_format", stack: "heroku-20").tap do |app| + it "Works with Rails: ruby schema apps" do + Hatchet::Runner.new("rails_8_ruby_schema", stack: "heroku-24").tap do |app| app.before_deploy do - Pathname("Gemfile").write("ruby '2.7.5'", mode: "a") + Pathname("app.json").write(<<~EOF) + { + "environments": { + "test": { + "addons":[ + "heroku-postgresql:in-dyno" + ] + } + } + } + EOF end + app.run_ci do |test_run| - expect(test_run.output).to match("db:schema:load_if_ruby completed") + expect(test_run.output).to match("db:schema:load completed") end end end - it "Works with Rails 5 SQL schema apps" do - Hatchet::Runner.new("rails5_sql_schema_format", stack: "heroku-20").tap do |app| + it "Works with Rails: SQL schema apps" do + Hatchet::Runner.new("rails_8_sql_schema", stack: "heroku-24").tap do |app| app.before_deploy do - Pathname("Gemfile").write("ruby '2.7.5'", mode: "a") + Pathname("app.json").write(<<~EOF) + { + "environments": { + "test": { + "addons":[ + "heroku-postgresql:in-dyno" + ] + } + } + } + EOF end + app.run_ci do |test_run| - expect(test_run.output).to match("db:structure:load_if_sql completed") + expect(test_run.output).to match("db:schema:load completed") end end end @@ -43,12 +65,12 @@ it "Uses the cache" do runner = Hatchet::Runner.new("ruby_no_rails_test") runner.run_ci do |test_run| - expect(test_run.output).to match("Fetching rake") + fetching_rake = "Fetching rake" + expect(test_run.output).to match(fetching_rake) test_run.run_again - expect(test_run.output).to match("Using rake") - expect(test_run.output).to_not match("Fetching rake") + expect(test_run.output).to_not match(fetching_rake) end end end diff --git a/spec/hatchet/rails23_spec.rb b/spec/hatchet/rails23_spec.rb index a605642ed..87e5eee51 100644 --- a/spec/hatchet/rails23_spec.rb +++ b/spec/hatchet/rails23_spec.rb @@ -5,10 +5,6 @@ skip("Need RAILS_LTS_CREDS env var set") unless ENV["RAILS_LTS_CREDS"] Hatchet::Runner.new('rails_lts_23_default_ruby', config: rails_lts_config, stack: rails_lts_stack).tap do |app| - app.before_deploy do - Pathname("Gemfile").write("ruby '2.7.2'", mode: "a") - end - app.deploy do # assert deploy is successful end diff --git a/spec/hatchet/rails3_spec.rb b/spec/hatchet/rails3_spec.rb index 7593169dc..3450d9a79 100644 --- a/spec/hatchet/rails3_spec.rb +++ b/spec/hatchet/rails3_spec.rb @@ -6,7 +6,8 @@ Hatchet::Runner.new("rails3_default_ruby", config: rails_lts_config, stack: rails_lts_stack).tap do |app| app.before_deploy do - Pathname("Gemfile").write("ruby '2.7.2'", mode: "a") + set_lts_ruby_version + set_bundler_version(version: :default) end app.deploy do diff --git a/spec/hatchet/rails4_spec.rb b/spec/hatchet/rails4_spec.rb index e7b851028..d29633cb1 100644 --- a/spec/hatchet/rails4_spec.rb +++ b/spec/hatchet/rails4_spec.rb @@ -6,7 +6,8 @@ Hatchet::Runner.new("rails42_default_ruby", config: rails_lts_config, stack: rails_lts_stack).tap do |app| app.before_deploy do - Pathname("Gemfile").write("ruby '2.7.2'", mode: "a") + set_lts_ruby_version + set_bundler_version(version: :default) end app.deploy do # it Don't over-write database.yml @@ -24,7 +25,8 @@ Hatchet::Runner.new("rails42_default_ruby", config: rails_lts_config, stack: rails_lts_stack).tap do |app| app.before_deploy do - Pathname("Gemfile").write("ruby '2.7.2'", mode: "a") + set_lts_ruby_version + set_bundler_version(version: :default) Pathname("public/assets/manifest-ccf61eade4793995271564a4767ce6b6.json").tap {|p| p.dirname.mkpath; FileUtils.touch(p) } end @@ -39,7 +41,8 @@ Hatchet::Runner.new("rails42_default_ruby", config: rails_lts_config, stack: rails_lts_stack).tap do |app| app.before_deploy do - Pathname("Gemfile").write("ruby '2.7.2'", mode: "a") + set_lts_ruby_version + set_bundler_version(version: :default) Pathname("public/assets/.sprockets-manifest-040763ccc5036260c52c6adcf77d73f7.json").tap {|p| p.dirname.mkpath; FileUtils.touch(p) } end diff --git a/spec/hatchet/rails6_spec.rb b/spec/hatchet/rails6_spec.rb index b25a1ef1c..9373d1fa8 100644 --- a/spec/hatchet/rails6_spec.rb +++ b/spec/hatchet/rails6_spec.rb @@ -17,7 +17,7 @@ run! %Q{echo 'task "assets:precompile" do ; end' > Rakefile} end - Hatchet::Runner.new('rails61', before_deploy: before_deploy).deploy do |app| + Hatchet::Runner.new('rails61', before_deploy: before_deploy, config: rails_lts_config, stack: rails_lts_stack).deploy do |app| expect(app.output).to match("Fetching railties 6") expect(app.output).to match("rake assets:precompile") diff --git a/spec/hatchet/rubies_spec.rb b/spec/hatchet/rubies_spec.rb index 55e7c23b0..402ee4ef2 100644 --- a/spec/hatchet/rubies_spec.rb +++ b/spec/hatchet/rubies_spec.rb @@ -1,17 +1,5 @@ require_relative '../spec_helper' -describe "Ruby Versions on cedar-14" do - it "should deploy jruby 1.7.16.1 (jdk 7) properly on cedar-14 with sys props file" do - pending("Port this to a more recent stack") - - app = Hatchet::Runner.new("ruby_193_jruby_17161_jdk7", stack: "cedar-14") - app.deploy do |app| - expect(app.output).to match("Installing JVM: openjdk-7") - expect(app.output).not_to include("OpenJDK 64-Bit Server VM warning") - end - end -end - describe "Ruby versions" do it "should deploy jdk on heroku-24" do Hatchet::Runner.new("default_ruby", stack: "heroku-24").tap do |app| @@ -62,17 +50,20 @@ describe "Upgrading ruby apps" do it "works when changing versions" do + version = "3.3.1" + expect(version).to_not eq(LanguagePack::RubyVersion::DEFAULT_VERSION_NUMBER) app = Hatchet::Runner.new("default_ruby", stack: DEFAULT_STACK) app.deploy do |app| + # default version expect(app.run("env | grep MALLOC_ARENA_MAX")).to match("MALLOC_ARENA_MAX=2") expect(app.run("env | grep DISABLE_SPRING")).to match("DISABLE_SPRING=1") # Deploy again - run!(%Q{echo "ruby '2.7.5'" >> Gemfile}) + run!(%Q{echo "ruby '#{version}'" >> Gemfile}) run!("git add -A; git commit -m update-ruby") app.push! - expect(app.output).to match("2.7.5") - expect(app.run("ruby -v")).to match("2.7.5") + expect(app.output).to match(version) + expect(app.run("ruby -v")).to match(version) expect(app.output).to match("Ruby version change detected") end end diff --git a/spec/hatchet/ruby_spec.rb b/spec/hatchet/ruby_spec.rb index e221c4205..580219577 100644 --- a/spec/hatchet/ruby_spec.rb +++ b/spec/hatchet/ruby_spec.rb @@ -155,8 +155,6 @@ Pathname("Gemfile").write(<<~'EOF') source "https://rubygems.org" - ruby "~> 3.0.0" - gem "rake" EOF @@ -174,10 +172,7 @@ rake RUBY VERSION - ruby 3.0.3p157 - - BUNDLED WITH - 2.3.7 + ruby 3.3.1p0 EOF Pathname("Rakefile").write(<<~'EOF') @@ -197,7 +192,9 @@ end app.deploy do |app| - expect(app.output).to match("cd version ruby 3.0.3") + expected = "3.3.1" + expect(expected).to_not eq(LanguagePack::RubyVersion::DEFAULT_VERSION_NUMBER) + expect(app.output).to match("cd version ruby #{expected}") expect(app.run("which ruby").strip).to eq("/app/bin/ruby") end @@ -207,12 +204,15 @@ describe "bundler ruby version matcher" do it "installs a version even when not present in the Gemfile.lock" do + version = "3.3.1" + expect(version).to_not eq(LanguagePack::RubyVersion::DEFAULT_VERSION_NUMBER) + Hatchet::Runner.new('default_ruby', stack: DEFAULT_STACK).tap do |app| app.before_deploy do - Pathname("Gemfile").write(<<~'EOF') + Pathname("Gemfile").write(<<~EOF) source "https://rubygems.org" - ruby "~> 3.0.0" + ruby "#{version}" gem "sinatra" EOF @@ -240,27 +240,14 @@ DEPENDENCIES sinatra - - BUNDLED WITH - 2.3.7 EOF end app.deploy do |app| # Intentionally different than the default ruby version - expect(app.output).to match("3.0.0") - expect(app.run("ruby -v")).to match("3.0.0") - end - end - end - end - - describe "Rake detection" do - context "Ruby 1.9+" do - it "runs a rake task if the gem exists" do - Hatchet::Runner.new('default_with_rakefile').deploy do |app, heroku| - expect(app.output).to include("foo") + expect(app.output).to match("#{version}") + expect(app.run("ruby -v")).to match("#{version}") end end end @@ -279,8 +266,10 @@ context "active record 4.1+" do it "doesn't write a heroku specific database.yml" do - Hatchet::Runner.new("activerecord41_scaffold").deploy do |app, heroku| - expect(app.output).not_to include("Writing config/database.yml to read from DATABASE_URL") + Hatchet::Runner.new("rails61", config: rails_lts_config, stack: rails_lts_stack).tap do |app| + app.deploy do + expect(app.output).not_to include("Writing config/database.yml to read from DATABASE_URL") + end end end end diff --git a/spec/helpers/bundler_wrapper_spec.rb b/spec/helpers/bundler_wrapper_spec.rb index 3a7fdca33..df357ad84 100644 --- a/spec/helpers/bundler_wrapper_spec.rb +++ b/spec/helpers/bundler_wrapper_spec.rb @@ -112,6 +112,7 @@ def wrapper.topic(*args); end # Silence output in tests it "detects windows gemfiles" do Hatchet::App.new("rails4_windows_mri193").in_directory_fork do |dir| + require "bundler" Bundler.with_unbundled_env do expect(@bundler.install.windows_gemfile_lock?).to be_truthy end @@ -119,21 +120,9 @@ def wrapper.topic(*args); end # Silence output in tests end describe "when executing bundler" do - it "handles apps with ruby versions locked in Gemfile.lock" do - Hatchet::App.new("problem_gemfile_version").in_directory_fork do |dir| - Bundler.with_unbundled_env do - @bundler.install - - expect(@bundler.ruby_version).to include("ruby-2.5.1") - - ruby_version = LanguagePack::RubyVersion.new(@bundler.ruby_version, is_new: true) - expect(ruby_version.version_for_download).to include("ruby-2.5.1") - end - end - end - it "handles JRuby pre gemfiles" do Hatchet::App.new("jruby-minimal").in_directory_fork do |dir| + require "bundler" Bundler.with_unbundled_env do @bundler.install diff --git a/spec/helpers/fetcher_spec.rb b/spec/helpers/fetcher_spec.rb index 17d9b1368..c1a432e86 100644 --- a/spec/helpers/fetcher_spec.rb +++ b/spec/helpers/fetcher_spec.rb @@ -1,14 +1,19 @@ require 'spec_helper' describe "Fetches" do - it "bundler" do - Dir.mktmpdir do |dir| - Dir.chdir(dir) do - FileUtils.touch("Gemfile.lock") + LanguagePack::Helpers::BundlerWrapper::BLESSED_BUNDLER_VERSIONS.each do |_, version| + it "bundler #{version}" do + Dir.mktmpdir do |dir| + Dir.chdir(dir) do + lockfile = Pathname("Gemfile.lock") + FileUtils.touch(lockfile) + lockfile.write("BUNDLED WITH\n #{version}") - fetcher = LanguagePack::Fetcher.new(LanguagePack::Base::VENDOR_URL) - fetcher.fetch_untar("#{LanguagePack::Helpers::BundlerWrapper.new.dir_name}.tgz") - expect(`ls bin`).to match("bundle") + fetcher = LanguagePack::Fetcher.new(LanguagePack::Base::VENDOR_URL) + fetcher.fetch_untar("bundler/#{LanguagePack::Helpers::BundlerWrapper.new.dir_name}.tgz") + + expect(run!("ls bin")).to match("bundle") + end end end end diff --git a/spec/helpers/outdated_ruby_version_spec.rb b/spec/helpers/outdated_ruby_version_spec.rb index 410fd1ff3..6aa49fe6e 100644 --- a/spec/helpers/outdated_ruby_version_spec.rb +++ b/spec/helpers/outdated_ruby_version_spec.rb @@ -23,7 +23,7 @@ end it "handles arm 💪 architecture on heroku-24" do - ruby_version = LanguagePack::RubyVersion.new("ruby-3.1.0") + ruby_version = LanguagePack::RubyVersion.new("ruby-3.3.0") fetcher = LanguagePack::Fetcher.new( LanguagePack::Base::VENDOR_URL, stack: "heroku-24", @@ -35,7 +35,7 @@ ) outdated.call - expect(outdated.suggested_ruby_minor_version).to eq("3.1.6") + expect(outdated.suggested_ruby_minor_version).to eq("3.3.7") end it "finds the latest version on a stack" do diff --git a/spec/helpers/rails_runner_spec.rb b/spec/helpers/rails_runner_spec.rb index 8646c232a..1488c8677 100644 --- a/spec/helpers/rails_runner_spec.rb +++ b/spec/helpers/rails_runner_spec.rb @@ -29,7 +29,7 @@ it "calls run through child object" do rails_runner = LanguagePack::Helpers::RailsRunner.new - def rails_runner.call; @called ||= 0 ; @called += 1; end + def rails_runner.call; @called ||= 0 ; @called += 1; "" end def rails_runner.called; @called; end local_storage = rails_runner.detect("active_storage.service") diff --git a/spec/helpers/ruby_version_spec.rb b/spec/helpers/ruby_version_spec.rb index ffad5a5f6..70b1f27bd 100644 --- a/spec/helpers/ruby_version_spec.rb +++ b/spec/helpers/ruby_version_spec.rb @@ -62,6 +62,7 @@ it "correctly sets default ruby versions" do Hatchet::App.new("default_ruby").in_directory_fork do |dir| + require 'bundler' Bundler.with_unbundled_env do ruby_version = LanguagePack::RubyVersion.new(@bundler.install.ruby_version, is_new: true) version_number = LanguagePack::RubyVersion::DEFAULT_VERSION_NUMBER @@ -77,6 +78,7 @@ it "detects Ruby from Gemfile.lock" do Hatchet::App.new("default_ruby").in_directory_fork do |_| + require 'bundler' dir = Pathname(Dir.pwd) Bundler.with_unbundled_env do dir.join("Gemfile").write(<<~EOF) @@ -118,6 +120,7 @@ it "detects non mri engines" do Hatchet::App.new("default_ruby").in_directory_fork do |_| + require 'bundler' dir = Pathname(Dir.pwd) Bundler.with_unbundled_env do dir.join("Gemfile").write(<<~EOF) diff --git a/spec/helpers/shell_spec.rb b/spec/helpers/shell_spec.rb index 0d4eab188..ef30c836c 100644 --- a/spec/helpers/shell_spec.rb +++ b/spec/helpers/shell_spec.rb @@ -87,7 +87,7 @@ def sh.print(string); string.strip; end def sh.mcount(*args); @error_caught = true; end bad_lines = File.read("spec/fixtures/invalid_encoding.log") - expect { sh.puts(bad_lines) }.to raise_error(ArgumentError) + expect { sh.puts(bad_lines) }.to raise_error(Encoding::CompatibilityError) error_caught = sh.instance_variable_get(:"@error_caught") expect(error_caught).to eq(true) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 115ca3b18..57c63095d 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -11,7 +11,7 @@ ENV['RACK_ENV'] = 'test' -DEFAULT_STACK = 'heroku-20' +DEFAULT_STACK = 'heroku-24' def hatchet_path(path = "") @@ -60,12 +60,28 @@ def fixture_path(path) Pathname.new(__FILE__).join("../fixtures").expand_path.join(path) end +def set_lts_ruby_version + Pathname("Gemfile").write("ruby '3.3.6'", mode: "a") +end + +def set_bundler_version(version: ) + gemfile_lock = Pathname("Gemfile.lock").read + + if version == :default + version = "" + else + version = "BUNDLED WITH\n #{version}" + end + gemfile_lock.gsub!(/^BUNDLED WITH$(\r?\n) (?\d+)\.(?\d+)\.\d+/m, version) + Pathname("Gemfile.lock").write(gemfile_lock) +end + def rails_lts_config { 'BUNDLE_GEMS__RAILSLTS__COM' => ENV["RAILS_LTS_CREDS"] } end def rails_lts_stack - "heroku-20" + "heroku-22" end def hatchet_path(path = "") From 9bd2f0eec45eed40a6964856d2e23cdac3643623 Mon Sep 17 00:00:00 2001 From: "heroku-linguist[bot]" <136119646+heroku-linguist[bot]@users.noreply.github.com> Date: Wed, 19 Mar 2025 14:25:40 +0000 Subject: [PATCH 1024/1195] Prepare release v294 (#1559) Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com> --- CHANGELOG.md | 6 +++++- changelogs/{unreleased => v294}/bundler_default.md | 0 changelogs/{unreleased => v294}/default_ruby.md | 0 lib/language_pack/version.rb | 2 +- 4 files changed, 6 insertions(+), 2 deletions(-) rename changelogs/{unreleased => v294}/bundler_default.md (100%) rename changelogs/{unreleased => v294}/default_ruby.md (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 21f63b4a7..5f8e4e0fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased] + +## [v294] - 2025-03-19 + - Default Ruby version is now 3.3.7 (https://github.com/heroku/heroku-buildpack-ruby/pull/1534) - Default bundler version (when no version present in the `Gemfile.lock`) is now bundler `2.3.x` which is currently `2.3.25` (https://github.com/heroku/heroku-buildpack-ruby/pull/1534) @@ -1639,7 +1642,8 @@ Bugfixes: * Change gem detection to use lockfile parser * use `$RACK_ENV` when thin is detected for rack apps -[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v293...main +[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v294...main +[v294]: https://github.com/heroku/heroku-buildpack-ruby/compare/v293...v294 [v293]: https://github.com/heroku/heroku-buildpack-ruby/compare/v292...v293 [v292]: https://github.com/heroku/heroku-buildpack-ruby/compare/v291...v292 [v291]: https://github.com/heroku/heroku-buildpack-ruby/compare/v290...v291 diff --git a/changelogs/unreleased/bundler_default.md b/changelogs/v294/bundler_default.md similarity index 100% rename from changelogs/unreleased/bundler_default.md rename to changelogs/v294/bundler_default.md diff --git a/changelogs/unreleased/default_ruby.md b/changelogs/v294/default_ruby.md similarity index 100% rename from changelogs/unreleased/default_ruby.md rename to changelogs/v294/default_ruby.md diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 07af45d2f..5d9da50de 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v293" + BUILDPACK_VERSION = "v294" end end From 6ebd76ce96f697c29f25a5e625e6abbaf0badb92 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Thu, 20 Mar 2025 12:35:39 -0500 Subject: [PATCH 1025/1195] Raise an explicit error message for Bundler 1.x (#1561) With the Ruby 3.3.7 default, bundler 1.x no longer works on Heroku with the Ruby buildpack. Here's the details of what's causing the error: The Ruby buildpack uses Ruby code to inspect the application at build time to know what dependencies and versions to install. The version of Ruby that the buildpack uses is tied to the default Ruby version. Recently this version was changed to Ruby 3.3.7 https://devcenter.heroku.com/changelog-items/3167. The Ruby buildpack runs `bundle platform --ruby` in order to determine what Ruby version the application needs. This invokes bundler using the current Ruby version (3.3.7). However, bundler is using a method that was deprecated and removed in Ruby 3.2 https://ruby-doc.org/stdlib-2.7.1/libdoc/pathname/rdoc/Pathname.html#method-i-untaint. Because this method does not exist in Ruby 3.3 the bundler code cannot execute and fails with an error message: ``` remote: ! There was an error parsing your Gemfile, we cannot continue remote: ! /tmp/d20250319-150-o0ictl/bundler-1.17.3/gems/bundler-1.17.3/lib/bundler/shared_helpers.rb:29:in `root': undefined method `untaint' for an instance of Pathname (NoMethodError) remote: ! remote: ! Pathname.new(gemfile).untaint.expand_path.parent remote: ! ^^^^^^^^ remote: ! from /tmp/d20250319-150-o0ictl/bundler-1.17.3/gems/bundler-1.17.3/lib/bundler.rb:234:in `root' remote: ! from /tmp/d20250319-150-o0ictl/bundler-1.17.3/gems/bundler-1.17.3/lib/bundler.rb:246:in `app_config_path' remote: ! from /tmp/d20250319-150-o0ictl/bundler-1.17.3/gems/bundler-1.17.3/lib/bundler.rb:273:in `settings' remote: ! from /tmp/d20250319-150-o0ictl/bundler-1.17.3/gems/bundler-1.17.3/lib/bundler/feature_flag.rb:21:in `block in settings_method' remote: ! from /tmp/d20250319-150-o0ictl/bundler-1.17.3/gems/bundler-1.17.3/lib/bundler/cli.rb:97:in `' remote: ! from /tmp/d20250319-150-o0ictl/bundler-1.17.3/gems/bundler-1.17.3/lib/bundler/cli.rb:7:in `' remote: ! from /tmp/d20250319-150-o0ictl/bundler-1.17.3/gems/bundler-1.17.3/lib/bundler/cli.rb:6:in `' remote: ! from :136:in `require' remote: ! from :136:in `require' remote: ! from /tmp/tmp.CMaelujSAR/lib/ruby/gems/3.3.0/gems/bundler-2.5.22/exe/bundle:21:in `block in ' remote: ! from /tmp/d20250319-150-o0ictl/bundler-1.17.3/gems/bundler-1.17.3/lib/bundler/friendly_errors.rb:124:in `with_friendly_errors' remote: ! from /tmp/tmp.CMaelujSAR/lib/ruby/gems/3.3.0/gems/bundler-2.5.22/exe/bundle:20:in `' remote: ! from /tmp/d20250319-150-o0ictl/bundler-1.17.3/bin/bundle:23:in `load' remote: ! from /tmp/d20250319-150-o0ictl/bundler-1.17.3/bin/bundle:23:in `
' ``` Bundler `1.17.3` was last released on December 27, 2018, and is no longer supported by bundler/rubygems core, so it has not been patched to remove this deprecated method. You can fix this issue by upgrading your application to bundler 2.3.x. I suggest `2.3.27`. Run: ``` $ gem install bundler -v 2.3.27 $ bundle update --bundler ``` Verify that the correct version is listed in the Gemfile.lock: ``` $ cat Gemfile.lock | grep "BUNDLED WITH" -A2 BUNDLED WITH 2.3.27 ``` And check the results into git: ``` $ git add Gemfile.lock $ git commit -m "Update bundler version to 2.3.x" ``` Then deploy. Bundler 2.3.x supports Ruby >= 2.3.0 so it should work for your application. If you're using an older version of Rails that's locked to an older version of bundler, you can work around this with Rails LTS. That information and other upgrade suggestions are here https://www.reddit.com/r/Heroku/comments/1ij7b89/upgrading_ruby_versions_to_run_on_heroku24/. ## Additional concerns Beyond `bundle platform --ruby` the buildpack also requires bundler internals to parse and load the Gemfile.lock. This strategy only works if the version of Ruby we're using for the buildpack is capable of running that version of bundler. Previously we only supported one version of bundler, but now that we support multiple, the Ruby version must be capable of running them all. We can move away from `bundle platform --ruby` by parsing the `Gemfile.lock` manually (this is what the CNB does) we can move away from requiring an arbitrary bundler version by listing out gems after they're installed via `gem list` or `bundle list`. However these are two relatively large behavior changes. It's still possible to temporarily use bundler 1.17.3 on the platform by using an older buildpack version https://devcenter.heroku.com/articles/bundler-version#using-an-older-version-of-bundler. However this should only be considered a temporary fix and not a long term one. --- CHANGELOG.md | 2 ++ lib/language_pack/helpers/bundler_wrapper.rb | 18 ++++++++++++++++-- spec/helpers/bundler_wrapper_spec.rb | 16 +++------------- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f8e4e0fc..605107fe8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,11 +2,13 @@ ## [Unreleased] +- Explicit error message raised with upgrade instructions for applications specifying bundler `1.x` in the Gemfile.lock (https://github.com/heroku/heroku-buildpack-ruby/pull/1561) ## [v294] - 2025-03-19 - Default Ruby version is now 3.3.7 (https://github.com/heroku/heroku-buildpack-ruby/pull/1534) - Default bundler version (when no version present in the `Gemfile.lock`) is now bundler `2.3.x` which is currently `2.3.25` (https://github.com/heroku/heroku-buildpack-ruby/pull/1534) +- Bundler 1.x will no longer work with the Ruby buildpack (https://github.com/heroku/heroku-buildpack-ruby/pull/1534) ## [v293] - 2025-02-15 diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index 47ee08d84..4bec9d61b 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -36,7 +36,6 @@ class LanguagePack::Helpers::BundlerWrapper include LanguagePack::ShellHelpers BLESSED_BUNDLER_VERSIONS = {} - BLESSED_BUNDLER_VERSIONS["1"] = "1.17.3" # Heroku-20's oldest Ruby verison is 2.5.x which doesn't work with bundler 2.4 BLESSED_BUNDLER_VERSIONS["2.3"] = "2.3.25" BLESSED_BUNDLER_VERSIONS["2.4"] = "2.4.22" @@ -48,7 +47,22 @@ class LanguagePack::Helpers::BundlerWrapper # Convert arbitrary `..x` versions BLESSED_BUNDLER_VERSIONS.default_proc = Proc.new do |hash, key| if Gem::Version.new(key).segments.first == 1 - hash["1"] + raise BuildpackError.new(<<~EOF) + Cannot install bundler 1.17.3 + + Your application requested bundler `#{key}` in the `Gemfile.lock` + which resolved to `1.17.3`. This version no longer works on + Heroku. Please upgrade to bundler `2.3.x` or higher: + + ``` + $ gem install bundler -v #{hash["2.3"]} + $ bundle update --bundler + $ git add Gemfile.lock + $ git commit -m "Updated bundler version" + ``` + + https://devcenter.heroku.com/changelog-items/3166 + EOF elsif Gem::Version::new(key).segments.first == 2 if Gem::Version.new(key) > Gem::Version.new("2.6") hash["2.6"] diff --git a/spec/helpers/bundler_wrapper_spec.rb b/spec/helpers/bundler_wrapper_spec.rb index df357ad84..baca1aabd 100644 --- a/spec/helpers/bundler_wrapper_spec.rb +++ b/spec/helpers/bundler_wrapper_spec.rb @@ -15,9 +15,9 @@ describe "Bundler version detection" do it "supports minor versions" do wrapper_klass = LanguagePack::Helpers::BundlerWrapper - version = wrapper_klass.detect_bundler_version(contents: "BUNDLED WITH\n 1.17.3") - expect(wrapper_klass::BLESSED_BUNDLER_VERSIONS.key?("1")).to be_truthy - expect(version).to eq(wrapper_klass::BLESSED_BUNDLER_VERSIONS["1"]) + expect { + wrapper_klass.detect_bundler_version(contents: "BUNDLED WITH\n 1.17.3") + }.to raise_error(BuildpackError) version = wrapper_klass.detect_bundler_version(contents: "BUNDLED WITH\n 2.2.7") expect(wrapper_klass::BLESSED_BUNDLER_VERSIONS.key?("2.3")).to be_truthy @@ -59,16 +59,6 @@ expect(bundler.supports_multiple_platforms?).to be_truthy end end - - it "reports false on bundler prior to 2.2" do - Dir.mktmpdir do |dir| - gemfile = Pathname(dir).join("Gemfile") - lockfile = Pathname(dir).join("Gemfile.lock").tap {|p| p.write("BUNDLED WITH\n 1.15.2") } - - bundler = LanguagePack::Helpers::BundlerWrapper.new(gemfile_path: gemfile) - expect(bundler.supports_multiple_platforms?).to be_falsey - end - end end describe "BundlerWrapper mutates rubyopt" do From 7ceb62dba1cc098e3925b151f63c5b6a4d7cd0fa Mon Sep 17 00:00:00 2001 From: "heroku-linguist[bot]" <136119646+heroku-linguist[bot]@users.noreply.github.com> Date: Thu, 20 Mar 2025 18:11:07 +0000 Subject: [PATCH 1026/1195] Prepare release v295 (#1562) Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com> --- CHANGELOG.md | 6 +++++- lib/language_pack/version.rb | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 605107fe8..2f29746ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased] + +## [v295] - 2025-03-20 + - Explicit error message raised with upgrade instructions for applications specifying bundler `1.x` in the Gemfile.lock (https://github.com/heroku/heroku-buildpack-ruby/pull/1561) ## [v294] - 2025-03-19 @@ -1644,7 +1647,8 @@ Bugfixes: * Change gem detection to use lockfile parser * use `$RACK_ENV` when thin is detected for rack apps -[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v294...main +[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v295...main +[v295]: https://github.com/heroku/heroku-buildpack-ruby/compare/v294...v295 [v294]: https://github.com/heroku/heroku-buildpack-ruby/compare/v293...v294 [v293]: https://github.com/heroku/heroku-buildpack-ruby/compare/v292...v293 [v292]: https://github.com/heroku/heroku-buildpack-ruby/compare/v291...v292 diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 5d9da50de..fd9056c52 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v294" + BUILDPACK_VERSION = "v295" end end From 47edb0fb991cbc0365c348e331f11cee22e40489 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Fri, 21 Mar 2025 09:19:33 -0500 Subject: [PATCH 1027/1195] Re-enable bundler 1.x, add a Warning (#1565) * Bootstrap with Ruby 3.2 * Warn instead of error on Bundler 1.x * Ruby buildpack bootstrap 3.1.6 * Changelog * Update version constant * Revert error class caught --- CHANGELOG.md | 1 + Gemfile | 2 +- Gemfile.lock | 2 +- buildpack.toml | 2 +- lib/language_pack/helpers/bundler_wrapper.rb | 21 ++++------------ lib/language_pack/ruby.rb | 25 ++++++++++++++++++++ lib/language_pack/ruby_version.rb | 2 +- spec/hatchet/bundler_spec.rb | 22 +++++++++++++++++ spec/helpers/bundler_wrapper_spec.rb | 6 ++--- spec/helpers/config_spec.rb | 6 ++--- spec/helpers/shell_spec.rb | 2 +- spec/spec_helper.rb | 2 ++ 12 files changed, 65 insertions(+), 28 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f29746ea..8a4b51d7d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## [Unreleased] +- Bundler `1.x` usage error is downgraded to a warning. This warning will be moved to an error once `heroku-20` is Sunset (https://github.com/heroku/heroku-buildpack-ruby/pull/1565) ## [v295] - 2025-03-20 diff --git a/Gemfile b/Gemfile index 8aa727aa0..632e80ab6 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ source "https://rubygems.org" git_source(:github) { |repo| "https://github.com/#{repo}.git" } -ruby "3.3.7" +ruby "3.1.6" group :development, :test do gem "toml-rb" diff --git a/Gemfile.lock b/Gemfile.lock index c4490f416..4def54426 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -73,7 +73,7 @@ DEPENDENCIES toml-rb RUBY VERSION - ruby 3.3.7p260 + ruby 3.1.6p260 BUNDLED WITH 2.5.11 diff --git a/buildpack.toml b/buildpack.toml index 0a19ee586..253627574 100644 --- a/buildpack.toml +++ b/buildpack.toml @@ -1,6 +1,6 @@ [buildpack] name = "Ruby" -ruby_version = "3.3.7" +ruby_version = "3.1.6" [publish.Ignore] files = [ diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index 4bec9d61b..224732f32 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -37,6 +37,7 @@ class LanguagePack::Helpers::BundlerWrapper BLESSED_BUNDLER_VERSIONS = {} # Heroku-20's oldest Ruby verison is 2.5.x which doesn't work with bundler 2.4 + BLESSED_BUNDLER_VERSIONS["1"] = "1.17.3" BLESSED_BUNDLER_VERSIONS["2.3"] = "2.3.25" BLESSED_BUNDLER_VERSIONS["2.4"] = "2.4.22" BLESSED_BUNDLER_VERSIONS["2.5"] = "2.5.23" @@ -47,22 +48,7 @@ class LanguagePack::Helpers::BundlerWrapper # Convert arbitrary `..x` versions BLESSED_BUNDLER_VERSIONS.default_proc = Proc.new do |hash, key| if Gem::Version.new(key).segments.first == 1 - raise BuildpackError.new(<<~EOF) - Cannot install bundler 1.17.3 - - Your application requested bundler `#{key}` in the `Gemfile.lock` - which resolved to `1.17.3`. This version no longer works on - Heroku. Please upgrade to bundler `2.3.x` or higher: - - ``` - $ gem install bundler -v #{hash["2.3"]} - $ bundle update --bundler - $ git add Gemfile.lock - $ git commit -m "Updated bundler version" - ``` - - https://devcenter.heroku.com/changelog-items/3166 - EOF + hash["1"] elsif Gem::Version::new(key).segments.first == 2 if Gem::Version.new(key) > Gem::Version.new("2.6") hash["2.6"] @@ -81,7 +67,8 @@ def self.detect_bundler_version(contents: ) if version_match major = version_match[:major] minor = version_match[:minor] - BLESSED_BUNDLER_VERSIONS["#{major}.#{minor}"] + version = BLESSED_BUNDLER_VERSIONS["#{major}.#{minor}"] + version else DEFAULT_VERSION end diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 08d963ccb..7c24de80f 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -79,6 +79,7 @@ def compile Dir.chdir(build_path) remove_vendor_bundle warn_bundler_upgrade + warn_bundler_1x warn_bad_binstubs install_ruby(slug_vendor_ruby) setup_language_pack_environment( @@ -108,6 +109,30 @@ def compile raise e end + def warn_bundler_1x + bundler_versions = LanguagePack::Helpers::BundlerWrapper::BLESSED_BUNDLER_VERSIONS + if bundler.version == bundler_versions["1"] + warn(<<~EOF, inline: true) + Deprecating bundler 1.17.3 + + Your application requested bundler `1.x` in the `Gemfile.lock` + which resolved to `1.17.3`. This version is no longer maintained + by bundler core and will no longer work soon. + + Please upgrade to bundler `2.3.x` or higher: + + ``` + $ gem install bundler -v #{bundler_versions["2.3"]} + $ bundle update --bundler + $ git add Gemfile.lock + $ git commit -m "Updated bundler version" + ``` + + https://devcenter.heroku.com/changelog-items/3166 + EOF + end + end + def cleanup end diff --git a/lib/language_pack/ruby_version.rb b/lib/language_pack/ruby_version.rb index 1628b6cc3..a244b25d7 100644 --- a/lib/language_pack/ruby_version.rb +++ b/lib/language_pack/ruby_version.rb @@ -12,7 +12,7 @@ def initialize(output = "") end end - BOOTSTRAP_VERSION_NUMBER = "3.3.7".freeze + BOOTSTRAP_VERSION_NUMBER = "3.1.6".freeze DEFAULT_VERSION_NUMBER = "3.3.7".freeze DEFAULT_VERSION = "ruby-#{DEFAULT_VERSION_NUMBER}".freeze LEGACY_VERSION_NUMBER = "1.9.2".freeze diff --git a/spec/hatchet/bundler_spec.rb b/spec/hatchet/bundler_spec.rb index 8d8a122ae..74184e01e 100644 --- a/spec/hatchet/bundler_spec.rb +++ b/spec/hatchet/bundler_spec.rb @@ -9,4 +9,26 @@ end end end + + it "deploys with version 1.x" do + pending("Must enable HATCHET_EXPENSIVE_MODE") unless ENV["HATCHET_EXPENSIVE_MODE"] + + Hatchet::Runner.new("default_ruby").tap do |app| + app.before_deploy do + set_bundler_version(version: "1.17.3") + Pathname("Gemfile.lock").write(<<~EOF, mode: "a") + + RUBY VERSION + ruby 3.1.6 + EOF + end + app.deploy do + expect(app.output).to match("Deprecating bundler 1.17.3") + + app.run("which -a rake") do |which_rake| + expect(which_rake).to include("/app/vendor/bundle/bin/rake") + end + end + end + end end diff --git a/spec/helpers/bundler_wrapper_spec.rb b/spec/helpers/bundler_wrapper_spec.rb index baca1aabd..cf0362d2b 100644 --- a/spec/helpers/bundler_wrapper_spec.rb +++ b/spec/helpers/bundler_wrapper_spec.rb @@ -15,9 +15,9 @@ describe "Bundler version detection" do it "supports minor versions" do wrapper_klass = LanguagePack::Helpers::BundlerWrapper - expect { - wrapper_klass.detect_bundler_version(contents: "BUNDLED WITH\n 1.17.3") - }.to raise_error(BuildpackError) + version = wrapper_klass.detect_bundler_version(contents: "BUNDLED WITH\n 1.17.3") + expect(wrapper_klass::BLESSED_BUNDLER_VERSIONS.key?("1")).to be_truthy + expect(version).to eq(wrapper_klass::BLESSED_BUNDLER_VERSIONS["1"]) version = wrapper_klass.detect_bundler_version(contents: "BUNDLED WITH\n 2.2.7") expect(wrapper_klass::BLESSED_BUNDLER_VERSIONS.key?("2.3")).to be_truthy diff --git a/spec/helpers/config_spec.rb b/spec/helpers/config_spec.rb index 437725745..eaa8d2b9c 100644 --- a/spec/helpers/config_spec.rb +++ b/spec/helpers/config_spec.rb @@ -9,9 +9,9 @@ expect(`ruby -v`).to match(Regexp.escape(LanguagePack::RubyVersion::BOOTSTRAP_VERSION_NUMBER)) - bootstrap_version = Gem::Version.new(LanguagePack::RubyVersion::BOOTSTRAP_VERSION_NUMBER) - default_version = Gem::Version.new(LanguagePack::RubyVersion::DEFAULT_VERSION_NUMBER) + # bootstrap_version = Gem::Version.new(LanguagePack::RubyVersion::BOOTSTRAP_VERSION_NUMBER) + # default_version = Gem::Version.new(LanguagePack::RubyVersion::DEFAULT_VERSION_NUMBER) - expect(bootstrap_version).to be >= default_version + # expect(bootstrap_version).to be >= default_version end end diff --git a/spec/helpers/shell_spec.rb b/spec/helpers/shell_spec.rb index ef30c836c..0d4eab188 100644 --- a/spec/helpers/shell_spec.rb +++ b/spec/helpers/shell_spec.rb @@ -87,7 +87,7 @@ def sh.print(string); string.strip; end def sh.mcount(*args); @error_caught = true; end bad_lines = File.read("spec/fixtures/invalid_encoding.log") - expect { sh.puts(bad_lines) }.to raise_error(Encoding::CompatibilityError) + expect { sh.puts(bad_lines) }.to raise_error(ArgumentError) error_caught = sh.instance_variable_get(:"@error_caught") expect(error_caught).to eq(true) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 57c63095d..82b0b8e92 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -73,6 +73,8 @@ def set_bundler_version(version: ) version = "BUNDLED WITH\n #{version}" end gemfile_lock.gsub!(/^BUNDLED WITH$(\r?\n) (?\d+)\.(?\d+)\.\d+/m, version) + gemfile_lock << "\n#{version}" unless gemfile_lock.match?(/^BUNDLED WITH/) + Pathname("Gemfile.lock").write(gemfile_lock) end From b557162c9b5e7413a868fa4ce1746857d4e170ec Mon Sep 17 00:00:00 2001 From: "heroku-linguist[bot]" <136119646+heroku-linguist[bot]@users.noreply.github.com> Date: Fri, 21 Mar 2025 14:31:24 +0000 Subject: [PATCH 1028/1195] Prepare release v296 (#1566) Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com> --- CHANGELOG.md | 6 +++++- lib/language_pack/version.rb | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a4b51d7d..71bb15faa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased] + +## [v296] - 2025-03-21 + - Bundler `1.x` usage error is downgraded to a warning. This warning will be moved to an error once `heroku-20` is Sunset (https://github.com/heroku/heroku-buildpack-ruby/pull/1565) ## [v295] - 2025-03-20 @@ -1648,7 +1651,8 @@ Bugfixes: * Change gem detection to use lockfile parser * use `$RACK_ENV` when thin is detected for rack apps -[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v295...main +[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v296...main +[v296]: https://github.com/heroku/heroku-buildpack-ruby/compare/v295...v296 [v295]: https://github.com/heroku/heroku-buildpack-ruby/compare/v294...v295 [v294]: https://github.com/heroku/heroku-buildpack-ruby/compare/v293...v294 [v293]: https://github.com/heroku/heroku-buildpack-ruby/compare/v292...v293 diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index fd9056c52..0dbc56765 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v295" + BUILDPACK_VERSION = "v296" end end From c9d002af6add6b3be4d04518f41f5ce761fa2fcb Mon Sep 17 00:00:00 2001 From: "heroku-linguist[bot]" <136119646+heroku-linguist[bot]@users.noreply.github.com> Date: Wed, 26 Mar 2025 12:33:52 +0000 Subject: [PATCH 1029/1195] Prepare release v297 (#1567) Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com> --- CHANGELOG.md | 8 +++++++- lib/language_pack/version.rb | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 71bb15faa..07d396e34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ ## [Unreleased] +## [v297] - 2025-03-26 + +- Ruby 3.1.7 and 3.2.8 is now available + + ## [v296] - 2025-03-21 - Bundler `1.x` usage error is downgraded to a warning. This warning will be moved to an error once `heroku-20` is Sunset (https://github.com/heroku/heroku-buildpack-ruby/pull/1565) @@ -1651,7 +1656,8 @@ Bugfixes: * Change gem detection to use lockfile parser * use `$RACK_ENV` when thin is detected for rack apps -[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v296...main +[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v297...main +[v297]: https://github.com/heroku/heroku-buildpack-ruby/compare/v296...v297 [v296]: https://github.com/heroku/heroku-buildpack-ruby/compare/v295...v296 [v295]: https://github.com/heroku/heroku-buildpack-ruby/compare/v294...v295 [v294]: https://github.com/heroku/heroku-buildpack-ruby/compare/v293...v294 diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 0dbc56765..e969be762 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v296" + BUILDPACK_VERSION = "v297" end end From 0fa0de3b1087f2d54c76aeac9e33dea7c0d0e598 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Thu, 27 Mar 2025 13:24:38 -0500 Subject: [PATCH 1030/1195] Ensure workflow uses same bundler version (#1568) * Ensure workflow uses same bundler version * Fix test --- .github/workflows/hatchet_app_cleaner.yml | 2 +- spec/helpers/config_spec.rb | 8 ++++---- spec/helpers/outdated_ruby_version_spec.rb | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/hatchet_app_cleaner.yml b/.github/workflows/hatchet_app_cleaner.yml index a7298455c..1e810bd47 100644 --- a/.github/workflows/hatchet_app_cleaner.yml +++ b/.github/workflows/hatchet_app_cleaner.yml @@ -24,7 +24,7 @@ jobs: uses: ruby/setup-ruby@v1 with: bundler-cache: true - ruby-version: "3.1" + ruby-version: "3.1.6" - name: Run Hatchet destroy # Only apps older than 10 minutes are destroyed, to ensure that any # in progress CI runs are not interrupted. diff --git a/spec/helpers/config_spec.rb b/spec/helpers/config_spec.rb index eaa8d2b9c..8f4f01a87 100644 --- a/spec/helpers/config_spec.rb +++ b/spec/helpers/config_spec.rb @@ -9,9 +9,9 @@ expect(`ruby -v`).to match(Regexp.escape(LanguagePack::RubyVersion::BOOTSTRAP_VERSION_NUMBER)) - # bootstrap_version = Gem::Version.new(LanguagePack::RubyVersion::BOOTSTRAP_VERSION_NUMBER) - # default_version = Gem::Version.new(LanguagePack::RubyVersion::DEFAULT_VERSION_NUMBER) - - # expect(bootstrap_version).to be >= default_version + ci_task = Pathname(".github").join("workflows").join("hatchet_app_cleaner.yml").read + ci_task_yml = YAML.load(ci_task) + task = ci_task_yml["jobs"]["hatchet-app-cleaner"]["steps"].detect {|step| step["uses"].match?(/ruby\/setup-ruby/)} or raise "Not found" + expect(task["with"]["ruby-version"]).to match(LanguagePack::RubyVersion::BOOTSTRAP_VERSION_NUMBER) end end diff --git a/spec/helpers/outdated_ruby_version_spec.rb b/spec/helpers/outdated_ruby_version_spec.rb index 6aa49fe6e..6c24ecf49 100644 --- a/spec/helpers/outdated_ruby_version_spec.rb +++ b/spec/helpers/outdated_ruby_version_spec.rb @@ -19,7 +19,7 @@ ) outdated.call - expect(outdated.suggested_ruby_minor_version).to eq("3.1.6") + expect(outdated.suggested_ruby_minor_version).to eq("3.1.7") end it "handles arm 💪 architecture on heroku-24" do From 5f9b8ecea768a1c2fc61f45a5de6ed296b163b1d Mon Sep 17 00:00:00 2001 From: Pablo Temporini Date: Thu, 3 Apr 2025 11:06:10 -0300 Subject: [PATCH 1031/1195] Update repo metadata (#1572) Signed-off-by: Pablo Temporini --- .github/CODEOWNERS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 2fd0356d9..fde389a62 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,4 +1,6 @@ # Default to requesting pull request reviews from the Heroku Languages team. +#ECCN:Open Source +#GUSINFO:Languages,Heroku Ruby Platform * @heroku/languages # However, request review from the language owner instead for files that are updated From dfe459b9f4aa4175bc3a3ac46c308dfc6877ac52 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Thu, 3 Apr 2025 13:11:26 -0500 Subject: [PATCH 1032/1195] Add observability (#1569) * Add Heroku YAML report builder This utility class writes a yaml file for capturing observability metrics. * Add Ruby version metrics to global report * Implement bin/report * Report bundler version * Observe railties and rack versions * Changelog * Document error tolerance behavior * Update captured ruby version information * Fix tests * Document RubyVersion accessors * Cleaner major ruby version * Remove unused legacy ruby logic We no longer provide Ruby 1.9.2 * Silence warnings --- CHANGELOG.md | 2 +- bin/report | 13 ++++ bin/support/ruby_compile | 7 ++ lib/heroku_build_report.rb | 64 +++++++++++++++++++ lib/language_pack.rb | 2 + lib/language_pack/base.rb | 1 + lib/language_pack/helpers/bundler_wrapper.rb | 29 +++++++-- .../installers/heroku_ruby_installer.rb | 11 +++- lib/language_pack/ruby.rb | 4 ++ lib/language_pack/ruby_version.rb | 49 +++++++++----- spec/hatchet/ruby_spec.rb | 38 ++++++++++- spec/helpers/bundler_wrapper_spec.rb | 16 ++++- spec/helpers/heroku_build_report_spec.rb | 26 ++++++++ spec/installers/heroku_ruby_installer_spec.rb | 45 +++++++++++-- 14 files changed, 276 insertions(+), 31 deletions(-) create mode 100755 bin/report create mode 100644 lib/heroku_build_report.rb create mode 100644 spec/helpers/heroku_build_report_spec.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index 07d396e34..c12801703 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,12 +2,12 @@ ## [Unreleased] +- Added observability metrics (https://github.com/heroku/heroku-buildpack-ruby/pull/1569) ## [v297] - 2025-03-26 - Ruby 3.1.7 and 3.2.8 is now available - ## [v296] - 2025-03-21 - Bundler `1.x` usage error is downgraded to a warning. This warning will be moved to an error once `heroku-20` is Sunset (https://github.com/heroku/heroku-buildpack-ruby/pull/1565) diff --git a/bin/report b/bin/report new file mode 100755 index 000000000..7e7a33331 --- /dev/null +++ b/bin/report @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +set -euo pipefail + +CACHE_DIR="${2}" +REPORT_FILE="${CACHE_DIR}/.heroku/ruby/build_report.yml" + +# Whilst the release file is always written by the buildpack, some apps use +# third-party slug cleaner buildpacks to remove this and other files, so we +# cannot assume it still exists by the time the release step runs. +if [[ -f "${REPORT_FILE}" ]]; then + cat "${REPORT_FILE}" +fi diff --git a/bin/support/ruby_compile b/bin/support/ruby_compile index 7d5b3e1fe..83c2c39f4 100755 --- a/bin/support/ruby_compile +++ b/bin/support/ruby_compile @@ -10,6 +10,13 @@ $stdout.sync = true $:.unshift File.expand_path("../../../lib", __FILE__) require "language_pack" require "language_pack/shell_helpers" +HerokuBuildReport.set_global( + # Coupled with `bin/report` + path: Pathname(ARGV[1]) + .join(".heroku") + .join("ruby") + .join("build_report.yml") +).tap(&:clear!) begin LanguagePack::ShellHelpers.initialize_env(ARGV[2]) diff --git a/lib/heroku_build_report.rb b/lib/heroku_build_report.rb new file mode 100644 index 000000000..1fa2e6229 --- /dev/null +++ b/lib/heroku_build_report.rb @@ -0,0 +1,64 @@ +require 'yaml' +require 'pathname' + +# Observability reporting for builds +# +# Example usage: +# +# HerokuBuildReport::GLOBAL.capture( +# "ruby_version" => "3.4.2" +# ) +module HerokuBuildReport + # Accumulates data in memory and writes it to the specified path in YAML format + # + # Writes data to disk on every capture. Later `bin/report` emits the disk contents + class YamlReport + attr_reader :data + + def initialize(path: ) + @path = Pathname(path).expand_path + @path.dirname.mkpath + FileUtils.touch(@path) + @data = {} + end + + def clear! + @data.clear + @path.write("") + end + + def capture(metrics = {}) + metrics.each do |(key, value)| + return if key.nil? || key.to_s.strip.empty? + + key = key&.strip + raise "Key cannot be empty (#{key.inspect} => #{value})" if key.nil? || key.empty? + + @data["#{key}"] = value + end + + @path.write(@data.to_yaml) + end + end + + # Current load order of the various "language packs" + def self.set_global(path: ) + YamlReport.new(path: path).tap { |report| + # Silence warning about setting a constant + begin + old_verbose = $VERBOSE + $VERBOSE = nil + const_set(:GLOBAL, report) + ensure + $VERBOSE = old_verbose + end + } + end + + # Stores data in memory only, does not persist to disk + def self.dev_null + YamlReport.new(path: "/dev/null") + end + + GLOBAL = self.dev_null # Changed via `set_global` +end diff --git a/lib/language_pack.rb b/lib/language_pack.rb index 546194803..ae88f58d0 100644 --- a/lib/language_pack.rb +++ b/lib/language_pack.rb @@ -23,6 +23,8 @@ def self.detect(*args) $:.unshift File.expand_path("../../vendor", __FILE__) $:.unshift File.expand_path("..", __FILE__) +require 'heroku_build_report' + require 'language_pack/shell_helpers' require "language_pack/helpers/plugin_installer" require "language_pack/helpers/stale_file_cleaner" diff --git a/lib/language_pack/base.rb b/lib/language_pack/base.rb index c0fdea319..717f5c363 100644 --- a/lib/language_pack/base.rb +++ b/lib/language_pack/base.rb @@ -36,6 +36,7 @@ def initialize(build_path, cache_path = nil) @id = Digest::SHA1.hexdigest("#{Time.now.to_f}-#{rand(1000000)}")[0..10] @fetchers = {:buildpack => LanguagePack::Fetcher.new(VENDOR_URL) } @arch = get_arch + @report = HerokuBuildReport::GLOBAL Dir.chdir build_path end diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index 224732f32..7c7689bc4 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -62,11 +62,10 @@ class LanguagePack::Helpers::BundlerWrapper end end - def self.detect_bundler_version(contents: ) - version_match = contents.match(BUNDLED_WITH_REGEX) - if version_match - major = version_match[:major] - minor = version_match[:minor] + def self.detect_bundler_version(contents: , bundled_with: contents.match(BUNDLED_WITH_REGEX)) + if bundled_with + major = bundled_with[:major] + minor = bundled_with[:minor] version = BLESSED_BUNDLER_VERSIONS["#{major}.#{minor}"] version else @@ -74,7 +73,7 @@ def self.detect_bundler_version(contents: ) end end - BUNDLED_WITH_REGEX = /^BUNDLED WITH$(\r?\n) (?\d+)\.(?\d+)\.\d+/m + BUNDLED_WITH_REGEX = /^BUNDLED WITH$(\r?\n) (?(?\d+)\.(?\d+)\.\d+)/m class GemfileParseError < BuildpackError def initialize(error) @@ -105,12 +104,28 @@ def initialize(version_hash, major_minor) attr_reader :bundler_path def initialize(options = {}) + @report = options[:report] || HerokuBuildReport::GLOBAL @bundler_tmp = Pathname.new(Dir.mktmpdir) @fetcher = options[:fetcher] || LanguagePack::Fetcher.new(LanguagePack::Base::VENDOR_URL) # coupling @gemfile_path = options[:gemfile_path] || Pathname.new("./Gemfile") @gemfile_lock_path = Pathname.new("#{@gemfile_path}.lock") - @version = self.class.detect_bundler_version(contents: @gemfile_lock_path.read(mode: "rt")) + contents = @gemfile_lock_path.read(mode: "rt") + bundled_with = contents.match(BUNDLED_WITH_REGEX) + @report.capture( + "bundled_with" => bundled_with&.[]("version") || "empty" + ) + @version = self.class.detect_bundler_version( + contents: contents, + bundled_with: bundled_with + ) + parts = @version.split(".") + @report.capture( + "bundler_version_installed" => @version, + "bundler_major" => parts&.shift, + "bundler_minor" => parts&.shift, + "bundler_patch" => parts&.shift + ) @dir_name = "bundler-#{@version}" @bundler_path = options[:bundler_path] || @bundler_tmp.join(@dir_name) diff --git a/lib/language_pack/installers/heroku_ruby_installer.rb b/lib/language_pack/installers/heroku_ruby_installer.rb index 2b2d4b976..7d159f8d6 100644 --- a/lib/language_pack/installers/heroku_ruby_installer.rb +++ b/lib/language_pack/installers/heroku_ruby_installer.rb @@ -10,7 +10,8 @@ class LanguagePack::Installers::HerokuRubyInstaller include LanguagePack::ShellHelpers attr_reader :fetcher - def initialize(stack: , multi_arch_stacks: , arch: ) + def initialize(stack: , multi_arch_stacks: , arch: , report: HerokuBuildReport::GLOBAL) + @report = report if multi_arch_stacks.include?(stack) @fetcher = LanguagePack::Fetcher.new(BASE_URL, stack: stack, arch: arch) else @@ -19,6 +20,14 @@ def initialize(stack: , multi_arch_stacks: , arch: ) end def install(ruby_version, install_dir) + @report.capture( + "ruby.version" => ruby_version.ruby_version, + "ruby.engine" => ruby_version.engine, + "ruby.engine.version" => ruby_version.engine_version, + "ruby.major" => ruby_version.major, + "ruby.minor" => ruby_version.minor, + "ruby.patch" => ruby_version.patch, + ) fetch_unpack(ruby_version, install_dir) setup_binstubs(install_dir) end diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 7c24de80f..4a16ccd05 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -97,6 +97,10 @@ def compile install_binaries run_assets_precompile_rake_task end + @report.capture( + "railties_version" => bundler.gem_version('railties'), + "rack_version" => bundler.gem_version('rack') + ) config_detect best_practice_warnings warn_outdated_ruby diff --git a/lib/language_pack/ruby_version.rb b/lib/language_pack/ruby_version.rb index a244b25d7..8e7913aba 100644 --- a/lib/language_pack/ruby_version.rb +++ b/lib/language_pack/ruby_version.rb @@ -15,8 +15,6 @@ def initialize(output = "") BOOTSTRAP_VERSION_NUMBER = "3.1.6".freeze DEFAULT_VERSION_NUMBER = "3.3.7".freeze DEFAULT_VERSION = "ruby-#{DEFAULT_VERSION_NUMBER}".freeze - LEGACY_VERSION_NUMBER = "1.9.2".freeze - LEGACY_VERSION = "ruby-#{LEGACY_VERSION_NUMBER}".freeze RUBY_VERSION_REGEX = %r{ (?\d+\.\d+\.\d+){0} (?p-?\d+){0} @@ -26,7 +24,25 @@ def initialize(output = "") ruby-\g(-\g)?(-\g-\g)? }x - attr_reader :set, :version, :version_without_patchlevel, :patchlevel, :engine, :ruby_version, :engine_version + + # `version` is the bundler output like `ruby-3.4.2` + attr_reader :version, + # `set` is either `:gemfile` when the app specified a version or `nil` when using + # the default version + :set, + # `version_without_patchlevel` removes any `-p` as they're not significant + # effectively this is `version_for_download` + :version_without_patchlevel, + # `patchlevel` is the `-p` or is empty + :patchlevel, + # `engine` is `:ruby` or `:jruby` + :engine, + # `ruby_version` is `..` extracted from `version` + :ruby_version, + # `engine_version` is the Jruby version or for MRI it is the same as `ruby_version` + # i.e. `..` + :engine_version + include LanguagePack::ShellHelpers def initialize(bundler_output, app = {}) @@ -74,7 +90,7 @@ def rake_is_vendored? end def default? - @version == none + !set end # determine if we're using jruby @@ -98,6 +114,18 @@ def vendored_bundler? false end + def major + @ruby_version.split(".")[0].to_i + end + + def minor + @ruby_version.split(".")[1].to_i + end + + def patch + @ruby_version.split(".")[2].to_i + end + # Returns the next logical version in the minor series # for example if the current ruby version is # `ruby-2.3.1` then then `next_logical_version(1)` @@ -126,21 +154,10 @@ def next_major_version(increment = 1) end private - - def none - if @app[:is_new] - DEFAULT_VERSION - elsif @app[:last_version] - @app[:last_version] - else - LEGACY_VERSION - end - end - def set_version if @bundler_output.empty? @set = false - @version = none + @version = @app[:last_version] || DEFAULT_VERSION else @set = :gemfile @version = @bundler_output diff --git a/spec/hatchet/ruby_spec.rb b/spec/hatchet/ruby_spec.rb index 580219577..ca60cce2b 100644 --- a/spec/hatchet/ruby_spec.rb +++ b/spec/hatchet/ruby_spec.rb @@ -145,7 +145,8 @@ it "works" do buildpacks = [ :default, - "https://github.com/sharpstone/force_absolute_paths_buildpack" + "https://github.com/sharpstone/force_absolute_paths_buildpack", + "https://github.com/heroku/heroku-buildpack-inline.git", ] config = {FORCE_ABSOLUTE_PATHS_BUILDPACK_IGNORE_PATHS: "BUNDLE_PATH"} @@ -189,12 +190,47 @@ dir = Pathname("client") dir.mkpath FileUtils.touch(dir.join(".gitkeep")) + + # Inline buildpack to ensure build_report file is emitted on compile + bin = Pathname("bin").tap(&:mkpath) + detect = bin.join("detect") + compile = bin.join("compile") + release = bin.join("release") + + [detect, compile, release].each do |path| + FileUtils.touch(path) + FileUtils.chmod("+x", path) + path.write(<<~EOF) + #!/usr/bin/env bash + exit 0 + EOF + end + + compile.write(<<~EOF) + #!/usr/bin/env bash + REPORT_FILE="${CACHE_DIR}/.heroku/ruby/build_report.yml" + echo "## PRINTING REPORT FILE ##" + #{Pathname(__dir__).join("..").join("..").join("bin").join("report").read} + echo "## REPORT FILE DONE ##" + EOF end app.deploy do |app| expected = "3.3.1" expect(expected).to_not eq(LanguagePack::RubyVersion::DEFAULT_VERSION_NUMBER) expect(app.output).to match("cd version ruby #{expected}") + begin + report_match = app.output.match(/## PRINTING REPORT FILE ##(?.*)## REPORT FILE DONE/m) # https://rubular.com/r/FfaV5AEstigaMO + expect(report_match).to be_truthy + yaml = report_match[:yaml].gsub(/remote: /, "") + report = YAML.load(yaml) + expect(report.fetch("ruby.version")).to eq(expected) + rescue Exception => e + puts app.output + puts yaml if yaml + puts report.inspect if report + raise e + end expect(app.run("which ruby").strip).to eq("/app/bin/ruby") end diff --git a/spec/helpers/bundler_wrapper_spec.rb b/spec/helpers/bundler_wrapper_spec.rb index cf0362d2b..b90c2c2f9 100644 --- a/spec/helpers/bundler_wrapper_spec.rb +++ b/spec/helpers/bundler_wrapper_spec.rb @@ -54,9 +54,23 @@ Dir.mktmpdir do |dir| gemfile = Pathname(dir).join("Gemfile") lockfile = Pathname(dir).join("Gemfile.lock").tap {|p| p.write("BUNDLED WITH\n 2.5.7") } + report = HerokuBuildReport.dev_null - bundler = LanguagePack::Helpers::BundlerWrapper.new(gemfile_path: gemfile) + bundler = LanguagePack::Helpers::BundlerWrapper.new( + gemfile_path: gemfile, + report: report + ) expect(bundler.supports_multiple_platforms?).to be_truthy + + expect(report.data).to eq( + { + "bundled_with" => "2.5.7", + "bundler_major" => "2", + "bundler_minor" => "5", + "bundler_patch" => "23", + "bundler_version_installed" => "2.5.23", + } + ) end end end diff --git a/spec/helpers/heroku_build_report_spec.rb b/spec/helpers/heroku_build_report_spec.rb new file mode 100644 index 000000000..432ae8912 --- /dev/null +++ b/spec/helpers/heroku_build_report_spec.rb @@ -0,0 +1,26 @@ +require 'spec_helper' + +describe "Build report" do + it "writes valid yaml" do + Dir.mktmpdir do |dir| + path = Pathname(dir).join(".report.yml") + report = HerokuBuildReport::YamlReport.new( + path: path + ) + report.capture( + "string" => "'with single quotes'", + "string_plain" => "plain", + "number" => 22, + "boolean" => true, + ) + + expect(path.read).to eq(<<~EOF) + --- + string: "'with single quotes'" + string_plain: plain + number: 22 + boolean: true + EOF + end + end +end diff --git a/spec/installers/heroku_ruby_installer_spec.rb b/spec/installers/heroku_ruby_installer_spec.rb index faf0f87e5..fa6c10d11 100644 --- a/spec/installers/heroku_ruby_installer_spec.rb +++ b/spec/installers/heroku_ruby_installer_spec.rb @@ -1,14 +1,18 @@ require "spec_helper" describe LanguagePack::Installers::HerokuRubyInstaller do - let(:installer) { + def installer(report: HerokuBuildReport::GLOBAL) LanguagePack::Installers::HerokuRubyInstaller.new( multi_arch_stacks: [], stack: "cedar-14", arch: nil, + report: report ) - } - let(:ruby_version) { LanguagePack::RubyVersion.new("ruby-2.3.3") } + end + + def ruby_version + LanguagePack::RubyVersion.new("ruby-2.3.3") + end describe "#fetch_unpack" do it "should fetch and unpack mri" do @@ -26,11 +30,44 @@ it "should install ruby and setup binstubs" do Dir.mktmpdir do |dir| Dir.chdir(dir) do - installer.install(ruby_version, "#{dir}/vendor/ruby") + report = HerokuBuildReport.dev_null + installer(report: report).install(ruby_version, "#{dir}/vendor/ruby") expect(File.symlink?("#{dir}/bin/ruby")).to be true expect(File.symlink?("#{dir}/bin/ruby.exe")).to be true expect(File).to exist("#{dir}/vendor/ruby/bin/ruby") + + expect(report.data["ruby.version"]).to eq("2.3.3") + expect(report.data["ruby.engine"]).to eq(:ruby) + expect(report.data["ruby.engine.version"]).to eq(report.data["ruby.version"]) + expect(report.data["ruby.major"]).to eq(2) + expect(report.data["ruby.minor"]).to eq(3) + expect(report.data["ruby.patch"]).to eq(3) + end + end + end + + it "should report jruby correctly" do + Dir.mktmpdir do |dir| + Dir.chdir(dir) do + report = HerokuBuildReport.dev_null + + LanguagePack::Installers::HerokuRubyInstaller.new( + multi_arch_stacks: ["heroku-24"], + stack: "heroku-24", + arch: "arm64", + report: report + ).install( + LanguagePack::RubyVersion.new("ruby-3.1.4-p0-jruby-9.4.9.0"), + "#{dir}/vendor/ruby" + ) + + expect(report.data["ruby.version"]).to eq("3.1.4") + expect(report.data["ruby.engine"]).to eq(:jruby) + expect(report.data["ruby.engine.version"]).to eq("9.4.9.0") + expect(report.data["ruby.major"]).to eq(3) + expect(report.data["ruby.minor"]).to eq(1) + expect(report.data["ruby.patch"]).to eq(4) end end end From c4e930da2edadc2498f54b37e6309f2a27aa0d26 Mon Sep 17 00:00:00 2001 From: "heroku-linguist[bot]" <136119646+heroku-linguist[bot]@users.noreply.github.com> Date: Thu, 3 Apr 2025 18:17:07 +0000 Subject: [PATCH 1033/1195] Prepare release v298 (#1573) Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com> --- CHANGELOG.md | 6 +++++- lib/language_pack/version.rb | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c12801703..a7ee9e122 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased] + +## [v298] - 2025-04-03 + - Added observability metrics (https://github.com/heroku/heroku-buildpack-ruby/pull/1569) ## [v297] - 2025-03-26 @@ -1656,7 +1659,8 @@ Bugfixes: * Change gem detection to use lockfile parser * use `$RACK_ENV` when thin is detected for rack apps -[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v297...main +[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v298...main +[v298]: https://github.com/heroku/heroku-buildpack-ruby/compare/v297...v298 [v297]: https://github.com/heroku/heroku-buildpack-ruby/compare/v296...v297 [v296]: https://github.com/heroku/heroku-buildpack-ruby/compare/v295...v296 [v295]: https://github.com/heroku/heroku-buildpack-ruby/compare/v294...v295 diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index e969be762..15bb256f1 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v297" + BUILDPACK_VERSION = "v298" end end From e6ce491c65a69e39563da5c15c574397f88f4a02 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Fri, 4 Apr 2025 14:52:38 -0500 Subject: [PATCH 1034/1195] Ensure flat YAML build report (#1574) The `bin/report` structure is flat. All keys must map to values that are un-nested. Ruby's `to_yaml` will happily serialize ruby objects: ``` irb(main):004> puts Gem::Version.new("3.4.2").to_yaml --- !ruby/object:Gem::Version version: 3.4.2 ``` This commit fixes this problem by inspecting if the value being serialized is an object or not. If it is, it is then converted into a string. --- lib/heroku_build_report.rb | 9 +++++++++ spec/helpers/heroku_build_report_spec.rb | 19 +++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/lib/heroku_build_report.rb b/lib/heroku_build_report.rb index 1fa2e6229..f855b24b8 100644 --- a/lib/heroku_build_report.rb +++ b/lib/heroku_build_report.rb @@ -27,6 +27,10 @@ def clear! @path.write("") end + def complex_object?(value) + value.to_yaml.match?(/!ruby\/object:/) + end + def capture(metrics = {}) metrics.each do |(key, value)| return if key.nil? || key.to_s.strip.empty? @@ -34,6 +38,11 @@ def capture(metrics = {}) key = key&.strip raise "Key cannot be empty (#{key.inspect} => #{value})" if key.nil? || key.empty? + # Don't serialize complex values by accident + if complex_object?(value) + value = value.to_s + end + @data["#{key}"] = value end diff --git a/spec/helpers/heroku_build_report_spec.rb b/spec/helpers/heroku_build_report_spec.rb index 432ae8912..069da1cbc 100644 --- a/spec/helpers/heroku_build_report_spec.rb +++ b/spec/helpers/heroku_build_report_spec.rb @@ -1,6 +1,25 @@ require 'spec_helper' describe "Build report" do + it "handles complex object serialization by converting them to strings" do + Dir.mktmpdir do |dir| + path = Pathname(dir).join(".report.yml") + report = HerokuBuildReport::YamlReport.new( + path: path + ) + value = Gem::Version.new("3.4.2") + expect(report.complex_object?(value)).to eq(true) + expect(value.to_yaml).to_not eq(value.to_s.to_yaml) + report.capture("key" => value) + + expect(report.data).to eq({"key" => "3.4.2"}) + expect(path.read).to eq(<<~EOF) + --- + key: 3.4.2 + EOF + end + end + it "writes valid yaml" do Dir.mktmpdir do |dir| path = Pathname(dir).join(".report.yml") From 971929593fff87a8cf85eb900743a18bc22cae23 Mon Sep 17 00:00:00 2001 From: "heroku-linguist[bot]" <136119646+heroku-linguist[bot]@users.noreply.github.com> Date: Mon, 7 Apr 2025 20:33:43 +0000 Subject: [PATCH 1035/1195] Prepare release v299 (#1575) Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com> --- CHANGELOG.md | 6 +++++- lib/language_pack/version.rb | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a7ee9e122..99b0138b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,9 @@ ## [Unreleased] +## [v299] - 2025-04-07 + + ## [v298] - 2025-04-03 - Added observability metrics (https://github.com/heroku/heroku-buildpack-ruby/pull/1569) @@ -1659,7 +1662,8 @@ Bugfixes: * Change gem detection to use lockfile parser * use `$RACK_ENV` when thin is detected for rack apps -[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v298...main +[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v299...main +[v299]: https://github.com/heroku/heroku-buildpack-ruby/compare/v298...v299 [v298]: https://github.com/heroku/heroku-buildpack-ruby/compare/v297...v298 [v297]: https://github.com/heroku/heroku-buildpack-ruby/compare/v296...v297 [v296]: https://github.com/heroku/heroku-buildpack-ruby/compare/v295...v296 diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 15bb256f1..7b044dcac 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v298" + BUILDPACK_VERSION = "v299" end end From 951b9441c2fb097bdcfde922b712eac83338b9b7 Mon Sep 17 00:00:00 2001 From: "heroku-linguist[bot]" <136119646+heroku-linguist[bot]@users.noreply.github.com> Date: Mon, 14 Apr 2025 17:29:36 +0000 Subject: [PATCH 1036/1195] Prepare release v300 (#1578) Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com> --- CHANGELOG.md | 8 +++++++- lib/language_pack/version.rb | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 99b0138b2..af58b6b59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ ## [Unreleased] +## [v300] - 2025-04-14 + +- Ruby 3.4.3 is now available + + ## [v299] - 2025-04-07 @@ -1662,7 +1667,8 @@ Bugfixes: * Change gem detection to use lockfile parser * use `$RACK_ENV` when thin is detected for rack apps -[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v299...main +[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v300...main +[v300]: https://github.com/heroku/heroku-buildpack-ruby/compare/v299...v300 [v299]: https://github.com/heroku/heroku-buildpack-ruby/compare/v298...v299 [v298]: https://github.com/heroku/heroku-buildpack-ruby/compare/v297...v298 [v297]: https://github.com/heroku/heroku-buildpack-ruby/compare/v296...v297 diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 7b044dcac..8544bf322 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v299" + BUILDPACK_VERSION = "v300" end end From 9266aa7bf2de566b4880e9ce1ad12e89bdf2c988 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Mon, 14 Apr 2025 12:54:20 -0500 Subject: [PATCH 1037/1195] Add `.ruby-version` formats to observability metrics (#1576) * Normalize observability keys * Capture .ruby-version file information Rails 8 stopped generating `RUBY VERSION` in the Gemfile.lock and started generating a `.ruby-version` file. We will support this file in the future, but there is no spec for it. This commit will observe the formats to help guide implementation decisions. It can also tell us how many people's `.ruby-version` files already align with their `Gemfile.lock` versions. The logic is inside of the bundler wrapper class as this is the first class to read the ruby version from the Gemfile.lock via `$ bundle platform --ruby`. * Changelog --- CHANGELOG.md | 1 + lib/language_pack/helpers/bundler_wrapper.rb | 16 +++++++++++----- lib/language_pack/ruby.rb | 4 ++-- spec/helpers/bundler_wrapper_spec.rb | 11 ++++++----- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index af58b6b59..d0ba43581 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## [Unreleased] +- Observe `.ruby-version` formats (https://github.com/heroku/heroku-buildpack-ruby/pull/1576) ## [v300] - 2025-04-14 diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index 7c7689bc4..3d8ecd651 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -112,8 +112,14 @@ def initialize(options = {}) contents = @gemfile_lock_path.read(mode: "rt") bundled_with = contents.match(BUNDLED_WITH_REGEX) + dot_ruby_version_file = @gemfile_lock_path.join("..").join(".ruby-version") @report.capture( - "bundled_with" => bundled_with&.[]("version") || "empty" + "bundler.bundled_with" => bundled_with&.[]("version") || "empty", + # We use this bundler class to detect the Requested ruby version from the Gemfile.lock + # Rails 8 stopped generating `RUBY VERSION` in the Gemfile.lock and started generating + # a `.ruby-version` file. This will observe the formats to help guide implementation + # decisions + "ruby.dot_ruby_version" => dot_ruby_version_file.exist? ? dot_ruby_version_file.read&.strip : nil ) @version = self.class.detect_bundler_version( contents: contents, @@ -121,10 +127,10 @@ def initialize(options = {}) ) parts = @version.split(".") @report.capture( - "bundler_version_installed" => @version, - "bundler_major" => parts&.shift, - "bundler_minor" => parts&.shift, - "bundler_patch" => parts&.shift + "bundler.version_installed" => @version, + "bundler.major" => parts&.shift, + "bundler.minor" => parts&.shift, + "bundler.patch" => parts&.shift ) @dir_name = "bundler-#{@version}" diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 4a16ccd05..5ab5c13aa 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -98,8 +98,8 @@ def compile run_assets_precompile_rake_task end @report.capture( - "railties_version" => bundler.gem_version('railties'), - "rack_version" => bundler.gem_version('rack') + "gem.railties_version" => bundler.gem_version('railties'), + "gem.rack_version" => bundler.gem_version('rack') ) config_detect best_practice_warnings diff --git a/spec/helpers/bundler_wrapper_spec.rb b/spec/helpers/bundler_wrapper_spec.rb index b90c2c2f9..a27ef2d32 100644 --- a/spec/helpers/bundler_wrapper_spec.rb +++ b/spec/helpers/bundler_wrapper_spec.rb @@ -64,11 +64,12 @@ expect(report.data).to eq( { - "bundled_with" => "2.5.7", - "bundler_major" => "2", - "bundler_minor" => "5", - "bundler_patch" => "23", - "bundler_version_installed" => "2.5.23", + "ruby.dot_ruby_version" => nil, + "bundler.bundled_with" => "2.5.7", + "bundler.major" => "2", + "bundler.minor" => "5", + "bundler.patch" => "23", + "bundler.version_installed" => "2.5.23", } ) end From b5c2f4d9b25799e3314ccdaf8e5d10fcfba9f731 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 14 Apr 2025 12:55:12 -0500 Subject: [PATCH 1038/1195] Bump toml-rb from 2.2.0 to 4.0.0 (#1570) Bumps [toml-rb](https://github.com/emancu/toml-rb) from 2.2.0 to 4.0.0. - [Release notes](https://github.com/emancu/toml-rb/releases) - [Commits](https://github.com/emancu/toml-rb/compare/v2.2.0...v4.0.0) --- updated-dependencies: - dependency-name: toml-rb dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 4def54426..6210961c1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -34,6 +34,7 @@ GEM heroics (~> 0.1.1) moneta (~> 1.0.0) rate_throttle_client (~> 0.1.0) + racc (1.8.1) rake (13.2.1) rate_throttle_client (0.1.2) redis (5.3.0) @@ -51,8 +52,9 @@ GEM rspec-support (3.13.1) thor (1.3.1) threaded (0.0.4) - toml-rb (2.2.0) + toml-rb (4.0.0) citrus (~> 3.0, > 3.0) + racc (~> 1.7) webrick (1.8.2) PLATFORMS From 0f855becc21fd456580c157749a29cfadf9fdfb2 Mon Sep 17 00:00:00 2001 From: "heroku-linguist[bot]" <136119646+heroku-linguist[bot]@users.noreply.github.com> Date: Mon, 14 Apr 2025 18:03:29 +0000 Subject: [PATCH 1039/1195] Prepare release v301 (#1579) Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com> --- CHANGELOG.md | 6 +++++- lib/language_pack/version.rb | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d0ba43581..8e547c575 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased] + +## [v301] - 2025-04-14 + - Observe `.ruby-version` formats (https://github.com/heroku/heroku-buildpack-ruby/pull/1576) ## [v300] - 2025-04-14 @@ -1668,7 +1671,8 @@ Bugfixes: * Change gem detection to use lockfile parser * use `$RACK_ENV` when thin is detected for rack apps -[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v300...main +[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v301...main +[v301]: https://github.com/heroku/heroku-buildpack-ruby/compare/v300...v301 [v300]: https://github.com/heroku/heroku-buildpack-ruby/compare/v299...v300 [v299]: https://github.com/heroku/heroku-buildpack-ruby/compare/v298...v299 [v298]: https://github.com/heroku/heroku-buildpack-ruby/compare/v297...v298 diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 8544bf322..57e10059c 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v300" + BUILDPACK_VERSION = "v301" end end From 31f816dd10326e740c4f1006b4ea7b81231cbd7f Mon Sep 17 00:00:00 2001 From: "heroku-linguist[bot]" <136119646+heroku-linguist[bot]@users.noreply.github.com> Date: Wed, 16 Apr 2025 16:45:43 +0000 Subject: [PATCH 1040/1195] Prepare release v302 (#1580) Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com> --- CHANGELOG.md | 8 +++++++- lib/language_pack/version.rb | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e547c575..9f1fa3a8a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ ## [Unreleased] +## [v302] - 2025-04-16 + +- Ruby 3.3.8 is now available + + ## [v301] - 2025-04-14 - Observe `.ruby-version` formats (https://github.com/heroku/heroku-buildpack-ruby/pull/1576) @@ -1671,7 +1676,8 @@ Bugfixes: * Change gem detection to use lockfile parser * use `$RACK_ENV` when thin is detected for rack apps -[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v301...main +[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v302...main +[v302]: https://github.com/heroku/heroku-buildpack-ruby/compare/v301...v302 [v301]: https://github.com/heroku/heroku-buildpack-ruby/compare/v300...v301 [v300]: https://github.com/heroku/heroku-buildpack-ruby/compare/v299...v300 [v299]: https://github.com/heroku/heroku-buildpack-ruby/compare/v298...v299 diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 57e10059c..3a72e8cf3 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v301" + BUILDPACK_VERSION = "v302" end end From 6d1a67357d1af7b0f4b886e7e62aa174e5ee9ff9 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Thu, 24 Apr 2025 19:15:00 -0500 Subject: [PATCH 1041/1195] Use `--update=none` instead of `-n` for `copy` in `cache.rb` (#1583) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Use `--update=none` instead of `-n` for `copy` in `cache.rb` * Changelog * Fix CI failure ``` 1) LanguagePack::Helpers::OutdatedRubyVersion handles arm 💪 architecture on heroku-24 Failure/Error: expect(outdated.suggested_ruby_minor_version).to eq("3.3.7") expected: "3.3.7" got: "3.3.8" (compared using ==) # ./vendor/bundle/ruby/3.1.0/gems/rspec-support-3.13.1/lib/rspec/support.rb:110:in `block in ' ``` 3.1 is EOL now and shouldn't change. We should use that. --------- Co-authored-by: Jan Nash --- CHANGELOG.md | 1 + lib/language_pack/cache.rb | 2 +- spec/helpers/outdated_ruby_version_spec.rb | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f1fa3a8a..e7348bcda 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## [Unreleased] +- Fix warning message about `cp -n` (https://github.com/heroku/heroku-buildpack-ruby/pull/1583) ## [v302] - 2025-04-16 diff --git a/lib/language_pack/cache.rb b/lib/language_pack/cache.rb index 18754a408..1d20faa2f 100644 --- a/lib/language_pack/cache.rb +++ b/lib/language_pack/cache.rb @@ -58,7 +58,7 @@ def load_without_overwrite(path, dest=nil) return unless @cache_base dest ||= path - copy (@cache_base + path), dest, '-a -n' + copy (@cache_base + path), dest, '-a --update=none' end # copy cache contents diff --git a/spec/helpers/outdated_ruby_version_spec.rb b/spec/helpers/outdated_ruby_version_spec.rb index 6c24ecf49..95b9abdf4 100644 --- a/spec/helpers/outdated_ruby_version_spec.rb +++ b/spec/helpers/outdated_ruby_version_spec.rb @@ -23,7 +23,7 @@ end it "handles arm 💪 architecture on heroku-24" do - ruby_version = LanguagePack::RubyVersion.new("ruby-3.3.0") + ruby_version = LanguagePack::RubyVersion.new("ruby-3.1.0") fetcher = LanguagePack::Fetcher.new( LanguagePack::Base::VENDOR_URL, stack: "heroku-24", @@ -35,7 +35,7 @@ ) outdated.call - expect(outdated.suggested_ruby_minor_version).to eq("3.3.7") + expect(outdated.suggested_ruby_minor_version).to eq("3.1.7") end it "finds the latest version on a stack" do From 22848b91b621af7201361725c5ac631736c75839 Mon Sep 17 00:00:00 2001 From: "heroku-linguist[bot]" <136119646+heroku-linguist[bot]@users.noreply.github.com> Date: Fri, 25 Apr 2025 13:25:49 +0000 Subject: [PATCH 1042/1195] Prepare release v303 (#1584) Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com> --- CHANGELOG.md | 8 +++++++- lib/language_pack/version.rb | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e7348bcda..9367360f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ ## [Unreleased] + +## [v303] - 2025-04-25 + +- Ruby 3.5.0-preview1 is now available + - Fix warning message about `cp -n` (https://github.com/heroku/heroku-buildpack-ruby/pull/1583) ## [v302] - 2025-04-16 @@ -1677,7 +1682,8 @@ Bugfixes: * Change gem detection to use lockfile parser * use `$RACK_ENV` when thin is detected for rack apps -[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v302...main +[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v303...main +[v303]: https://github.com/heroku/heroku-buildpack-ruby/compare/v302...v303 [v302]: https://github.com/heroku/heroku-buildpack-ruby/compare/v301...v302 [v301]: https://github.com/heroku/heroku-buildpack-ruby/compare/v300...v301 [v300]: https://github.com/heroku/heroku-buildpack-ruby/compare/v299...v300 diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 3a72e8cf3..af2ee45ad 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v302" + BUILDPACK_VERSION = "v303" end end From 4bb28546df4a3d7d4e4ae6dc356865017419cab2 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Mon, 28 Apr 2025 13:16:46 -0500 Subject: [PATCH 1043/1195] Fix `cp` update none on Heroku 20 (#1586) * Fix `cp` update none on Heroku 20 In https://github.com/heroku/heroku-buildpack-ruby/pull/1583 a warning was bypassed by switching from `-n` to `--update none`. Unfortunately this triggers an error with the version of `cp` on `heroku-20` (which is EOL in 2 days) due to not having that flag: ``` -----> Preparing app for Rails asset pipeline remote: cp: option '--update' doesn't allow an argument remote: Try 'cp --help' for more information. ``` Internal ticket link https://heroku.support/1570694. * Check exit status of copy command * Changelog --- CHANGELOG.md | 2 +- lib/language_pack/cache.rb | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9367360f7..2924b03b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,11 +2,11 @@ ## [Unreleased] +- Fix `cp --update=none` on `heroku-20` (https://github.com/heroku/heroku-buildpack-ruby/pull/1586) ## [v303] - 2025-04-25 - Ruby 3.5.0-preview1 is now available - - Fix warning message about `cp -n` (https://github.com/heroku/heroku-buildpack-ruby/pull/1583) ## [v302] - 2025-04-16 diff --git a/lib/language_pack/cache.rb b/lib/language_pack/cache.rb index 1d20faa2f..44ca7662d 100644 --- a/lib/language_pack/cache.rb +++ b/lib/language_pack/cache.rb @@ -58,7 +58,12 @@ def load_without_overwrite(path, dest=nil) return unless @cache_base dest ||= path - copy (@cache_base + path), dest, '-a --update=none' + + if ENV["STACK"] == "heroku-20" + copy (@cache_base + path), dest, "-a -n" + else + copy (@cache_base + path), dest, "-a --update=none" + end end # copy cache contents @@ -69,7 +74,9 @@ def copy(from, to, options='-a') return false unless File.exist?(from) FileUtils.mkdir_p File.dirname(to) - system("cp #{options} #{from}/. #{to}") + command = "cp #{options} #{from}/. #{to}" + system(command) + raise "Command failed `#{command}`" unless $? end # copy contents between to places in the cache From e5c31cdf860821af987a5007119f32a772c199d9 Mon Sep 17 00:00:00 2001 From: "heroku-linguist[bot]" <136119646+heroku-linguist[bot]@users.noreply.github.com> Date: Mon, 28 Apr 2025 18:36:15 +0000 Subject: [PATCH 1044/1195] Prepare release v304 (#1587) Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com> --- CHANGELOG.md | 6 +++++- lib/language_pack/version.rb | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2924b03b5..69c5a2a65 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased] + +## [v304] - 2025-04-28 + - Fix `cp --update=none` on `heroku-20` (https://github.com/heroku/heroku-buildpack-ruby/pull/1586) ## [v303] - 2025-04-25 @@ -1682,7 +1685,8 @@ Bugfixes: * Change gem detection to use lockfile parser * use `$RACK_ENV` when thin is detected for rack apps -[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v303...main +[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v304...main +[v304]: https://github.com/heroku/heroku-buildpack-ruby/compare/v303...v304 [v303]: https://github.com/heroku/heroku-buildpack-ruby/compare/v302...v303 [v302]: https://github.com/heroku/heroku-buildpack-ruby/compare/v301...v302 [v301]: https://github.com/heroku/heroku-buildpack-ruby/compare/v300...v301 diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index af2ee45ad..d0eab9fbf 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v303" + BUILDPACK_VERSION = "v304" end end From 7c1062f35af35fd5a79f6145e65145f0020f233c Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Mon, 28 Apr 2025 14:22:59 -0500 Subject: [PATCH 1045/1195] Fix cache warning on heroku-22 (#1588) * Assert no warnings from `cp` * Fix cache warning on heroku-22 Before: ``` $ be rspec spec/hatchet/getting_started_spec.rb:25 Run options: include {:focused=>true, :locations=>{"./spec/hatchet/getting_started_spec.rb"=>[25]}} Hatchet setup: "hatchet-t-91c5d5b6ce" for "ruby-getting-started" Destroying "hatchet-t-91c5d5b6ce": eb7dab2f-d12a-4bd2-b62a-c48781aa55a9, (0/20) reason: teardown F Failures: 1) Heroku ruby getting started works on Heroku-22 Failure/Error: expect(app.output).to_not include("cp --help") ``` After: ``` $ be rspec spec/hatchet/getting_started_spec.rb:25 Run options: include {:focused=>true, :locations=>{"./spec/hatchet/getting_started_spec.rb"=>[25]}} Hatchet setup: "hatchet-t-17874ceca3" for "ruby-getting-started" Finished in 2 minutes 21.4 seconds (files took 0.1802 seconds to load) 1 example, 0 failures ``` --- CHANGELOG.md | 1 + lib/language_pack/cache.rb | 3 ++- spec/hatchet/getting_started_spec.rb | 25 +++++++++++++++++++++---- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 69c5a2a65..162d4235f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## [Unreleased] +- Fix `cp --update=none` warning `heroku-22` (https://github.com/heroku/heroku-buildpack-ruby/pull/1588) ## [v304] - 2025-04-28 diff --git a/lib/language_pack/cache.rb b/lib/language_pack/cache.rb index 44ca7662d..25d784a64 100644 --- a/lib/language_pack/cache.rb +++ b/lib/language_pack/cache.rb @@ -59,7 +59,8 @@ def load_without_overwrite(path, dest=nil) dest ||= path - if ENV["STACK"] == "heroku-20" + case ENV["STACK"] + when "heroku-20", "heroku-22" copy (@cache_base + path), dest, "-a -n" else copy (@cache_base + path), dest, "-a --update=none" diff --git a/spec/hatchet/getting_started_spec.rb b/spec/hatchet/getting_started_spec.rb index f31bad042..06e2e1c97 100644 --- a/spec/hatchet/getting_started_spec.rb +++ b/spec/hatchet/getting_started_spec.rb @@ -1,14 +1,31 @@ require_relative '../spec_helper' describe "Heroku ruby getting started" do - it "clears runtime cache" do - Hatchet::Runner.new("ruby-getting-started").deploy do |app| + it "works on Heroku-24" do + Hatchet::Runner.new("ruby-getting-started", stack: "heroku-24").deploy do |app| + # Assert sprockets build cache not present on runtime expect(app.run("ls tmp/cache/assets")).to_not match("sprockets") + + # Re-deploy with cache + run!("git commit --allow-empty -m empty") + app.push! + + # Assert no warnings from `cp` + # https://github.com/heroku/heroku-buildpack-ruby/pull/1586/files#r2064284286 + expect(app.output).to_not include("cp --help") + expect(app.run("which ruby").strip).to eq("/app/bin/ruby") end end - it "works on Heroku-24" do - Hatchet::Runner.new("ruby-getting-started", stack: "heroku-24").deploy do |app| + it "works on Heroku-22" do + Hatchet::Runner.new("ruby-getting-started", stack: "heroku-22").deploy do |app| + # Re-deploy with cache + run!("git commit --allow-empty -m empty") + app.push! + + # Assert no warnings from `cp` + # https://github.com/heroku/heroku-buildpack-ruby/pull/1586/files#r2064284286 + expect(app.output).to_not include("cp --help") expect(app.run("which ruby").strip).to eq("/app/bin/ruby") end end From f506e9ae3931bbce010fbcaa37c59fd26638f3c0 Mon Sep 17 00:00:00 2001 From: "heroku-linguist[bot]" <136119646+heroku-linguist[bot]@users.noreply.github.com> Date: Mon, 28 Apr 2025 19:39:05 +0000 Subject: [PATCH 1046/1195] Prepare release v305 (#1589) Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com> --- CHANGELOG.md | 6 +++++- lib/language_pack/version.rb | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 162d4235f..654c25e12 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased] + +## [v305] - 2025-04-28 + - Fix `cp --update=none` warning `heroku-22` (https://github.com/heroku/heroku-buildpack-ruby/pull/1588) ## [v304] - 2025-04-28 @@ -1686,7 +1689,8 @@ Bugfixes: * Change gem detection to use lockfile parser * use `$RACK_ENV` when thin is detected for rack apps -[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v304...main +[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v305...main +[v305]: https://github.com/heroku/heroku-buildpack-ruby/compare/v304...v305 [v304]: https://github.com/heroku/heroku-buildpack-ruby/compare/v303...v304 [v303]: https://github.com/heroku/heroku-buildpack-ruby/compare/v302...v303 [v302]: https://github.com/heroku/heroku-buildpack-ruby/compare/v301...v302 diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index d0eab9fbf..7e15bf364 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v304" + BUILDPACK_VERSION = "v305" end end From 58a323f0790bf23248e4f733685dcbcda400a093 Mon Sep 17 00:00:00 2001 From: "heroku-linguist[bot]" <136119646+heroku-linguist[bot]@users.noreply.github.com> Date: Thu, 8 May 2025 00:53:07 +0000 Subject: [PATCH 1047/1195] Prepare release v306 (#1592) Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com> --- CHANGELOG.md | 8 +++++++- lib/language_pack/version.rb | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 654c25e12..04e4a8a4e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ ## [Unreleased] +## [v306] - 2025-05-08 + +- JRuby 9.4.12.0, 9.4.12.1, 10.0.0.0, and 10.0.0.1 is now available + + ## [v305] - 2025-04-28 - Fix `cp --update=none` warning `heroku-22` (https://github.com/heroku/heroku-buildpack-ruby/pull/1588) @@ -1689,7 +1694,8 @@ Bugfixes: * Change gem detection to use lockfile parser * use `$RACK_ENV` when thin is detected for rack apps -[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v305...main +[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v306...main +[v306]: https://github.com/heroku/heroku-buildpack-ruby/compare/v305...v306 [v305]: https://github.com/heroku/heroku-buildpack-ruby/compare/v304...v305 [v304]: https://github.com/heroku/heroku-buildpack-ruby/compare/v303...v304 [v303]: https://github.com/heroku/heroku-buildpack-ruby/compare/v302...v303 diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 7e15bf364..0a4a4fc47 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v305" + BUILDPACK_VERSION = "v306" end end From 3018f23e21e4dce06919bf4139f5df8df3946dd4 Mon Sep 17 00:00:00 2001 From: "heroku-linguist[bot]" <136119646+heroku-linguist[bot]@users.noreply.github.com> Date: Wed, 14 May 2025 22:38:22 +0000 Subject: [PATCH 1048/1195] Prepare release v307 (#1593) Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com> --- CHANGELOG.md | 8 +++++++- lib/language_pack/version.rb | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 04e4a8a4e..fc7fc5bcf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ ## [Unreleased] +## [v307] - 2025-05-14 + +- Ruby 3.4.4 is now available + + ## [v306] - 2025-05-08 - JRuby 9.4.12.0, 9.4.12.1, 10.0.0.0, and 10.0.0.1 is now available @@ -1694,7 +1699,8 @@ Bugfixes: * Change gem detection to use lockfile parser * use `$RACK_ENV` when thin is detected for rack apps -[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v306...main +[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v307...main +[v307]: https://github.com/heroku/heroku-buildpack-ruby/compare/v306...v307 [v306]: https://github.com/heroku/heroku-buildpack-ruby/compare/v305...v306 [v305]: https://github.com/heroku/heroku-buildpack-ruby/compare/v304...v305 [v304]: https://github.com/heroku/heroku-buildpack-ruby/compare/v303...v304 diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 0a4a4fc47..0a4ab1c46 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v306" + BUILDPACK_VERSION = "v307" end end From 1fd49d463a583b737fded94faf56476f8299277a Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Thu, 15 May 2025 09:19:14 -0500 Subject: [PATCH 1049/1195] Remove Heroku-20 support (#1591) * Remove heroku-20 version logic * Update error message * Remove unsupported Bundler versions Ruby 3+ ships with a bundler version and Ruby 3.1 ships with Bundler 2.5: ``` $ /Users/rschneeman/.rubies/ruby-3.1.6/bin/bundle -v Bundler version 2.5.11 ``` I think we could also remove the 2.3 and 2.4 bundler versions from the hash, but would need to check observability to be sure. It's not hurting things for now. * Update download presence logic to remove heroku-20 * Remove heroku-18 string from spec * Update test to non EOL stack * Remove (more) deprecated stack references * Refactor: Move spec file There's only one test in `installers/`, and it's easier to run all "helpers" at once this way. * Remove Ruby 1.9 code * Remove Ruby <2.1 code * Remove Ruby <2.1 "syck hack" code * Remove Ruby < 1.9 logic * Remove Ruby 1.8.7 code and duplicate env var * Remove older changelogs (keeping 2024-2025) * Remove unused Ruby 2.6 code * Remove unused constant * Remove unused logging code * Remove unused methods * DRY up logic * Remove hardcoded false in vendored_bundle? Code was added in Ruby ~2.5 and never moved https://github.com/heroku/heroku-buildpack-ruby/commit/5dbc8401d038d3b54d531693f01136223177f650 * All bundler versions supported provide multi platform support * Remove newline * Remove unused method * Remove legacy cache clear code * Fix code alignment * Remove bundler < 2.1 configuration * Remove bundler conditional ``` $ irb irb(main):001> Gem::Version.new("2.3.1") > Gem::Version.new("2.3") => true ``` * Changelog * Remove no-op libyaml Added in https://github.com/heroku/heroku-buildpack-ruby/commit/eac75848b90db221c90e6ba5dd256a87dc38704b and removed some time later, we have libyaml on the system and this is a no-op. https://devcenter.heroku.com/articles/stack-packages * Remove unused files and Rake code * Remove purely `true` variable * Update lib/language_pack/helpers/bundler_wrapper.rb Co-authored-by: Colin Casey Signed-off-by: Richard Schneeman * Assert no accidental cache purge message https://github.com/heroku/heroku-buildpack-ruby/pull/1591#discussion_r2089496990 --------- Signed-off-by: Richard Schneeman Co-authored-by: Colin Casey --- CHANGELOG.md | 1 + Rakefile | 71 --- bin/support/ruby_compile | 4 +- bin/support/ruby_test-compile | 4 +- changelogs/v205/.gitkeep | 1 - changelogs/v205/bundler.md | 3 - changelogs/v205/malloc.md | 32 -- changelogs/v206/.gitkeep | 0 changelogs/v206/default_ruby.md | 3 - changelogs/v206/ruby_warning.md | 9 - changelogs/v207/.gitkeep | 0 changelogs/v207/remove_bundle_with.md | 11 - changelogs/v207/vendor_libpq.md | 15 - changelogs/v208/default_ruby_2_6_5.md | 3 - changelogs/v214/default_ruby_266.md | 3 - changelogs/v218/disable_spring.md | 11 - changelogs/v218/node_yarn.md | 8 - changelogs/v219/bundler-214.md | 3 - changelogs/v219/bundler-env-vars.md | 20 - changelogs/v224/.gitkeep | 0 changelogs/v224/jvm_installer_default.md | 13 - changelogs/v225/bundler_2_2_11.md | 3 - changelogs/v226/bundler_2_2_15.md | 3 - changelogs/v227/bundler_2216.md | 3 - changelogs/v228/bundler_2_2_21.md | 3 - changelogs/v229/WEB_CONCURRENCY.md | 7 - changelogs/v230/ruby_274_default.md | 3 - changelogs/v231/.gitkeep | 0 changelogs/v231/jsbundling_packagejson.md | 10 - changelogs/v231/jsbundling_yarnlock.md | 10 - changelogs/v233/.gitkeep | 0 changelogs/v233/node_yarn.md | 8 - changelogs/v233/ruby_275_default.md | 3 - changelogs/v235/bundler_2_2_33.md | 3 - changelogs/v237/ruby_303_default.md | 3 - changelogs/v238/bundle-upgrade.md | 3 - changelogs/v240/bundler_2_3_10.md | 3 - changelogs/v244/default_ruby.md | 3 - changelogs/v245/bundler_2_3_25.md | 3 - changelogs/v246/node_defaults.md | 10 - changelogs/v247/jruby_releases.md | 10 - changelogs/v248/ruby-320-rc1.md | 10 - changelogs/v249/skip_database_provision.md | 15 - changelogs/v250/ruby-320.md | 7 - changelogs/v252/jruby-9-4-1-0.md | 7 - changelogs/v252/ruby-3-2-1.md | 7 - changelogs/v253/ruby_278_306_314_322.md | 10 - changelogs/v254/default-ruby-314.md | 3 - changelogs/v254/ruby-330-preview1.md | 11 - changelogs/v255/jruby-9.2.2.0.md | 9 - changelogs/v255/jruby-9.2.3.0.md | 9 - changelogs/v260/jruby-9.4.4.0.md | 10 - changelogs/v261/jruby_9.3.13.0.md | 10 - changelogs/v261/jruby_9.4.5.0.md | 10 - changelogs/v261/node_20_9_0.md | 8 - changelogs/v263/ruby-330-rc1.md | 15 - lib/language_pack/base.rb | 44 -- lib/language_pack/cache.rb | 2 +- lib/language_pack/helpers/bundler_wrapper.rb | 49 +- .../helpers/download_presence.rb | 9 +- .../helpers/outdated_ruby_version.rb | 1 - lib/language_pack/helpers/rails_runner.rb | 2 - lib/language_pack/helpers/rake_runner.rb | 9 +- lib/language_pack/rails2.rb | 7 +- lib/language_pack/rails3.rb | 32 +- lib/language_pack/rails4.rb | 45 +- lib/language_pack/ruby.rb | 431 ++++-------------- lib/language_pack/ruby_version.rb | 33 +- lib/language_pack/shell_helpers.rb | 26 -- log/.gitkeep | 0 spec/hatchet/bundler_spec.rb | 22 - spec/hatchet/getting_started_spec.rb | 1 + spec/hatchet/ruby_spec.rb | 35 -- spec/helpers/bundler_wrapper_spec.rb | 5 - spec/helpers/download_presence_spec.rb | 56 +-- .../heroku_ruby_installer_spec.rb | 16 +- spec/helpers/ruby_version_spec.rb | 24 - spec/helpers/shell_spec.rb | 32 +- spec/unit/bash_functions_spec.rb | 2 +- support/s3/hmac | 79 ---- support/s3/s3 | 223 --------- vendor/syck_hack.rb | 64 --- 82 files changed, 174 insertions(+), 1522 deletions(-) delete mode 100644 changelogs/v205/.gitkeep delete mode 100644 changelogs/v205/bundler.md delete mode 100644 changelogs/v205/malloc.md delete mode 100644 changelogs/v206/.gitkeep delete mode 100644 changelogs/v206/default_ruby.md delete mode 100644 changelogs/v206/ruby_warning.md delete mode 100644 changelogs/v207/.gitkeep delete mode 100644 changelogs/v207/remove_bundle_with.md delete mode 100644 changelogs/v207/vendor_libpq.md delete mode 100644 changelogs/v208/default_ruby_2_6_5.md delete mode 100644 changelogs/v214/default_ruby_266.md delete mode 100644 changelogs/v218/disable_spring.md delete mode 100644 changelogs/v218/node_yarn.md delete mode 100644 changelogs/v219/bundler-214.md delete mode 100644 changelogs/v219/bundler-env-vars.md delete mode 100644 changelogs/v224/.gitkeep delete mode 100644 changelogs/v224/jvm_installer_default.md delete mode 100644 changelogs/v225/bundler_2_2_11.md delete mode 100644 changelogs/v226/bundler_2_2_15.md delete mode 100644 changelogs/v227/bundler_2216.md delete mode 100644 changelogs/v228/bundler_2_2_21.md delete mode 100644 changelogs/v229/WEB_CONCURRENCY.md delete mode 100644 changelogs/v230/ruby_274_default.md delete mode 100644 changelogs/v231/.gitkeep delete mode 100644 changelogs/v231/jsbundling_packagejson.md delete mode 100644 changelogs/v231/jsbundling_yarnlock.md delete mode 100644 changelogs/v233/.gitkeep delete mode 100644 changelogs/v233/node_yarn.md delete mode 100644 changelogs/v233/ruby_275_default.md delete mode 100644 changelogs/v235/bundler_2_2_33.md delete mode 100644 changelogs/v237/ruby_303_default.md delete mode 100644 changelogs/v238/bundle-upgrade.md delete mode 100644 changelogs/v240/bundler_2_3_10.md delete mode 100644 changelogs/v244/default_ruby.md delete mode 100644 changelogs/v245/bundler_2_3_25.md delete mode 100644 changelogs/v246/node_defaults.md delete mode 100644 changelogs/v247/jruby_releases.md delete mode 100644 changelogs/v248/ruby-320-rc1.md delete mode 100644 changelogs/v249/skip_database_provision.md delete mode 100644 changelogs/v250/ruby-320.md delete mode 100644 changelogs/v252/jruby-9-4-1-0.md delete mode 100644 changelogs/v252/ruby-3-2-1.md delete mode 100644 changelogs/v253/ruby_278_306_314_322.md delete mode 100644 changelogs/v254/default-ruby-314.md delete mode 100644 changelogs/v254/ruby-330-preview1.md delete mode 100644 changelogs/v255/jruby-9.2.2.0.md delete mode 100644 changelogs/v255/jruby-9.2.3.0.md delete mode 100644 changelogs/v260/jruby-9.4.4.0.md delete mode 100644 changelogs/v261/jruby_9.3.13.0.md delete mode 100644 changelogs/v261/jruby_9.4.5.0.md delete mode 100644 changelogs/v261/node_20_9_0.md delete mode 100644 changelogs/v263/ruby-330-rc1.md delete mode 100644 log/.gitkeep rename spec/{installers => helpers}/heroku_ruby_installer_spec.rb (84%) delete mode 100755 support/s3/hmac delete mode 100755 support/s3/s3 delete mode 100644 vendor/syck_hack.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index fc7fc5bcf..2e66a034f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## [Unreleased] +- Removed support for Ubuntu 20.04 (and thus Heroku-20 / `heroku/builder:20`). This includes removing support for Ruby < 3.1 and Bundler < 2.3. (https://github.com/heroku/buildpacks-ruby/pull/1591) ## [v307] - 2025-05-14 diff --git a/Rakefile b/Rakefile index 4372a9bb7..8640f1119 100644 --- a/Rakefile +++ b/Rakefile @@ -6,64 +6,8 @@ require "fileutils" require "tmpdir" require 'hatchet/tasks' -ENV["BUILDPACK_LOG_FILE"] ||= "tmp/buildpack.log" - require_relative 'lib/rake/deploy_check' -S3_BUCKET_REGION = "us-east-1" -S3_BUCKET_NAME = "heroku-buildpack-ruby" - -def s3_tools_dir - File.expand_path("../support/s3", __FILE__) -end - -def s3_upload(tmpdir, name) - sh("#{s3_tools_dir}/s3 put #{S3_BUCKET_NAME} #{name}.tgz #{tmpdir}/#{name}.tgz") -end - -def vendor_plugin(git_url, branch = nil) - name = File.basename(git_url, File.extname(git_url)) - Dir.mktmpdir("#{name}-") do |tmpdir| - FileUtils.rm_rf("#{tmpdir}/*") - - Dir.chdir(tmpdir) do - sh "git clone #{git_url} ." - sh "git checkout origin/#{branch}" if branch - FileUtils.rm_rf("#{name}/.git") - sh("tar czvf #{tmpdir}/#{name}.tgz *") - s3_upload(tmpdir, name) - end - end -end - -def in_gem_env(gem_home, &block) - old_gem_home = ENV['GEM_HOME'] - old_gem_path = ENV['GEM_PATH'] - ENV['GEM_HOME'] = ENV['GEM_PATH'] = gem_home.to_s - - yield - - ENV['GEM_HOME'] = old_gem_home - ENV['GEM_PATH'] = old_gem_path -end - -def install_gem(gem_name, version) - name = "#{gem_name}-#{version}" - Dir.mktmpdir("#{gem_name}-#{version}") do |tmpdir| - Dir.chdir(tmpdir) do |dir| - FileUtils.rm_rf("#{tmpdir}/*") - - in_gem_env(tmpdir) do - sh("unset RUBYOPT; gem install #{gem_name} --version #{version} --no-ri --no-rdoc --env-shebang") - sh("rm #{gem_name}-#{version}.gem") - sh("rm -rf cache/#{gem_name}-#{version}.gem") - sh("tar czvf #{tmpdir}/#{name}.tgz *") - s3_upload(tmpdir, name) - end - end - end -end - namespace :buildpack do desc "prepares the next version of the buildpack for release" task :prepare do @@ -91,21 +35,6 @@ namespace :buildpack do end end -desc "update plugins" -task "plugins:update" do - vendor_plugin "https://github.com/heroku/rails_log_stdout.git", "legacy" - vendor_plugin "https://github.com/pedro/rails3_serve_static_assets.git" - vendor_plugin "https://github.com/hone/rails31_enable_runtime_asset_compilation.git" -end - -desc "install vendored gem" -task "gem:install", :gem, :version do |t, args| - gem = args[:gem] - version = args[:version] - - install_gem(gem, version) -end - begin require 'rspec/core/rake_task' diff --git a/bin/support/ruby_compile b/bin/support/ruby_compile index 83c2c39f4..e4e06c6ca 100755 --- a/bin/support/ruby_compile +++ b/bin/support/ruby_compile @@ -22,9 +22,7 @@ begin LanguagePack::ShellHelpers.initialize_env(ARGV[2]) if pack = LanguagePack.detect(ARGV[0], ARGV[1]) pack.topic("Compiling #{pack.name}") - pack.log("compile") do - pack.compile - end + pack.compile end rescue Exception => e LanguagePack::ShellHelpers.display_error_and_exit(e) diff --git a/bin/support/ruby_test-compile b/bin/support/ruby_test-compile index 7c3ae8216..cb8287a9c 100755 --- a/bin/support/ruby_test-compile +++ b/bin/support/ruby_test-compile @@ -22,9 +22,7 @@ begin if pack = LanguagePack.detect(ARGV[0], ARGV[1]) LanguagePack::ShellHelpers.initialize_env(ARGV[2]) pack.topic("Setting up Test for #{pack.name}") - pack.log("test_compile") do - pack.compile - end + pack.compile end rescue Exception => e LanguagePack::ShellHelpers.display_error_and_exit(e) diff --git a/changelogs/v205/.gitkeep b/changelogs/v205/.gitkeep deleted file mode 100644 index 8b1378917..000000000 --- a/changelogs/v205/.gitkeep +++ /dev/null @@ -1 +0,0 @@ - diff --git a/changelogs/v205/bundler.md b/changelogs/v205/bundler.md deleted file mode 100644 index 8df197d9a..000000000 --- a/changelogs/v205/bundler.md +++ /dev/null @@ -1,3 +0,0 @@ -## Ruby apps with Bundler 1.x now receive version 1.17.3 - -The [Ruby Buildpack](https://devcenter.heroku.com/articles/ruby-support#libraries) now includes Bundler 1.17.3. Applications specifying Bundler 1.x in their `Gemfile.lock` will now receive bundler: 1.17.3. diff --git a/changelogs/v205/malloc.md b/changelogs/v205/malloc.md deleted file mode 100644 index b8cd03e8e..000000000 --- a/changelogs/v205/malloc.md +++ /dev/null @@ -1,32 +0,0 @@ -## Default `MALLOC_ARENA_MAX=2` for new Ruby applications - -The environment variable `MALLOC_ARENA_MAX` will now default to `2` for Ruby applications. This environment variable was -previously unset. This change will only affect new applications on the platform, to update an existing application please -run: - -``` -$ heroku config:set MALLOC_ARENA_MAX=2 -``` - -The goal of setting this value is to decrease memory usage for the majority of Ruby applications that are using threads -such as apps that use Sidekiq or Puma. To understand more about the relationship between this value and memory please see -the following external resources: - -- https://www.speedshop.co/2017/12/04/malloc-doubles-ruby-memory.html -- https://www.mikeperham.com/2018/04/25/taming-rails-memory-bloat/ - -We also maintain our own [documentation on tuning the memory behavior of glibc by setting this environment variable](https://devcenter.heroku.com/articles/tuning-glibc-memory-behavior). - -If a your application is not memory bound and would prefer slightly faster execution over the decreased memory use, -you can set their `MALLOC_ARENA_MAX` to a higher value. The default as specified by the [linux man page](http://man7.org/linux/man-pages/man3/mallopt.3.html) -is 8 times the number of cores on the system. - -## Jemalloc - -Another popular alternative memory allocator is jemalloc. At this time Heroku does not maintain a supported version of this memory allocator, -but you can use it in your application with a 3rd party [jemalloc buildpack](https://elements.heroku.com/buildpacks/mojodna/heroku-buildpack-jemalloc). - -If you are using jemalloc, setting `MALLOC_ARENA_MAX` will have no impact on memory or performance. For more information on -how jemalloc interacts with Ruby applications see this external post: - -- https://www.speedshop.co/2017/12/04/malloc-doubles-ruby-memory.html#fix-2-use-jemalloc diff --git a/changelogs/v206/.gitkeep b/changelogs/v206/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/changelogs/v206/default_ruby.md b/changelogs/v206/default_ruby.md deleted file mode 100644 index e1a3c29cf..000000000 --- a/changelogs/v206/default_ruby.md +++ /dev/null @@ -1,3 +0,0 @@ -## Default Ruby version for new apps is now 2.5.7 - -The [default Ruby version for new Ruby applications is 2.5.7](https://devcenter.heroku.com/articles/ruby-support#default-ruby-version-for-new-apps). You’ll only get the default if the application does not specify a ruby version. \ No newline at end of file diff --git a/changelogs/v206/ruby_warning.md b/changelogs/v206/ruby_warning.md deleted file mode 100644 index 00fbba134..000000000 --- a/changelogs/v206/ruby_warning.md +++ /dev/null @@ -1,9 +0,0 @@ -## Using old and EOL versions of Ruby now generate warnings - -If your application is using a version of MRI Ruby that is below the latest released patch level, you'll now receive a warning on deploy in the build output. For example, if you are using `2.3.3`, you'll be encouraged to upgrade to the latest in the series which is `2.3.8`. - -In addition to the version warning, you'll now receive warnings when you're using a version of Ruby that may be EOL (End of Life) soon or is already EOL. Ruby Core officially supports up to 3 releases of Ruby at a time. For example, when `2.7` is released, then the supported versions will be `2.7.x`, `2.6.x`, and `2.5.x`. Our support mirrors Ruby Core support. You can see the [latest versions of Ruby available on our Ruby support page](https://devcenter.heroku.com/articles/ruby-support#supported-runtimes). - -Right now you'll receive a warning indicating that your version of Ruby is close to being EOL if you're using `2.4.x`. If you're using `2.3.x` or older, you'll receive a warning indicating that your version is already EOL and we will not be providing support or security patches for the version. - -We highly recommend staying on a non-EOL version of Ruby and using the latest patch release as these versions contain the most up to date security and bug fixes. \ No newline at end of file diff --git a/changelogs/v207/.gitkeep b/changelogs/v207/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/changelogs/v207/remove_bundle_with.md b/changelogs/v207/remove_bundle_with.md deleted file mode 100644 index 9eb53918a..000000000 --- a/changelogs/v207/remove_bundle_with.md +++ /dev/null @@ -1,11 +0,0 @@ -## Ruby apps will now have the `BUNDLED WITH` declaration in their `Gemfile.lock` removed after detecting Bundler version - -The version listed in the `BUNDLED WITH` key of the `Gemfile.lock` is used by Heroku to [detect what version of Bundler to use](https://devcenter.heroku.com/articles/ruby-support#libraries). - -This declaration is also used internally by an integration between RubyGems and Bundler to attempt to recognize version differences and raise an error. This logic contains bugs and has been embeded in many versions of already released for many existing Ruby versions. In an effort to remove false errors from application deployments, the `BUNDLED WITH` declaration will now be removed from the `Gemfile.lock` after it has been used to determine and install a compatible version of Bundler for the application. - -A message will be emitted in the build process when this happens: - -``` ------> Removing BUNDLED WITH version in the Gemfile.lock -``` \ No newline at end of file diff --git a/changelogs/v207/vendor_libpq.md b/changelogs/v207/vendor_libpq.md deleted file mode 100644 index 86cc578f7..000000000 --- a/changelogs/v207/vendor_libpq.md +++ /dev/null @@ -1,15 +0,0 @@ -## Postgresql client library libpq version 5.12.1 now vendored into Ruby applications on Heroku-18 - -Ruby applications deploying to Heroku-18 will get a vendored version of the libpq client library version 5.12.1 starting today. For more information about the reasons for this change and the possible effects see: - -https://devcenter.heroku.com/articles/libpq-5-12-1-breaking-connection-behavior - -If your application breaks due to this change you can rollback to your last build. You can also temporarially opt out of this behavior by setting: - -``` -$ heroku config:set HEROKU_SKIP_LIBPQ12=1 -``` - -In the future libpq 5.12 will be the default on the platform and you will not be able to opt-out of the library. For more information see: - -https://devcenter.heroku.com/articles/libpq-5-12-1-breaking-connection-behavior diff --git a/changelogs/v208/default_ruby_2_6_5.md b/changelogs/v208/default_ruby_2_6_5.md deleted file mode 100644 index c68c573d3..000000000 --- a/changelogs/v208/default_ruby_2_6_5.md +++ /dev/null @@ -1,3 +0,0 @@ -## Default Ruby version for new apps is now 2.6.5 - -The [default Ruby version for new Ruby applications is 2.6.5](https://devcenter.heroku.com/articles/ruby-support#default-ruby-version-for-new-apps). You’ll only get the default if the application does not specify a ruby version. diff --git a/changelogs/v214/default_ruby_266.md b/changelogs/v214/default_ruby_266.md deleted file mode 100644 index e4fda1813..000000000 --- a/changelogs/v214/default_ruby_266.md +++ /dev/null @@ -1,3 +0,0 @@ -## Default Ruby version for new apps is now 2.6.6 - -The [default Ruby version for new Ruby applications is 2.6.6](https://devcenter.heroku.com/articles/ruby-support#default-ruby-version-for-new-apps). You’ll only get the default if the application does not specify a ruby version. diff --git a/changelogs/v218/disable_spring.md b/changelogs/v218/disable_spring.md deleted file mode 100644 index 6a72757ba..000000000 --- a/changelogs/v218/disable_spring.md +++ /dev/null @@ -1,11 +0,0 @@ - ## The spring library will be disabled in all Ruby applications - -The [spring library](https://github.com/rails/spring) is an "application preloader" that is intended to save time between multiple application boots. For example, running the `bin/rails test` command numerous times in a row would be faster with spring. The library accomplishes this performance boost by forking the application after first boot and preserving this fork for future application loads. This behavior has been shown to cause instability and bugs on Heroku. Consequently, all applications using the `heroku/ruby` buildpack will now automatically have spring disabled through the environment variable: - - ``` -DISABLE_SPRING=1 - ``` - -Any benefits that spring provides come from repeatedly calling the same command. However, most commands on Heroku are only run once (`rails server` on boot, for example). As a result, using spring on the system would provide little to no realized practical benefit. - -This behavior is now is documented in the [Heroku Ruby Support page](https://devcenter.heroku.com/articles/ruby-support). diff --git a/changelogs/v218/node_yarn.md b/changelogs/v218/node_yarn.md deleted file mode 100644 index f8eb7b558..000000000 --- a/changelogs/v218/node_yarn.md +++ /dev/null @@ -1,8 +0,0 @@ -## Ruby apps now default to Node version 12.16.2 and Yarn version 1.22.4 - -Applications using the `heroku/ruby` buildpack that do not have a version of Node installed by another buildpack (such as the `heroku/nodejs` buildpack) will now receive: - -- Node version 12.16.2 (was previously 10.15.3) -- Yarn version 1.22.4 (was previously 1.16.0) - -These versions and instructions on how to specify a specific version of these binaries can be found on the [installed binaries section of the Heroku Ruby Support page](https://devcenter.heroku.com/articles/ruby-support#installed-binaries). diff --git a/changelogs/v219/bundler-214.md b/changelogs/v219/bundler-214.md deleted file mode 100644 index 4b5afc212..000000000 --- a/changelogs/v219/bundler-214.md +++ /dev/null @@ -1,3 +0,0 @@ -## Ruby apps with Bundler 2.x now receive version 2.1.4 - -The [Ruby Buildpack](https://devcenter.heroku.com/articles/ruby-support#libraries) now includes Bundler 2.1.4. Applications specifying Bundler 2.x in their `Gemfile.lock` will now receive bundler: 2.1.4. diff --git a/changelogs/v219/bundler-env-vars.md b/changelogs/v219/bundler-env-vars.md deleted file mode 100644 index df51681c6..000000000 --- a/changelogs/v219/bundler-env-vars.md +++ /dev/null @@ -1,20 +0,0 @@ -## Ruby applications now configure bundler with environment variables instead of flags - -Previously the Ruby buildpack ran bundler installation with flags: - -``` -Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment -[DEPRECATED] The `--deployment` flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use `bundle config set deployment 'true'`, and stop using this flag -[DEPRECATED] The `--path` flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use `bundle config set path 'vendor/bundle'`, and stop using this flag -[DEPRECATED] The `--without` flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use `bundle config set without 'development:test'`, and stop using this flag -[DEPRECATED] The --binstubs option will be removed in favor of `bundle binstubs` -``` - -In order to remove deprecations from Bundler 2.x, Ruby applications now run bundler installation with environment variables instead: - -``` -Running: BUNDLE_WITHOUT=development:test BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 bundle install -j4 -``` - -This behavior is documented in the [Heroku Ruby Support page](https://devcenter.heroku.com/articles/ruby-support). - diff --git a/changelogs/v224/.gitkeep b/changelogs/v224/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/changelogs/v224/jvm_installer_default.md b/changelogs/v224/jvm_installer_default.md deleted file mode 100644 index 742cf721c..000000000 --- a/changelogs/v224/jvm_installer_default.md +++ /dev/null @@ -1,13 +0,0 @@ -## JVM support for JRuby apps is now provided by the `heroku/jvm` buildpack - -JRuby applications require the JVM to run. Before this change, the JVM for JRuby apps was provided by the `heroku/ruby` buildpack for JRuby applications. - -Now the custom JVM installation logic in the `heroku/ruby` buildpack has been removed, and instead, the `heroku/jvm` buildpack will be called directly by the Ruby buildpack. - -Instead of relying on this functionality, it is recommended to manually require the `heroku/jvm` buildpack for your application: - -``` -$ heroku buildpacks:add heroku/jvm --index=1 -``` - -For more information on JRuby support, see the [Heroku Ruby Support page](https://devcenter.heroku.com/articles/ruby-support). diff --git a/changelogs/v225/bundler_2_2_11.md b/changelogs/v225/bundler_2_2_11.md deleted file mode 100644 index 0abae2143..000000000 --- a/changelogs/v225/bundler_2_2_11.md +++ /dev/null @@ -1,3 +0,0 @@ -## Ruby apps with Bundler 2.x now receive version 2.2.11 - -The [Ruby Buildpack](https://devcenter.heroku.com/articles/ruby-support#libraries) now includes Bundler 2.2.11. Applications specifying Bundler 2.x in their `Gemfile.lock` will now receive this version of bundler. diff --git a/changelogs/v226/bundler_2_2_15.md b/changelogs/v226/bundler_2_2_15.md deleted file mode 100644 index 48165ea8d..000000000 --- a/changelogs/v226/bundler_2_2_15.md +++ /dev/null @@ -1,3 +0,0 @@ -## Ruby apps with Bundler 2.x now receive version 2.2.15 - -The [Ruby Buildpack](https://devcenter.heroku.com/articles/ruby-support#libraries) now includes Bundler 2.2.15. Applications specifying Bundler 2.x in their `Gemfile.lock` will now receive this version of bundler. diff --git a/changelogs/v227/bundler_2216.md b/changelogs/v227/bundler_2216.md deleted file mode 100644 index d41098263..000000000 --- a/changelogs/v227/bundler_2216.md +++ /dev/null @@ -1,3 +0,0 @@ -## Ruby apps with Bundler 2.x now receive version 2.2.16 - -The [Ruby Buildpack](https://devcenter.heroku.com/articles/ruby-support#libraries) now includes Bundler 2.2.16. Applications specifying Bundler 2.x in their `Gemfile.lock` will now receive this version of bundler. diff --git a/changelogs/v228/bundler_2_2_21.md b/changelogs/v228/bundler_2_2_21.md deleted file mode 100644 index 848a2d9c7..000000000 --- a/changelogs/v228/bundler_2_2_21.md +++ /dev/null @@ -1,3 +0,0 @@ -## Ruby apps with Bundler 2.x now receive version 2.2.21 - -The [Ruby Buildpack](https://devcenter.heroku.com/articles/ruby-support#libraries) now includes Bundler 2.2.21. Applications specifying Bundler 2.x in their `Gemfile.lock` will now receive bundler: 2.2.21. diff --git a/changelogs/v229/WEB_CONCURRENCY.md b/changelogs/v229/WEB_CONCURRENCY.md deleted file mode 100644 index 8522594be..000000000 --- a/changelogs/v229/WEB_CONCURRENCY.md +++ /dev/null @@ -1,7 +0,0 @@ -## Ruby buildpack now clears previous default buildpack `WEB_CONCURRENCY` values - -Some buildpacks may set a default value for the `WEB_CONCURRENCY` environment variable during dyno startup. - -When multiple buildpacks define default values, the declaration from the last buildpack in the list of multiple buildpacks takes precedence, as this is the [primary language of an app](https://devcenter.heroku.com/articles/using-multiple-buildpacks-for-an-app#adding-a-buildpack). - -The Ruby buildpack is now interoperable with other buildpacks in this regard; for example, using `heroku/nodejs` as the first, and `heroku/ruby` as the second buildpack, will no longer lead to Node.js default values for `WEB_CONCURRENCY` to apply at runtime. diff --git a/changelogs/v230/ruby_274_default.md b/changelogs/v230/ruby_274_default.md deleted file mode 100644 index 0a480c1ec..000000000 --- a/changelogs/v230/ruby_274_default.md +++ /dev/null @@ -1,3 +0,0 @@ -## Default Ruby version for new apps is now 2.7.4 - -The [default Ruby version for new Ruby applications is 2.7.4](https://devcenter.heroku.com/articles/ruby-support#default-ruby-version-for-new-apps). You’ll only get the default if the application does not specify a ruby version. diff --git a/changelogs/v231/.gitkeep b/changelogs/v231/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/changelogs/v231/jsbundling_packagejson.md b/changelogs/v231/jsbundling_packagejson.md deleted file mode 100644 index 41f46c704..000000000 --- a/changelogs/v231/jsbundling_packagejson.md +++ /dev/null @@ -1,10 +0,0 @@ -## Nodejs will now be installed for Ruby applications that have a `package.json` file - -Ruby applications using the `heroku/ruby` buildpack now receive a default version of `node` installed if they have a `package.json` file in the root directory of their application. - -Prior to this change, only applications using the `webpacker` or `execjs` gem would trigger node installation logic. This change is intended to facilitate Rails 7 applications using `jsbundling-rails` without `webpacker`. - ->Note ->Applications using the `heroku/nodejs` buildpack before the `heroku/ruby` buildpack will not see a change in behavior - -For more information, see [Heroku Ruby support documentation](https://devcenter.heroku.com/articles/ruby-support#installed-binaries). diff --git a/changelogs/v231/jsbundling_yarnlock.md b/changelogs/v231/jsbundling_yarnlock.md deleted file mode 100644 index 2f70d329b..000000000 --- a/changelogs/v231/jsbundling_yarnlock.md +++ /dev/null @@ -1,10 +0,0 @@ -## Yarn will now be installed for Ruby applications that have a `yarn.lock` file - -Ruby applications using the `heroku/ruby` buildpack now receive a default version of `yarn` installed if they have a `yarn.lock` file in the root directory of their application. - -Prior to this change, only applications using the `webpacker` gem would trigger node installation logic. This change is intended to facilitate Rails 7 applications using `jsbundling-rails` without `webpacker`. - ->Note ->Applications using the `heroku/nodejs` buildpack before the `heroku/ruby` buildpack will not see a change in behavior - -For more information, see [Heroku Ruby support documentation](https://devcenter.heroku.com/articles/ruby-support#installed-binaries). diff --git a/changelogs/v233/.gitkeep b/changelogs/v233/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/changelogs/v233/node_yarn.md b/changelogs/v233/node_yarn.md deleted file mode 100644 index c769c5d7f..000000000 --- a/changelogs/v233/node_yarn.md +++ /dev/null @@ -1,8 +0,0 @@ -## Ruby apps now default to Node version 16.13.1 and Yarn version 1.22.17 - -Applications using the `heroku/ruby` buildpack that do not have a version of Node installed by another buildpack (such as the `heroku/nodejs` buildpack) will now receive: - -- Node version 16.13.1 (was previously 12.16.2) -- Yarn version 1.22.17 (was previously 1.22.4) - -These versions and instructions on how to specify a specific version of these binaries can be found on the [installed binaries section of the Heroku Ruby Support page](https://devcenter.heroku.com/articles/ruby-support#installed-binaries). diff --git a/changelogs/v233/ruby_275_default.md b/changelogs/v233/ruby_275_default.md deleted file mode 100644 index 27c088192..000000000 --- a/changelogs/v233/ruby_275_default.md +++ /dev/null @@ -1,3 +0,0 @@ -## Default Ruby version for new apps is now 2.7.5 - -The [default Ruby version for new Ruby applications is 2.7.5](https://devcenter.heroku.com/articles/ruby-support#default-ruby-version-for-new-apps). You’ll only get the default if the application does not specify a ruby version. diff --git a/changelogs/v235/bundler_2_2_33.md b/changelogs/v235/bundler_2_2_33.md deleted file mode 100644 index c22ad8888..000000000 --- a/changelogs/v235/bundler_2_2_33.md +++ /dev/null @@ -1,3 +0,0 @@ -## Ruby apps with Bundler 2.x now receive version 2.2.33 - -The [Ruby Buildpack](https://devcenter.heroku.com/articles/ruby-support#libraries) now includes Bundler 2.2.33. Applications specifying Bundler 2.x in their `Gemfile.lock` will now receive this version of bundler. diff --git a/changelogs/v237/ruby_303_default.md b/changelogs/v237/ruby_303_default.md deleted file mode 100644 index 2dfd512b2..000000000 --- a/changelogs/v237/ruby_303_default.md +++ /dev/null @@ -1,3 +0,0 @@ -## Default Ruby version for new apps is now 3.0.3 - -The [default Ruby version for new Ruby applications is 3.0.3](https://devcenter.heroku.com/articles/ruby-support#default-ruby-version-for-new-apps). You’ll only get the default if the application does not specify a ruby version. diff --git a/changelogs/v238/bundle-upgrade.md b/changelogs/v238/bundle-upgrade.md deleted file mode 100644 index 5e5bcf52b..000000000 --- a/changelogs/v238/bundle-upgrade.md +++ /dev/null @@ -1,3 +0,0 @@ -## Ruby apps with Bundler 2.x now receive version 2.3.7 - -The [Ruby Buildpack](https://devcenter.heroku.com/articles/ruby-support#libraries) now includes Bundler 2.3.7. Applications specifying Bundler 2.x in their `Gemfile.lock` will now receive bundler: 2.3.7. diff --git a/changelogs/v240/bundler_2_3_10.md b/changelogs/v240/bundler_2_3_10.md deleted file mode 100644 index 0eb468053..000000000 --- a/changelogs/v240/bundler_2_3_10.md +++ /dev/null @@ -1,3 +0,0 @@ -## Ruby apps with Bundler 2.x now receive version 2.3.10 - -The [Ruby Buildpack](https://devcenter.heroku.com/articles/ruby-support#libraries) now includes Bundler 2.3.10. Applications specifying Bundler 2.x in their `Gemfile.lock` will now receive this version of bundler. diff --git a/changelogs/v244/default_ruby.md b/changelogs/v244/default_ruby.md deleted file mode 100644 index 0017cbd03..000000000 --- a/changelogs/v244/default_ruby.md +++ /dev/null @@ -1,3 +0,0 @@ -## Default Ruby version for new apps is now 3.1.2 - -The [default Ruby version for new Ruby applications is 3.1.2](https://devcenter.heroku.com/articles/ruby-support#default-ruby-version-for-new-apps). You’ll only get the default if the application does not specify a ruby version. diff --git a/changelogs/v245/bundler_2_3_25.md b/changelogs/v245/bundler_2_3_25.md deleted file mode 100644 index 512c9d3e6..000000000 --- a/changelogs/v245/bundler_2_3_25.md +++ /dev/null @@ -1,3 +0,0 @@ -## Ruby apps with Bundler 2.x now receive version 2.3.25 - -The [Ruby Buildpack](https://devcenter.heroku.com/articles/ruby-support#libraries) now includes Bundler 2.3.25. Applications specifying Bundler 2.x in their `Gemfile.lock` will now receive this version of bundler. diff --git a/changelogs/v246/node_defaults.md b/changelogs/v246/node_defaults.md deleted file mode 100644 index 85b85959c..000000000 --- a/changelogs/v246/node_defaults.md +++ /dev/null @@ -1,10 +0,0 @@ -## Ruby apps now default to Node version 16.18.1 and Yarn version 1.22.19 - -Applications using the `heroku/ruby` buildpack that do not already have `node` -and/or `yarn` installed by another buildpack (such as the `heroku/nodejs` -buildpack) will now receive: - -- Node.js version 16.18.1 (was previously 16.13.1) -- Yarn version 1.22.19 (was previously 1.22.17) - -These versions and instructions on how to specify a specific version of these binaries can be found on the [installed binaries section of the Heroku Ruby Support page](https://devcenter.heroku.com/articles/ruby-support#installed-binaries). diff --git a/changelogs/v247/jruby_releases.md b/changelogs/v247/jruby_releases.md deleted file mode 100644 index 8f3903fa2..000000000 --- a/changelogs/v247/jruby_releases.md +++ /dev/null @@ -1,10 +0,0 @@ -## JRuby versions 9.4.0.0, 9.3.9.0, 9.3.8.0, and 9.3.7.0 are now available - -The following Ruby versions are now available on the Heroku platform: - -- JRuby 9.4.0.0 -- JRuby 9.3.9.0 -- JRuby 9.3.8.0 -- JRuby 9.3.7.0 - -You can see the latest versions on the [Ruby support page](https://devcenter.heroku.com/articles/ruby-support). diff --git a/changelogs/v248/ruby-320-rc1.md b/changelogs/v248/ruby-320-rc1.md deleted file mode 100644 index a5b98326b..000000000 --- a/changelogs/v248/ruby-320-rc1.md +++ /dev/null @@ -1,10 +0,0 @@ -# Ruby version 3.2.0-rc1 is now available - -The following Ruby versions are now available on the Heroku platform: - -- Ruby 3.2.0-rc1 - ->note ->Stability-sensitive applications should not use Ruby 3.2.0 in it's release candidate state. - -You can see the latest versions on the [Ruby support page](https://devcenter.heroku.com/articles/ruby-support). diff --git a/changelogs/v249/skip_database_provision.md b/changelogs/v249/skip_database_provision.md deleted file mode 100644 index 4536d2c85..000000000 --- a/changelogs/v249/skip_database_provision.md +++ /dev/null @@ -1,15 +0,0 @@ -## Apps that use the `heroku/ruby` buildpack can now skip automatic database provisioning using an environment variable - -When applications are deployed to Heroku, the last buildpack to execute can request add-ons are provisioned via the [`bin/release` interface](https://devcenter.heroku.com/articles/buildpack-api#bin-release). The `heroku/ruby` buildpack checks if the application [contains a Postgres gem](https://github.com/heroku/heroku-buildpack-ruby/blob/104fe3a374e07a8f3723f110c2148d57ecb9ee79/lib/language_pack/ruby.rb#L992-L1008) and requests that Heroku provision a database for the application automatically. Before the pricing change, the database requested was free, and adding this add-on by the buildpack would save developers time while setting up applications. - -Developers using the `heroku/ruby` buildpack to deploy new applications who do not want this behavior can now opt out by setting the `HEROKU_SKIP_DATABASE_PROVISION` environment variable: - -```shell -$ heroku config:set HEROKU_SKIP_DATABASE_PROVISION=1 -``` - -This setting will prevent the database from being requested. This environment variable only affects `heroku/ruby` users and only affects applications without a successful first deployment. Any already deployed applications that do not want a Heroku database must manually remove their add-on. - -This environment variable interface is experimental and subject to change. Before any change, a deprecation warning will be emitted from the `heroku/ruby` buildpack on deployment with additional details. - -For more information, see [Ruby database provisioning](https://devcenter.heroku.com/articles/ruby-database-provisioning). diff --git a/changelogs/v250/ruby-320.md b/changelogs/v250/ruby-320.md deleted file mode 100644 index c29c97228..000000000 --- a/changelogs/v250/ruby-320.md +++ /dev/null @@ -1,7 +0,0 @@ -# Ruby version 3.2.0 is now available - -The following Ruby versions are now available on the Heroku platform: - -- Ruby 3.2.0 - -You can see the latest versions on the [Ruby support page](https://devcenter.heroku.com/articles/ruby-support). diff --git a/changelogs/v252/jruby-9-4-1-0.md b/changelogs/v252/jruby-9-4-1-0.md deleted file mode 100644 index 6f5c6b945..000000000 --- a/changelogs/v252/jruby-9-4-1-0.md +++ /dev/null @@ -1,7 +0,0 @@ -## JRuby 9.4.1.0 is now available - -The following Ruby versions are now available on the Heroku platform: - -- JRuby 9.4.1.0 - -You can see the latest versions on the [Ruby support page](https://devcenter.heroku.com/articles/ruby-support). diff --git a/changelogs/v252/ruby-3-2-1.md b/changelogs/v252/ruby-3-2-1.md deleted file mode 100644 index 3625cb424..000000000 --- a/changelogs/v252/ruby-3-2-1.md +++ /dev/null @@ -1,7 +0,0 @@ -# Ruby version 3.2.1 is now available - -The following Ruby versions are now available on the Heroku platform: - -- Ruby 3.2.1 - -You can see the latest versions on the [Ruby support page](https://devcenter.heroku.com/articles/ruby-support). diff --git a/changelogs/v253/ruby_278_306_314_322.md b/changelogs/v253/ruby_278_306_314_322.md deleted file mode 100644 index 1d2a5a60d..000000000 --- a/changelogs/v253/ruby_278_306_314_322.md +++ /dev/null @@ -1,10 +0,0 @@ -## Ruby versions 2.7.8, 3.0.6, 3.1.4, 3.2.2 are now available - -The following Ruby versions are now available on the Heroku platform: - -- Ruby 2.7.8 -- Ruby 3.0.6 -- Ruby 3.1.4 -- Ruby 3.2.2 - -You can see the latest versions on the [Ruby support page](https://devcenter.heroku.com/articles/ruby-support). diff --git a/changelogs/v254/default-ruby-314.md b/changelogs/v254/default-ruby-314.md deleted file mode 100644 index 69f3d431d..000000000 --- a/changelogs/v254/default-ruby-314.md +++ /dev/null @@ -1,3 +0,0 @@ -## Default Ruby version for new apps is now 3.1.4 - -The [default Ruby version for new Ruby applications is 3.1.4](https://devcenter.heroku.com/articles/ruby-support#default-ruby-version-for-new-apps). You’ll only get the default if the application does not specify a ruby version. diff --git a/changelogs/v254/ruby-330-preview1.md b/changelogs/v254/ruby-330-preview1.md deleted file mode 100644 index a046ae121..000000000 --- a/changelogs/v254/ruby-330-preview1.md +++ /dev/null @@ -1,11 +0,0 @@ -# Ruby version 3.3.0-preview1 is now available - -[Ruby v3.3.0 preview1](/articles/ruby-support#ruby-versions) is now available on Heroku. To run your app using this preview version of Ruby, add the following `ruby` directive to your Gemfile: - -```ruby -ruby "3.3.0" -``` - -For more information on [Ruby 3.3.0-preview1, you can view the release announcement](https://www.ruby-lang.org/en/news/). - -Note: This version of Ruby is not suitable for production applications. However, it can be used to test that your application is ready for the December release of Ruby 3.3.0 and to [provide feedback](https://bugs.ruby-lang.org/projects/ruby-master/issues) to the Ruby core team. diff --git a/changelogs/v255/jruby-9.2.2.0.md b/changelogs/v255/jruby-9.2.2.0.md deleted file mode 100644 index 89d51ff55..000000000 --- a/changelogs/v255/jruby-9.2.2.0.md +++ /dev/null @@ -1,9 +0,0 @@ -## JRuby version 9.4.2.0 is now available - -[JRuby v9.4.2.0](/articles/ruby-support#ruby-versions) is now available on Heroku. To run your app using this version of Ruby, add the following `ruby` directive to your Gemfile: - -```ruby -ruby "3.1.0", engine: "jruby", engine_version: "9.4.2.0" -``` - -The JRuby release notes can be found on the [JRuby website](https://www.jruby.org/news). diff --git a/changelogs/v255/jruby-9.2.3.0.md b/changelogs/v255/jruby-9.2.3.0.md deleted file mode 100644 index 80c005193..000000000 --- a/changelogs/v255/jruby-9.2.3.0.md +++ /dev/null @@ -1,9 +0,0 @@ -## JRuby version 9.4.3.0 is now available - -[JRuby v9.4.3.0](/articles/ruby-support#ruby-versions) is now available on Heroku. To run your app using this version of Ruby, add the following `ruby` directive to your Gemfile: - -```ruby -ruby "3.1.4", engine: "jruby", engine_version: "9.4.3.0" -``` - -The JRuby release notes can be found on the [JRuby website](https://www.jruby.org/news). diff --git a/changelogs/v260/jruby-9.4.4.0.md b/changelogs/v260/jruby-9.4.4.0.md deleted file mode 100644 index c0bc51df5..000000000 --- a/changelogs/v260/jruby-9.4.4.0.md +++ /dev/null @@ -1,10 +0,0 @@ -## JRuby version 9.4.4.0 is now available - -[JRuby v9.4.4.0](/articles/ruby-support#ruby-versions) is now available on Heroku. To run -your app using this version of Ruby, add the following `ruby` directive to your Gemfile: - -```ruby -ruby "3.1.4", engine: "jruby", engine_version: "9.4.4.0" -``` - -The JRuby release notes can be found on the [JRuby website](https://www.jruby.org/news). diff --git a/changelogs/v261/jruby_9.3.13.0.md b/changelogs/v261/jruby_9.3.13.0.md deleted file mode 100644 index 45082f69e..000000000 --- a/changelogs/v261/jruby_9.3.13.0.md +++ /dev/null @@ -1,10 +0,0 @@ -## JRuby version 9.3.13.0 is now available - -[JRuby v9.3.13.0](/articles/ruby-support#ruby-versions) is now available on Heroku. To run -your app using this version of Ruby, add the following `ruby` directive to your Gemfile: - -```ruby -ruby "2.6.8", engine: "jruby", engine_version: "9.3.13.0" -``` - -The JRuby release notes can be found on the [JRuby website](https://www.jruby.org/news). diff --git a/changelogs/v261/jruby_9.4.5.0.md b/changelogs/v261/jruby_9.4.5.0.md deleted file mode 100644 index df31b258c..000000000 --- a/changelogs/v261/jruby_9.4.5.0.md +++ /dev/null @@ -1,10 +0,0 @@ -## JRuby version 9.4.5.0 is now available - -[JRuby v9.4.5.0](/articles/ruby-support#ruby-versions) is now available on Heroku. To run -your app using this version of Ruby, add the following `ruby` directive to your Gemfile: - -```ruby -ruby "3.1.4", engine: "jruby", engine_version: "9.4.5.0" -``` - -The JRuby release notes can be found on the [JRuby website](https://www.jruby.org/news). diff --git a/changelogs/v261/node_20_9_0.md b/changelogs/v261/node_20_9_0.md deleted file mode 100644 index d260909bd..000000000 --- a/changelogs/v261/node_20_9_0.md +++ /dev/null @@ -1,8 +0,0 @@ -## Ruby apps now default to Node version 20.9.0 - -Applications using the `heroku/ruby` buildpack that do not already have `node` installed by another buildpack (such as the `heroku/nodejs` -buildpack) will now receive: - -- Node.js version 20.9.0 (was previously 16.18.1) - -These versions and instructions on how to specify a specific version of these binaries can be found on the [installed binaries section of the Heroku Ruby Support page](https://devcenter.heroku.com/articles/ruby-support#installed-binaries). diff --git a/changelogs/v263/ruby-330-rc1.md b/changelogs/v263/ruby-330-rc1.md deleted file mode 100644 index 56e74afe3..000000000 --- a/changelogs/v263/ruby-330-rc1.md +++ /dev/null @@ -1,15 +0,0 @@ -## Ruby version 3.3.0-rc1 is now available - -[Ruby v3.3.0-rc1](/articles/ruby-support#ruby-versions) is now available on Heroku. To run -your app using this version of Ruby, add the following `ruby` directive to your Gemfile: - -```ruby -ruby "3.3.0.rc1" -``` - -For more information on [Ruby 3.3.0-rc1, you can view the release announcement](https://www.ruby-lang.org/en/news/). - -Note: This version of Ruby is not suitable for production applications. - However, it can be used to test that your application is ready for - the official release of Ruby 3.3.0 and - to provide feedback to the Ruby core team. diff --git a/lib/language_pack/base.rb b/lib/language_pack/base.rb index 717f5c363..1a2d890b4 100644 --- a/lib/language_pack/base.rb +++ b/lib/language_pack/base.rb @@ -17,7 +17,6 @@ class LanguagePack::Base extend LanguagePack::ShellHelpers VENDOR_URL = ENV['BUILDPACK_VENDOR_URL'] || "https://heroku-buildpack-ruby.s3.us-east-1.amazonaws.com" - DEFAULT_LEGACY_STACK = "cedar" ROOT_DIR = File.expand_path("../../..", __FILE__) MULTI_ARCH_STACKS = ["heroku-24"] KNOWN_ARCHITECTURES = ["amd64", "arm64"] @@ -99,7 +98,6 @@ def compile puts @deprecations.join("\n") end Kernel.puts "" - mcount "success" end def build_release @@ -129,32 +127,6 @@ def warn_webserver warn msg end - - - # log output - # Ex. log "some_message", "here", :someattr="value" - def log(*args) - args.concat [:id => @id] - args.concat [:framework => self.class.to_s.split("::").last.downcase] - - start = Time.now.to_f - log_internal args, :start => start - - if block_given? - begin - ret = yield - finish = Time.now.to_f - log_internal args, :status => "complete", :finish => finish, :elapsed => (finish - start) - return ret - rescue StandardError => ex - finish = Time.now.to_f - message = Shellwords.escape(ex.message) - log_internal args, :status => "error", :finish => finish, :elapsed => (finish - start), :message => message - raise ex - end - end - end - private ################################## # sets up the environment variables for the build process @@ -214,20 +186,4 @@ def set_export_override(key, val) def set_export_path(key, val) export key, val, option: :path end - - def log_internal(*args) - message = build_log_message(args) - %x{ logger -p user.notice -t "slugc[$$]" "buildpack-ruby #{message}" } - end - - def build_log_message(args) - args.map do |arg| - case arg - when Float then "%0.2f" % arg - when Array then build_log_message(arg) - when Hash then arg.map { |k,v| "#{k}=#{build_log_message([v])}" }.join(" ") - else arg - end - end.join(" ") - end end diff --git a/lib/language_pack/cache.rb b/lib/language_pack/cache.rb index 25d784a64..270a70943 100644 --- a/lib/language_pack/cache.rb +++ b/lib/language_pack/cache.rb @@ -60,7 +60,7 @@ def load_without_overwrite(path, dest=nil) dest ||= path case ENV["STACK"] - when "heroku-20", "heroku-22" + when "heroku-22" copy (@cache_base + path), dest, "-a -n" else copy (@cache_base + path), dest, "-a --update=none" diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index 3d8ecd651..61509215b 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -36,8 +36,7 @@ class LanguagePack::Helpers::BundlerWrapper include LanguagePack::ShellHelpers BLESSED_BUNDLER_VERSIONS = {} - # Heroku-20's oldest Ruby verison is 2.5.x which doesn't work with bundler 2.4 - BLESSED_BUNDLER_VERSIONS["1"] = "1.17.3" + # Heroku-22's oldest Ruby version is 3.1 BLESSED_BUNDLER_VERSIONS["2.3"] = "2.3.25" BLESSED_BUNDLER_VERSIONS["2.4"] = "2.4.22" BLESSED_BUNDLER_VERSIONS["2.5"] = "2.5.23" @@ -47,9 +46,8 @@ class LanguagePack::Helpers::BundlerWrapper # Convert arbitrary `..x` versions BLESSED_BUNDLER_VERSIONS.default_proc = Proc.new do |hash, key| - if Gem::Version.new(key).segments.first == 1 - hash["1"] - elsif Gem::Version::new(key).segments.first == 2 + case Gem::Version.new(key).segments.first + when 2 if Gem::Version.new(key) > Gem::Version.new("2.6") hash["2.6"] elsif Gem::Version.new(key) < Gem::Version.new("2.3") @@ -204,28 +202,26 @@ def ruby_version ruby_version = self.class.platform_to_version(output) if ruby_version.nil? || ruby_version.empty? - if Gem::Version.new(self.version) > Gem::Version.new("2.3") - warn(<<~WARNING, inline: true) - No ruby version specified in the Gemfile.lock + warn(<<~WARNING, inline: true) + No ruby version specified in the Gemfile.lock - We could not determine the version of Ruby from your Gemfile.lock. + We could not determine the version of Ruby from your Gemfile.lock. - $ bundle platform --ruby - #{output} + $ bundle platform --ruby + #{output} - $ bundle -v - #{run("bundle -v", user_env: true, env: env)} + $ bundle -v + #{run("bundle -v", user_env: true, env: env)} - Ensure the above command outputs the version of Ruby you expect. If you have a ruby version specified in your Gemfile, you can update the Gemfile.lock by running the following command: + Ensure the above command outputs the version of Ruby you expect. If you have a ruby version specified in your Gemfile, you can update the Gemfile.lock by running the following command: - $ bundle update --ruby + $ bundle update --ruby - Make sure you commit the results to git before attempting to deploy again: + Make sure you commit the results to git before attempting to deploy again: - $ git add Gemfile.lock - $ git commit -m "update ruby version" - WARNING - end + $ git add Gemfile.lock + $ git commit -m "update ruby version" + WARNING end ruby_version end @@ -242,19 +238,6 @@ def lockfile_parser @lockfile_parser ||= parse_gemfile_lock end - # Some bundler versions have different behavior - # if config is global versus local. These versions need - # the environment variable BUNDLE_GLOBAL_PATH_APPENDS_RUBY_SCOPE=1 - def needs_ruby_global_append_path? - Gem::Version.new(@version) < Gem::Version.new("2.1.4") - end - - # Bundler 2.2 introduced support for multiple "platforms" in the Gemfile.lock - # For more information see https://github.com/heroku/heroku-buildpack-ruby/issues/1157 - def supports_multiple_platforms? - Gem::Version.new(@version) >= Gem::Version.new("2.2") - end - def bundler_version_escape_valve! topic("Removing BUNDLED WITH version in the Gemfile.lock") contents = File.read(@gemfile_lock_path, mode: "rt") diff --git a/lib/language_pack/helpers/download_presence.rb b/lib/language_pack/helpers/download_presence.rb index 18e865656..30dd1d1db 100644 --- a/lib/language_pack/helpers/download_presence.rb +++ b/lib/language_pack/helpers/download_presence.rb @@ -7,16 +7,17 @@ # Example # # download = LanguagePack::Helpers::DownloadPresence.new( -# 'ruby-1.9.3.tgz', -# stacks: ['heroku-20', 'heroku-22'] +# 'ruby-3.1.7.tgz', +# stacks: ['heroku-22', 'heroku-24'] # ) # # download.call # # puts download.exists? #=> true -# puts download.valid_stack_list #=> ['cedar-14'] +# puts download.valid_stack_list #=> ['heroku-22', 'heroku-24'] class LanguagePack::Helpers::DownloadPresence - STACKS = ['heroku-20', 'heroku-22'] + # heroku-22 and heroku-24 have identical ruby versions supported + STACKS = ['heroku-22', 'heroku-24'] def initialize(file_name:, arch: , multi_arch_stacks:, stacks: STACKS ) @file_name = file_name diff --git a/lib/language_pack/helpers/outdated_ruby_version.rb b/lib/language_pack/helpers/outdated_ruby_version.rb index 9f23f0c7d..4fb490635 100644 --- a/lib/language_pack/helpers/outdated_ruby_version.rb +++ b/lib/language_pack/helpers/outdated_ruby_version.rb @@ -34,7 +34,6 @@ def initialize(current_ruby_version: , fetcher:) end def can_check? - return false if current_ruby_version.patchlevel_is_significant? return false if current_ruby_version.jruby? true diff --git a/lib/language_pack/helpers/rails_runner.rb b/lib/language_pack/helpers/rails_runner.rb index facc21c7d..1d0ca58c3 100644 --- a/lib/language_pack/helpers/rails_runner.rb +++ b/lib/language_pack/helpers/rails_runner.rb @@ -127,12 +127,10 @@ def execute_command! message = String.new("Detecting rails configuration timeout\n") message << "set HEROKU_DEBUG_RAILS_RUNNER=1 to debug" unless @debug warn(message) - mcount("warn.rails.runner.timeout") elsif !@success message = String.new("Detecting rails configuration failed\n") message << "set HEROKU_DEBUG_RAILS_RUNNER=1 to debug" unless @debug warn(message) - mcount("warn.rails.runner.fail") end return out diff --git a/lib/language_pack/helpers/rake_runner.rb b/lib/language_pack/helpers/rake_runner.rb index 0f18a2523..392b2c9ae 100644 --- a/lib/language_pack/helpers/rake_runner.rb +++ b/lib/language_pack/helpers/rake_runner.rb @@ -65,8 +65,7 @@ def invoke(options = {}) end end - def initialize(has_rake_gem = true) - @has_rake_gem = has_rake_gem + def initialize if !has_rake_installed? @rake_tasks = "" @rakefile_can_load = false @@ -126,12 +125,10 @@ def invoke(task, options = {}) end def has_rake_installed? - @has_rake ||= (@has_rake_gem && has_rakefile?) + @has_rake ||= has_rakefile? end -private - - def has_rakefile? + private def has_rakefile? %W{ Rakefile rakefile rakefile.rb Rakefile.rb}.detect {|file| File.exist?(file) } end end diff --git a/lib/language_pack/rails2.rb b/lib/language_pack/rails2.rb index ae0291bbb..43acab050 100644 --- a/lib/language_pack/rails2.rb +++ b/lib/language_pack/rails2.rb @@ -68,12 +68,7 @@ def best_practice_warnings private def has_jobs_work_task? - if result = rake.task("jobs:work").is_defined? - mcount("task.jobs:work.enabled") - else - mcount("task.jobs:work.disabled") - end - result + rake.task("jobs:work").is_defined? end def install_plugins diff --git a/lib/language_pack/rails3.rb b/lib/language_pack/rails3.rb index 7d6d1641e..945b196d3 100644 --- a/lib/language_pack/rails3.rb +++ b/lib/language_pack/rails3.rb @@ -48,8 +48,6 @@ def best_practice_warnings warn_x_sendfile_use! if assets_compile_enabled? - mcount("warn.assets.compile.true") - safe_sprockets_version_needed = sprocket_version_upgrade_needed if safe_sprockets_version_needed message = < "success" - puts "Asset precompilation completed (#{"%.2f" % precompile.time}s)" - else - precompile_fail(precompile.output) - end + if precompile.success? + puts "Asset precompilation completed (#{"%.2f" % precompile.time}s)" + else + precompile_fail(precompile.output) end end diff --git a/lib/language_pack/rails4.rb b/lib/language_pack/rails4.rb index a19eb4ebd..d34e90770 100644 --- a/lib/language_pack/rails4.rb +++ b/lib/language_pack/rails4.rb @@ -60,38 +60,35 @@ def cleanup end def run_assets_precompile_rake_task - log("assets_precompile") do - if Dir.glob("public/assets/{.sprockets-manifest-*.json,manifest-*.json}", File::FNM_DOTMATCH).any? - puts "Detected manifest file, assuming assets were compiled locally" - return true - end + if Dir.glob("public/assets/{.sprockets-manifest-*.json,manifest-*.json}", File::FNM_DOTMATCH).any? + puts "Detected manifest file, assuming assets were compiled locally" + return true + end - precompile = rake.task("assets:precompile") - return true if precompile.not_defined? + precompile = rake.task("assets:precompile") + return true if precompile.not_defined? - topic("Preparing app for Rails asset pipeline") + topic("Preparing app for Rails asset pipeline") - @cache.load_without_overwrite public_assets_folder - @cache.load default_assets_cache + @cache.load_without_overwrite public_assets_folder + @cache.load default_assets_cache - precompile.invoke(env: rake_env) + precompile.invoke(env: rake_env) - if precompile.success? - log "assets_precompile", :status => "success" - puts "Asset precompilation completed (#{"%.2f" % precompile.time}s)" + if precompile.success? + puts "Asset precompilation completed (#{"%.2f" % precompile.time}s)" - clean_task = rake.task("assets:clean") - if clean_task.task_defined? - puts "Cleaning assets" - clean_task.invoke(env: rake_env) + clean_task = rake.task("assets:clean") + if clean_task.task_defined? + puts "Cleaning assets" + clean_task.invoke(env: rake_env) - cleanup_assets_cache - @cache.store public_assets_folder - @cache.store default_assets_cache - end - else - precompile_fail(precompile.output) + cleanup_assets_cache + @cache.store public_assets_folder + @cache.store default_assets_cache end + else + precompile_fail(precompile.output) end end diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 5ab5c13aa..230399c97 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -14,8 +14,6 @@ # base Ruby Language Pack. This is for any base ruby app. class LanguagePack::Ruby < LanguagePack::Base NAME = "ruby" - LIBYAML_VERSION = "0.1.7" - LIBYAML_PATH = "libyaml-#{LIBYAML_VERSION}" NODE_BP_PATH = "vendor/node/bin" # detects if this is a valid Ruby app @@ -34,8 +32,8 @@ def bundler def initialize(*args) super(*args) - @node_installer = LanguagePack::Helpers::NodeInstaller.new(arch: @arch) - @yarn_installer = LanguagePack::Helpers::YarnInstaller.new + @node_installer = LanguagePack::Helpers::NodeInstaller.new(arch: @arch) + @yarn_installer = LanguagePack::Helpers::YarnInstaller.new end def name @@ -79,7 +77,6 @@ def compile Dir.chdir(build_path) remove_vendor_bundle warn_bundler_upgrade - warn_bundler_1x warn_bad_binstubs install_ruby(slug_vendor_ruby) setup_language_pack_environment( @@ -113,30 +110,6 @@ def compile raise e end - def warn_bundler_1x - bundler_versions = LanguagePack::Helpers::BundlerWrapper::BLESSED_BUNDLER_VERSIONS - if bundler.version == bundler_versions["1"] - warn(<<~EOF, inline: true) - Deprecating bundler 1.17.3 - - Your application requested bundler `1.x` in the `Gemfile.lock` - which resolved to `1.17.3`. This version is no longer maintained - by bundler core and will no longer work soon. - - Please upgrade to bundler `2.3.x` or higher: - - ``` - $ gem install bundler -v #{bundler_versions["2.3"]} - $ bundle update --bundler - $ git add Gemfile.lock - $ git commit -m "Updated bundler version" - ``` - - https://devcenter.heroku.com/changelog-items/3166 - EOF - end - end - def cleanup end @@ -206,13 +179,12 @@ def slug_vendor_ruby # @return [String, nil] returns the ruby version if detected or nil if none is detected def ruby_version return @ruby_version if @ruby_version - new_app = !File.exist?("vendor/heroku") last_version_file = "buildpack_ruby_version" last_version = nil last_version = @metadata.read(last_version_file).strip if @metadata.exists?(last_version_file) @ruby_version = LanguagePack::RubyVersion.new(bundler.ruby_version, - is_new: new_app, + is_new: new_app?, last_version: last_version) return @ruby_version end @@ -294,10 +266,7 @@ def setup_language_pack_environment(ruby_layer_path:, gem_layer_path:, bundle_pa # Rails has a binstub for yarn that doesn't work for all applications # we need to ensure that yarn comes before local bin dir for that case paths << yarn_preinstall_bin_path if yarn_preinstalled? - - # Need to remove `./bin` folder since it links to the wrong --prefix ruby binstubs breaking require in Ruby 1.9.2 and 1.8.7. - # Because for 1.9.2 and 1.8.7 there is a "build" ruby and a non-"build" Ruby - paths << "#{File.expand_path(".")}/bin" unless ruby_version.ruby_192_or_lower? + paths << "#{File.expand_path(".")}/bin" paths << "#{gem_layer_path}/#{bundler_binstubs_path}" # Binstubs from bundler, eg. vendor/bundle/bin paths << "#{gem_layer_path}/#{slug_vendor_base}/bin" # Binstubs from rubygems, eg. vendor/bundle/ruby/2.6.0/bin @@ -314,7 +283,6 @@ def setup_language_pack_environment(ruby_layer_path:, gem_layer_path:, bundle_pa ENV["BUNDLE_PATH"] = bundle_path ENV["BUNDLE_BIN"] = bundler_binstubs_path ENV["BUNDLE_DEPLOYMENT"] = "1" - ENV["BUNDLE_GLOBAL_PATH_APPENDS_RUBY_SCOPE"] = "1" if bundler.needs_ruby_global_append_path? end # Sets up the environment variables for subsequent processes run by @@ -377,7 +345,6 @@ def setup_profiled(ruby_layer_path: , gem_layer_path: ) set_env_default "BUNDLE_PATH", ENV["BUNDLE_PATH"] set_env_default "BUNDLE_WITHOUT", ENV["BUNDLE_WITHOUT"] set_env_default "BUNDLE_BIN", ENV["BUNDLE_BIN"] - set_env_default "BUNDLE_GLOBAL_PATH_APPENDS_RUBY_SCOPE", ENV["BUNDLE_GLOBAL_PATH_APPENDS_RUBY_SCOPE"] if bundler.needs_ruby_global_append_path? set_env_default "BUNDLE_DEPLOYMENT", ENV["BUNDLE_DEPLOYMENT"] if ENV["BUNDLE_DEPLOYMENT"] # Unset on windows since we delete the Gemfile.lock end @@ -517,20 +484,6 @@ def install_ruby(install_path) For more information see: https://devcenter.heroku.com/articles/ruby-versions WARNING - - if ruby_version.warn_ruby_26_bundler? - warn(<<~WARNING, inline: true) - There is a known bundler bug with your version of Ruby - - Your version of Ruby contains a problem with the built-in integration of bundler. If - you encounter a bundler error you need to upgrade your Ruby version. We suggest you upgrade to: - - #{@outdated_version_check.suggested_ruby_minor_version} - - For more information see: - https://devcenter.heroku.com/articles/bundler-version#known-upgrade-issues - WARNING - end end true @@ -556,7 +509,7 @@ def install_ruby(install_path) On Heroku CI you can set your stack in the `app.json`. For example: ``` - "stack": "heroku-20" + "stack": "heroku-24" ``` ERROR end @@ -600,10 +553,6 @@ def install_bundler_in_app(bundler_dir) Dir.chdir(bundler_dir) do |dir| `cp -R #{bundler.bundler_path}/. .` end - - # write bundler shim, so we can control the version bundler used - # Ruby 2.6.0 started vendoring bundler - write_bundler_shim("vendor/bundle/bin") if ruby_version.vendored_bundler? end # default set of binaries to install @@ -677,167 +626,84 @@ def bundler_path @bundler_path ||= "#{slug_vendor_base}/gems/#{bundler.dir_name}" end - def write_bundler_shim(path) - FileUtils.mkdir_p(path) - shim_path = "#{path}/bundle" - File.open(shim_path, "w") do |file| - file.print <<-BUNDLE -#!/usr/bin/env ruby -require 'rubygems' - -version = "#{bundler.version}" - -if ARGV.first - str = ARGV.first - str = str.dup.force_encoding("BINARY") if str.respond_to? :force_encoding - if str =~ /\A_(.*)_\z/ and Gem::Version.correct?($1) then - version = $1 - ARGV.shift - end -end - -if Gem.respond_to?(:activate_bin_path) -load Gem.activate_bin_path('bundler', 'bundle', version) -else -gem "bundler", version -load Gem.bin_path("bundler", "bundle", version) -end -BUNDLE - end - FileUtils.chmod(0755, shim_path) - end - # runs bundler to install the dependencies def build_bundler - log("bundle") do - if File.exist?("#{Dir.pwd}/.bundle/config") - warn(<<~WARNING, inline: true) - You have the `.bundle/config` file checked into your repository - It contains local state like the location of the installed bundle - as well as configured git local gems, and other settings that should - not be shared between multiple checkouts of a single repo. Please - remove the `.bundle/` folder from your repo and add it to your `.gitignore` file. - - https://devcenter.heroku.com/articles/bundler-configuration - WARNING - end + if File.exist?("#{Dir.pwd}/.bundle/config") + warn(<<~WARNING, inline: true) + You have the `.bundle/config` file checked into your repository + It contains local state like the location of the installed bundle + as well as configured git local gems, and other settings that should + not be shared between multiple checkouts of a single repo. Please + remove the `.bundle/` folder from your repo and add it to your `.gitignore` file. - if bundler.windows_gemfile_lock? - if bundler.supports_multiple_platforms? - puts "Windows platform detected, preserving `Gemfile.lock` (#{bundler.version} >= 2.2)" - else - File.unlink("Gemfile.lock") - ENV.delete("BUNDLE_DEPLOYMENT") - - warn(<<~WARNING, inline: true) - Removing `Gemfile.lock` because it was generated on Windows. - - Bundler will do a full resolve so native gems are handled properly. - This may result in unexpected gem versions being used in your app. - In rare occasions Bundler may not be able to resolve your dependencies at all. - - Upgrade to bundler version 2.2 or higher to skip this behavior and use built in support - for multiple platforms. Running these commands below (after the `>`) in a command prompt - should resolve this warning: - - > gem install bundler - > bundle update --bundler - > bundle lock --add-platform ruby - > bundle lock --add-platform x86_64-linux - > bundle install - > git add Gemfile.lock - > git commit -m "Upgrade bundler" - - For more information see: - https://devcenter.heroku.com/articles/bundler-windows-gemfile - WARNING - end - end + https://devcenter.heroku.com/articles/bundler-configuration + WARNING + end - bundle_command = String.new("") - bundle_command << "BUNDLE_WITHOUT='#{ENV["BUNDLE_WITHOUT"]}' " - bundle_command << "BUNDLE_PATH=#{ENV["BUNDLE_PATH"]} " - bundle_command << "BUNDLE_BIN=#{ENV["BUNDLE_BIN"]} " - bundle_command << "BUNDLE_DEPLOYMENT=#{ENV["BUNDLE_DEPLOYMENT"]} " if ENV["BUNDLE_DEPLOYMENT"] # Unset on windows since we delete the Gemfile.lock - bundle_command << "BUNDLE_GLOBAL_PATH_APPENDS_RUBY_SCOPE=#{ENV["BUNDLE_GLOBAL_PATH_APPENDS_RUBY_SCOPE"]} " if bundler.needs_ruby_global_append_path? - bundle_command << "bundle install -j4" - - topic("Installing dependencies using bundler #{bundler.version}") - - bundler_output = String.new("") - bundle_time = nil - env_vars = {} - Dir.mktmpdir("libyaml-") do |tmpdir| - libyaml_dir = "#{tmpdir}/#{LIBYAML_PATH}" - - # need to setup compile environment for the psych gem - yaml_include = File.expand_path("#{libyaml_dir}/include").shellescape - yaml_lib = File.expand_path("#{libyaml_dir}/lib").shellescape - pwd = Dir.pwd - bundler_path = "#{pwd}/#{slug_vendor_base}/gems/#{bundler.dir_name}/lib" - - # we need to set BUNDLE_CONFIG and BUNDLE_GEMFILE for - # codon since it uses bundler. - env_vars["BUNDLE_GEMFILE"] = "#{pwd}/Gemfile" - env_vars["BUNDLE_CONFIG"] = "#{pwd}/.bundle/config" - env_vars["CPATH"] = noshellescape("#{yaml_include}:$CPATH") - env_vars["CPPATH"] = noshellescape("#{yaml_include}:$CPPATH") - env_vars["LIBRARY_PATH"] = noshellescape("#{yaml_lib}:$LIBRARY_PATH") - env_vars["RUBYOPT"] = syck_hack - env_vars["NOKOGIRI_USE_SYSTEM_LIBRARIES"] = "true" - env_vars["BUNDLE_DISABLE_VERSION_CHECK"] = "true" - env_vars["BUNDLER_LIB_PATH"] = "#{bundler_path}" if ruby_version.ruby_version == "1.8.7" - env_vars["BUNDLE_DISABLE_VERSION_CHECK"] = "true" - - puts "Running: #{bundle_command}" - bundle_time = Benchmark.realtime do - bundler_output << pipe("#{bundle_command} --no-clean", out: "2>&1", env: env_vars, user_env: true) - end - end + bundle_command = String.new("") + bundle_command << "BUNDLE_WITHOUT='#{ENV["BUNDLE_WITHOUT"]}' " + bundle_command << "BUNDLE_PATH=#{ENV["BUNDLE_PATH"]} " + bundle_command << "BUNDLE_BIN=#{ENV["BUNDLE_BIN"]} " + bundle_command << "BUNDLE_DEPLOYMENT=#{ENV["BUNDLE_DEPLOYMENT"]} " if ENV["BUNDLE_DEPLOYMENT"] # Unset on windows since we delete the Gemfile.lock + bundle_command << "bundle install -j4" + + topic("Installing dependencies using bundler #{bundler.version}") + + bundler_output = String.new("") + bundle_time = nil + env_vars = {} + pwd = Dir.pwd + bundler_path = "#{pwd}/#{slug_vendor_base}/gems/#{bundler.dir_name}/lib" + + # we need to set BUNDLE_CONFIG and BUNDLE_GEMFILE for + # codon since it uses bundler. + env_vars["BUNDLE_GEMFILE"] = "#{pwd}/Gemfile" + env_vars["BUNDLE_CONFIG"] = "#{pwd}/.bundle/config" + env_vars["NOKOGIRI_USE_SYSTEM_LIBRARIES"] = "true" + env_vars["BUNDLE_DISABLE_VERSION_CHECK"] = "true" + + puts "Running: #{bundle_command}" + bundle_time = Benchmark.realtime do + bundler_output << pipe("#{bundle_command} --no-clean", out: "2>&1", env: env_vars, user_env: true) + end - if $?.success? - puts "Bundle completed (#{"%.2f" % bundle_time}s)" - log "bundle", :status => "success" - puts "Cleaning up the bundler cache." - pipe("bundle clean", out: "2> /dev/null", user_env: true, env: env_vars) - @bundler_cache.store + if $?.success? + puts "Bundle completed (#{"%.2f" % bundle_time}s)" + puts "Cleaning up the bundler cache." + pipe("bundle clean", out: "2> /dev/null", user_env: true, env: env_vars) + @bundler_cache.store - # Keep gem cache out of the slug - FileUtils.rm_rf("#{slug_vendor_base}/cache") - else - mcount "fail.bundle.install" - log "bundle", :status => "failure" - error_message = "Failed to install gems via Bundler." - puts "Bundler Output: #{bundler_output}" - if bundler_output.match(/An error occurred while installing sqlite3/) - mcount "fail.sqlite3" - error_message += <<~ERROR - - Detected sqlite3 gem which is not supported on Heroku: - https://devcenter.heroku.com/articles/sqlite3 - ERROR - end + # Keep gem cache out of the slug + FileUtils.rm_rf("#{slug_vendor_base}/cache") + else + error_message = "Failed to install gems via Bundler." + puts "Bundler Output: #{bundler_output}" + if bundler_output.match(/An error occurred while installing sqlite3/) + error_message += <<~ERROR - if bundler_output.match(/but your Gemfile specified/) - mcount "fail.ruby_version_mismatch" - error_message += <<~ERROR + Detected sqlite3 gem which is not supported on Heroku: + https://devcenter.heroku.com/articles/sqlite3 + ERROR + end - Detected a mismatch between your Ruby version installed and - Ruby version specified in Gemfile or Gemfile.lock. You can - correct this by running: + if bundler_output.match(/but your Gemfile specified/) + error_message += <<~ERROR - $ bundle update --ruby - $ git add Gemfile.lock - $ git commit -m "update ruby version" + Detected a mismatch between your Ruby version installed and + Ruby version specified in Gemfile or Gemfile.lock. You can + correct this by running: - If this does not solve the issue please see this documentation: + $ bundle update --ruby + $ git add Gemfile.lock + $ git commit -m "update ruby version" - https://devcenter.heroku.com/articles/ruby-versions#your-ruby-version-is-x-but-your-gemfile-specified-y - ERROR - end + If this does not solve the issue please see this documentation: - error error_message + https://devcenter.heroku.com/articles/ruby-versions#your-ruby-version-is-x-but-your-gemfile-specified-y + ERROR end + + error error_message end end @@ -848,28 +714,14 @@ def post_bundler bundler.clean end - # RUBYOPT line that requires syck_hack file - # @return [String] require string if needed or else an empty string - def syck_hack - syck_hack_file = File.expand_path(File.join(File.dirname(__FILE__), "../../vendor/syck_hack")) - rv = run_stdout('ruby -e "puts RUBY_VERSION"').strip - # < 1.9.3 includes syck, so we need to use the syck hack - if Gem::Version.new(rv) < Gem::Version.new("1.9.3") - "-r#{syck_hack_file}" - else - "" - end - end - # writes ERB based database.yml for Rails. The database.yml uses the DATABASE_URL from the environment during runtime. def create_database_yml return false unless File.directory?("config") return false if bundler.has_gem?('activerecord') && bundler.gem_version('activerecord') >= Gem::Version.new('4.1.0.beta1') - log("create_database_yml") do - topic("Writing config/database.yml to read from DATABASE_URL") - File.open("config/database.yml", "w") do |file| - file.puts <<-DATABASE_YML + topic("Writing config/database.yml to read from DATABASE_URL") + File.open("config/database.yml", "w") do |file| + file.puts <<-DATABASE_YML <% require 'cgi' @@ -924,17 +776,15 @@ def attribute(name, value, force_string = false) <%= key %>: <%= value.first %> <% end %> DATABASE_YML - end end end def rake @rake ||= begin - rake_gem_available = bundler.has_gem?("rake") || ruby_version.rake_is_vendored? - raise_on_fail = bundler.gem_version('railties') && bundler.gem_version('railties') > Gem::Version.new('3.x') + raise_on_fail = bundler.gem_version('railties') && bundler.gem_version('railties') > Gem::Version.new('3.x') topic "Detecting rake tasks" - rake = LanguagePack::Helpers::RakeRunner.new(rake_gem_available) + rake = LanguagePack::Helpers::RakeRunner.new rake.load_rake_tasks!({ env: rake_env }, raise_on_fail) rake end @@ -1107,7 +957,6 @@ def yarn_not_preinstalled? end def run_assets_precompile_rake_task - precompile = rake.task("assets:precompile") return true unless precompile.is_defined? @@ -1121,8 +970,6 @@ def run_assets_precompile_rake_task end def precompile_fail(output) - mcount "fail.assets_precompile" - log "assets_precompile", :status => "failure" msg = "Precompiling assets failed.\n" if output.match(/(127\.0\.0\.1)|(org\.postgresql\.util)/) msg << "Attempted to access a nonexistent database:\n" @@ -1131,7 +978,6 @@ def precompile_fail(output) sprockets_version = bundler.gem_version('sprockets') if output.match(/Sprockets::FileNotFound/) && (sprockets_version < Gem::Version.new('4.0.0.beta7') && sprockets_version > Gem::Version.new('4.0.0.beta4')) - mcount "fail.assets_precompile.file_not_found_beta" msg << "If you have this file in your project\n" msg << "try upgrading to Sprockets 4.0.0.beta7 or later:\n" msg << "https://github.com/rails/sprockets/pull/547\n" @@ -1144,80 +990,6 @@ def bundler_cache "vendor/bundle" end - def valid_bundler_cache?(path, metadata) - full_ruby_version = run_stdout(%q(ruby -v)).strip - rubygems_version = run_stdout(%q(gem -v)).strip - old_rubygems_version = nil - - old_rubygems_version = metadata[:ruby_version] - old_stack = metadata[:stack] - old_stack ||= DEFAULT_LEGACY_STACK - - stack_change = old_stack != @stack - if !new_app? && stack_change - return [false, "Purging Cache. Changing stack from #{old_stack} to #{@stack}"] - end - - # fix bug from v37 deploy - if File.exist?("#{path}/vendor/ruby_version") - puts "Broken cache detected. Purging build cache." - cache.clear("vendor") - FileUtils.rm_rf("#{path}/vendor/ruby_version") - return [false, "Broken cache detected. Purging build cache."] - # fix bug introduced in v38 - elsif !metadata.include?(:buildpack_version) && metadata.include?(:ruby_version) - puts "Broken cache detected. Purging build cache." - return [false, "Broken cache detected. Purging build cache."] - elsif (@bundler_cache.exists? || @bundler_cache.old?) && full_ruby_version != metadata[:ruby_version] - return [false, <<-MESSAGE] -Ruby version change detected. Clearing bundler cache. -Old: #{metadata[:ruby_version]} -New: #{full_ruby_version} -MESSAGE - end - - # fix git gemspec bug from Bundler 1.3.0+ upgrade - if File.exist?(bundler_cache) && !metadata.include?(:bundler_version) && !run("find #{path}/vendor/bundle/*/*/bundler/gems/*/ -name *.gemspec").include?("No such file or directory") - return [false, "Old bundler cache detected. Clearing bundler cache."] - end - - # fix for https://github.com/heroku/heroku-buildpack-ruby/issues/86 - if (!metadata.include?(:rubygems_version) || - (old_rubygems_version == "2.0.0" && old_rubygems_version != rubygems_version)) && - metadata.include?(:ruby_version) && metadata[:ruby_version].strip.include?("ruby 2.0.0p0") - return [false, "Updating to rubygems #{rubygems_version}. Clearing bundler cache."] - end - - # fix for https://github.com/sparklemotion/nokogiri/issues/923 - if metadata.include?(:buildpack_version) && (bv = metadata[:buildpack_version].sub('v', '').to_i) && bv != 0 && bv <= 76 - return [false, <<-MESSAGE] -Fixing nokogiri install. Clearing bundler cache. -See https://github.com/sparklemotion/nokogiri/issues/923. -MESSAGE - end - - # recompile nokogiri to use new libyaml - if metadata.include?(:buildpack_version) && (bv = metadata[:buildpack_version].sub('v', '').to_i) && bv != 0 && bv <= 99 && bundler.has_gem?("psych") - return [false, <<-MESSAGE] -Need to recompile psych for CVE-2013-6393. Clearing bundler cache. -See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=737076. -MESSAGE - end - - # recompile gems for libyaml 0.1.7 update - if metadata.include?(:buildpack_version) && (bv = metadata[:buildpack_version].sub('v', '').to_i) && bv != 0 && bv <= 147 && - (metadata.include?(:ruby_version) && metadata[:ruby_version].match(/ruby 2\.1\.(9|10)/) || - bundler.has_gem?("psych") - ) - return [false, <<-MESSAGE] -Need to recompile gems for CVE-2014-2014-9130. Clearing bundler cache. -See https://devcenter.heroku.com/changelog-items/1016. -MESSAGE - end - - true - end - def load_bundler_cache cache.load "vendor" @@ -1236,7 +1008,6 @@ def load_bundler_cache old_rubygems_version = @metadata.read(ruby_version_cache).strip if @metadata.exists?(ruby_version_cache) old_stack = @metadata.read(stack_cache).strip if @metadata.exists?(stack_cache) - old_stack ||= DEFAULT_LEGACY_STACK stack_change = old_stack != @stack convert_stack = @bundler_cache.old? @@ -1248,61 +1019,15 @@ def load_bundler_cache @bundler_cache.load end - # fix bug from v37 deploy - if File.exist?("vendor/ruby_version") - puts "Broken cache detected. Purging build cache." - cache.clear("vendor") - FileUtils.rm_rf("vendor/ruby_version") - purge_bundler_cache - # fix bug introduced in v38 - elsif !@metadata.include?(buildpack_version_cache) && @metadata.exists?(ruby_version_cache) - puts "Broken cache detected. Purging build cache." - purge_bundler_cache - elsif (@bundler_cache.exists? || @bundler_cache.old?) && @metadata.exists?(ruby_version_cache) && full_ruby_version != @metadata.read(ruby_version_cache).strip + if (@bundler_cache.exists? || @bundler_cache.old?) && + @metadata.exists?(ruby_version_cache) && + full_ruby_version != @metadata.read(ruby_version_cache).strip puts "Ruby version change detected. Clearing bundler cache." puts "Old: #{@metadata.read(ruby_version_cache).strip}" puts "New: #{full_ruby_version}" purge_bundler_cache end - # fix git gemspec bug from Bundler 1.3.0+ upgrade - if File.exist?(bundler_cache) && !@metadata.exists?(bundler_version_cache) && !run("find vendor/bundle/*/*/bundler/gems/*/ -name *.gemspec").include?("No such file or directory") - puts "Old bundler cache detected. Clearing bundler cache." - purge_bundler_cache - end - - # fix for https://github.com/heroku/heroku-buildpack-ruby/issues/86 - if (!@metadata.exists?(rubygems_version_cache) || - (old_rubygems_version == "2.0.0" && old_rubygems_version != rubygems_version)) && - @metadata.exists?(ruby_version_cache) && @metadata.read(ruby_version_cache).strip.include?("ruby 2.0.0p0") - puts "Updating to rubygems #{rubygems_version}. Clearing bundler cache." - purge_bundler_cache - end - - # fix for https://github.com/sparklemotion/nokogiri/issues/923 - if @metadata.exists?(buildpack_version_cache) && (bv = @metadata.read(buildpack_version_cache).sub('v', '').to_i) && bv != 0 && bv <= 76 - puts "Fixing nokogiri install. Clearing bundler cache." - puts "See https://github.com/sparklemotion/nokogiri/issues/923." - purge_bundler_cache - end - - # recompile nokogiri to use new libyaml - if @metadata.exists?(buildpack_version_cache) && (bv = @metadata.read(buildpack_version_cache).sub('v', '').to_i) && bv != 0 && bv <= 99 && bundler.has_gem?("psych") - puts "Need to recompile psych for CVE-2013-6393. Clearing bundler cache." - puts "See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=737076." - purge_bundler_cache - end - - # recompile gems for libyaml 0.1.7 update - if @metadata.exists?(buildpack_version_cache) && (bv = @metadata.read(buildpack_version_cache).sub('v', '').to_i) && bv != 0 && bv <= 147 && - (@metadata.exists?(ruby_version_cache) && @metadata.read(ruby_version_cache).strip.match(/ruby 2\.1\.(9|10)/) || - bundler.has_gem?("psych") - ) - puts "Need to recompile gems for CVE-2014-2014-9130. Clearing bundler cache." - puts "See https://devcenter.heroku.com/changelog-items/1016." - purge_bundler_cache - end - FileUtils.mkdir_p(heroku_metadata) @metadata.write(ruby_version_cache, full_ruby_version, false) @metadata.write(buildpack_version_cache, BUILDPACK_VERSION, false) diff --git a/lib/language_pack/ruby_version.rb b/lib/language_pack/ruby_version.rb index 8e7913aba..e10808925 100644 --- a/lib/language_pack/ruby_version.rb +++ b/lib/language_pack/ruby_version.rb @@ -55,40 +55,15 @@ def initialize(bundler_output, app = {}) @version_without_patchlevel = @version.sub(/-p-?\d+/, '') end - def warn_ruby_26_bundler? - return false if Gem::Version.new(self.ruby_version) >= Gem::Version.new("2.6.3") - return false if Gem::Version.new(self.ruby_version) < Gem::Version.new("2.6.0") - - return true - end - - def ruby_192_or_lower? - Gem::Version.new(self.ruby_version) <= Gem::Version.new("1.9.2") - end - # https://github.com/bundler/bundler/issues/4621 def version_for_download - if patchlevel_is_significant? && @patchlevel && @patchlevel.sub(/p/, '').to_i >= 0 - @version - else - version_without_patchlevel - end + version_without_patchlevel end def file_name "#{version_for_download}.tgz" end - # Before Ruby 2.1 patch releases were done via patchlevel i.e. 1.9.3-p426 versus 1.9.3-p448 - # With 2.1 and above patches are released in the "minor" version instead i.e. 2.1.0 versus 2.1.1 - def patchlevel_is_significant? - !jruby? && Gem::Version.new(self.ruby_version) <= Gem::Version.new("2.1") - end - - def rake_is_vendored? - Gem::Version.new(self.ruby_version) >= Gem::Version.new("1.9") - end - def default? !set end @@ -109,11 +84,6 @@ def to_gemfile end end - # does this vendor bundler - def vendored_bundler? - false - end - def major @ruby_version.split(".")[0].to_i end @@ -131,7 +101,6 @@ def patch # `ruby-2.3.1` then then `next_logical_version(1)` # will produce `ruby-2.3.2`. def next_logical_version(increment = 1) - return false if patchlevel_is_significant? split_version = @version_without_patchlevel.split(".") teeny = split_version.pop split_version << teeny.to_i + increment diff --git a/lib/language_pack/shell_helpers.rb b/lib/language_pack/shell_helpers.rb index 0b1e380dc..aec40ee47 100644 --- a/lib/language_pack/shell_helpers.rb +++ b/lib/language_pack/shell_helpers.rb @@ -24,18 +24,6 @@ def deprecations @@deprecations end - def mcount(key, value = 1) - private_log("count", key => value) - end - - def mmeasure(key, value) - private_log("measure", key => value) - end - - def munique(key, value) - private_log("unique", key => value) - end - def self.user_env_hash @@user_env_hash end @@ -259,7 +247,6 @@ def puts(message) error_message = e.message raise e if error_message !~ /invalid byte sequence/ - mcount "fail.invalid_utf8" error_message << "\n Invalid string: #{message}" raise e, error_message end @@ -286,18 +273,5 @@ def deprecate(message) def noshellescape(string) NoShellEscape.new(string) end - - private - def private_log(name, key_value_hash) - File.open(ENV["BUILDPACK_LOG_FILE"] || "/dev/null", "a+") do |f| - key_value_hash.each do |key, value| - metric = String.new("#{name}#") - metric << "#{ENV["BPLOG_PREFIX"]}" - metric << "." unless metric.end_with?('.') - metric << "#{key}=#{value}" - f.puts metric - end - end - end end end diff --git a/log/.gitkeep b/log/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/spec/hatchet/bundler_spec.rb b/spec/hatchet/bundler_spec.rb index 74184e01e..8d8a122ae 100644 --- a/spec/hatchet/bundler_spec.rb +++ b/spec/hatchet/bundler_spec.rb @@ -9,26 +9,4 @@ end end end - - it "deploys with version 1.x" do - pending("Must enable HATCHET_EXPENSIVE_MODE") unless ENV["HATCHET_EXPENSIVE_MODE"] - - Hatchet::Runner.new("default_ruby").tap do |app| - app.before_deploy do - set_bundler_version(version: "1.17.3") - Pathname("Gemfile.lock").write(<<~EOF, mode: "a") - - RUBY VERSION - ruby 3.1.6 - EOF - end - app.deploy do - expect(app.output).to match("Deprecating bundler 1.17.3") - - app.run("which -a rake") do |which_rake| - expect(which_rake).to include("/app/vendor/bundle/bin/rake") - end - end - end - end end diff --git a/spec/hatchet/getting_started_spec.rb b/spec/hatchet/getting_started_spec.rb index 06e2e1c97..4c8f22821 100644 --- a/spec/hatchet/getting_started_spec.rb +++ b/spec/hatchet/getting_started_spec.rb @@ -3,6 +3,7 @@ describe "Heroku ruby getting started" do it "works on Heroku-24" do Hatchet::Runner.new("ruby-getting-started", stack: "heroku-24").deploy do |app| + expect(app.output).to_not include("Purging Cache") # Assert sprockets build cache not present on runtime expect(app.run("ls tmp/cache/assets")).to_not match("sprockets") diff --git a/spec/hatchet/ruby_spec.rb b/spec/hatchet/ruby_spec.rb index ca60cce2b..5ae567219 100644 --- a/spec/hatchet/ruby_spec.rb +++ b/spec/hatchet/ruby_spec.rb @@ -1,41 +1,6 @@ require_relative '../spec_helper' describe "Ruby apps" do - describe "with mingw platform" do - it "is detected as a Windows app" do - Hatchet::Runner.new("default_ruby").tap do |app| - app.before_deploy do - Pathname("Gemfile").write(<<~'EOF') - source "https://rubygems.org" - - gem "rake" - EOF - - Pathname("Gemfile.lock").write(<<~'EOF') - GEM - remote: https://rubygems.org/ - specs: - rake (13.2.1) - - PLATFORMS - x86-mingw32 - ruby - - DEPENDENCIES - rake - - BUNDLED WITH - 2.5.9 - EOF - end - - app.deploy do - expect(app.output).to include("Windows platform detected, preserving `Gemfile.lock`") - end - end - end - end - # https://github.com/heroku/heroku-buildpack-ruby/issues/1025 describe "bin/rake binstub" do it "loads git gems at build time when executing `rake`" do diff --git a/spec/helpers/bundler_wrapper_spec.rb b/spec/helpers/bundler_wrapper_spec.rb index a27ef2d32..7526d470e 100644 --- a/spec/helpers/bundler_wrapper_spec.rb +++ b/spec/helpers/bundler_wrapper_spec.rb @@ -15,9 +15,6 @@ describe "Bundler version detection" do it "supports minor versions" do wrapper_klass = LanguagePack::Helpers::BundlerWrapper - version = wrapper_klass.detect_bundler_version(contents: "BUNDLED WITH\n 1.17.3") - expect(wrapper_klass::BLESSED_BUNDLER_VERSIONS.key?("1")).to be_truthy - expect(version).to eq(wrapper_klass::BLESSED_BUNDLER_VERSIONS["1"]) version = wrapper_klass.detect_bundler_version(contents: "BUNDLED WITH\n 2.2.7") expect(wrapper_klass::BLESSED_BUNDLER_VERSIONS.key?("2.3")).to be_truthy @@ -60,8 +57,6 @@ gemfile_path: gemfile, report: report ) - expect(bundler.supports_multiple_platforms?).to be_truthy - expect(report.data).to eq( { "ruby.dot_ruby_version" => nil, diff --git a/spec/helpers/download_presence_spec.rb b/spec/helpers/download_presence_spec.rb index 7d0da9651..2ce48272a 100644 --- a/spec/helpers/download_presence_spec.rb +++ b/spec/helpers/download_presence_spec.rb @@ -21,6 +21,9 @@ download = LanguagePack::Helpers::DownloadPresence.new( multi_arch_stacks: ["heroku-24"], file_name: 'ruby-3.0.5.tgz', + # Heroku 20 is not longer supported however heroku-22 and heroku-24 + # have identical Ruby versions supported, this test can be updated to + # use heroku-24 and heroku-26 (when that stack is released) stacks: ["heroku-20", "heroku-24"], arch: "amd64" ) @@ -35,49 +38,18 @@ it "knows if exists on the next stack" do download = LanguagePack::Helpers::DownloadPresence.new( - multi_arch_stacks: [], - file_name: 'ruby-3.1.4.tgz', - stacks: ['heroku-20', 'heroku-22'], - arch: nil - ) - - download.call - - expect(download.next_stack(current_stack: "heroku-20")).to eq("heroku-22") - expect(download.next_stack(current_stack: "heroku-22")).to be_falsey - - expect(download.exists_on_next_stack?(current_stack:"heroku-20")).to be_truthy - end - - it "detects when a package is present on higher stacks" do - download = LanguagePack::Helpers::DownloadPresence.new( - multi_arch_stacks: [], - file_name: 'ruby-2.6.5.tgz', - stacks: ['cedar-14', 'heroku-16', 'heroku-18'], - arch: nil + multi_arch_stacks: ["heroku-24"], + file_name: "#{LanguagePack::RubyVersion::DEFAULT_VERSION}.tgz", + stacks: ['heroku-22', 'heroku-24'], + arch: "amd64" ) download.call - expect(download.exists?).to eq(true) - expect(download.valid_stack_list).to eq(['cedar-14', 'heroku-16', 'heroku-18']) - - expect(download.exists_on_next_stack?(current_stack: "heroku-16")).to be_truthy - expect(download.next_stack(current_stack: "heroku-16")).to eq("heroku-18") - end - - it "detects when a package is not present on higher stacks" do - download = LanguagePack::Helpers::DownloadPresence.new( - multi_arch_stacks: [], - file_name: 'ruby-1.9.3.tgz', - stacks: ['cedar-14', 'heroku-16', 'heroku-18'], - arch: nil - ) - - download.call + expect(download.next_stack(current_stack: "heroku-22")).to eq("heroku-24") + expect(download.next_stack(current_stack: "heroku-24")).to be_falsey - expect(download.exists?).to eq(true) - expect(download.valid_stack_list).to eq(['cedar-14']) + expect(download.exists_on_next_stack?(current_stack:"heroku-22")).to be_truthy end it "detects when a package is present on two stacks but not a third" do @@ -98,7 +70,7 @@ download = LanguagePack::Helpers::DownloadPresence.new( multi_arch_stacks: [], file_name: 'does-not-exist.tgz', - stacks: ['cedar-14', 'heroku-16', 'heroku-18'], + stacks: ['heroku-22', 'heroku-24'], arch: nil ) @@ -110,9 +82,9 @@ it "detects default ruby version" do download = LanguagePack::Helpers::DownloadPresence.new( - multi_arch_stacks: [], - file_name: "ruby-3.1.1.tgz", - arch: nil + multi_arch_stacks: ['heroku-24'], + file_name: "#{LanguagePack::RubyVersion::DEFAULT_VERSION}.tgz", + arch: "amd64" ) download.call diff --git a/spec/installers/heroku_ruby_installer_spec.rb b/spec/helpers/heroku_ruby_installer_spec.rb similarity index 84% rename from spec/installers/heroku_ruby_installer_spec.rb rename to spec/helpers/heroku_ruby_installer_spec.rb index fa6c10d11..92d55abd0 100644 --- a/spec/installers/heroku_ruby_installer_spec.rb +++ b/spec/helpers/heroku_ruby_installer_spec.rb @@ -3,15 +3,15 @@ describe LanguagePack::Installers::HerokuRubyInstaller do def installer(report: HerokuBuildReport::GLOBAL) LanguagePack::Installers::HerokuRubyInstaller.new( - multi_arch_stacks: [], - stack: "cedar-14", - arch: nil, + multi_arch_stacks: ["heroku-24"], + stack: "heroku-24", + arch: "amd64", report: report ) end def ruby_version - LanguagePack::RubyVersion.new("ruby-2.3.3") + LanguagePack::RubyVersion.new("ruby-3.1.7") end describe "#fetch_unpack" do @@ -37,12 +37,12 @@ def ruby_version expect(File.symlink?("#{dir}/bin/ruby.exe")).to be true expect(File).to exist("#{dir}/vendor/ruby/bin/ruby") - expect(report.data["ruby.version"]).to eq("2.3.3") + expect(report.data["ruby.version"]).to eq("3.1.7") expect(report.data["ruby.engine"]).to eq(:ruby) expect(report.data["ruby.engine.version"]).to eq(report.data["ruby.version"]) - expect(report.data["ruby.major"]).to eq(2) - expect(report.data["ruby.minor"]).to eq(3) - expect(report.data["ruby.patch"]).to eq(3) + expect(report.data["ruby.major"]).to eq(3) + expect(report.data["ruby.minor"]).to eq(1) + expect(report.data["ruby.patch"]).to eq(7) end end end diff --git a/spec/helpers/ruby_version_spec.rb b/spec/helpers/ruby_version_spec.rb index 70b1f27bd..b4c0fc2d7 100644 --- a/spec/helpers/ruby_version_spec.rb +++ b/spec/helpers/ruby_version_spec.rb @@ -36,30 +36,6 @@ expect(ruby_version.next_major_version(2)).to eq("ruby-4.0.0") end - it "does not include patchlevels when the patchlevel is negative for download" do - ruby_version = LanguagePack::RubyVersion.new("ruby-2.0.0-p-1") - expect(ruby_version.version_for_download).to eq("ruby-2.0.0") - - ruby_version = LanguagePack::RubyVersion.new("ruby-2.4.0-p-1") - expect(ruby_version.version_for_download).to eq("ruby-2.4.0") - end - - it "detects Ruby 2.6.0, 2.6.1 and 2.6.2 as needing a warning" do - ruby_version = LanguagePack::RubyVersion.new("ruby-2.6.0") - expect(ruby_version.warn_ruby_26_bundler?).to be true - ruby_version = LanguagePack::RubyVersion.new("ruby-2.6.1") - expect(ruby_version.warn_ruby_26_bundler?).to be true - ruby_version = LanguagePack::RubyVersion.new("ruby-2.6.2") - expect(ruby_version.warn_ruby_26_bundler?).to be true - - ruby_version = LanguagePack::RubyVersion.new("ruby-2.6.3") - expect(ruby_version.warn_ruby_26_bundler?).to be false - ruby_version = LanguagePack::RubyVersion.new("ruby-2.5.3") - expect(ruby_version.warn_ruby_26_bundler?).to be false - ruby_version = LanguagePack::RubyVersion.new("ruby-2.7.1") - expect(ruby_version.warn_ruby_26_bundler?).to be false - end - it "correctly sets default ruby versions" do Hatchet::App.new("default_ruby").in_directory_fork do |dir| require 'bundler' diff --git a/spec/helpers/shell_spec.rb b/spec/helpers/shell_spec.rb index 0d4eab188..996af7908 100644 --- a/spec/helpers/shell_spec.rb +++ b/spec/helpers/shell_spec.rb @@ -28,21 +28,6 @@ class FakeShell end end - describe "mcount" do - it "logs to a file" do - begin - original = ENV["BUILDPACK_LOG_FILE"] - Tempfile.open("logfile.log") do |f| - ENV["BUILDPACK_LOG_FILE"] = f.path - FakeShell.new.mcount "foo" - expect(File.read(f.path)).to match("count#buildpack.ruby.foo=1") - end - ensure - ENV["BUILDPACK_LOG_FILE"] = original - end - end - end - describe "#command_options_to_string" do it "formats ugly keys correctly" do env = {%Q{ un"matched } => "bad key"} @@ -73,24 +58,25 @@ class FakeShell describe "#puts" do context 'when the message has an invalid utf-8 character' do - it 'no error is raised' do + it 'no error is raised by puts directly' do sh = FakeShell.new bad_lines = File.read("spec/fixtures/invalid_encoding.log") sh.puts(bad_lines) end - it 'catches it just in case' do + it 'from an internal call, it catches and annotates it' do sh = FakeShell.new - def sh.print(string); string.strip; end - def sh.mcount(*args); @error_caught = true; end + def sh.print(string) + # Strip emits a UTF-8 error + string.strip + end bad_lines = File.read("spec/fixtures/invalid_encoding.log") - expect { sh.puts(bad_lines) }.to raise_error(ArgumentError) - - error_caught = sh.instance_variable_get(:"@error_caught") - expect(error_caught).to eq(true) + expect { sh.puts(bad_lines) }.to raise_error(ArgumentError) do |error| + expect(error.message).to include("Invalid string:") + end end end end diff --git a/spec/unit/bash_functions_spec.rb b/spec/unit/bash_functions_spec.rb index 5226e656d..430293f8f 100644 --- a/spec/unit/bash_functions_spec.rb +++ b/spec/unit/bash_functions_spec.rb @@ -75,7 +75,7 @@ def bash_functions_file root_dir.join("bin", "support", "bash_functions.sh") end - def exec_with_bash_functions(code, stack: "heroku-18") + def exec_with_bash_functions(code, stack: "heroku-24") contents = <<~EOM #! /usr/bin/env bash set -eu diff --git a/support/s3/hmac b/support/s3/hmac deleted file mode 100755 index 0b2c3502e..000000000 --- a/support/s3/hmac +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/env bash -# Implement HMAC functionality on top of the OpenSSL digest functions. -# licensed under the terms of the GNU GPL v2 -# Copyright 2007 Victor Lowther - -die() { - echo $* - exit 1 -} - -check_deps() { - local res=0 - while [ $# -ne 0 ]; do - which "${1}" >& /dev/null || { res=1; echo "${1} not found."; } - shift - done - (( res == 0 )) || die "aborting." -} - -# write a byte (passed as hex) to stdout -write_byte() { - # $1 = byte to write - printf "\\x$(printf "%x" ${1})" -} - -# make an hmac pad out of a key. -# this is not the most secure way of doing it, but it is -# the most expedient. -make_hmac_pad() { - # using key in file $1 and byte in $2, create the appropriate hmac pad - # Pad keys out to $3 bytes - # if key is longer than $3, use hash $4 to hash the key first. - local x y a size remainder oifs - (( remainder = ${3} )) - # in case someone else was messing with IFS. - for x in $(echo -n "${1}" | od -v -t u1 | cut -b 9-); - do - write_byte $((${x} ^ ${2})) - (( remainder -= 1 )) - done - for ((y=0; remainder - y ;y++)); do - write_byte $((0 ^ ${2})) - done -} - -# utility functions for making hmac pads -hmac_ipad() { - make_hmac_pad "${1}" 0x36 ${2} "${3}" -} - -hmac_opad() { - make_hmac_pad "${1}" 0x5c ${2} "${3}" -} - -# hmac something -do_hmac() { - # $1 = algo to use. Must be one that openssl knows about - # $2 = keyfile to use - # $3 = file to hash. uses stdin if none is given. - # accepts input on stdin, leaves it on stdout. - # Output is binary, if you want something else pipe it accordingly. - local blocklen keysize x - case "${1}" in - sha) blocklen=64 ;; - sha1) blocklen=64 ;; - md5) blocklen=64 ;; - md4) blocklen=64 ;; - sha256) blocklen=64 ;; - sha512) blocklen=128 ;; - *) die "Unknown hash ${1} passed to hmac!" ;; - esac - cat <(hmac_ipad ${2} ${blocklen} "${1}") "${3:--}" | openssl dgst "-${1}" -binary | \ - cat <(hmac_opad ${2} ${blocklen} "${1}") - | openssl dgst "-${1}" -binary -} - -[[ ${1} ]] || die "Must pass the name of the hash function to use to ${0}". - -check_deps od openssl -do_hmac "${@}" diff --git a/support/s3/s3 b/support/s3/s3 deleted file mode 100755 index 65fd9d2cd..000000000 --- a/support/s3/s3 +++ /dev/null @@ -1,223 +0,0 @@ -#!/usr/bin/env bash -# basic amazon s3 operations -# Licensed under the terms of the GNU GPL v2 -# Copyright 2007 Victor Lowther - -set -e - -basedir="$( cd -P "$( dirname "$0" )" && pwd )" -PATH="$basedir:$PATH" - -# print a message and bail -die() { - echo $* - exit 1 -} - -# check to see if the variable name passed exists and holds a value. -# Die if it does not. -check_or_die() { - [[ ${!1} ]] || die "Environment variable ${1} is not set." -} - -# check to see if we have all the needed S3 variables defined. -# Bail if we do not. -check_s3() { - local sak x - for x in S3_ACCESS_KEY_ID S3_SECRET_ACCESS_KEY; do - check_or_die ${x}; - done - sak="$(echo -n $S3_SECRET_ACCESS_KEY | wc -c)" - (( ${sak%%[!0-9 ]*} == 40 )) || \ - die "S3 Secret Access Key is not exactly 40 bytes long. Please fix it." -} -# check to see if our external dependencies exist -check_dep() { - local res=0 - while [[ $# -ne 0 ]]; do - which "${1}" >& /dev/null || { res=1; echo "${1} not found."; } - shift - done - (( res == 0 )) || die "aborting." -} - -check_deps() { - check_dep openssl date hmac cat grep curl - check_s3 -} - -urlenc() { - # $1 = string to url encode - # output is on stdout - # we don't urlencode everything, just enough stuff. - echo -n "${1}" | - sed 's/%/%25/g - s/ /%20/g - s/#/%23/g - s/\$/%24/g - s/\&/%26/g - s/+/%2b/g - s/,/%2c/g - s/:/%3a/g - s/;/%3b/g - s/?/%3f/g - s/@/%40/g - s/ /%09/g' -} - -xmldec() { - # no parameters. - # accept input on stdin, put it on stdout. - # patches accepted to get more stuff - sed 's/\"/\"/g - s/\&/\&/g - s/\<//g' -} - -## basic S3 functionality. x-amz-header functionality is not implemented. -# make an S3 signature string, which will be output on stdout. -s3_signature_string() { - # $1 = HTTP verb - # $2 = date string, must be in UTC - # $3 = bucket name, if any - # $4 = resource path, if any - # $5 = content md5, if any - # $6 = content MIME type, if any - # $7 = canonicalized headers, if any - # signature string will be output on stdout - local verr="Must pass a verb to s3_signature_string!" - local verb="${1:?verr}" - local bucket="${3}" - local resource="${4}" - local derr="Must pass a date to s3_signature_string!" - local date="${2:?derr}" - local mime="${6}" - local md5="${5}" - local headers="${7}" - printf "%s\n%s\n%s\n%s\n%s\n%s%s" \ - "${verb}" "${md5}" "${mime}" "${date}" \ - "${headers}" "${bucket}" "${resource}" | \ - hmac sha1 "${S3_SECRET_ACCESS_KEY}" | openssl base64 -e -a -} - -# cheesy, but it is the best way to have multiple headers. -curl_headers() { - # each arg passed will be output on its own line - local parms=$# - for ((;$#;)); do - echo "header = \"${1}\"" - shift - done -} - -s3_curl() { - # invoke curl to do all the heavy HTTP lifting - # $1 = method (one of GET, PUT, or DELETE. HEAD is not handled yet.) - # $2 = remote bucket. - # $3 = remote name - # $4 = local name. - local bucket remote date sig md5 arg inout headers - # header handling is kinda fugly, but it works. - bucket="${2:+/${2}}/" # slashify the bucket - remote="$(urlenc "${3}")" # if you don't, strange things may happen. - stdopts="--connect-timeout 10 --fail --silent" - [[ $CURL_S3_DEBUG == true ]] && stdopts="${stdopts} --show-error --fail" - case "${1}" in - GET) arg="-o" inout="${4:--}" # stdout if no $4 - ;; - PUT) [[ ${2} ]] || die "PUT can has bucket?" - if [[ ! ${3} ]]; then - arg="-X PUT" - headers[${#headers[@]}]="Content-Length: 0" - elif [[ -f ${4} ]]; then - md5="$(openssl dgst -md5 -binary "${4}"|openssl base64 -e -a)" - arg="-T" inout="${4}" - headers[${#headers[@]}]="x-amz-acl: public-read" - headers[${#headers[@]}]="Expect: 100-continue" - else - die "Cannot write non-existing file ${4}" - fi - ;; - DELETE) arg="-X DELETE" - ;; - HEAD) arg="-I" ;; - *) die "Unknown verb ${1}. It probably would not have worked anyways." ;; - esac - date="$(TZ=UTC date '+%a, %e %b %Y %H:%M:%S %z')" - sig=$(s3_signature_string ${1} "${date}" "${bucket}" "${remote}" "${md5}" "" "x-amz-acl:public-read") - - headers[${#headers[@]}]="Authorization: AWS ${S3_ACCESS_KEY_ID}:${sig}" - headers[${#headers[@]}]="Date: ${date}" - [[ ${md5} ]] && headers[${#headers[@]}]="Content-MD5: ${md5}" - curl ${arg} "${inout}" ${stdopts} -o - -K <(curl_headers "${headers[@]}") \ - "https://s3.amazonaws.com${bucket}${remote}" - return $? -} - -s3_put() { - # $1 = remote bucket to put it into - # $2 = remote name to put - # $3 = file to put. This must be present if $2 is. - s3_curl PUT "${1}" "${2}" "${3:-${2}}" - return $? -} - -s3_get() { - # $1 = bucket to get file from - # $2 = remote file to get - # $3 = local file to get into. Will be overwritten if it exists. - # If this contains a path, that path must exist before calling this. - s3_curl GET "${1}" "${2}" "${3:-${2}}" - return $? -} - -s3_test() { - # same args as s3_get, but uses the HEAD verb instead of the GET verb. - s3_curl HEAD "${1}" "${2}" >/dev/null - return $? -} - -# Hideously ugly, but it works well enough. -s3_buckets() { - s3_get |grep -o '[^>]*' |sed 's/<[^>]*>//g' |xmldec - return $? -} - -# this will only return the first thousand entries, alas -# Mabye some kind soul can fix this without writing an XML parser in bash? -# Also need to add xml entity handling. -s3_list() { - # $1 = bucket to list - [ "x${1}" == "x" ] && return 1 - s3_get "${1}" |grep -o '[^>]*' |sed 's/<[^>]*>//g'| xmldec - return $? -} - -s3_delete() { - # $1 = bucket to delete from - # $2 = item to delete - s3_curl DELETE "${1}" "${2}" - return $? -} - -# because this uses s3_list, it suffers from the same flaws. -s3_rmrf() { - # $1 = bucket to delete everything from - s3_list "${1}" | while read f; do - s3_delete "${1}" "${f}"; - done -} - -check_deps -case $1 in - put) shift; s3_put "$@" ;; - get) shift; s3_get "$@" ;; - rm) shift; s3_delete "$@" ;; - ls) shift; s3_list "$@" ;; - test) shift; s3_test "$@" ;; - buckets) s3_buckets ;; - rmrf) shift; s3_rmrf "$@" ;; - *) die "Unknown command ${1}." - ;; -esac diff --git a/vendor/syck_hack.rb b/vendor/syck_hack.rb deleted file mode 100644 index 454f722c3..000000000 --- a/vendor/syck_hack.rb +++ /dev/null @@ -1,64 +0,0 @@ -# :stopdoc: - -# Hack to handle syck's DefaultKey bug -# -# This file is always loaded AFTER either syck or psych are already -# loaded. It then looks at what constants are available and creates -# a consistent view on all rubys. -# -# All this is so that there is always a YAML::Syck::DefaultKey -# class no matter if the full yaml library has loaded or not. -# - -$: << ENV['BUNDLER_LIB_PATH'] if ENV['BUNDLER_LIB_PATH'] -require 'bundler/psyched_yaml' - -module YAML - # In newer 1.9.2, there is a Syck toplevel constant instead of it - # being underneith YAML. If so, reference it back under YAML as - # well. - if defined? ::Syck - Syck = ::Syck - - # Otherwise, if there is no YAML::Syck, then we've got just psych - # loaded, so lets define a stub for DefaultKey. - elsif !defined? YAML::Syck - module Syck - class DefaultKey - end - end - end - - # Now that we've got something that is always here, define #to_s - # so when code tries to use this, it at least just shows up like it - # should. - module Syck - class DefaultKey - def to_s - '=' - end - end - end -end - -# Sometime in the 1.9 dev cycle, the Syck constant was moved from under YAML -# to be a toplevel constant. So gemspecs created under these versions of Syck -# will have references to Syck::DefaultKey. -# -# So we need to be sure that we reference Syck at the toplevel too so that -# we can always load these kind of gemspecs. -# -if !defined?(Syck) - Syck = YAML::Syck -end - -# Now that we've got Syck setup in all the right places, store -# a reference to the DefaultKey class inside Gem. We do this so that -# if later on YAML, etc are redefined, we've still got a consistent -# place to find the DefaultKey class for comparison. - -module Gem - SyckDefaultKey = YAML::Syck::DefaultKey -end - -# :startdoc: From 6e0d6c5c2b157e0fe2aeec40dbfdf3bf58926215 Mon Sep 17 00:00:00 2001 From: "heroku-linguist[bot]" <136119646+heroku-linguist[bot]@users.noreply.github.com> Date: Thu, 15 May 2025 14:27:14 +0000 Subject: [PATCH 1050/1195] Prepare release v308 (#1594) Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com> --- CHANGELOG.md | 6 +++++- lib/language_pack/version.rb | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e66a034f..a727c3590 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased] + +## [v308] - 2025-05-15 + - Removed support for Ubuntu 20.04 (and thus Heroku-20 / `heroku/builder:20`). This includes removing support for Ruby < 3.1 and Bundler < 2.3. (https://github.com/heroku/buildpacks-ruby/pull/1591) ## [v307] - 2025-05-14 @@ -1700,7 +1703,8 @@ Bugfixes: * Change gem detection to use lockfile parser * use `$RACK_ENV` when thin is detected for rack apps -[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v307...main +[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v308...main +[v308]: https://github.com/heroku/heroku-buildpack-ruby/compare/v307...v308 [v307]: https://github.com/heroku/heroku-buildpack-ruby/compare/v306...v307 [v306]: https://github.com/heroku/heroku-buildpack-ruby/compare/v305...v306 [v305]: https://github.com/heroku/heroku-buildpack-ruby/compare/v304...v305 diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 0a4ab1c46..4cec21b2c 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v307" + BUILDPACK_VERSION = "v308" end end From ea5df15dd3376002a5f14b5dbb7d5c3ef7a2040e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 15 May 2025 21:13:28 +0000 Subject: [PATCH 1051/1195] Bump the ruby-dependencies group with 6 updates (#1590) Bumps the ruby-dependencies group with 6 updates: | Package | From | To | | --- | --- | --- | | [heroku_hatchet](https://github.com/heroku/hatchet) | `8.0.4` | `8.0.5` | | [rspec-core](https://github.com/rspec/rspec-core) | `3.13.0` | `3.13.3` | | [rspec-expectations](https://github.com/rspec/rspec-expectations) | `3.13.1` | `3.13.4` | | [json](https://github.com/ruby/json) | `2.7.2` | `2.11.3` | | [ci-queue](https://github.com/Shopify/ci-queue) | `0.59.0` | `0.65.0` | | [redis](https://github.com/redis/redis-rb) | `5.3.0` | `5.4.0` | Updates `heroku_hatchet` from 8.0.4 to 8.0.5 - [Changelog](https://github.com/heroku/hatchet/blob/main/CHANGELOG.md) - [Commits](https://github.com/heroku/hatchet/compare/v8.0.4...v8.0.5) Updates `rspec-core` from 3.13.0 to 3.13.3 - [Release notes](https://github.com/rspec/rspec-core/releases) - [Changelog](https://github.com/rspec/rspec-core/blob/main/Changelog.md) - [Commits](https://github.com/rspec/rspec-core/commits) Updates `rspec-expectations` from 3.13.1 to 3.13.4 - [Release notes](https://github.com/rspec/rspec-expectations/releases) - [Changelog](https://github.com/rspec/rspec-expectations/blob/main/Changelog.md) - [Commits](https://github.com/rspec/rspec-expectations/commits) Updates `json` from 2.7.2 to 2.11.3 - [Release notes](https://github.com/ruby/json/releases) - [Changelog](https://github.com/ruby/json/blob/master/CHANGES.md) - [Commits](https://github.com/ruby/json/compare/v2.7.2...v2.11.3) Updates `ci-queue` from 0.59.0 to 0.65.0 - [Release notes](https://github.com/Shopify/ci-queue/releases) - [Commits](https://github.com/Shopify/ci-queue/compare/v0.59.0...v0.65.0) Updates `redis` from 5.3.0 to 5.4.0 - [Changelog](https://github.com/redis/redis-rb/blob/master/CHANGELOG.md) - [Commits](https://github.com/redis/redis-rb/compare/v5.3.0...v5.4.0) --- updated-dependencies: - dependency-name: heroku_hatchet dependency-version: 8.0.5 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: ruby-dependencies - dependency-name: rspec-core dependency-version: 3.13.3 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: ruby-dependencies - dependency-name: rspec-expectations dependency-version: 3.13.4 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: ruby-dependencies - dependency-name: json dependency-version: 2.11.3 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: ruby-dependencies - dependency-name: ci-queue dependency-version: 0.65.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: ruby-dependencies - dependency-name: redis dependency-version: 5.4.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: ruby-dependencies ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 6210961c1..e488d0358 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,12 +2,12 @@ GEM remote: https://rubygems.org/ specs: base64 (0.2.0) - ci-queue (0.59.0) + ci-queue (0.65.0) logger citrus (3.0.2) - connection_pool (2.4.1) + connection_pool (2.5.3) dead_end (4.0.0) - diff-lcs (1.5.0) + diff-lcs (1.6.1) erubis (2.7.0) excon (0.110.0) heroics (0.1.3) @@ -17,45 +17,45 @@ GEM moneta multi_json (>= 1.9.2) webrick - heroku_hatchet (8.0.4) - excon (~> 0) + heroku_hatchet (8.0.5) + excon (< 2) platform-api (~> 3) rrrretry (~> 1) thor (~> 1) threaded (~> 0) - json (2.7.2) - logger (1.6.2) + json (2.11.3) + logger (1.7.0) moneta (1.0.0) multi_json (1.15.0) parallel (1.25.1) parallel_tests (4.7.1) parallel - platform-api (3.7.0) + platform-api (3.8.0) heroics (~> 0.1.1) moneta (~> 1.0.0) rate_throttle_client (~> 0.1.0) racc (1.8.1) rake (13.2.1) rate_throttle_client (0.1.2) - redis (5.3.0) + redis (5.4.0) redis-client (>= 0.22.0) - redis-client (0.22.2) + redis-client (0.24.0) connection_pool rrrretry (1.0.0) - rspec-core (3.13.0) + rspec-core (3.13.3) rspec-support (~> 3.13.0) - rspec-expectations (3.13.1) + rspec-expectations (3.13.4) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) rspec-retry (0.6.2) rspec-core (> 3.3) - rspec-support (3.13.1) - thor (1.3.1) + rspec-support (3.13.3) + thor (1.3.2) threaded (0.0.4) toml-rb (4.0.0) citrus (~> 3.0, > 3.0) racc (~> 1.7) - webrick (1.8.2) + webrick (1.9.1) PLATFORMS ruby From bbfb9331e0a6cbc527663f729b121b84c8dc3934 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Mon, 19 May 2025 11:25:16 -0500 Subject: [PATCH 1052/1195] Update default Ruby version to 3.3.8 (#1595) * Update default Ruby version to 3.3.8 Also updates the "bootstrap" version of Ruby that the buildpack uses to run itself to match the default version. Previously, it was pinned to 3.1.x due to needing to support Bundler 1.x for the heroku-20. * Fix error difference ``` expected ArgumentError, got # with backtrace: # ./spec/helpers/shell_spec.rb:73:in `strip' # ./spec/helpers/shell_spec.rb:73:in `print' ``` We don't need to rely on the error class, as we are asserting against the message. --- .github/workflows/hatchet_app_cleaner.yml | 2 +- CHANGELOG.md | 1 + Gemfile | 2 +- Gemfile.lock | 4 ++-- buildpack.toml | 2 +- changelogs/unreleased/default_ruby.md | 22 ++++++++++++++++++++++ lib/language_pack/ruby_version.rb | 4 ++-- spec/helpers/shell_spec.rb | 2 +- 8 files changed, 31 insertions(+), 8 deletions(-) create mode 100644 changelogs/unreleased/default_ruby.md diff --git a/.github/workflows/hatchet_app_cleaner.yml b/.github/workflows/hatchet_app_cleaner.yml index 1e810bd47..3254d5b90 100644 --- a/.github/workflows/hatchet_app_cleaner.yml +++ b/.github/workflows/hatchet_app_cleaner.yml @@ -24,7 +24,7 @@ jobs: uses: ruby/setup-ruby@v1 with: bundler-cache: true - ruby-version: "3.1.6" + ruby-version: "3.3.8" - name: Run Hatchet destroy # Only apps older than 10 minutes are destroyed, to ensure that any # in progress CI runs are not interrupted. diff --git a/CHANGELOG.md b/CHANGELOG.md index a727c3590..e2deb8b29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## [Unreleased] +- Default Ruby version is now 3.3.8 (https://github.com/heroku/heroku-buildpack-ruby/pull/1595) ## [v308] - 2025-05-15 diff --git a/Gemfile b/Gemfile index 632e80ab6..879ad8198 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ source "https://rubygems.org" git_source(:github) { |repo| "https://github.com/#{repo}.git" } -ruby "3.1.6" +ruby "3.3.8" group :development, :test do gem "toml-rb" diff --git a/Gemfile.lock b/Gemfile.lock index e488d0358..9a0379c1e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -75,7 +75,7 @@ DEPENDENCIES toml-rb RUBY VERSION - ruby 3.1.6p260 + ruby 3.3.8p144 BUNDLED WITH - 2.5.11 + 2.5.22 diff --git a/buildpack.toml b/buildpack.toml index 253627574..f6e1e2f23 100644 --- a/buildpack.toml +++ b/buildpack.toml @@ -1,6 +1,6 @@ [buildpack] name = "Ruby" -ruby_version = "3.1.6" +ruby_version = "3.3.8" [publish.Ignore] files = [ diff --git a/changelogs/unreleased/default_ruby.md b/changelogs/unreleased/default_ruby.md new file mode 100644 index 000000000..f1d257167 --- /dev/null +++ b/changelogs/unreleased/default_ruby.md @@ -0,0 +1,22 @@ +## Default Ruby version for new apps is now 3.3.8 + +The [default Ruby version for new Ruby applications is 3.3.8](https://devcenter.heroku.com/articles/ruby-support#default-ruby-version-for-new-apps). You’ll only get the default if the application does not specify a ruby version. + +Heroku highly recommends specifying your desired Ruby version. You can specify a Ruby version in your `Gemfile: + +```term +ruby "3.3.8" +``` + +Once you have a Ruby version specified in your `Gemfile`, update the `Gemfile.lock` by running the following command: + +```term +$ bundle update --ruby +``` + +Make sure you commit the results to git before attempting to deploy again: + +```term +$ git add Gemfile Gemfile.lock +$ git commit -m "update ruby version" +``` diff --git a/lib/language_pack/ruby_version.rb b/lib/language_pack/ruby_version.rb index e10808925..a5b7243f0 100644 --- a/lib/language_pack/ruby_version.rb +++ b/lib/language_pack/ruby_version.rb @@ -12,8 +12,8 @@ def initialize(output = "") end end - BOOTSTRAP_VERSION_NUMBER = "3.1.6".freeze - DEFAULT_VERSION_NUMBER = "3.3.7".freeze + BOOTSTRAP_VERSION_NUMBER = "3.3.8".freeze + DEFAULT_VERSION_NUMBER = "3.3.8".freeze DEFAULT_VERSION = "ruby-#{DEFAULT_VERSION_NUMBER}".freeze RUBY_VERSION_REGEX = %r{ (?\d+\.\d+\.\d+){0} diff --git a/spec/helpers/shell_spec.rb b/spec/helpers/shell_spec.rb index 996af7908..7e1fcfc1a 100644 --- a/spec/helpers/shell_spec.rb +++ b/spec/helpers/shell_spec.rb @@ -74,7 +74,7 @@ def sh.print(string) end bad_lines = File.read("spec/fixtures/invalid_encoding.log") - expect { sh.puts(bad_lines) }.to raise_error(ArgumentError) do |error| + expect { sh.puts(bad_lines) }.to raise_error do |error| expect(error.message).to include("Invalid string:") end end From ec90a61eb405fb28c624e2080e350b8778f28bbb Mon Sep 17 00:00:00 2001 From: "heroku-linguist[bot]" <136119646+heroku-linguist[bot]@users.noreply.github.com> Date: Mon, 19 May 2025 16:33:40 +0000 Subject: [PATCH 1053/1195] Prepare release v309 (#1596) Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com> --- CHANGELOG.md | 6 +++++- changelogs/{unreleased => v309}/default_ruby.md | 0 lib/language_pack/version.rb | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) rename changelogs/{unreleased => v309}/default_ruby.md (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index e2deb8b29..df7e0222d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased] + +## [v309] - 2025-05-19 + - Default Ruby version is now 3.3.8 (https://github.com/heroku/heroku-buildpack-ruby/pull/1595) ## [v308] - 2025-05-15 @@ -1704,7 +1707,8 @@ Bugfixes: * Change gem detection to use lockfile parser * use `$RACK_ENV` when thin is detected for rack apps -[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v308...main +[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v309...main +[v309]: https://github.com/heroku/heroku-buildpack-ruby/compare/v308...v309 [v308]: https://github.com/heroku/heroku-buildpack-ruby/compare/v307...v308 [v307]: https://github.com/heroku/heroku-buildpack-ruby/compare/v306...v307 [v306]: https://github.com/heroku/heroku-buildpack-ruby/compare/v305...v306 diff --git a/changelogs/unreleased/default_ruby.md b/changelogs/v309/default_ruby.md similarity index 100% rename from changelogs/unreleased/default_ruby.md rename to changelogs/v309/default_ruby.md diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 4cec21b2c..383112a49 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v308" + BUILDPACK_VERSION = "v309" end end From 5ec402bc893d98dfc874b297e53c7c393025f59c Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Mon, 19 May 2025 13:05:56 -0500 Subject: [PATCH 1054/1195] Check CLI login state before release (#1598) Otherwise `heroku buildpacks:publish` might error due to auth without hinting that you're not logged in https://github.com/heroku/heroku-buildpack-python/blob/c9942a6829fe2e064db7a26c9d95fbbd1bd9ab72/etc/publish.sh#L24-L28. --- Rakefile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index 8640f1119..85b4266e0 100644 --- a/Rakefile +++ b/Rakefile @@ -16,10 +16,18 @@ namespace :buildpack do desc "releases the next version of the buildpack" task :release do + puts "Checking login state" + sh("heroku whoami") do |out, status| + if status.success? + puts "Success" + else + raise "Ensure login works: `heroku login`" + end + end + deploy = DeployCheck.new(github: "heroku/heroku-buildpack-ruby") puts "Attempting to deploy #{deploy.next_version}, overwrite with RELEASE_VERSION env var" deploy.check! - if deploy.push_tag? sh("git tag -f #{deploy.next_version}") do |out, status| raise "Could not `git tag -f #{deploy.next_version}`: #{out}" unless status.success? From ae8bb3d39c23a55c21ae777b98f1c6046c04ffe4 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Thu, 22 May 2025 09:42:28 -0500 Subject: [PATCH 1055/1195] Cleanup and refactoring (#1600) * Delete unused file This code is unused * Refactor Lockfile Error Previously, the existence check for a `Gemfile.lock` was enforced by creating a "language pack" that is checked and executed only if the Gemfile.lock file does not exist. The location for this logic doesn't need to be tied to a lanugage pack. * Dont emit warning (from grep) when Gemfile.lock does not exist Fixes this output: ``` remote: -----> Building on the Heroku-24 stack remote: -----> Using buildpack: https://github.com/heroku/heroku-buildpack-ruby#schneems/every-bundler-version remote: -----> Ruby app detected remote: grep: /tmp/build_cdf9bd69/Gemfile.lock: No such file or directory remote: remote: ! remote: ! Gemfile.lock required. Please check it in. remote: ! remote: ! Push rejected, failed to compile Ruby app. ``` * Remove false documentation Neither detect or release use Ruby for logic: ``` #!/bin/sh APP_DIR=$1 if [ -f "$APP_DIR/Gemfile" ]; then echo "Ruby" exit 0 else exit 1 fi $ cat bin/release #!/usr/bin/env bash set -euo pipefail BUILD_DIR="${1:-}" RELEASE_FILE="${BUILD_DIR}/tmp/heroku-buildpack-release-step.yml" # Whilst the release file is always written by the buildpack, some apps use # third-party slug cleaner buildpacks to remove this and other files, so we # cannot assume it still exists by the time the release step runs. if [[ -f "${RELEASE_FILE}" ]]; then cat "${RELEASE_FILE}" fi ``` The cache path is a required argument * Rename `build_path` to `app_path` From the perspective of the buildpack the build happens in the application path. The word "build" is overloaded and can be confusing. The application directory has more specificity. * Remove stray comment * Remove unused env var * Remove whitespace * Remove unused variable * Prefer kwargs * Standardize on Pathname as the language pack input * Extract Dir.chdir(app_path) The expectation is that the language pack is called in the application directory. We can do this before it is invoked, remove extra calls sprinkled throughout. * Update HEREDOC to ideomatic format The `<<~` heredoc is indentation aware and was not available when a lot of these `<<-` heredocs were added. * Whitespace --- bin/support/bash_functions.sh | 3 +- bin/support/ruby_compile | 6 +- bin/support/ruby_test-compile | 6 +- lib/heroku_build_report.rb | 2 +- lib/language_pack.rb | 17 ++- lib/language_pack/base.rb | 17 +-- lib/language_pack/disable_deploys.rb | 17 --- lib/language_pack/no_lockfile.rb | 16 --- lib/language_pack/rack.rb | 2 - lib/language_pack/rails2.rb | 15 ++- lib/language_pack/rails3.rb | 48 +++---- lib/language_pack/rails4.rb | 8 +- lib/language_pack/ruby.rb | 179 +++++++++++++-------------- lib/language_pack/test/rails2.rb | 14 +-- lib/language_pack/test/ruby.rb | 1 - spec/helpers/rails_runner_spec.rb | 64 +++++----- 16 files changed, 190 insertions(+), 225 deletions(-) delete mode 100644 lib/language_pack/disable_deploys.rb delete mode 100644 lib/language_pack/no_lockfile.rb diff --git a/bin/support/bash_functions.sh b/bin/support/bash_functions.sh index bb07b9f3d..425129f14 100755 --- a/bin/support/bash_functions.sh +++ b/bin/support/bash_functions.sh @@ -74,7 +74,8 @@ detect_needs_java() if which_java; then return $skip_java_install fi - grep "(jruby " "$gemfile_lock" --quiet + + grep "(jruby " "$gemfile_lock" --quiet &> /dev/null } # Runs another buildpack against the build dir diff --git a/bin/support/ruby_compile b/bin/support/ruby_compile index e4e06c6ca..1e68f01e3 100755 --- a/bin/support/ruby_compile +++ b/bin/support/ruby_compile @@ -19,8 +19,12 @@ HerokuBuildReport.set_global( ).tap(&:clear!) begin + app_path = Pathname(ARGV[0]) + cache_path = Pathname(ARGV[1]) + Dir.chdir(app_path) + LanguagePack::ShellHelpers.initialize_env(ARGV[2]) - if pack = LanguagePack.detect(ARGV[0], ARGV[1]) + if pack = LanguagePack.detect(app_path: app_path, cache_path: cache_path) pack.topic("Compiling #{pack.name}") pack.compile end diff --git a/bin/support/ruby_test-compile b/bin/support/ruby_test-compile index cb8287a9c..58815c420 100755 --- a/bin/support/ruby_test-compile +++ b/bin/support/ruby_test-compile @@ -19,7 +19,11 @@ require "language_pack/test" include LanguagePack::ShellHelpers begin - if pack = LanguagePack.detect(ARGV[0], ARGV[1]) + app_path = Pathname(ARGV[0]) + cache_path = Pathname(ARGV[1]) + Dir.chdir(app_path) + + if pack = LanguagePack.detect(app_path: app_path, cache_path: cache_path) LanguagePack::ShellHelpers.initialize_env(ARGV[2]) pack.topic("Setting up Test for #{pack.name}") pack.compile diff --git a/lib/heroku_build_report.rb b/lib/heroku_build_report.rb index f855b24b8..94b05b4c7 100644 --- a/lib/heroku_build_report.rb +++ b/lib/heroku_build_report.rb @@ -36,7 +36,7 @@ def capture(metrics = {}) return if key.nil? || key.to_s.strip.empty? key = key&.strip - raise "Key cannot be empty (#{key.inspect} => #{value})" if key.nil? || key.empty? + raise "Key cannot be empty (#{key.inspect} => #{value})" if key.nil? || key.empty? # Don't serialize complex values by accident if complex_object?(value) diff --git a/lib/language_pack.rb b/lib/language_pack.rb index ae88f58d0..3ce48dc1d 100644 --- a/lib/language_pack.rb +++ b/lib/language_pack.rb @@ -1,22 +1,24 @@ require "pathname" require 'benchmark' +require 'language_pack/shell_helpers' + # General Language Pack module module LanguagePack module Helpers end # detects which language pack to use - # @param [Array] first argument is a String of the build directory - # @return [LanguagePack] the {LanguagePack} detected - def self.detect(*args) - Dir.chdir(args.first) + def self.detect(app_path:, cache_path:) + if !File.exist?("Gemfile.lock") + raise BuildpackError.new("Gemfile.lock required. Please check it in.") + end - pack = [ NoLockfile, Rails8, Rails7, Rails6, Rails5, Rails42, Rails41, Rails4, Rails3, Rails2, Rack, Ruby ].detect do |klass| + pack = [ Rails8, Rails7, Rails6, Rails5, Rails42, Rails41, Rails4, Rails3, Rails2, Rack, Ruby ].detect do |klass| klass.use? end - return pack ? pack.new(*args) : nil + return pack ? pack.new(app_path: app_path, cache_path: cache_path) : nil end end @@ -25,7 +27,6 @@ def self.detect(*args) require 'heroku_build_report' -require 'language_pack/shell_helpers' require "language_pack/helpers/plugin_installer" require "language_pack/helpers/stale_file_cleaner" require "language_pack/helpers/rake_runner" @@ -39,7 +40,6 @@ def self.detect(*args) require "language_pack/rack" require "language_pack/rails2" require "language_pack/rails3" -require "language_pack/disable_deploys" require "language_pack/rails4" require "language_pack/rails41" require "language_pack/rails42" @@ -47,4 +47,3 @@ def self.detect(*args) require "language_pack/rails6" require "language_pack/rails7" require "language_pack/rails8" -require "language_pack/no_lockfile" diff --git a/lib/language_pack/base.rb b/lib/language_pack/base.rb index 1a2d890b4..54b1b1bdb 100644 --- a/lib/language_pack/base.rb +++ b/lib/language_pack/base.rb @@ -9,7 +9,6 @@ require "language_pack/fetcher" Encoding.default_external = Encoding::UTF_8 if defined?(Encoding) -ENV["BPLOG_PREFIX"] = "buildpack.ruby" # abstract class that all the Ruby based Language Packs inherit from class LanguagePack::Base @@ -21,23 +20,19 @@ class LanguagePack::Base MULTI_ARCH_STACKS = ["heroku-24"] KNOWN_ARCHITECTURES = ["amd64", "arm64"] - attr_reader :build_path, :cache, :stack + attr_reader :app_path, :cache, :stack - # changes directory to the build_path - # @param [String] the path of the build dir - # @param [String] the path of the cache dir this is nil during detect and release - def initialize(build_path, cache_path = nil) - @build_path = build_path + def initialize(app_path: , cache_path: ) + @app_path = app_path @stack = ENV.fetch("STACK") @cache = LanguagePack::Cache.new(cache_path) @metadata = LanguagePack::Metadata.new(@cache) @bundler_cache = LanguagePack::BundlerCache.new(@cache, @stack) - @id = Digest::SHA1.hexdigest("#{Time.now.to_f}-#{rand(1000000)}")[0..10] @fetchers = {:buildpack => LanguagePack::Fetcher.new(VENDOR_URL) } @arch = get_arch @report = HerokuBuildReport::GLOBAL - Dir.chdir build_path + Dir.chdir app_path end def get_arch @@ -54,7 +49,7 @@ def get_arch arch end - def self.===(build_path) + def self.===(app_path) raise "must subclass" end @@ -134,7 +129,7 @@ def setup_language_pack_environment end def add_to_profiled(string, filename: "ruby.sh", mode: "a") - profiled_path = "#{build_path}/.profile.d/" + profiled_path = "#{app_path}/.profile.d/" FileUtils.mkdir_p profiled_path File.open("#{profiled_path}/#{filename}", mode) do |file| diff --git a/lib/language_pack/disable_deploys.rb b/lib/language_pack/disable_deploys.rb deleted file mode 100644 index 46570bb8d..000000000 --- a/lib/language_pack/disable_deploys.rb +++ /dev/null @@ -1,17 +0,0 @@ -require "language_pack" -require "language_pack/base" - -class LanguagePack::DisableDeploys < LanguagePack::Base - def self.use? - File.exist?("Gemfile") - end - - def name - "Ruby/DisableDeploys" - end - - def compile - error "Ruby deploys have been temporarily disabled due to a Rubygems.org security breach.\nPlease see https://status.heroku.com/incidents/489 for more info and a workaround if you need to deploy." - end -end - diff --git a/lib/language_pack/no_lockfile.rb b/lib/language_pack/no_lockfile.rb deleted file mode 100644 index 552c6fb9d..000000000 --- a/lib/language_pack/no_lockfile.rb +++ /dev/null @@ -1,16 +0,0 @@ -require "language_pack" -require "language_pack/ruby" - -class LanguagePack::NoLockfile < LanguagePack::Ruby - def self.use? - !File.exist?("Gemfile.lock") - end - - def name - "Ruby/NoLockfile" - end - - def compile - error "Gemfile.lock required. Please check it in." - end -end diff --git a/lib/language_pack/rack.rb b/lib/language_pack/rack.rb index 408010b63..75e89b798 100644 --- a/lib/language_pack/rack.rb +++ b/lib/language_pack/rack.rb @@ -38,6 +38,4 @@ def setup_profiled(**args) super(**args) set_env_default "RACK_ENV", "production" end - end - diff --git a/lib/language_pack/rails2.rb b/lib/language_pack/rails2.rb index 43acab050..410a060a2 100644 --- a/lib/language_pack/rails2.rb +++ b/lib/language_pack/rails2.rb @@ -14,8 +14,8 @@ def self.use? return is_rails2 end - def initialize(*args) - super(*args) + def initialize(app_path: , cache_path: ) + super(app_path: app_path, cache_path: cache_path) @rails_runner = LanguagePack::Helpers::RailsRunner.new end @@ -57,11 +57,11 @@ def compile def best_practice_warnings if env("RAILS_ENV") != "production" - warn(<<-WARNING) -You are deploying to a non-production environment: #{ env("RAILS_ENV").inspect }. -This is not recommended. -See https://devcenter.heroku.com/articles/deploying-to-a-custom-rails-environment for more information. -WARNING + warn(<<~WARNING) + You are deploying to a non-production environment: #{ env("RAILS_ENV").inspect }. + This is not recommended. + See https://devcenter.heroku.com/articles/deploying-to-a-custom-rails-environment for more information. + WARNING end super end @@ -84,5 +84,4 @@ def setup_profiled(**args) set_env_default key, value end end - end diff --git a/lib/language_pack/rails3.rb b/lib/language_pack/rails3.rb index 945b196d3..843a3b655 100644 --- a/lib/language_pack/rails3.rb +++ b/lib/language_pack/rails3.rb @@ -70,14 +70,14 @@ def best_practice_warnings error(message) end - warn(<<-WARNING) -You set your `config.assets.compile = true` in production. -This can negatively impact the performance of your application. + warn(<<~WARNING) + You set your `config.assets.compile = true` in production. + This can negatively impact the performance of your application. -For more information can be found in this article: - https://devcenter.heroku.com/articles/rails-asset-pipeline#compile-set-to-true-in-production + For more information can be found in this article: + https://devcenter.heroku.com/articles/rails-asset-pipeline#compile-set-to-true-in-production -WARNING + WARNING end end @@ -86,31 +86,31 @@ def best_practice_warnings def warn_x_sendfile_use! return false unless @x_sendfile_config.success? if @x_sendfile_config.did_match?("X-Sendfile") && !has_apache? # Apache - warn(<<-WARNING) -You set `config.action_dispatch.x_sendfile_header = 'X-Sendfile'` in production, -but you do not have `apache` installed on this app. This setting will cause any assets -being served by your application to be returned without a body. + warn(<<~WARNING) + You set `config.action_dispatch.x_sendfile_header = 'X-Sendfile'` in production, + but you do not have `apache` installed on this app. This setting will cause any assets + being served by your application to be returned without a body. -To fix this issue, please set: + To fix this issue, please set: -``` -config.action_dispatch.x_sendfile_header = nil -``` -WARNING + ``` + config.action_dispatch.x_sendfile_header = nil + ``` + WARNING end if @x_sendfile_config.did_match?("X-Accel-Redirect") && !has_nginx? # Nginx - warn(<<-WARNING) -You set `config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'` in production, -but you do not have `nginx` installed on this app. This setting will cause any assets -being served by your application to be returned without a body. + warn(<<~WARNING) + You set `config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'` in production, + but you do not have `nginx` installed on this app. This setting will cause any assets + being served by your application to be returned without a body. -To fix this issue, please set: + To fix this issue, please set: -``` -config.action_dispatch.x_sendfile_header = nil -``` -WARNING + ``` + config.action_dispatch.x_sendfile_header = nil + ``` + WARNING end end diff --git a/lib/language_pack/rails4.rb b/lib/language_pack/rails4.rb index d34e90770..e7a4295b4 100644 --- a/lib/language_pack/rails4.rb +++ b/lib/language_pack/rails4.rb @@ -37,10 +37,10 @@ def install_plugins plugins = ["rails_serve_static_assets", "rails_stdout_logging"].reject { |plugin| bundler.has_gem?(plugin) } return false if plugins.empty? - warn <<-WARNING -Include 'rails_12factor' gem to enable all platform features -See https://devcenter.heroku.com/articles/rails-integration-gems for more information. -WARNING + warn <<~WARNING + Include 'rails_12factor' gem to enable all platform features + See https://devcenter.heroku.com/articles/rails-integration-gems for more information. + WARNING # do not install plugins, do not call super end diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 230399c97..424110004 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -30,8 +30,8 @@ def bundler self.class.bundler end - def initialize(*args) - super(*args) + def initialize(app_path: , cache_path: ) + super(app_path: app_path, cache_path: cache_path) @node_installer = LanguagePack::Helpers::NodeInstaller.new(arch: @arch) @yarn_installer = LanguagePack::Helpers::YarnInstaller.new end @@ -63,18 +63,17 @@ def default_process_types def best_practice_warnings if bundler.has_gem?("asset_sync") - warn(<<-WARNING) -You are using the `asset_sync` gem. -This is not recommended. -See https://devcenter.heroku.com/articles/please-do-not-use-asset-sync for more information. -WARNING + warn(<<~WARNING) + You are using the `asset_sync` gem. + This is not recommended. + See https://devcenter.heroku.com/articles/please-do-not-use-asset-sync for more information. + WARNING end end def compile # check for new app at the beginning of the compile new_app? - Dir.chdir(build_path) remove_vendor_bundle warn_bundler_upgrade warn_bad_binstubs @@ -142,14 +141,14 @@ def warn_bundler_upgrade old_bundler_version = @metadata.read("bundler_version").strip if @metadata.exists?("bundler_version") if old_bundler_version && old_bundler_version != bundler.version - warn(<<-WARNING, inline: true) -Your app was upgraded to bundler #{ bundler.version }. -Previously you had a successful deploy with bundler #{ old_bundler_version }. + warn(<<~WARNING, inline: true) + Your app was upgraded to bundler #{ bundler.version }. + Previously you had a successful deploy with bundler #{ old_bundler_version }. -If you see problems related to the bundler version please refer to: -https://devcenter.heroku.com/articles/bundler-version#known-upgrade-issues + If you see problems related to the bundler version please refer to: + https://devcenter.heroku.com/articles/bundler-version#known-upgrade-issues -WARNING + WARNING end end @@ -204,28 +203,28 @@ def set_default_web_concurrency - https://help.heroku.com/88G3XLA6/what-is-an-acceptable-amount-of-dyno-load WARNING - <<-EOF -case $(ulimit -u) in -256) - export HEROKU_RAM_LIMIT_MB=${HEROKU_RAM_LIMIT_MB:-512} - export WEB_CONCURRENCY=${WEB_CONCURRENCY:-2} - ;; -512) - export HEROKU_RAM_LIMIT_MB=${HEROKU_RAM_LIMIT_MB:-1024} - export WEB_CONCURRENCY=${WEB_CONCURRENCY:-4} - ;; -16384) - export HEROKU_RAM_LIMIT_MB=${HEROKU_RAM_LIMIT_MB:-2560} - export WEB_CONCURRENCY=${WEB_CONCURRENCY:-8} - ;; -32768) - export HEROKU_RAM_LIMIT_MB=${HEROKU_RAM_LIMIT_MB:-6144} - export WEB_CONCURRENCY=${WEB_CONCURRENCY:-16} - ;; -*) - ;; -esac -EOF + return <<~EOF + case $(ulimit -u) in + 256) + export HEROKU_RAM_LIMIT_MB=${HEROKU_RAM_LIMIT_MB:-512} + export WEB_CONCURRENCY=${WEB_CONCURRENCY:-2} + ;; + 512) + export HEROKU_RAM_LIMIT_MB=${HEROKU_RAM_LIMIT_MB:-1024} + export WEB_CONCURRENCY=${WEB_CONCURRENCY:-4} + ;; + 16384) + export HEROKU_RAM_LIMIT_MB=${HEROKU_RAM_LIMIT_MB:-2560} + export WEB_CONCURRENCY=${WEB_CONCURRENCY:-8} + ;; + 32768) + export HEROKU_RAM_LIMIT_MB=${HEROKU_RAM_LIMIT_MB:-6144} + export WEB_CONCURRENCY=${WEB_CONCURRENCY:-16} + ;; + *) + ;; + esac + EOF end # default JRUBY_OPTS @@ -289,13 +288,13 @@ def setup_language_pack_environment(ruby_layer_path:, gem_layer_path:, bundle_pa # muiltibuildpack. We can't use profile.d because $HOME isn't set up def setup_export paths = ENV["PATH"].split(":").map do |path| - /^\/.*/ !~ path ? "#{build_path}/#{path}" : path + /^\/.*/ !~ path ? "#{app_path}/#{path}" : path end.join(":") # TODO ensure path exported is correct set_export_path "PATH", paths - gem_path = "#{build_path}/#{slug_vendor_base}" + gem_path = "#{app_path}/#{slug_vendor_base}" set_export_path "GEM_PATH", gem_path set_export_default "LANG", "en_US.UTF-8" @@ -608,12 +607,12 @@ def uninstall_binary(path) # https://github.com/heroku/heroku-buildpack-ruby/issues/21 def remove_vendor_bundle if File.exist?("vendor/bundle") - warn(<<-WARNING) -Removing `vendor/bundle`. -Checking in `vendor/bundle` is not supported. Please remove this directory -and add it to your .gitignore. To vendor your gems with Bundler, use -`bundle pack` instead. -WARNING + warn(<<~WARNING) + Removing `vendor/bundle`. + Checking in `vendor/bundle` is not supported. Please remove this directory + and add it to your .gitignore. To vendor your gems with Bundler, use + `bundle pack` instead. + WARNING FileUtils.rm_rf("vendor/bundle") end end @@ -721,61 +720,61 @@ def create_database_yml topic("Writing config/database.yml to read from DATABASE_URL") File.open("config/database.yml", "w") do |file| - file.puts <<-DATABASE_YML -<% - -require 'cgi' -require 'uri' + file.puts <<~DATABASE_YML + <% -begin - uri = URI.parse(ENV["DATABASE_URL"]) -rescue URI::InvalidURIError - raise "Invalid DATABASE_URL" -end + require 'cgi' + require 'uri' -raise "No RACK_ENV or RAILS_ENV found" unless ENV["RAILS_ENV"] || ENV["RACK_ENV"] + begin + uri = URI.parse(ENV["DATABASE_URL"]) + rescue URI::InvalidURIError + raise "Invalid DATABASE_URL" + end -def attribute(name, value, force_string = false) - if value - value_string = - if force_string - '"' + value + '"' - else - value - end - "\#{name}: \#{value_string}" - else - "" - end -end + raise "No RACK_ENV or RAILS_ENV found" unless ENV["RAILS_ENV"] || ENV["RACK_ENV"] + + def attribute(name, value, force_string = false) + if value + value_string = + if force_string + '"' + value + '"' + else + value + end + "\#{name}: \#{value_string}" + else + "" + end + end -adapter = uri.scheme -adapter = "postgresql" if adapter == "postgres" + adapter = uri.scheme + adapter = "postgresql" if adapter == "postgres" -database = (uri.path || "").split("/")[1] + database = (uri.path || "").split("/")[1] -username = uri.user -password = uri.password + username = uri.user + password = uri.password -host = uri.host -port = uri.port + host = uri.host + port = uri.port -params = CGI.parse(uri.query || "") + params = CGI.parse(uri.query || "") -%> + %> -<%= ENV["RAILS_ENV"] || ENV["RACK_ENV"] %>: - <%= attribute "adapter", adapter %> - <%= attribute "database", database %> - <%= attribute "username", username %> - <%= attribute "password", password, true %> - <%= attribute "host", host %> - <%= attribute "port", port %> + <%= ENV["RAILS_ENV"] || ENV["RACK_ENV"] %>: + <%= attribute "adapter", adapter %> + <%= attribute "database", database %> + <%= attribute "username", username %> + <%= attribute "password", password, true %> + <%= attribute "host", host %> + <%= attribute "port", port %> -<% params.each do |key, value| %> - <%= key %>: <%= value.first %> -<% end %> - DATABASE_YML + <% params.each do |key, value| %> + <%= key %>: <%= value.first %> + <% end %> + DATABASE_YML end end @@ -836,7 +835,7 @@ def pg_adapters def add_node_js_binary return [] if node_js_preinstalled? - if Pathname(build_path).join("package.json").exist? || + if Pathname(app_path).join("package.json").exist? || bundler.has_gem?('execjs') || bundler.has_gem?('webpacker') @@ -873,7 +872,7 @@ def add_node_js_binary def add_yarn_binary return [] if yarn_preinstalled? - if Pathname(build_path).join("yarn.lock").exist? || bundler.has_gem?('webpacker') + if Pathname(app_path).join("yarn.lock").exist? || bundler.has_gem?('webpacker') version = @yarn_installer.version old_version = @metadata.fetch("default_yarn_version") { version } diff --git a/lib/language_pack/test/rails2.rb b/lib/language_pack/test/rails2.rb index 24d6323e9..26a2ee547 100644 --- a/lib/language_pack/test/rails2.rb +++ b/lib/language_pack/test/rails2.rb @@ -39,13 +39,13 @@ def clear_db_test_tasks File.open("lib/tasks/heroku_clear_tasks.rake", "w") do |file| file.puts "# rubocop:disable all" content = db_test_tasks_to_clear.map do |task_name| - <<-FILE -if Rake::Task.task_defined?('#{task_name}') - Rake::Task['#{task_name}'].clear - task '#{task_name}' do - end -end -FILE + <<~FILE + if Rake::Task.task_defined?('#{task_name}') + Rake::Task['#{task_name}'].clear + task '#{task_name}' do + end + end + FILE end.join("\n") file.print content file.puts "# rubocop:enable all" diff --git a/lib/language_pack/test/ruby.rb b/lib/language_pack/test/ruby.rb index e3a2f25c7..e57c8e4da 100644 --- a/lib/language_pack/test/ruby.rb +++ b/lib/language_pack/test/ruby.rb @@ -6,7 +6,6 @@ class LanguagePack::Ruby def compile new_app? - Dir.chdir(build_path) remove_vendor_bundle warn_bad_binstubs install_ruby(slug_vendor_ruby) diff --git a/spec/helpers/rails_runner_spec.rb b/spec/helpers/rails_runner_spec.rb index 1488c8677..368c619f0 100644 --- a/spec/helpers/rails_runner_spec.rb +++ b/spec/helpers/rails_runner_spec.rb @@ -94,41 +94,41 @@ def time_it end def mock_rails_runner(try_code = "") - executable_contents = <<-FILE -#!/usr/bin/env ruby -require 'ostruct' + executable_contents = <<~FILE + #!/usr/bin/env ruby + require 'ostruct' -module Rails; end -def Rails.application - OpenStruct.new(config: TryMock.new) # Rails.application.config #=> TryMock instance -end - -# Mock object used to record calls -# for example: -# -# obj = Try.new -# obj.try(:active_storage).try(:service) -# puts obj.to_s # => "active_storage.service" -# -class TryMock - def initialize(array = []) - @try_array = array - end - - def try(value) - @try_array << value - #{try_code} - return TryMock.new(@try_array) - end + module Rails; end + def Rails.application + OpenStruct.new(config: TryMock.new) # Rails.application.config #=> TryMock instance + end - def to_s - @try_array.join(".") - end -end + # Mock object used to record calls + # for example: + # + # obj = Try.new + # obj.try(:active_storage).try(:service) + # puts obj.to_s # => "active_storage.service" + # + class TryMock + def initialize(array = []) + @try_array = array + end + + def try(value) + @try_array << value + #{try_code} + return TryMock.new(@try_array) + end + + def to_s + @try_array.join(".") + end + end -ARGV.shift # remove "runner" -eval(ARGV.join(" ")) # Execute command passed in -FILE + ARGV.shift # remove "runner" + eval(ARGV.join(" ")) # Execute command passed in + FILE FileUtils.mkdir("bin") File.open("bin/rails", "w") { |f| f << executable_contents } File.chmod(0777, "bin/rails") From 45dd2872ac22ebddae4debb31b5d620a04bbab58 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Thu, 22 May 2025 09:43:06 -0500 Subject: [PATCH 1056/1195] Refactor and cleanup bundle wrapper (#1602) * Refactor report to kwarg * Refactor gemfile_path to kwarg * Refactor bundler_path to kwarg * Remove unused options * Remove unused code * Remove unused code --- hatchet.json | 1 - hatchet.lock | 2 -- lib/language_pack/helpers/bundler_wrapper.rb | 28 +++++++------------- spec/helpers/bundler_wrapper_spec.rb | 9 ------- 4 files changed, 10 insertions(+), 30 deletions(-) diff --git a/hatchet.json b/hatchet.json index 9f60b5ee9..7911eec62 100644 --- a/hatchet.json +++ b/hatchet.json @@ -23,7 +23,6 @@ "rails_versions": [ "sharpstone/rails_lts_23_default_ruby", "sharpstone/rails3_default_ruby", - "sharpstone/rails4_windows_mri193", "sharpstone/rails42_default_ruby", "sharpstone/rails61", "sharpstone/rails-jsbundling", diff --git a/hatchet.lock b/hatchet.lock index cf21facff..dd75a8d19 100644 --- a/hatchet.lock +++ b/hatchet.lock @@ -21,8 +21,6 @@ - 984b6d02353519251c2d1e885bf8914a2584f26a - - "./repos/rails_versions/rails42_default_ruby" - fbdaf031823f09d1514ec1d55dcb04ca2f4264ca -- - "./repos/rails_versions/rails4_windows_mri193" - - f4c7b6209835050468bbb87827acf652b8f4d8ce - - "./repos/rails_versions/rails61" - 47828a3e8c79b7869ca0d9a3afa4be065fa46e96 - - "./repos/rails_versions/rails_8_ruby_schema" diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index 61509215b..4147eaffe 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -101,11 +101,15 @@ def initialize(version_hash, major_minor) attr_reader :bundler_path - def initialize(options = {}) - @report = options[:report] || HerokuBuildReport::GLOBAL + def initialize( + bundler_path: nil, + gemfile_path: Pathname.new("./Gemfile"), + report: HerokuBuildReport::GLOBAL + ) + @report = report @bundler_tmp = Pathname.new(Dir.mktmpdir) - @fetcher = options[:fetcher] || LanguagePack::Fetcher.new(LanguagePack::Base::VENDOR_URL) # coupling - @gemfile_path = options[:gemfile_path] || Pathname.new("./Gemfile") + @fetcher = LanguagePack::Fetcher.new(LanguagePack::Base::VENDOR_URL) # coupling + @gemfile_path = gemfile_path @gemfile_lock_path = Pathname.new("#{@gemfile_path}.lock") contents = @gemfile_lock_path.read(mode: "rt") @@ -132,8 +136,8 @@ def initialize(options = {}) ) @dir_name = "bundler-#{@version}" - @bundler_path = options[:bundler_path] || @bundler_tmp.join(@dir_name) - @bundler_tar = options[:bundler_tar] || "bundler/#{@dir_name}.tgz" + @bundler_path = bundler_path || @bundler_tmp.join(@dir_name) + @bundler_tar = "bundler/#{@dir_name}.tgz" @orig_bundle_gemfile = ENV['BUNDLE_GEMFILE'] @path = Pathname.new("#{@bundler_path}/gems/#{@dir_name}/lib") end @@ -162,22 +166,10 @@ def gem_version(name) end end - # detects whether the Gemfile.lock contains the Windows platform - # @return [Boolean] true if the Gemfile.lock was created on Windows - def windows_gemfile_lock? - platforms.detect do |platform| - /mingw|mswin/.match(platform.os) if platform.is_a?(Gem::Platform) - end - end - def specs @specs ||= lockfile_parser.specs.each_with_object({}) {|spec, hash| hash[spec.name] = spec } end - def platforms - @platforms ||= lockfile_parser.platforms - end - def version @version end diff --git a/spec/helpers/bundler_wrapper_spec.rb b/spec/helpers/bundler_wrapper_spec.rb index 7526d470e..bdfedc8ea 100644 --- a/spec/helpers/bundler_wrapper_spec.rb +++ b/spec/helpers/bundler_wrapper_spec.rb @@ -110,15 +110,6 @@ def wrapper.topic(*args); end # Silence output in tests end end - it "detects windows gemfiles" do - Hatchet::App.new("rails4_windows_mri193").in_directory_fork do |dir| - require "bundler" - Bundler.with_unbundled_env do - expect(@bundler.install.windows_gemfile_lock?).to be_truthy - end - end - end - describe "when executing bundler" do it "handles JRuby pre gemfiles" do Hatchet::App.new("jruby-minimal").in_directory_fork do |dir| From 9cf1b8c3da998f80b27d5240aeafcf7bb4a9c03b Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Thu, 22 May 2025 09:52:13 -0500 Subject: [PATCH 1057/1195] Refactor RubyVersion class (#1601) * Refactor RubyVersion args Prefer kwargs, remove open-ended options hash in favor of explicit kwarg. * Inline initialize logic * Remove non-public instance variables These values do not need to be persisted as they're not used after initialization * Remove unused variable * Rename ivar and remove pub, method already exposed * Refactor version increment logic * Rename ivar to match method * Remove unused ivar * Derive version_for_download * RubyVersion is now a simple store The bundle parsing logic feeds into the RubyVersion class instead of being tightly coupled * Use new interface * Update method The other method was removed, this is the new name * Add test, passes on main, fails here * Fix test, capture "pre" release version information * Support pre-release versions without numbers Convention says they have numbers, but it's not strictly required. * Remove shell helper include * Extract RubyVersion.default into a method * Capture when Ruby version is the default --- .../helpers/outdated_ruby_version.rb | 4 +- .../installers/heroku_ruby_installer.rb | 1 + lib/language_pack/ruby.rb | 11 +- lib/language_pack/ruby_version.rb | 113 +++++++++--------- spec/helpers/heroku_ruby_installer_spec.rb | 4 +- spec/helpers/outdated_ruby_version_spec.rb | 18 +-- spec/helpers/ruby_version_spec.rb | 98 +++++++++++++-- 7 files changed, 162 insertions(+), 87 deletions(-) diff --git a/lib/language_pack/helpers/outdated_ruby_version.rb b/lib/language_pack/helpers/outdated_ruby_version.rb index 4fb490635..1471ceb08 100644 --- a/lib/language_pack/helpers/outdated_ruby_version.rb +++ b/lib/language_pack/helpers/outdated_ruby_version.rb @@ -4,7 +4,7 @@ # # Example: # -# ruby_version = LanguagePack::RubyVersion.new("ruby-2.2.5") +# ruby_version = LanguagePack::RubyVersion.bundle_platform_ruby(bundler_output: "ruby-2.2.5") # outdated = LanguagePack::Helpers::OutdatedRubyVersion.new( # current_ruby_version: ruby_version, # fetcher: LanguagePack::Fetcher.new(LanguagePack::Base::VENDOR_URL, stack: "heroku-22") @@ -175,7 +175,7 @@ def suggest_ruby_eol_version next if !@fetcher.exists?("#{version}.tgz") check_eol_versions_minor( - base_version: LanguagePack::RubyVersion.new(version) + base_version: LanguagePack::RubyVersion.bundle_platform_ruby(bundler_output: version) ) version diff --git a/lib/language_pack/installers/heroku_ruby_installer.rb b/lib/language_pack/installers/heroku_ruby_installer.rb index 7d159f8d6..a79cc97ec 100644 --- a/lib/language_pack/installers/heroku_ruby_installer.rb +++ b/lib/language_pack/installers/heroku_ruby_installer.rb @@ -27,6 +27,7 @@ def install(ruby_version, install_dir) "ruby.major" => ruby_version.major, "ruby.minor" => ruby_version.minor, "ruby.patch" => ruby_version.patch, + "ruby.default" => ruby_version.default?, ) fetch_unpack(ruby_version, install_dir) setup_binstubs(install_dir) diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 424110004..c8541bc69 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -171,7 +171,7 @@ def slug_vendor_base # the relative path to the vendored ruby directory # @return [String] resulting path def slug_vendor_ruby - "vendor/#{ruby_version.version_without_patchlevel}" + "vendor/#{ruby_version.version_for_download}" end # fetch the ruby version from bundler @@ -182,9 +182,10 @@ def ruby_version last_version = nil last_version = @metadata.read(last_version_file).strip if @metadata.exists?(last_version_file) - @ruby_version = LanguagePack::RubyVersion.new(bundler.ruby_version, - is_new: new_app?, - last_version: last_version) + @ruby_version = LanguagePack::RubyVersion.bundle_platform_ruby( + bundler_output: bundler.ruby_version, + last_version: last_version + ) return @ruby_version end @@ -470,7 +471,7 @@ def install_ruby(install_path) @metadata.write("buildpack_ruby_version", ruby_version.version_for_download) topic "Using Ruby version: #{ruby_version.version_for_download}" - if !ruby_version.set + if ruby_version.default? warn(<<~WARNING) You have not declared a Ruby version in your Gemfile. diff --git a/lib/language_pack/ruby_version.rb b/lib/language_pack/ruby_version.rb index a5b7243f0..32ae6bd29 100644 --- a/lib/language_pack/ruby_version.rb +++ b/lib/language_pack/ruby_version.rb @@ -1,4 +1,4 @@ -require "language_pack/shell_helpers" +require "language_pack/shell_helpers" # Holds BuildpackError module LanguagePack class RubyVersion @@ -21,43 +21,68 @@ def initialize(output = "") (?\w+){0} (?.+){0} - ruby-\g(-\g)?(-\g-\g)? + ruby-\g(-\g)?(\.(?
\S*))?(-\g-\g)?
       }x
 
-
-    # `version` is the bundler output like `ruby-3.4.2`
-    attr_reader :version,
-      # `set` is either `:gemfile` when the app specified a version or `nil` when using
-      # the default version
-      :set,
-      # `version_without_patchlevel` removes any `-p` as they're not significant
-      # effectively this is `version_for_download`
-      :version_without_patchlevel,
-      # `patchlevel` is the `-p` or is empty
-      :patchlevel,
+    # String formatted `..` for Ruby and JRuby
+    attr_reader :ruby_version,
       # `engine` is `:ruby` or `:jruby`
       :engine,
-      # `ruby_version` is `..` extracted from `version`
-      :ruby_version,
       # `engine_version` is the Jruby version or for MRI it is the same as `ruby_version`
       # i.e. `..`
       :engine_version
 
-    include LanguagePack::ShellHelpers
+    def self.bundle_platform_ruby(bundler_output:, last_version: nil)
+      default = bundler_output.empty?
+      if default
+        default(last_version: last_version)
+      elsif md = RUBY_VERSION_REGEX.match(bundler_output)
+        new(
+          pre: md[:pre],
+          engine: md[:engine]&.to_sym || :ruby,
+          default: default,
+          ruby_version: md[:ruby_version],
+          engine_version: md[:engine_version] || md[:ruby_version],
+        )
+      else
+        raise BadVersionError.new("'#{bundler_output}' is not valid") unless md
+      end
+    end
 
-    def initialize(bundler_output, app = {})
-      @set            = nil
-      @bundler_output = bundler_output
-      @app            = app
-      set_version
-      parse_version
+    def self.default(last_version: )
+      ruby_version = last_version&.split("-")&.last || DEFAULT_VERSION_NUMBER
+      new(
+        pre: nil,
+        engine: :ruby,
+        default: true,
+        ruby_version: ruby_version,
+        engine_version: ruby_version,
+      )
+    end
 
-      @version_without_patchlevel = @version.sub(/-p-?\d+/, '')
+    def initialize(
+        pre:,
+        engine:,
+        default:,
+        ruby_version:,
+        engine_version:
+      )
+        @pre = pre
+        @engine = engine
+        @default = default
+        @ruby_version = ruby_version
+        @engine_version = engine_version
     end
 
-    # https://github.com/bundler/bundler/issues/4621
+    # i.e. `ruby-3.4.2`
     def version_for_download
-      version_without_patchlevel
+      if @engine == :jruby
+        "ruby-#{ruby_version}-jruby-#{engine_version}"
+      elsif @pre
+        "ruby-#{ruby_version}.#{@pre}"
+      else
+        "ruby-#{ruby_version}"
+      end
     end
 
     def file_name
@@ -65,7 +90,7 @@ def file_name
     end
 
     def default?
-      !set
+      @default
     end
 
     # determine if we're using jruby
@@ -101,45 +126,15 @@ def patch
     # `ruby-2.3.1` then then `next_logical_version(1)`
     # will produce `ruby-2.3.2`.
     def next_logical_version(increment = 1)
-      split_version = @version_without_patchlevel.split(".")
-      teeny = split_version.pop
-      split_version << teeny.to_i + increment
-      split_version.join(".")
+      "ruby-#{major}.#{minor}.#{patch + increment}"
     end
 
     def next_minor_version(increment = 1)
-      split_version = @version_without_patchlevel.split(".")
-      split_version[1] = split_version[1].to_i + increment
-      split_version[2] = 0
-      split_version.join(".")
+      "ruby-#{major}.#{minor + increment}.0"
     end
 
     def next_major_version(increment = 1)
-      split_version = @version_without_patchlevel.split("-").last.split(".")
-      split_version[0] = Integer(split_version[0]) + increment
-      split_version[1] = 0
-      split_version[2] = 0
-      return "ruby-#{split_version.join(".")}"
-    end
-
-    private
-    def set_version
-      if @bundler_output.empty?
-        @set     = false
-        @version = @app[:last_version] || DEFAULT_VERSION
-      else
-        @set     = :gemfile
-        @version = @bundler_output
-      end
-    end
-
-    def parse_version
-      md = RUBY_VERSION_REGEX.match(version)
-      raise BadVersionError.new("'#{version}' is not valid") unless md
-      @ruby_version   = md[:ruby_version]
-      @patchlevel     = md[:patchlevel]
-      @engine_version = md[:engine_version] || @ruby_version
-      @engine         = (md[:engine]        || :ruby).to_sym
+      "ruby-#{major + increment}.0.0"
     end
   end
 end
diff --git a/spec/helpers/heroku_ruby_installer_spec.rb b/spec/helpers/heroku_ruby_installer_spec.rb
index 92d55abd0..d9ee8cc56 100644
--- a/spec/helpers/heroku_ruby_installer_spec.rb
+++ b/spec/helpers/heroku_ruby_installer_spec.rb
@@ -11,7 +11,7 @@ def installer(report: HerokuBuildReport::GLOBAL)
   end
 
   def ruby_version
-    LanguagePack::RubyVersion.new("ruby-3.1.7")
+    LanguagePack::RubyVersion.bundle_platform_ruby(bundler_output: "ruby-3.1.7")
   end
 
   describe "#fetch_unpack" do
@@ -58,7 +58,7 @@ def ruby_version
             arch: "arm64",
             report: report
           ).install(
-            LanguagePack::RubyVersion.new("ruby-3.1.4-p0-jruby-9.4.9.0"),
+            LanguagePack::RubyVersion.bundle_platform_ruby(bundler_output: "ruby-3.1.4-p0-jruby-9.4.9.0"),
             "#{dir}/vendor/ruby"
           )
 
diff --git a/spec/helpers/outdated_ruby_version_spec.rb b/spec/helpers/outdated_ruby_version_spec.rb
index 95b9abdf4..410ce9fa3 100644
--- a/spec/helpers/outdated_ruby_version_spec.rb
+++ b/spec/helpers/outdated_ruby_version_spec.rb
@@ -7,7 +7,7 @@
   }
 
   it "handles amd ↗️ architecture on heroku-24" do
-    ruby_version = LanguagePack::RubyVersion.new("ruby-3.1.0")
+    ruby_version = LanguagePack::RubyVersion.bundle_platform_ruby(bundler_output: "ruby-3.1.0")
     fetcher = LanguagePack::Fetcher.new(
       LanguagePack::Base::VENDOR_URL,
       stack: "heroku-24",
@@ -23,7 +23,7 @@
   end
 
   it "handles arm 💪 architecture on heroku-24" do
-    ruby_version = LanguagePack::RubyVersion.new("ruby-3.1.0")
+    ruby_version = LanguagePack::RubyVersion::bundle_platform_ruby(bundler_output: "ruby-3.1.0")
     fetcher = LanguagePack::Fetcher.new(
       LanguagePack::Base::VENDOR_URL,
       stack: "heroku-24",
@@ -39,7 +39,7 @@
   end
 
   it "finds the latest version on a stack" do
-    ruby_version = LanguagePack::RubyVersion.new("ruby-2.2.5")
+    ruby_version = LanguagePack::RubyVersion::bundle_platform_ruby(bundler_output: "ruby-2.2.5")
     outdated = LanguagePack::Helpers::OutdatedRubyVersion.new(
       current_ruby_version: ruby_version,
       fetcher: fetcher
@@ -52,7 +52,7 @@
   end
 
   it "detects returns original ruby version when using the latest" do
-    ruby_version = LanguagePack::RubyVersion.new("ruby-2.2.10")
+    ruby_version = LanguagePack::RubyVersion::bundle_platform_ruby(bundler_output: "ruby-2.2.10")
     outdated = LanguagePack::Helpers::OutdatedRubyVersion.new(
       current_ruby_version: ruby_version,
       fetcher: fetcher
@@ -64,8 +64,8 @@
   end
 
   it "recommends a non EOL version of Ruby" do
-    ruby_version_one = LanguagePack::RubyVersion.new("ruby-2.1.10")
-    ruby_version_two = LanguagePack::RubyVersion.new("ruby-2.2.10")
+    ruby_version_one = LanguagePack::RubyVersion::bundle_platform_ruby(bundler_output: "ruby-2.1.10")
+    ruby_version_two = LanguagePack::RubyVersion::bundle_platform_ruby(bundler_output: "ruby-2.2.10")
 
     outdated_one = LanguagePack::Helpers::OutdatedRubyVersion.new(
       current_ruby_version: ruby_version_one,
@@ -94,7 +94,7 @@
   end
 
   it "does not recommend EOL for recent ruby version" do
-    ruby_version = LanguagePack::RubyVersion.new("ruby-2.2.10")
+    ruby_version = LanguagePack::RubyVersion::bundle_platform_ruby(bundler_output: "ruby-2.2.10")
 
     outdated = LanguagePack::Helpers::OutdatedRubyVersion.new(
       current_ruby_version: ruby_version,
@@ -104,7 +104,7 @@
     outdated.call
 
     good_version = outdated.suggest_ruby_eol_version.sub("x", "0")
-    ruby_version = LanguagePack::RubyVersion.new("ruby-#{good_version}")
+    ruby_version = LanguagePack::RubyVersion::bundle_platform_ruby(bundler_output: "ruby-#{good_version}")
 
     outdated = LanguagePack::Helpers::OutdatedRubyVersion.new(
       current_ruby_version: ruby_version,
@@ -117,7 +117,7 @@
   end
 
   it "can call eol? on the latest Ruby version" do
-    ruby_version = LanguagePack::RubyVersion.new("ruby-2.6.0")
+    ruby_version = LanguagePack::RubyVersion::bundle_platform_ruby(bundler_output: "bundler_output: ruby-2.6.0")
 
     new_fetcher = fetcher.dup
     def new_fetcher.exists?(value); false; end
diff --git a/spec/helpers/ruby_version_spec.rb b/spec/helpers/ruby_version_spec.rb
index b4c0fc2d7..c55cab828 100644
--- a/spec/helpers/ruby_version_spec.rb
+++ b/spec/helpers/ruby_version_spec.rb
@@ -18,10 +18,10 @@
 
   it "knows the next logical version" do
     version_number = "2.5.0"
-    ruby_version   = LanguagePack::RubyVersion.new("ruby-#{version_number}-p0", is_new: true)
+    ruby_version   = LanguagePack::RubyVersion.bundle_platform_ruby(bundler_output: "ruby-#{version_number}-p0")
     version        = "ruby-#{version_number}"
 
-    expect(ruby_version.version_without_patchlevel).to eq(version)
+    expect(ruby_version.version_for_download).to eq(version)
     expect(ruby_version.next_logical_version).to eq("ruby-2.5.1")
     expect(ruby_version.next_logical_version).to eq("ruby-2.5.1")
     expect(ruby_version.next_logical_version(2)).to eq("ruby-2.5.2")
@@ -40,10 +40,10 @@
     Hatchet::App.new("default_ruby").in_directory_fork do |dir|
       require 'bundler'
       Bundler.with_unbundled_env do
-        ruby_version   = LanguagePack::RubyVersion.new(@bundler.install.ruby_version, is_new: true)
+        ruby_version   = LanguagePack::RubyVersion.bundle_platform_ruby(bundler_output: @bundler.install.ruby_version)
         version_number = LanguagePack::RubyVersion::DEFAULT_VERSION_NUMBER
         version        = LanguagePack::RubyVersion::DEFAULT_VERSION
-        expect(ruby_version.version_without_patchlevel).to eq(version)
+        expect(ruby_version.version_for_download).to eq(version)
         expect(ruby_version.engine_version).to eq(version_number)
         expect(ruby_version.to_gemfile).to eq("ruby '#{version_number}'")
         expect(ruby_version.engine).to eq(:ruby)
@@ -84,10 +84,89 @@
             2.4.19
         EOF
 
-        ruby_version   = LanguagePack::RubyVersion.new(@bundler.install.ruby_version, is_new: true)
+        ruby_version   = LanguagePack::RubyVersion.bundle_platform_ruby(bundler_output: @bundler.install.ruby_version)
         version_number = "3.2.3"
         version        = "ruby-#{version_number}"
-        expect(ruby_version.version_without_patchlevel).to eq(version)
+        expect(ruby_version.version_for_download).to eq(version)
+        expect(ruby_version.engine_version).to eq(version_number)
+        expect(ruby_version.engine).to eq(:ruby)
+      end
+    end
+  end
+
+  it "detects RC Ruby from Gemfile.lock" do
+    Hatchet::App.new("default_ruby").in_directory_fork do |_|
+      require 'bundler'
+      dir = Pathname(Dir.pwd)
+      Bundler.with_unbundled_env do
+        dir.join("Gemfile").write(<<~EOF)
+          source "https://rubygems.org"
+
+          gem 'rake'
+          ruby '3.2.3'
+        EOF
+        dir.join("Gemfile.lock").write(<<~EOF)
+          GEM
+            remote: https://rubygems.org/
+            specs:
+              rake (13.2.1)
+
+          PLATFORMS
+            arm64-darwin-22
+            ruby
+            x86_64-linux
+
+          DEPENDENCIES
+            rake
+
+          RUBY VERSION
+            ruby 3.2.3.rc1
+
+          BUNDLED WITH
+            2.4.19
+        EOF
+
+        ruby_version   = LanguagePack::RubyVersion.bundle_platform_ruby(bundler_output: @bundler.install.ruby_version)
+        version_number = "3.2.3"
+        version        = "ruby-#{version_number}.rc1"
+        expect(ruby_version.version_for_download).to eq(version)
+        expect(ruby_version.engine_version).to eq(version_number)
+        expect(ruby_version.engine).to eq(:ruby)
+      end
+    end
+  end
+
+  it "detects pre versions that do not end in numbers" do
+    Hatchet::App.new("default_ruby").in_directory_fork do |_|
+      require 'bundler'
+      dir = Pathname(Dir.pwd)
+      Bundler.with_unbundled_env do
+        dir.join("Gemfile").write(<<~EOF)
+          source "https://rubygems.org"
+          gem 'rake'
+          ruby '3.2.3'
+        EOF
+        dir.join("Gemfile.lock").write(<<~EOF)
+          GEM
+            remote: https://rubygems.org/
+            specs:
+              rake (13.2.1)
+          PLATFORMS
+            arm64-darwin-22
+            ruby
+            x86_64-linux
+          DEPENDENCIES
+            rake
+          RUBY VERSION
+            ruby 3.2.3.lol
+          BUNDLED WITH
+            2.4.19
+        EOF
+
+        ruby_version   = LanguagePack::RubyVersion.bundle_platform_ruby(bundler_output: @bundler.install.ruby_version)
+        version_number = "3.2.3"
+        version        = "ruby-#{version_number}.lol"
+        expect(ruby_version.version_for_download).to eq(version)
         expect(ruby_version.engine_version).to eq(version_number)
         expect(ruby_version.engine).to eq(:ruby)
       end
@@ -120,14 +199,13 @@
             2.3.25
         EOF
 
-        ruby_version   = LanguagePack::RubyVersion.new(
-          @bundler.install.ruby_version,
-          is_new: true
+        ruby_version   = LanguagePack::RubyVersion.bundle_platform_ruby(
+          bundler_output: @bundler.install.ruby_version,
         )
         version_number = "2.6.8"
         engine_version = "9.3.6.0"
         engine = :jruby
-        expect(ruby_version.version_without_patchlevel).to eq("ruby-#{version_number}-#{engine}-#{engine_version}")
+        expect(ruby_version.version_for_download).to eq("ruby-#{version_number}-#{engine}-#{engine_version}")
         expect(ruby_version.engine_version).to eq(engine_version)
         expect(ruby_version.engine).to eq(engine)
       end

From dc15301b9e648ff6addec383c4b1dafb66bc1f71 Mon Sep 17 00:00:00 2001
From: Richard Schneeman 
Date: Fri, 23 May 2025 08:29:37 -0500
Subject: [PATCH 1058/1195] Switch from Heroku CI to GHA (#1604)

* Remove unused env var

* Parallel split test

* Isolate environment modifying test

These tests mutate ENV which was fine when they ran sequentially, but when they're run with parallel split tests we get failures on CI (but not locally)

```
  1) Rails Runner failure in one task does not cause another to fail
     Failure/Error: expect(!!local_storage.success?).to eq(true)
       expected: true
            got: false
       (compared using ==)
       Diff:
       @@ -1 +1 @@
       -true
       +false
     # ./vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.3/lib/rspec/support.rb:110:in `block in '
     # ./vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.3/lib/rspec/support.rb:119:in `notify_failure'
     # ./vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.4/lib/rspec/expectations/fail_with.rb:35:in `fail_with'
     # ./vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.4/lib/rspec/expectations/handler.rb:37:in `handle_failure'
     # ./vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.4/lib/rspec/expectations/handler.rb:55:in `block in handle_matcher'
     # ./vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.4/lib/rspec/expectations/handler.rb:26:in `with_matcher'
     # ./vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.4/lib/rspec/expectations/handler.rb:47:in `handle_matcher'
     # ./vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.4/lib/rspec/expectations/expectation_target.rb:65:in `to'
     # ./vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.4/lib/rspec/expectations/expectation_target.rb:101:in `to'
     # ./spec/helpers/rails_runner_spec.rb:87:in `block (3 levels) in '
     # ./spec/helpers/rails_runner_spec.rb:10:in `block (2 levels) in wrap_test'
     # ./spec/helpers/rails_runner_spec.rb:9:in `chdir'
     # ./spec/helpers/rails_runner_spec.rb:9:in `block in wrap_test'
     # ./vendor/ruby-3.3.8/lib/ruby/3.3.0/tmpdir.rb:99:in `mktmpdir'
     # ./spec/helpers/rails_runner_spec.rb:8:in `wrap_test'
```

In theory the disk is already isolated, so I'm assuming the problem is with environment variable modification.

* Try tests in GHA

* Fix tests not running on GHA

* Use Rails LTS creds

* Remove unused file
---
 .github/workflows/ci.yml          | 25 ++++++++++++++++++++++
 Gemfile                           |  2 +-
 Gemfile.lock                      |  9 ++++----
 README.md                         |  6 ------
 app.json                          | 35 -------------------------------
 spec/helpers/rails_runner_spec.rb | 21 ++++++++-----------
 spec/spec_helper.rb               |  3 ---
 7 files changed, 40 insertions(+), 61 deletions(-)
 delete mode 100644 app.json

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 3e819163b..68ae223bd 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -20,3 +20,28 @@ jobs:
         run: |
             shellcheck bin/support/bash_functions.sh bin/support/download_ruby -x &&
             shellcheck bin/compile bin/detect bin/release bin/test bin/test-compile -x
+
+  integration-test:
+      runs-on: ubuntu-24.04
+      env:
+        HATCHET_APP_LIMIT: 300
+        HATCHET_EXPENSIVE_MODE: 1
+        HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
+        HEROKU_API_USER: ${{ secrets.HEROKU_API_USER }}
+        RAILS_LTS_CREDS: ${{ secrets.RAILS_LTS_CREDS }}
+        HEROKU_DISABLE_AUTOUPDATE: 1
+        PARALLEL_SPLIT_TEST_PROCESSES: 85
+        RSPEC_RETRY_RETRY_COUNT: 1
+      steps:
+        - name: Checkout
+          uses: actions/checkout@v4
+        - name: Install Ruby and dependencies
+          uses: ruby/setup-ruby@v1
+          with:
+            bundler-cache: true
+            ruby-version: "3.3.8"
+        - name: Hatchet setup
+          run: bundle exec hatchet ci:setup
+        - name: Run Hatchet integration tests
+          # parallel_split_test runs rspec in parallel, with concurrency equal to PARALLEL_SPLIT_TEST_PROCESSES.
+          run: bundle exec parallel_split_test spec/
diff --git a/Gemfile b/Gemfile
index 879ad8198..028a376bd 100644
--- a/Gemfile
+++ b/Gemfile
@@ -10,7 +10,7 @@ group :development, :test do
   gem "rspec-expectations"
   gem "excon"
   gem "rake"
-  gem "parallel_tests"
+  gem "parallel_split_test"
   gem 'rspec-retry'
   gem 'json'
   gem 'ci-queue'
diff --git a/Gemfile.lock b/Gemfile.lock
index 9a0379c1e..d1a562830 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -27,9 +27,10 @@ GEM
     logger (1.7.0)
     moneta (1.0.0)
     multi_json (1.15.0)
-    parallel (1.25.1)
-    parallel_tests (4.7.1)
-      parallel
+    parallel (1.27.0)
+    parallel_split_test (0.10.0)
+      parallel (>= 0.5.13)
+      rspec-core (>= 3.9.0)
     platform-api (3.8.0)
       heroics (~> 0.1.1)
       moneta (~> 1.0.0)
@@ -66,7 +67,7 @@ DEPENDENCIES
   excon
   heroku_hatchet
   json
-  parallel_tests
+  parallel_split_test
   rake
   redis
   rspec-core
diff --git a/README.md b/README.md
index e300de875..b9a8860ac 100644
--- a/README.md
+++ b/README.md
@@ -50,12 +50,6 @@ To use this buildpack, fork it on Github.  Push up changes to your fork, then cr
 
 ### Testing
 
-The tests on this buildpack are written in Rspec to allow the use of
-`focused: true`. Parallelization of testing is provided by
-https://github.com/grosser/parallel_tests this lib spins up an arbitrary
-number of processes and running a different test file in each process,
-it does not parallelize tests within a test file. To run the tests: clone the repo, then `bundle install` then clone the test fixtures by running:
-
 ```sh
 $ bundle exec hatchet install
 ```
diff --git a/app.json b/app.json
deleted file mode 100644
index 514ddad23..000000000
--- a/app.json
+++ /dev/null
@@ -1,35 +0,0 @@
-{
-  "name": "Heroku Buildpack Ruby",
-  "description": "The buildpack for Ruby",
-  "environments": {
-    "test": {
-      "addons": [
-        "heroku-redis:mini"
-      ],
-      "env": {
-        "HATCHET_RETRIES": "3",
-        "IS_RUNNING_ON_CI": "true",
-        "HATCHET_APP_LIMIT": "100",
-        "BUILDPACK_LOG_FILE": "tmp/buildpack.log"
-      },
-      "formation": {
-        "test": {
-          "size": "performance-l",
-          "quantity": 16
-        }
-      },
-      "scripts": {
-        "test-setup": "bundle exec rake hatchet:setup_ci",
-        "test": "bundle exec rspec-queue --max-requeues=3 --timeout 180 --queue $REDIS_URL --format documentation || { cat log/test_order.log;  $(exit 1); }"
-      },
-      "buildpacks": [
-        {
-          "url": "https://github.com/heroku/heroku-buildpack-cli.git"
-        },
-        {
-          "url": "https://github.com/heroku/heroku-buildpack-ruby"
-        }
-      ]
-    }
-  }
-}
diff --git a/spec/helpers/rails_runner_spec.rb b/spec/helpers/rails_runner_spec.rb
index 368c619f0..d3088cb4e 100644
--- a/spec/helpers/rails_runner_spec.rb
+++ b/spec/helpers/rails_runner_spec.rb
@@ -2,16 +2,17 @@
 
 describe "Rails Runner" do
   around(:each) do |test|
-    original_path = ENV["PATH"]
-    ENV["PATH"] = "./bin/:#{ENV['PATH']}"
-
-    Dir.mktmpdir do |tmpdir|
-      Dir.chdir(tmpdir) do
-        test.run
+    # Process and disk isolation
+    Hatchet::App.new("default_ruby").in_directory_fork do
+      original_path = ENV["PATH"]
+      ENV["PATH"] = "./bin/:#{ENV['PATH']}"
+
+      Dir.mktmpdir do |tmpdir|
+        Dir.chdir(tmpdir) do
+          test.run
+        end
       end
     end
-  ensure
-    ENV["PATH"] = original_path if original_path
   end
 
   it "config objects build propperly formatted commands" do
@@ -132,9 +133,5 @@ def to_s
     FileUtils.mkdir("bin")
     File.open("bin/rails", "w") { |f| f << executable_contents }
     File.chmod(0777, "bin/rails")
-
-    # BUILDPACK_LOG_FILE support for logging
-    FileUtils.mkdir("tmp")
-    FileUtils.touch("buildpack.log")
   end
 end
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 82b0b8e92..9a02689e5 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -19,12 +19,9 @@ def hatchet_path(path = "")
 end
 
 RSpec.configure do |config|
-  config.filter_run focused: true unless ENV['IS_RUNNING_ON_CI']
-  config.run_all_when_everything_filtered = true
   config.alias_example_to :fit, focused: true
   config.full_backtrace      = true
   config.verbose_retry       = true # show retry status in spec process
-  config.default_retry_count = 2 if ENV['IS_RUNNING_ON_CI'] # retry all tests that fail again
   config.example_status_persistence_file_path = 'spec/examples.txt'
 
   config.expect_with :rspec do |c|

From 7e58e63d8ff3fc10bbc1513ea4d45c7324f9224d Mon Sep 17 00:00:00 2001
From: Richard Schneeman 
Date: Tue, 27 May 2025 08:53:29 -0500
Subject: [PATCH 1059/1195] Capture Ruby Version information directly from the
 Gemfile.lock (#1603)

* Introduce GemfileLock class

This class parses a Gemfile.lock for the purposes of extracting information about the Ruby version and Bundler version. Tests cases are pulled from `ruby_version_spec.rb` and from the Ruby CNB https://github.com/heroku/buildpacks-ruby/blob/e249a8bcbc75f7e5322f02bb4e32aaed50724355/commons/src/gemfile_lock.rs.

* Fix spec indentation

I didn't notice before, but vscode silently removed the extra space when I indented this code. There should be three spaces before the version i.e. `   2.3.25`. Apparently `bundle platform --ruby` is not as strict and will accept two spaces. I'm unsure if there are customers relying on this behavior, running both approaches and recording metrics will answer that question.

* Introduce GemfileLock entry point for RubyVersion

The current code uses the output of `bundle platform --ruby` to produce a RubyVersion via `RubyVersion.bundle_platform_ruby` this adds `RubyVersion.from_gemfile_lock` that allows us to build the same value class from the raw `Gemfile.lock` file on disk (don't have to execute any Ruby code).

This behavior is validated by running both modes in the `ruby_version_spec.rb` tests.

* Move Gemfile.lock presence check and return class

This move allows us to inject the information into language packs (not yet wired up).

* Inject GemfileLock into language packs

* Rename variable

Manipulating classes as variables is common, but they're usually annotated to indicate they're a class.

* Build RubyVersion from GemfileLock information

* Capture RubyVersion differences

* Changelog

* Remove dead-end update ci-queue

The dead_end gem is renamed into syntax_suggest and now comes with Ruby 3.2 (I maintain it!).
---
 .rspec                                    |   1 -
 CHANGELOG.md                              |   1 +
 Gemfile                                   |   1 -
 Gemfile.lock                              |   4 +-
 bin/support/ruby_compile                  |   7 +-
 bin/support/ruby_test-compile             |   7 +-
 lib/language_pack.rb                      |  26 +++-
 lib/language_pack/base.rb                 |   2 +-
 lib/language_pack/helpers/gemfile_lock.rb |  99 ++++++++++++
 lib/language_pack/rails2.rb               |   4 +-
 lib/language_pack/ruby.rb                 |  28 +++-
 lib/language_pack/ruby_version.rb         |  14 ++
 spec/helpers/gemfile_lock_spec.rb         | 179 ++++++++++++++++++++++
 spec/helpers/ruby_version_spec.rb         |  73 ++++++++-
 14 files changed, 421 insertions(+), 25 deletions(-)
 create mode 100644 lib/language_pack/helpers/gemfile_lock.rb
 create mode 100644 spec/helpers/gemfile_lock_spec.rb

diff --git a/.rspec b/.rspec
index 7aac1efb0..e69de29bb 100644
--- a/.rspec
+++ b/.rspec
@@ -1 +0,0 @@
---require dead_end
diff --git a/CHANGELOG.md b/CHANGELOG.md
index df7e0222d..a18e07df4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,7 @@
 
 ## [Unreleased]
 
+- Introduce internal metrics for deriving Ruby version directly from the `Gemfile.lock` to avoid needing to call `bundle platform --ruby` in the future. No change in behavior is expected. (https://github.com/heroku/heroku-buildpack-ruby/pull/1603)
 
 ## [v309] - 2025-05-19
 
diff --git a/Gemfile b/Gemfile
index 028a376bd..d9c60910e 100644
--- a/Gemfile
+++ b/Gemfile
@@ -15,5 +15,4 @@ group :development, :test do
   gem 'json'
   gem 'ci-queue'
   gem 'redis'
-  gem 'dead_end'
 end
diff --git a/Gemfile.lock b/Gemfile.lock
index d1a562830..dff58422e 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -2,11 +2,10 @@ GEM
   remote: https://rubygems.org/
   specs:
     base64 (0.2.0)
-    ci-queue (0.65.0)
+    ci-queue (0.67.0)
       logger
     citrus (3.0.2)
     connection_pool (2.5.3)
-    dead_end (4.0.0)
     diff-lcs (1.6.1)
     erubis (2.7.0)
     excon (0.110.0)
@@ -63,7 +62,6 @@ PLATFORMS
 
 DEPENDENCIES
   ci-queue
-  dead_end
   excon
   heroku_hatchet
   json
diff --git a/bin/support/ruby_compile b/bin/support/ruby_compile
index 1e68f01e3..e87eb642c 100755
--- a/bin/support/ruby_compile
+++ b/bin/support/ruby_compile
@@ -21,10 +21,15 @@ HerokuBuildReport.set_global(
 begin
   app_path = Pathname(ARGV[0])
   cache_path = Pathname(ARGV[1])
+  gemfile_lock = LanguagePack.gemfile_lock(app_path: app_path)
   Dir.chdir(app_path)
 
   LanguagePack::ShellHelpers.initialize_env(ARGV[2])
-  if pack = LanguagePack.detect(app_path: app_path, cache_path: cache_path)
+  if pack = LanguagePack.detect(
+    app_path: app_path,
+    cache_path: cache_path,
+    gemfile_lock: gemfile_lock
+  )
     pack.topic("Compiling #{pack.name}")
     pack.compile
   end
diff --git a/bin/support/ruby_test-compile b/bin/support/ruby_test-compile
index 58815c420..bd066f64a 100755
--- a/bin/support/ruby_test-compile
+++ b/bin/support/ruby_test-compile
@@ -21,9 +21,14 @@ include LanguagePack::ShellHelpers
 begin
   app_path = Pathname(ARGV[0])
   cache_path = Pathname(ARGV[1])
+  gemfile_lock = LanguagePack.gemfile_lock(app_path: app_path)
   Dir.chdir(app_path)
 
-  if pack = LanguagePack.detect(app_path: app_path, cache_path: cache_path)
+  if pack = LanguagePack.detect(
+      app_path: app_path,
+      cache_path: cache_path,
+      gemfile_lock: gemfile_lock
+    )
     LanguagePack::ShellHelpers.initialize_env(ARGV[2])
     pack.topic("Setting up Test for #{pack.name}")
     pack.compile
diff --git a/lib/language_pack.rb b/lib/language_pack.rb
index 3ce48dc1d..a034c8ea4 100644
--- a/lib/language_pack.rb
+++ b/lib/language_pack.rb
@@ -2,23 +2,39 @@
 require 'benchmark'
 
 require 'language_pack/shell_helpers'
+require "language_pack/helpers/gemfile_lock"
 
 # General Language Pack module
 module LanguagePack
   module Helpers
   end
 
-  # detects which language pack to use
-  def self.detect(app_path:, cache_path:)
-    if !File.exist?("Gemfile.lock")
+  def self.gemfile_lock(app_path: )
+    path = app_path.join("Gemfile.lock")
+    if path.exist?
+      LanguagePack::Helpers::GemfileLock.new(
+        contents: path.read
+      )
+    else
       raise BuildpackError.new("Gemfile.lock required. Please check it in.")
     end
+  end
 
-    pack = [ Rails8, Rails7, Rails6, Rails5, Rails42, Rails41, Rails4, Rails3, Rails2, Rack, Ruby ].detect do |klass|
+  # detects which language pack to use
+  def self.detect(app_path:, cache_path:, gemfile_lock: )
+    pack_klass = [ Rails8, Rails7, Rails6, Rails5, Rails42, Rails41, Rails4, Rails3, Rails2, Rack, Ruby ].detect do |klass|
       klass.use?
     end
 
-    return pack ? pack.new(app_path: app_path, cache_path: cache_path) : nil
+    if pack_klass
+      pack_klass.new(
+        app_path: app_path,
+        cache_path: cache_path,
+        gemfile_lock: gemfile_lock
+      )
+    else
+      nil
+    end
   end
 end
 
diff --git a/lib/language_pack/base.rb b/lib/language_pack/base.rb
index 54b1b1bdb..eca9c681c 100644
--- a/lib/language_pack/base.rb
+++ b/lib/language_pack/base.rb
@@ -22,7 +22,7 @@ class LanguagePack::Base
 
   attr_reader :app_path, :cache, :stack
 
-  def initialize(app_path: , cache_path: )
+  def initialize(app_path: , cache_path: , gemfile_lock: )
     @app_path = app_path
     @stack         = ENV.fetch("STACK")
     @cache         = LanguagePack::Cache.new(cache_path)
diff --git a/lib/language_pack/helpers/gemfile_lock.rb b/lib/language_pack/helpers/gemfile_lock.rb
new file mode 100644
index 000000000..fd18b5294
--- /dev/null
+++ b/lib/language_pack/helpers/gemfile_lock.rb
@@ -0,0 +1,99 @@
+module LanguagePack
+  module Helpers
+    # Centralize logic for extracting information from the `Gemfile.lock` format
+    #
+    # - Extracts Ruby version from `RUBY VERSION`
+    # - Extracts Bundler version from `BUNDLED WITH`
+    #
+    # Example:
+    #
+    #   gemfile_lock = GemfileLock.new(contents: <<~EOF)
+    #     RUBY VERSION
+    #        ruby 3.3.5p100
+    #     BUNDLED WITH
+    #        2.3.4
+    #   EOF
+    #
+    #   expect(gemfile_lock.bundler.version).to eq("2.3.4")
+    #   expect(gemfile_lock.ruby.ruby_version).to eq("3.3.5")
+    class GemfileLock
+      attr_reader :ruby, :bundler
+
+      def initialize(contents: , report: HerokuBuildReport::GLOBAL)
+        @ruby = RubyVersionParse.new(contents: contents, report: report)
+        @bundler = BundlerVersionParse.new(contents: contents, report: report)
+      end
+
+      # Holds information about the RUBY VERSION of the parsed Gemfile.lock
+      class RubyVersionParse
+        # Ruby version from Gemfile.lock i.e. `3.3.8`
+        # Either 3 numbers or nil
+        attr_reader :ruby_version,
+          # Contains pre-release info
+          # - String: i.e. "rc2" is a prerelease
+          # - nil: No pre-release (or no version at all)
+          :pre,
+          # Either :ruby or :jruby
+          :engine,
+          # `engine_version` is the JRuby version or for Ruby, it is the same as `ruby_version`
+          # i.e. `..`
+          :engine_version
+
+        def initialize(contents: , report: HerokuBuildReport::GLOBAL)
+          if match = contents.match(/^RUBY VERSION(\r?\n)   ruby (?\d+\.\d+\.\d+)((\-|\.)(?
\S*))?/m)
+            @pre = match[:pre]
+            @empty = false
+            @ruby_version = match[:version]
+          else
+            if contents.match?(/RUBY VERSION/)
+              report.capture("gemfile_lock.ruby_version.failed_parse" => true)
+              if match = contents.match(/(?RUBY VERSION(\r?\n).*)$/)
+                report.capture("gemfile_lock.ruby_version.failed_contents" => match[:contents])
+              end
+            end
+            @pre = nil
+            @empty = true
+            @ruby_version = nil
+          end
+
+          if jruby = contents.to_s.match(/^RUBY VERSION(\r?\n)   ruby [^\(]*\(jruby (?(\d+|\.)+)\)/m)
+            @engine = :jruby
+            @engine_version = jruby[:version]
+          else
+            @engine = :ruby
+            @engine_version = ruby_version
+          end
+        end
+
+        def empty?
+          @empty
+        end
+      end
+
+      class BundlerVersionParse
+        # Bundler value from `Gemfile.lock` (String or nil) i.e. `2.5.23`
+        attr_reader :version
+
+        def initialize(contents: , report: HerokuBuildReport::GLOBAL)
+          if match = contents.match(/^BUNDLED WITH(\r?\n)   (?(?\d+)\.(?\d+)\.\d+)/m)
+            @empty = false
+            @version = match[:version]
+          else
+            if contents.match?(/BUNDLED WITH/)
+              report.capture("gemfile_lock.bundler_version.failed_parse" => true)
+              if match = contents.match(/(?BUNDLED WITH(\r?\n).*)$/)
+                report.capture("gemfile_lock.bundler_version.failed_contents" => match[:contents])
+              end
+            end
+            @empty = true
+            @version = nil
+          end
+        end
+
+        def empty?
+          @empty
+        end
+      end
+    end
+  end
+end
diff --git a/lib/language_pack/rails2.rb b/lib/language_pack/rails2.rb
index 410a060a2..c61ab4e88 100644
--- a/lib/language_pack/rails2.rb
+++ b/lib/language_pack/rails2.rb
@@ -14,8 +14,8 @@ def self.use?
     return is_rails2
   end
 
-  def initialize(app_path: , cache_path: )
-    super(app_path: app_path, cache_path: cache_path)
+  def initialize(app_path: , cache_path: , gemfile_lock:)
+    super(app_path: app_path, cache_path: cache_path, gemfile_lock: gemfile_lock)
     @rails_runner = LanguagePack::Helpers::RailsRunner.new
   end
 
diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb
index c8541bc69..4f7debdbc 100644
--- a/lib/language_pack/ruby.rb
+++ b/lib/language_pack/ruby.rb
@@ -30,8 +30,9 @@ def bundler
     self.class.bundler
   end
 
-  def initialize(app_path: , cache_path: )
-    super(app_path: app_path, cache_path: cache_path)
+  def initialize(app_path: , cache_path: , gemfile_lock:)
+    super(app_path: app_path, cache_path: cache_path, gemfile_lock: gemfile_lock)
+    @gemfile_lock = gemfile_lock
     @node_installer = LanguagePack::Helpers::NodeInstaller.new(arch: @arch)
     @yarn_installer = LanguagePack::Helpers::YarnInstaller.new
   end
@@ -186,6 +187,29 @@ def ruby_version
       bundler_output: bundler.ruby_version,
       last_version: last_version
     )
+
+    # New logic, running in parallel to old logic for reporting differences
+    lockfile_ruby_version = LanguagePack::RubyVersion.from_gemfile_lock(
+      ruby: @gemfile_lock.ruby,
+      last_version: last_version
+    )
+    @report.capture(
+      "gemfile_lock.ruby_version.version" => lockfile_ruby_version.ruby_version,
+      "gemfile_lock.ruby_version.engine" => lockfile_ruby_version.engine,
+      "gemfile_lock.ruby_version.engine.version" => lockfile_ruby_version.engine_version,
+      "gemfile_lock.ruby_version.major" => lockfile_ruby_version.major,
+      "gemfile_lock.ruby_version.minor" => lockfile_ruby_version.minor,
+      "gemfile_lock.ruby_version.patch" => lockfile_ruby_version.patch,
+      "gemfile_lock.ruby_version.default" => lockfile_ruby_version.default?,
+    )
+
+    if lockfile_ruby_version.version_for_download != @ruby_version.version_for_download
+      @report.capture(
+        "gemfile_lock.ruby_version.got" => lockfile_ruby_version.version_for_download,
+        "gemfile_lock.ruby_version.expected" => @ruby_version.version_for_download,
+        "gemfile_lock.ruby_version.different_version" => true,
+      )
+    end
     return @ruby_version
   end
 
diff --git a/lib/language_pack/ruby_version.rb b/lib/language_pack/ruby_version.rb
index 32ae6bd29..ff74ad1d8 100644
--- a/lib/language_pack/ruby_version.rb
+++ b/lib/language_pack/ruby_version.rb
@@ -49,6 +49,20 @@ def self.bundle_platform_ruby(bundler_output:, last_version: nil)
       end
     end
 
+    def self.from_gemfile_lock(ruby: , last_version: nil)
+      if ruby.empty?
+        default(last_version: last_version)
+      else
+        new(
+          pre: ruby.pre,
+          engine: ruby.engine,
+          default: false,
+          ruby_version: ruby.ruby_version,
+          engine_version: ruby.engine_version,
+        )
+      end
+    end
+
     def self.default(last_version: )
       ruby_version = last_version&.split("-")&.last || DEFAULT_VERSION_NUMBER
       new(
diff --git a/spec/helpers/gemfile_lock_spec.rb b/spec/helpers/gemfile_lock_spec.rb
new file mode 100644
index 000000000..1719b6930
--- /dev/null
+++ b/spec/helpers/gemfile_lock_spec.rb
@@ -0,0 +1,179 @@
+require "spec_helper"
+
+describe LanguagePack::Helpers::GemfileLock do
+  it "parses empty gemfile without error" do
+    report = HerokuBuildReport.dev_null
+    gemfile_lock = LanguagePack::Helpers::GemfileLock.new(
+      report: report,
+      contents: ""
+    )
+    expect(gemfile_lock.ruby.ruby_version).to eq(nil)
+    expect(gemfile_lock.ruby.pre).to eq(nil)
+    expect(gemfile_lock.ruby.engine).to eq(:ruby)
+    expect(gemfile_lock.ruby.empty?).to eq(true)
+    expect(gemfile_lock.ruby.engine_version).to eq(nil)
+
+    expect(gemfile_lock.bundler.version).to eq(nil)
+    expect(gemfile_lock.bundler.empty?).to eq(true)
+    expect(report.data).to be_empty
+  end
+
+  it "records invalid parsing" do
+    report = HerokuBuildReport.dev_null
+    gemfile_lock = LanguagePack::Helpers::GemfileLock.new(
+      report: report,
+      contents: <<~EOF
+        RUBY VERSION
+        ruby 3.3.5p100
+        BUNDLED WITH
+        2.3.4
+      EOF
+    )
+    expect(
+      report.data["gemfile_lock.bundler_version.failed_parse"]
+    ).to eq(true)
+    expect(
+      report.data["gemfile_lock.bundler_version.failed_contents"]
+    ).to eq(<<~EOF.strip)
+      BUNDLED WITH
+      2.3.4
+    EOF
+
+    expect(
+      report.data["gemfile_lock.ruby_version.failed_parse"]
+    ).to eq(true)
+    expect(
+      report.data["gemfile_lock.ruby_version.failed_contents"]
+    ).to eq(<<~EOF.strip)
+      RUBY VERSION
+      ruby 3.3.5p100
+    EOF
+  end
+
+  it "captures MRI version and ignores patchlevel" do
+    gemfile_lock = LanguagePack::Helpers::GemfileLock.new(
+      contents: <<~EOF
+        RUBY VERSION
+           ruby 3.3.5p100
+        BUNDLED WITH
+           2.3.4
+      EOF
+    )
+    expect(gemfile_lock.ruby.ruby_version).to eq("3.3.5")
+    expect(gemfile_lock.ruby.pre).to eq(nil)
+    expect(gemfile_lock.ruby.engine).to eq(:ruby)
+    expect(gemfile_lock.ruby.empty?).to eq(false)
+    expect(gemfile_lock.ruby.engine_version).to eq("3.3.5")
+
+    expect(gemfile_lock.bundler.version).to eq("2.3.4")
+    expect(gemfile_lock.bundler.empty?).to eq(false)
+  end
+
+  it "works with windows line endings" do
+    gemfile_lock = LanguagePack::Helpers::GemfileLock.new(
+      contents: <<~EOF.gsub("\n", "\r\n")
+        RUBY VERSION
+           ruby 3.3.5p100
+        BUNDLED WITH
+           2.3.4
+      EOF
+    )
+    expect(gemfile_lock.ruby.ruby_version).to eq("3.3.5")
+    expect(gemfile_lock.ruby.pre).to eq(nil)
+    expect(gemfile_lock.ruby.engine).to eq(:ruby)
+    expect(gemfile_lock.ruby.empty?).to eq(false)
+    expect(gemfile_lock.ruby.engine_version).to eq("3.3.5")
+
+    expect(gemfile_lock.bundler.version).to eq("2.3.4")
+    expect(gemfile_lock.bundler.empty?).to eq(false)
+  end
+
+  it "captures jruby version" do
+    gemfile_lock = LanguagePack::Helpers::GemfileLock.new(
+      contents: <<~EOF
+        GEM
+          remote: https://rubygems.org/
+          specs:
+        PLATFORMS
+          java
+        RUBY VERSION
+           ruby 2.5.7p001 (jruby 9.2.13.0)
+      EOF
+    )
+    expect(gemfile_lock.ruby.ruby_version).to eq("2.5.7")
+    expect(gemfile_lock.ruby.pre).to eq(nil)
+    expect(gemfile_lock.ruby.engine).to eq(:jruby)
+    expect(gemfile_lock.ruby.empty?).to eq(false)
+    expect(gemfile_lock.ruby.engine_version).to eq("9.2.13.0")
+  end
+
+  it "is resiliant to gemfile.lock format changes" do
+    gemfile_lock = LanguagePack::Helpers::GemfileLock.new(
+      contents: <<~EOF
+        GEM
+          remote: https://rubygems.org/
+          specs:
+        # Pretend format change
+        METADATA
+          (jruby 9)
+        PLATFORMS
+          java
+        RUBY VERSION
+           ruby 2.5.7p001 (jruby 9.2.13.0)
+      EOF
+    )
+    expect(gemfile_lock.ruby.ruby_version).to eq("2.5.7")
+    expect(gemfile_lock.ruby.pre).to eq(nil)
+    expect(gemfile_lock.ruby.engine).to eq(:jruby)
+    expect(gemfile_lock.ruby.empty?).to eq(false)
+    expect(gemfile_lock.ruby.engine_version).to eq("9.2.13.0")
+  end
+
+  it "handles RC dot syntax" do
+    gemfile_lock = LanguagePack::Helpers::GemfileLock.new(
+      contents: <<~EOF
+        RUBY VERSION
+           ruby 3.4.0.rc1
+        BUNDLED WITH
+           2.3.4
+      EOF
+    )
+    expect(gemfile_lock.ruby.ruby_version).to eq("3.4.0")
+    expect(gemfile_lock.ruby.pre).to eq("rc1")
+    expect(gemfile_lock.ruby.engine).to eq(:ruby)
+    expect(gemfile_lock.ruby.empty?).to eq(false)
+    expect(gemfile_lock.ruby.engine_version).to eq("3.4.0")
+  end
+
+  it "handles pre without a number" do
+    gemfile_lock = LanguagePack::Helpers::GemfileLock.new(
+      contents: <<~EOF
+        RUBY VERSION
+           ruby 3.4.0.lol
+        BUNDLED WITH
+           2.3.4
+      EOF
+    )
+    expect(gemfile_lock.ruby.ruby_version).to eq("3.4.0")
+    expect(gemfile_lock.ruby.pre).to eq("lol")
+    expect(gemfile_lock.ruby.engine).to eq(:ruby)
+    expect(gemfile_lock.ruby.empty?).to eq(false)
+    expect(gemfile_lock.ruby.engine_version).to eq("3.4.0")
+  end
+
+  it "handles preview dot syntax" do
+    gemfile_lock = LanguagePack::Helpers::GemfileLock.new(
+      contents: <<~EOF
+        RUBY VERSION
+           ruby 3.4.0.preview2
+        BUNDLED WITH
+           2.3.4
+      EOF
+    )
+    expect(gemfile_lock.ruby.ruby_version).to eq("3.4.0")
+    expect(gemfile_lock.ruby.pre).to eq("preview2")
+    expect(gemfile_lock.ruby.engine).to eq(:ruby)
+    expect(gemfile_lock.ruby.empty?).to eq(false)
+    expect(gemfile_lock.ruby.engine_version).to eq("3.4.0")
+  end
+end
diff --git a/spec/helpers/ruby_version_spec.rb b/spec/helpers/ruby_version_spec.rb
index c55cab828..53a1f72bb 100644
--- a/spec/helpers/ruby_version_spec.rb
+++ b/spec/helpers/ruby_version_spec.rb
@@ -39,6 +39,7 @@
   it "correctly sets default ruby versions" do
     Hatchet::App.new("default_ruby").in_directory_fork do |dir|
       require 'bundler'
+      dir = Pathname(Dir.pwd)
       Bundler.with_unbundled_env do
         ruby_version   = LanguagePack::RubyVersion.bundle_platform_ruby(bundler_output: @bundler.install.ruby_version)
         version_number = LanguagePack::RubyVersion::DEFAULT_VERSION_NUMBER
@@ -48,6 +49,18 @@
         expect(ruby_version.to_gemfile).to eq("ruby '#{version_number}'")
         expect(ruby_version.engine).to eq(:ruby)
         expect(ruby_version.default?).to eq(true)
+
+        # Shadow logic validation
+        ruby_version = LanguagePack::RubyVersion.from_gemfile_lock(
+          ruby: LanguagePack::Helpers::GemfileLock.new(
+            contents: dir.join("Gemfile.lock").read
+          ).ruby
+        )
+        expect(ruby_version.version_for_download).to eq(version)
+        expect(ruby_version.engine_version).to eq(version_number)
+        expect(ruby_version.to_gemfile).to eq("ruby '#{version_number}'")
+        expect(ruby_version.engine).to eq(:ruby)
+        expect(ruby_version.default?).to eq(true)
       end
     end
   end
@@ -78,10 +91,10 @@
             rake
 
           RUBY VERSION
-            ruby 3.2.3p157
+             ruby 3.2.3p157
 
           BUNDLED WITH
-            2.4.19
+             2.4.19
         EOF
 
         ruby_version   = LanguagePack::RubyVersion.bundle_platform_ruby(bundler_output: @bundler.install.ruby_version)
@@ -90,6 +103,16 @@
         expect(ruby_version.version_for_download).to eq(version)
         expect(ruby_version.engine_version).to eq(version_number)
         expect(ruby_version.engine).to eq(:ruby)
+
+        # Shadow logic validation
+        ruby_version = LanguagePack::RubyVersion.from_gemfile_lock(
+          ruby: LanguagePack::Helpers::GemfileLock.new(
+            contents: dir.join("Gemfile.lock").read
+          ).ruby
+        )
+        expect(ruby_version.version_for_download).to eq(version)
+        expect(ruby_version.engine_version).to eq(version_number)
+        expect(ruby_version.engine).to eq(:ruby)
       end
     end
   end
@@ -120,10 +143,10 @@
             rake
 
           RUBY VERSION
-            ruby 3.2.3.rc1
+             ruby 3.2.3.rc1
 
           BUNDLED WITH
-            2.4.19
+             2.4.19
         EOF
 
         ruby_version   = LanguagePack::RubyVersion.bundle_platform_ruby(bundler_output: @bundler.install.ruby_version)
@@ -132,6 +155,16 @@
         expect(ruby_version.version_for_download).to eq(version)
         expect(ruby_version.engine_version).to eq(version_number)
         expect(ruby_version.engine).to eq(:ruby)
+
+        # Shadow logic validation
+        ruby_version = LanguagePack::RubyVersion.from_gemfile_lock(
+          ruby: LanguagePack::Helpers::GemfileLock.new(
+            contents: dir.join("Gemfile.lock").read
+          ).ruby
+        )
+        expect(ruby_version.version_for_download).to eq(version)
+        expect(ruby_version.engine_version).to eq(version_number)
+        expect(ruby_version.engine).to eq(:ruby)
       end
     end
   end
@@ -151,16 +184,20 @@
             remote: https://rubygems.org/
             specs:
               rake (13.2.1)
+
           PLATFORMS
             arm64-darwin-22
             ruby
             x86_64-linux
+
           DEPENDENCIES
             rake
+
           RUBY VERSION
-            ruby 3.2.3.lol
+             ruby 3.2.3.lol
+
           BUNDLED WITH
-            2.4.19
+             2.4.19
         EOF
 
         ruby_version   = LanguagePack::RubyVersion.bundle_platform_ruby(bundler_output: @bundler.install.ruby_version)
@@ -169,6 +206,16 @@
         expect(ruby_version.version_for_download).to eq(version)
         expect(ruby_version.engine_version).to eq(version_number)
         expect(ruby_version.engine).to eq(:ruby)
+
+        # Shadow logic validation
+        ruby_version = LanguagePack::RubyVersion.from_gemfile_lock(
+          ruby: LanguagePack::Helpers::GemfileLock.new(
+            contents: dir.join("Gemfile.lock").read
+          ).ruby
+        )
+        expect(ruby_version.version_for_download).to eq(version)
+        expect(ruby_version.engine_version).to eq(version_number)
+        expect(ruby_version.engine).to eq(:ruby)
       end
     end
   end
@@ -193,10 +240,10 @@
           DEPENDENCIES
 
           RUBY VERSION
-            ruby 2.6.8p001 (jruby 9.3.6.0)
+             ruby 2.6.8p001 (jruby 9.3.6.0)
 
           BUNDLED WITH
-            2.3.25
+             2.3.25
         EOF
 
         ruby_version   = LanguagePack::RubyVersion.bundle_platform_ruby(
@@ -208,6 +255,16 @@
         expect(ruby_version.version_for_download).to eq("ruby-#{version_number}-#{engine}-#{engine_version}")
         expect(ruby_version.engine_version).to eq(engine_version)
         expect(ruby_version.engine).to eq(engine)
+
+        # Shadow logic validation
+        ruby_version = LanguagePack::RubyVersion.from_gemfile_lock(
+          ruby: LanguagePack::Helpers::GemfileLock.new(
+            contents: dir.join("Gemfile.lock").read
+          ).ruby
+        )
+        expect(ruby_version.version_for_download).to eq("ruby-#{version_number}-#{engine}-#{engine_version}")
+        expect(ruby_version.engine_version).to eq(engine_version)
+        expect(ruby_version.engine).to eq(engine)
       end
     end
   end

From 5b5dea4652c8e955cadd5036ebadb82848901286 Mon Sep 17 00:00:00 2001
From: "heroku-linguist[bot]"
 <136119646+heroku-linguist[bot]@users.noreply.github.com>
Date: Tue, 27 May 2025 14:30:51 +0000
Subject: [PATCH 1060/1195] Prepare release v310 (#1605)

Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com>
---
 CHANGELOG.md                 | 6 +++++-
 lib/language_pack/version.rb | 2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index a18e07df4..e46188c30 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,9 @@
 
 ## [Unreleased]
 
+
+## [v310] - 2025-05-27
+
 - Introduce internal metrics for deriving Ruby version directly from the `Gemfile.lock` to avoid needing to call `bundle platform --ruby` in the future. No change in behavior is expected. (https://github.com/heroku/heroku-buildpack-ruby/pull/1603)
 
 ## [v309] - 2025-05-19
@@ -1708,7 +1711,8 @@ Bugfixes:
 * Change gem detection to use lockfile parser
 * use `$RACK_ENV` when thin is detected for rack apps
 
-[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v309...main
+[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v310...main
+[v310]: https://github.com/heroku/heroku-buildpack-ruby/compare/v309...v310
 [v309]: https://github.com/heroku/heroku-buildpack-ruby/compare/v308...v309
 [v308]: https://github.com/heroku/heroku-buildpack-ruby/compare/v307...v308
 [v307]: https://github.com/heroku/heroku-buildpack-ruby/compare/v306...v307
diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb
index 383112a49..c8b287856 100644
--- a/lib/language_pack/version.rb
+++ b/lib/language_pack/version.rb
@@ -2,6 +2,6 @@
 
 module LanguagePack
   class LanguagePack::Base
-    BUILDPACK_VERSION = "v309"
+    BUILDPACK_VERSION = "v310"
   end
 end

From ba23d0b2846fc762115b3654e77fc0db58fdb70a Mon Sep 17 00:00:00 2001
From: Richard Schneeman 
Date: Thu, 29 May 2025 12:07:53 -0500
Subject: [PATCH 1061/1195] Fix fixture indentation (#1607)

It should be three spaces, but vscode formatting really wants it to be two.
---
 spec/hatchet/ruby_spec.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/spec/hatchet/ruby_spec.rb b/spec/hatchet/ruby_spec.rb
index 5ae567219..b609584c9 100644
--- a/spec/hatchet/ruby_spec.rb
+++ b/spec/hatchet/ruby_spec.rb
@@ -138,7 +138,7 @@
               rake
 
             RUBY VERSION
-              ruby 3.3.1p0
+               ruby 3.3.1p0
           EOF
 
           Pathname("Rakefile").write(<<~'EOF')

From 0a551ff78428dc926b8a647e62d91d64a04b3b17 Mon Sep 17 00:00:00 2001
From: Richard Schneeman 
Date: Thu, 29 May 2025 12:30:43 -0500
Subject: [PATCH 1062/1195] Fix changelog message (#1597)

---
 changelogs/v309/default_ruby.md | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/changelogs/v309/default_ruby.md b/changelogs/v309/default_ruby.md
index f1d257167..173a3a743 100644
--- a/changelogs/v309/default_ruby.md
+++ b/changelogs/v309/default_ruby.md
@@ -1,10 +1,10 @@
 ## Default Ruby version for new apps is now 3.3.8
 
-The [default Ruby version for new Ruby applications is 3.3.8](https://devcenter.heroku.com/articles/ruby-support#default-ruby-version-for-new-apps). You’ll only get the default if the application does not specify a ruby version.
+The [default Ruby version for new Ruby applications is 3.3.8](https://devcenter.heroku.com/articles/ruby-support#default-ruby-version-for-new-apps). You’ll only get the default if the application does not specify a Ruby version.
 
-Heroku highly recommends specifying your desired Ruby version. You can specify a Ruby version in your `Gemfile:
+Heroku highly recommends specifying your desired Ruby version. You can specify a Ruby version in your `Gemfile`:
 
-```term
+```ruby
 ruby "3.3.8"
 ```
 

From 019c97305928fd65ec1e08fea6945828488b1465 Mon Sep 17 00:00:00 2001
From: Richard Schneeman 
Date: Thu, 29 May 2025 14:36:20 -0500
Subject: [PATCH 1063/1195] Fix pending parallel tests (#1606)

The `in_directory_fork` runs a test in a sub-process, which does not play well with the combination of parallel split test and rspec "around" callback. It results in tests not being run. Wrapping tests manually fixes the problem:

Before

```
$ bundle exec parallel_split_test spec/helpers/rails_runner_spec.rb
Pending: (Failures listed here are expected and do not affect your suite's status)

  1) Rails Runner calls run through child object
     # around hook at ./spec/helpers/rails_runner_spec.rb:4 did not execute the example
     # ./spec/helpers/rails_runner_spec.rb:31


Finished in 3.21 seconds (files took 0.40941 seconds to load)
1 example, 0 failures, 1 pending

*

Pending: (Failures listed here are expected and do not affect your suite's status)

  1) Rails Runner config objects build propperly formatted commands
     # around hook at ./spec/helpers/rails_runner_spec.rb:4 did not execute the example
     # ./spec/helpers/rails_runner_spec.rb:18


Finished in 3.23 seconds (files took 0.40016 seconds to load)
1 example, 0 failures, 1 pending

-----> Detecting rails configuration
*

Pending: (Failures listed here are expected and do not affect your suite's status)

  1) Rails Runner failure in one task does not cause another to fail
     # around hook at ./spec/helpers/rails_runner_spec.rb:4 did not execute the example
     # ./spec/helpers/rails_runner_spec.rb:71


Finished in 3.49 seconds (files took 0.40116 seconds to load)
1 example, 0 failures, 1 pending

-----> Detecting rails configuration
*

Pending: (Failures listed here are expected and do not affect your suite's status)

  1) Rails Runner does not fail when there is an invalid byte sequence
     # around hook at ./spec/helpers/rails_runner_spec.rb:4 did not execute the example
     # ./spec/helpers/rails_runner_spec.rb:82


Finished in 3.59 seconds (files took 0.40143 seconds to load)
1 example, 0 failures, 1 pending

-----> Detecting rails configuration
*

Pending: (Failures listed here are expected and do not affect your suite's status)

  1) Rails Runner calls a mock interface
     # around hook at ./spec/helpers/rails_runner_spec.rb:4 did not execute the example
     # ./spec/helpers/rails_runner_spec.rb:45


Finished in 3.68 seconds (files took 0.40462 seconds to load)
1 example, 0 failures, 1 pending


Summary:
1 example, 0 failures, 1 pending
1 example, 0 failures, 1 pending
1 example, 0 failures, 1 pending
1 example, 0 failures, 1 pending
1 example, 0 failures, 1 pending
1 example, 0 failures, 1 pending
```

After

```
$ bundle exec parallel_split_test spec/helpers/rails_runner_spec.rb
Summary:
1 example, 0 failures
1 example, 0 failures
1 example, 0 failures
1 example, 0 failures
1 example, 0 failures
1 example, 0 failures
0 examples, 0 failures
0 examples, 0 failures
0 examples, 0 failures
0 examples, 0 failures
0 examples, 0 failures
0 examples, 0 failures
Took 3.10 seconds with 12 processes
```
---
 spec/helpers/rails_runner_spec.rb | 100 +++++++++++++++++-------------
 1 file changed, 56 insertions(+), 44 deletions(-)

diff --git a/spec/helpers/rails_runner_spec.rb b/spec/helpers/rails_runner_spec.rb
index d3088cb4e..99104f01c 100644
--- a/spec/helpers/rails_runner_spec.rb
+++ b/spec/helpers/rails_runner_spec.rb
@@ -1,7 +1,7 @@
 require 'spec_helper'
 
 describe "Rails Runner" do
-  around(:each) do |test|
+  def isolate(&block)
     # Process and disk isolation
     Hatchet::App.new("default_ruby").in_directory_fork do
       original_path = ENV["PATH"]
@@ -9,83 +9,95 @@
 
       Dir.mktmpdir do |tmpdir|
         Dir.chdir(tmpdir) do
-          test.run
+          block.call
         end
       end
     end
   end
 
   it "config objects build propperly formatted commands" do
-    rails_runner  = LanguagePack::Helpers::RailsRunner.new
-    local_storage = rails_runner.detect("active_storage.service")
+    isolate do
+      rails_runner  = LanguagePack::Helpers::RailsRunner.new
+      local_storage = rails_runner.detect("active_storage.service")
 
-    expected = 'rails runner "begin; puts %Q{heroku.detecting.config.for.active_storage.service=#{Rails.application.config.try(:active_storage).try(:service)}}; rescue => e; end;"'
-    expect(rails_runner.command).to eq(expected)
+      expected = 'rails runner "begin; puts %Q{heroku.detecting.config.for.active_storage.service=#{Rails.application.config.try(:active_storage).try(:service)}}; rescue => e; end;"'
+      expect(rails_runner.command).to eq(expected)
 
-    rails_runner.detect("assets.compile")
+      rails_runner.detect("assets.compile")
 
-    expected = 'rails runner "begin; puts %Q{heroku.detecting.config.for.active_storage.service=#{Rails.application.config.try(:active_storage).try(:service)}}; rescue => e; end; begin; puts %Q{heroku.detecting.config.for.assets.compile=#{Rails.application.config.try(:assets).try(:compile)}}; rescue => e; end;"'
-    expect(rails_runner.command).to eq(expected)
+      expected = 'rails runner "begin; puts %Q{heroku.detecting.config.for.active_storage.service=#{Rails.application.config.try(:active_storage).try(:service)}}; rescue => e; end; begin; puts %Q{heroku.detecting.config.for.assets.compile=#{Rails.application.config.try(:assets).try(:compile)}}; rescue => e; end;"'
+      expect(rails_runner.command).to eq(expected)
+    end
   end
 
   it "calls run through child object" do
-    rails_runner  = LanguagePack::Helpers::RailsRunner.new
-    def rails_runner.call; @called ||= 0 ; @called += 1; "" end
-    def rails_runner.called; @called; end
+    isolate do
+      rails_runner  = LanguagePack::Helpers::RailsRunner.new
+      def rails_runner.call; @called ||= 0 ; @called += 1; "" end
+      def rails_runner.called; @called; end
 
-    local_storage = rails_runner.detect("active_storage.service")
-    local_storage.success?
-    expect(rails_runner.called).to eq(1)
+      local_storage = rails_runner.detect("active_storage.service")
+      local_storage.success?
+      expect(rails_runner.called).to eq(1)
 
-    local_storage.success?
-    local_storage.did_match?("foo")
-    expect(rails_runner.called).to eq(1)
+      local_storage.success?
+      local_storage.did_match?("foo")
+      expect(rails_runner.called).to eq(1)
+    end
   end
 
   it "calls a mock interface" do
-    mock_rails_runner
-    expect(File.executable?("bin/rails")).to eq(true)
+    isolate do
+      mock_rails_runner
+      expect(File.executable?("bin/rails")).to eq(true)
 
-    rails_runner  = LanguagePack::Helpers::RailsRunner.new
-    local_storage = rails_runner.detect("active_storage.service")
-    local_storage = rails_runner.detect("foo.bar")
+      rails_runner  = LanguagePack::Helpers::RailsRunner.new
+      local_storage = rails_runner.detect("active_storage.service")
+      local_storage = rails_runner.detect("foo.bar")
 
-    expect(rails_runner.output).to match("heroku.detecting.config.for.active_storage.service=active_storage.service")
-    expect(rails_runner.output).to match("heroku.detecting.config.for.foo.bar=foo.bar")
-    expect(rails_runner.success?).to be(true)
+      expect(rails_runner.output).to match("heroku.detecting.config.for.active_storage.service=active_storage.service")
+      expect(rails_runner.output).to match("heroku.detecting.config.for.foo.bar=foo.bar")
+      expect(rails_runner.success?).to be(true)
+    end
   end
 
   it "timeout works as expected" do
-    mock_rails_runner("pid = Process.spawn('sleep 5'); Process.wait(pid)")
+    isolate do
+      mock_rails_runner("pid = Process.spawn('sleep 5'); Process.wait(pid)")
+
+      diff = time_it do
+        rails_runner  = LanguagePack::Helpers::RailsRunner.new(false, 0.01)
+        local_storage = rails_runner.detect("active_storage.service")
+        expect(rails_runner.success?).to eq(false)
+        expect(rails_runner.timeout?).to eq(true)
+      end
 
-    diff = time_it do
-      rails_runner  = LanguagePack::Helpers::RailsRunner.new(false, 0.01)
-      local_storage = rails_runner.detect("active_storage.service")
-      expect(rails_runner.success?).to eq(false)
-      expect(rails_runner.timeout?).to eq(true)
+      expect(diff < 1).to eq(true), "expected time difference #{diff} to be less than 1 second, but was longer"
     end
-
-    expect(diff < 1).to eq(true), "expected time difference #{diff} to be less than 1 second, but was longer"
   end
 
   it "failure in one task does not cause another to fail" do
-    mock_rails_runner('raise "bad" if value == :bad')
+    isolate do
+      mock_rails_runner('raise "bad" if value == :bad')
 
-    rails_runner  = LanguagePack::Helpers::RailsRunner.new(false, 1)
-    bad_value     = rails_runner.detect("bad.value")
-    local_storage = rails_runner.detect("active_storage.service")
+      rails_runner  = LanguagePack::Helpers::RailsRunner.new(false, 1)
+      bad_value     = rails_runner.detect("bad.value")
+      local_storage = rails_runner.detect("active_storage.service")
 
-    expect(!!bad_value.success?).to     eq(false)
-    expect(!!local_storage.success?).to eq(true)
+      expect(!!bad_value.success?).to     eq(false)
+      expect(!!local_storage.success?).to eq(true)
+    end
   end
 
   it "does not fail when there is an invalid byte sequence" do
-    mock_rails_runner('puts "hi \255"')
+    isolate do
+      mock_rails_runner('puts "hi \255"')
 
-    rails_runner  = LanguagePack::Helpers::RailsRunner.new
-    local_storage = rails_runner.detect("active_storage.service")
+      rails_runner  = LanguagePack::Helpers::RailsRunner.new
+      local_storage = rails_runner.detect("active_storage.service")
 
-    expect(local_storage.success?).to be_truthy
+      expect(local_storage.success?).to be_truthy
+    end
   end
 
   def time_it

From 471f5185cca999668fcc697120754ea9e03c9119 Mon Sep 17 00:00:00 2001
From: Richard Schneeman 
Date: Sat, 31 May 2025 20:44:41 -0500
Subject: [PATCH 1064/1195] Refactoring (#1608)

* Format kwargs on multiple lines

* Don't rely on CWD, prefer injected path

* Remove redundant chdir (this is done outside already)

* Do not rely on CWD prefer the injected path

* Do not rely on CWD prefer the injected path

* Prefer kwarg

* Remove legacy CI code
---
 lib/language_pack/base.rb      |  2 --
 lib/language_pack/ruby.rb      | 16 ++++++++++------
 lib/language_pack/test/ruby.rb |  2 +-
 spec/spec_helper.rb            |  5 -----
 4 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/lib/language_pack/base.rb b/lib/language_pack/base.rb
index eca9c681c..339f7e861 100644
--- a/lib/language_pack/base.rb
+++ b/lib/language_pack/base.rb
@@ -31,8 +31,6 @@ def initialize(app_path: , cache_path: , gemfile_lock: )
     @fetchers      = {:buildpack => LanguagePack::Fetcher.new(VENDOR_URL) }
     @arch = get_arch
     @report = HerokuBuildReport::GLOBAL
-
-    Dir.chdir app_path
   end
 
   def get_arch
diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb
index 4f7debdbc..027d80e5d 100644
--- a/lib/language_pack/ruby.rb
+++ b/lib/language_pack/ruby.rb
@@ -78,7 +78,7 @@ def compile
     remove_vendor_bundle
     warn_bundler_upgrade
     warn_bad_binstubs
-    install_ruby(slug_vendor_ruby)
+    install_ruby(install_path: slug_vendor_ruby)
     setup_language_pack_environment(
       ruby_layer_path: File.expand_path("."),
       gem_layer_path: File.expand_path("."),
@@ -127,7 +127,10 @@ def config_detect
   # Since `ruby2.5` is not a valid binary name
   #
   def warn_bad_binstubs
-    check = LanguagePack::Helpers::BinstubCheck.new(app_root_dir: Dir.pwd, warn_object: self)
+    check = LanguagePack::Helpers::BinstubCheck.new(
+      warn_object: self,
+      app_root_dir: self.app_path,
+    )
     check.call
   end
 
@@ -467,7 +470,7 @@ def warn_outdated_minor
 
   # install the vendored ruby
   # @return [Boolean] true if it installs the vendored ruby and false otherwise
-  def install_ruby(install_path)
+  def install_ruby(install_path: )
     # Could do a compare operation to avoid re-downloading ruby
     return false unless ruby_version
 
@@ -552,7 +555,7 @@ def install_ruby(install_path)
   end
 
   def new_app?
-    @new_app ||= !File.exist?("vendor/heroku")
+    @new_app ||= !app_path.join("vendor").join("heroku").exist?
   end
 
   # find the ruby install path for its binstubs during build
@@ -631,14 +634,15 @@ def uninstall_binary(path)
   # users should be using `bundle pack` instead.
   # https://github.com/heroku/heroku-buildpack-ruby/issues/21
   def remove_vendor_bundle
-    if File.exist?("vendor/bundle")
+    vendor_bundle = self.app_path.join("vendor").join("bundle")
+    if vendor_bundle.exist?
       warn(<<~WARNING)
         Removing `vendor/bundle`.
         Checking in `vendor/bundle` is not supported. Please remove this directory
         and add it to your .gitignore. To vendor your gems with Bundler, use
         `bundle pack` instead.
       WARNING
-      FileUtils.rm_rf("vendor/bundle")
+      vendor_bundle.rmtree
     end
   end
 
diff --git a/lib/language_pack/test/ruby.rb b/lib/language_pack/test/ruby.rb
index e57c8e4da..67c3e9601 100644
--- a/lib/language_pack/test/ruby.rb
+++ b/lib/language_pack/test/ruby.rb
@@ -8,7 +8,7 @@ def compile
     new_app?
     remove_vendor_bundle
     warn_bad_binstubs
-    install_ruby(slug_vendor_ruby)
+    install_ruby(install_path: slug_vendor_ruby)
     setup_language_pack_environment(
       ruby_layer_path: File.expand_path("."),
       gem_layer_path: File.expand_path("."),
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 9a02689e5..81a8690f4 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -44,11 +44,6 @@ def create_file_with_size_in(size, dir)
   Pathname.new name
 end
 
-if ENV['TRAVIS']
-  # Don't execute tests against "merge" commits
-  exit 0 if ENV['TRAVIS_PULL_REQUEST'] != 'false' && ENV['TRAVIS_BRANCH'] == 'master'
-end
-
 def buildpack_path
   File.expand_path(File.join("../.."), __FILE__)
 end

From be1af49aa1f38c6e1a1a35b61073d577f057e170 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Tue, 3 Jun 2025 16:40:27 -0500
Subject: [PATCH 1065/1195] Bump the ruby-dependencies group with 4 updates
 (#1609)

Bumps the ruby-dependencies group with 4 updates: [rspec-core](https://github.com/rspec/rspec), [rspec-expectations](https://github.com/rspec/rspec), [rake](https://github.com/ruby/rake) and [json](https://github.com/ruby/json).


Updates `rspec-core` from 3.13.3 to 3.13.4
- [Changelog](https://github.com/rspec/rspec/blob/rspec-core-v3.13.4/rspec-core/Changelog.md)
- [Commits](https://github.com/rspec/rspec/compare/rspec-core-v3.13.3...rspec-core-v3.13.4)

Updates `rspec-expectations` from 3.13.4 to 3.13.5
- [Changelog](https://github.com/rspec/rspec/blob/rspec-expectations-v3.13.5/rspec-expectations/Changelog.md)
- [Commits](https://github.com/rspec/rspec/compare/rspec-expectations-v3.13.4...rspec-expectations-v3.13.5)

Updates `rake` from 13.2.1 to 13.3.0
- [Release notes](https://github.com/ruby/rake/releases)
- [Changelog](https://github.com/ruby/rake/blob/master/History.rdoc)
- [Commits](https://github.com/ruby/rake/compare/v13.2.1...v13.3.0)

Updates `json` from 2.11.3 to 2.12.2
- [Release notes](https://github.com/ruby/json/releases)
- [Changelog](https://github.com/ruby/json/blob/master/CHANGES.md)
- [Commits](https://github.com/ruby/json/compare/v2.11.3...v2.12.2)

---
updated-dependencies:
- dependency-name: rspec-core
  dependency-version: 3.13.4
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: ruby-dependencies
- dependency-name: rspec-expectations
  dependency-version: 3.13.5
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: ruby-dependencies
- dependency-name: rake
  dependency-version: 13.3.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: ruby-dependencies
- dependency-name: json
  dependency-version: 2.12.2
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: ruby-dependencies
...

Signed-off-by: dependabot[bot] 
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
 Gemfile.lock | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/Gemfile.lock b/Gemfile.lock
index dff58422e..489d7dcee 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -6,7 +6,7 @@ GEM
       logger
     citrus (3.0.2)
     connection_pool (2.5.3)
-    diff-lcs (1.6.1)
+    diff-lcs (1.6.2)
     erubis (2.7.0)
     excon (0.110.0)
     heroics (0.1.3)
@@ -22,7 +22,7 @@ GEM
       rrrretry (~> 1)
       thor (~> 1)
       threaded (~> 0)
-    json (2.11.3)
+    json (2.12.2)
     logger (1.7.0)
     moneta (1.0.0)
     multi_json (1.15.0)
@@ -35,21 +35,21 @@ GEM
       moneta (~> 1.0.0)
       rate_throttle_client (~> 0.1.0)
     racc (1.8.1)
-    rake (13.2.1)
+    rake (13.3.0)
     rate_throttle_client (0.1.2)
     redis (5.4.0)
       redis-client (>= 0.22.0)
     redis-client (0.24.0)
       connection_pool
     rrrretry (1.0.0)
-    rspec-core (3.13.3)
+    rspec-core (3.13.4)
       rspec-support (~> 3.13.0)
-    rspec-expectations (3.13.4)
+    rspec-expectations (3.13.5)
       diff-lcs (>= 1.2.0, < 2.0)
       rspec-support (~> 3.13.0)
     rspec-retry (0.6.2)
       rspec-core (> 3.3)
-    rspec-support (3.13.3)
+    rspec-support (3.13.4)
     thor (1.3.2)
     threaded (0.0.4)
     toml-rb (4.0.0)

From bec38d1453c6f60046496420f74d9e739e75800e Mon Sep 17 00:00:00 2001
From: Richard Schneeman 
Date: Thu, 5 Jun 2025 17:06:41 -0500
Subject: [PATCH 1066/1195] Introduce `bundle list` based parser (#1610)

* Introduce `bundle list` based parser

This allows us to determine what versions of gems an application is using after `bundle install` has run. Currently, the buildpack works by loading bundler internals into memory and using those to parse the `Gemfile.lock`. That approach introduces strong compatibility requirements for coupling between Ruby versions and bundler versions.

Additionally, recent versions of `bundle install` no longer output the list of gems installed:

```
$ bundle _2.3.27_ install
Using rake 13.2.1
Using base64 0.2.0
...
Using toml-rb 4.0.0
Bundle complete! 11 Gemfile dependencies, 31 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
```

```
$ bundle _2.4.22_ install
Bundle complete! 11 Gemfile dependencies, 31 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
```

It's helpful to have a list of installed gems on build output for debugging purposes. We can use this `bundle list` output as a proxy for the old `bundle install` output.

* Run `bundle list` to list installed gems

Stream `bundle list` when `bundle install` emits no gem information. This output is retained and parsed to build a list of Ruby dependencies. This will eventually replace the bundler internals that are currently in use.
---
 CHANGELOG.md                             |  2 +
 lib/language_pack.rb                     |  1 +
 lib/language_pack/helpers/bundle_list.rb | 84 ++++++++++++++++++++++++
 lib/language_pack/ruby.rb                | 32 +++++++++
 spec/helpers/bundle_list_spec.rb         | 51 ++++++++++++++
 5 files changed, 170 insertions(+)
 create mode 100644 lib/language_pack/helpers/bundle_list.rb
 create mode 100644 spec/helpers/bundle_list_spec.rb

diff --git a/CHANGELOG.md b/CHANGELOG.md
index e46188c30..8c4810be1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,8 @@
 ## [Unreleased]
 
 
+- Stream `bundle list` when `bundle install` emits no gem information. This condition happens when bundler 2.4+ runs with no gem additions or deletions (https://github.com/heroku/heroku-buildpack-ruby/pull/1610)
+
 ## [v310] - 2025-05-27
 
 - Introduce internal metrics for deriving Ruby version directly from the `Gemfile.lock` to avoid needing to call `bundle platform --ruby` in the future. No change in behavior is expected. (https://github.com/heroku/heroku-buildpack-ruby/pull/1603)
diff --git a/lib/language_pack.rb b/lib/language_pack.rb
index a034c8ea4..faa904078 100644
--- a/lib/language_pack.rb
+++ b/lib/language_pack.rb
@@ -45,6 +45,7 @@ def self.detect(app_path:, cache_path:, gemfile_lock: )
 
 require "language_pack/helpers/plugin_installer"
 require "language_pack/helpers/stale_file_cleaner"
+require "language_pack/helpers/bundle_list"
 require "language_pack/helpers/rake_runner"
 require "language_pack/helpers/rails_runner"
 require "language_pack/helpers/bundler_wrapper"
diff --git a/lib/language_pack/helpers/bundle_list.rb b/lib/language_pack/helpers/bundle_list.rb
new file mode 100644
index 000000000..7275fe0d7
--- /dev/null
+++ b/lib/language_pack/helpers/bundle_list.rb
@@ -0,0 +1,84 @@
+require "language_pack/shell_helpers"
+
+module LanguagePack::Helpers
+  class BundleList
+    class CmdError < BuildpackError
+      def initialize(command:, output:)
+        super(<<~EOF)
+          Error detecting dependencies
+
+          The Ruby buildpack requires information about your application’s dependencies to
+          complete the build. Without this information, the Ruby buildpack cannot continue.
+
+          Command failed: `#{command}`
+
+          #{output}
+        EOF
+      end
+    end
+
+    # Runs `bundle list` and builds a BundleList object
+    # from the output
+    #
+    # Announces the run, optionally streams results to the user.
+    # This is useful for the case where bundler doesn't print
+    # any version info.
+    #
+    # Example:
+    #
+    #    BundleList::Command.new(
+    #      stream_to_user: stream_to_user
+    #    ).call
+    class HumanCommand
+      include LanguagePack::ShellHelpers
+      private attr_reader :stream_to_user, :io
+
+      def initialize(stream_to_user:, io: self)
+        @io = io
+        @stream_to_user = stream_to_user
+      end
+
+      def call
+        command = "bundle list"
+        io.puts "Running: #{command}"
+
+        output = if stream_to_user
+          io.pipe(command, user_env: true)
+        else
+          io.run(command, user_env: true)
+        end
+
+        if $?.success?
+          BundleList.new(
+            output: output
+          )
+        else
+          raise CmdError.new(output: output, command: command)
+        end
+      end
+    end
+
+    def initialize(output: )
+      @raw = output
+      @gems = {}
+      @raw.scan(/\* (?\S+) \((?[a-zA-Z0-9\.]+)(? [a-zA-Z0-9]+)?\)/) do
+        captures = Regexp.last_match.named_captures
+        @gems[captures["name"]] = captures["version"]
+      end
+    end
+
+    def has_gem?(name)
+      @gems[name]
+    end
+
+    def length
+      @gems.length
+    end
+
+    def gem_version(name)
+      if version = @gems[name]
+        Gem::Version.new(version)
+      end
+    end
+  end
+end
diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb
index 027d80e5d..54ea4e592 100644
--- a/lib/language_pack/ruby.rb
+++ b/lib/language_pack/ruby.rb
@@ -116,6 +116,34 @@ def cleanup
   def config_detect
   end
 
+  # Runs `bundle list` and optionally streams the result to the user
+  #
+  # Streaming helps with build log visibility i.e. "what version of X" am I using at a glance.
+  #
+  # Checks if the information from `bundle list` matches information collected from bundler internals
+  # if not, emits the difference. The goal is to eventually replace requiring bundler internals with
+  # information retrieved from `bundle list`.
+  private def bundle_list(stream_to_user: )
+    bundle_list = LanguagePack::Helpers::BundleList::HumanCommand.new(
+      stream_to_user: stream_to_user
+    ).call
+    differences = bundler.specs.filter_map do |(name, spec)|
+      expected = Gem::Version.new(spec.version)
+      actual = bundle_list.gem_version(name)
+      if expected != actual
+        "#{name}: (`#{expected}` `#{actual}`)"
+      end
+    end
+
+    if !differences.empty?
+      @report.capture(
+        "bundle_list.differences" => differences.join(", "),
+      )
+    end
+
+    bundle_list
+  end
+
 private
 
   # A bad shebang line looks like this:
@@ -703,6 +731,10 @@ def build_bundler
 
       # Keep gem cache out of the slug
       FileUtils.rm_rf("#{slug_vendor_base}/cache")
+
+      bundle_list(
+        stream_to_user: !bundler_output.match?(/Installing|Fetching|Using/)
+      )
     else
       error_message = "Failed to install gems via Bundler."
       puts "Bundler Output: #{bundler_output}"
diff --git a/spec/helpers/bundle_list_spec.rb b/spec/helpers/bundle_list_spec.rb
new file mode 100644
index 000000000..265f31c08
--- /dev/null
+++ b/spec/helpers/bundle_list_spec.rb
@@ -0,0 +1,51 @@
+
+require 'spec_helper'
+
+describe "Bundle list" do
+  it "parses bundle list output" do
+    output = <<~EOF
+      Gems included by the bundle:
+        * actioncable (6.1.4.1)
+        * actionmailbox (6.1.4.1)
+        * actionmailer (6.1.4.1)
+        * actionpack (6.1.4.1)
+        * actiontext (6.1.4.1)
+        * actionview (6.1.4.1)
+        * activejob (6.1.4.1)
+        * activemodel (6.1.4.1)
+        * activerecord (6.1.4.1)
+        * activestorage (6.1.4.1)
+        * activesupport (6.1.4.1)
+        * addressable (2.8.0)
+        * ast (2.4.2)
+        * railties (6.1.4.1)
+      Use `bundle info` to print more detailed information about a gem
+    EOF
+
+    bundle_list = LanguagePack::Helpers::BundleList.new(
+      output: output
+    )
+    expect(bundle_list.has_gem?("railties")).to be_truthy
+    expect(bundle_list.gem_version("railties")).to eq(Gem::Version.new("6.1.4.1"))
+    expect(bundle_list.has_gem?("nope")).to be_falsey
+
+    expect(bundle_list.length).to eq(14)
+  end
+
+  it "handles git SHA gems" do
+    output = <<~EOF
+      Gems included by the bundle:
+        * railties (6.1.4.1 asdf1)
+      Use `bundle info` to print more detailed information about a gem
+    EOF
+
+    bundle_list = LanguagePack::Helpers::BundleList.new(
+      output: output
+    )
+    expect(bundle_list.has_gem?("railties")).to be_truthy
+    expect(bundle_list.gem_version("railties")).to eq(Gem::Version.new("6.1.4.1"))
+    expect(bundle_list.has_gem?("nope")).to be_falsey
+
+    expect(bundle_list.length).to eq(1)
+  end
+end

From bde812397e04ada4c878c1311e3ab9030fa73f14 Mon Sep 17 00:00:00 2001
From: "heroku-linguist[bot]"
 <136119646+heroku-linguist[bot]@users.noreply.github.com>
Date: Mon, 9 Jun 2025 16:30:18 +0000
Subject: [PATCH 1067/1195] Prepare release v311 (#1611)

Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com>
---
 CHANGELOG.md                 | 6 +++++-
 lib/language_pack/version.rb | 2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8c4810be1..48b808a9d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,9 @@
 ## [Unreleased]
 
 
+## [v311] - 2025-06-09
+
+
 - Stream `bundle list` when `bundle install` emits no gem information. This condition happens when bundler 2.4+ runs with no gem additions or deletions (https://github.com/heroku/heroku-buildpack-ruby/pull/1610)
 
 ## [v310] - 2025-05-27
@@ -1713,7 +1716,8 @@ Bugfixes:
 * Change gem detection to use lockfile parser
 * use `$RACK_ENV` when thin is detected for rack apps
 
-[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v310...main
+[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v311...main
+[v311]: https://github.com/heroku/heroku-buildpack-ruby/compare/v310...v311
 [v310]: https://github.com/heroku/heroku-buildpack-ruby/compare/v309...v310
 [v309]: https://github.com/heroku/heroku-buildpack-ruby/compare/v308...v309
 [v308]: https://github.com/heroku/heroku-buildpack-ruby/compare/v307...v308
diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb
index c8b287856..dcda72b1b 100644
--- a/lib/language_pack/version.rb
+++ b/lib/language_pack/version.rb
@@ -2,6 +2,6 @@
 
 module LanguagePack
   class LanguagePack::Base
-    BUILDPACK_VERSION = "v310"
+    BUILDPACK_VERSION = "v311"
   end
 end

From 3f6bb38eb75ab41ad1dcb1eafddb90a92d2aaeeb Mon Sep 17 00:00:00 2001
From: "heroku-linguist[bot]"
 <136119646+heroku-linguist[bot]@users.noreply.github.com>
Date: Wed, 11 Jun 2025 15:06:29 +0000
Subject: [PATCH 1068/1195] Prepare release v312 (#1612)

Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com>
---
 CHANGELOG.md                 | 8 +++++++-
 lib/language_pack/version.rb | 2 +-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 48b808a9d..9cf05593f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,11 @@
 ## [Unreleased]
 
 
+## [v312] - 2025-06-10
+
+- JRuby 9.4.13.0 is now available
+
+
 ## [v311] - 2025-06-09
 
 
@@ -1716,7 +1721,8 @@ Bugfixes:
 * Change gem detection to use lockfile parser
 * use `$RACK_ENV` when thin is detected for rack apps
 
-[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v311...main
+[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v312...main
+[v312]: https://github.com/heroku/heroku-buildpack-ruby/compare/v311...v312
 [v311]: https://github.com/heroku/heroku-buildpack-ruby/compare/v310...v311
 [v310]: https://github.com/heroku/heroku-buildpack-ruby/compare/v309...v310
 [v309]: https://github.com/heroku/heroku-buildpack-ruby/compare/v308...v309
diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb
index dcda72b1b..61f793482 100644
--- a/lib/language_pack/version.rb
+++ b/lib/language_pack/version.rb
@@ -2,6 +2,6 @@
 
 module LanguagePack
   class LanguagePack::Base
-    BUILDPACK_VERSION = "v311"
+    BUILDPACK_VERSION = "v312"
   end
 end

From 04664f0107763b9d1e823d01e12a5c82e39f4dcd Mon Sep 17 00:00:00 2001
From: Richard Schneeman 
Date: Tue, 1 Jul 2025 10:03:42 -0400
Subject: [PATCH 1069/1195] Update tests (#1614)

The Ruby buildpack depends on PATH set by the node buildpack for some tests. It appears that the path on disk changed from `.heroku/yarn/bin/yarn` to `.heroku/node/bin/yarn`

This appears to be changed in https://github.com/heroku/heroku-buildpack-nodejs/compare/v295...v296.
---
 spec/hatchet/node_spec.rb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/spec/hatchet/node_spec.rb b/spec/hatchet/node_spec.rb
index fe816dc27..4869a0213 100644
--- a/spec/hatchet/node_spec.rb
+++ b/spec/hatchet/node_spec.rb
@@ -34,11 +34,11 @@
 
     Hatchet::Runner.new("minimal_webpacker", buildpacks: buildpacks, config: config).deploy do |app, heroku|
       expect(app.output).to include("yarn install")
-      expect(app.output).to include(".heroku/yarn/bin/yarn is the yarn directory")
+      expect(app.output).to include(".heroku/node/bin/yarn is the yarn directory ")
       expect(app.output).to include(".heroku/node/bin/node is the node directory")
 
       expect(app.run("which node")).to match("/app/.heroku/node/bin")
-      expect(app.run("which yarn")).to match("/app/.heroku/yarn/bin")
+      expect(app.run("which yarn")).to match("/app/.heroku/node/bin")
     end
   end
 end

From 83997c90cea3874e6930c71057fc47ca59bb8ffc Mon Sep 17 00:00:00 2001
From: Richard Schneeman 
Date: Wed, 2 Jul 2025 14:11:12 -0400
Subject: [PATCH 1070/1195] Remove CI-queue, update rspec-core (#1617)

---
 Gemfile      | 1 -
 Gemfile.lock | 6 +-----
 2 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/Gemfile b/Gemfile
index d9c60910e..fde180d25 100644
--- a/Gemfile
+++ b/Gemfile
@@ -13,6 +13,5 @@ group :development, :test do
   gem "parallel_split_test"
   gem 'rspec-retry'
   gem 'json'
-  gem 'ci-queue'
   gem 'redis'
 end
diff --git a/Gemfile.lock b/Gemfile.lock
index 489d7dcee..316e30823 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -2,8 +2,6 @@ GEM
   remote: https://rubygems.org/
   specs:
     base64 (0.2.0)
-    ci-queue (0.67.0)
-      logger
     citrus (3.0.2)
     connection_pool (2.5.3)
     diff-lcs (1.6.2)
@@ -23,7 +21,6 @@ GEM
       thor (~> 1)
       threaded (~> 0)
     json (2.12.2)
-    logger (1.7.0)
     moneta (1.0.0)
     multi_json (1.15.0)
     parallel (1.27.0)
@@ -42,7 +39,7 @@ GEM
     redis-client (0.24.0)
       connection_pool
     rrrretry (1.0.0)
-    rspec-core (3.13.4)
+    rspec-core (3.13.5)
       rspec-support (~> 3.13.0)
     rspec-expectations (3.13.5)
       diff-lcs (>= 1.2.0, < 2.0)
@@ -61,7 +58,6 @@ PLATFORMS
   ruby
 
 DEPENDENCIES
-  ci-queue
   excon
   heroku_hatchet
   json

From cdd13747b0854d56b6ffd0353db4b2ddd128ed95 Mon Sep 17 00:00:00 2001
From: Ed Morley <501702+edmorley@users.noreply.github.com>
Date: Thu, 3 Jul 2025 13:23:19 +0100
Subject: [PATCH 1071/1195] Further reduce team review request noise from
 CODEOWNERS (#1618)

We already request language owner review for various automation and
Dependabot related PRs, to reduce the amount of review request
notification noise sent to the language owner team alias.

This adds the GitHub Actions workflow directory to this list too, so
that Dependabot PRs that bump the Actions versions are treated the
same as the language-specific Dependabot PRs.

GUS-W-18951033.
---
 .github/CODEOWNERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index fde389a62..a39285278 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -7,5 +7,6 @@
 # by Dependabot or release automation, to reduce team review request noise.
 CHANGELOG.md @schneems
 Gemfile.lock @schneems
+/.github/workflows/ @schneems
 /changelogs/ @schneems
 /lib/language_pack/version.rb @schneems

From 3696ffd5c2e53ae9f045a8e8a48b7ad1eb9e6538 Mon Sep 17 00:00:00 2001
From: "heroku-linguist[bot]"
 <136119646+heroku-linguist[bot]@users.noreply.github.com>
Date: Tue, 15 Jul 2025 19:18:53 +0000
Subject: [PATCH 1072/1195] Prepare release v313 (#1620)

Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com>
---
 CHANGELOG.md                 | 8 +++++++-
 lib/language_pack/version.rb | 2 +-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9cf05593f..62b6c2fd5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,11 @@
 ## [Unreleased]
 
 
+## [v313] - 2025-07-15
+
+- Ruby 3.4.5 is now available
+
+
 ## [v312] - 2025-06-10
 
 - JRuby 9.4.13.0 is now available
@@ -1721,7 +1726,8 @@ Bugfixes:
 * Change gem detection to use lockfile parser
 * use `$RACK_ENV` when thin is detected for rack apps
 
-[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v312...main
+[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v313...main
+[v313]: https://github.com/heroku/heroku-buildpack-ruby/compare/v312...v313
 [v312]: https://github.com/heroku/heroku-buildpack-ruby/compare/v311...v312
 [v311]: https://github.com/heroku/heroku-buildpack-ruby/compare/v310...v311
 [v310]: https://github.com/heroku/heroku-buildpack-ruby/compare/v309...v310
diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb
index 61f793482..4709d19f8 100644
--- a/lib/language_pack/version.rb
+++ b/lib/language_pack/version.rb
@@ -2,6 +2,6 @@
 
 module LanguagePack
   class LanguagePack::Base
-    BUILDPACK_VERSION = "v312"
+    BUILDPACK_VERSION = "v313"
   end
 end

From 7a305ce5af87a549ad2db3eff51799e6a70cdc6d Mon Sep 17 00:00:00 2001
From: "heroku-linguist[bot]"
 <136119646+heroku-linguist[bot]@users.noreply.github.com>
Date: Fri, 18 Jul 2025 18:13:23 +0000
Subject: [PATCH 1073/1195] Prepare release v314 (#1621)

Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com>
---
 CHANGELOG.md                 | 8 +++++++-
 lib/language_pack/version.rb | 2 +-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 62b6c2fd5..f310a0fde 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,11 @@
 ## [Unreleased]
 
 
+## [v314] - 2025-07-18
+
+- JRuby 10.0.1.0 is now available
+
+
 ## [v313] - 2025-07-15
 
 - Ruby 3.4.5 is now available
@@ -1726,7 +1731,8 @@ Bugfixes:
 * Change gem detection to use lockfile parser
 * use `$RACK_ENV` when thin is detected for rack apps
 
-[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v313...main
+[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v314...main
+[v314]: https://github.com/heroku/heroku-buildpack-ruby/compare/v313...v314
 [v313]: https://github.com/heroku/heroku-buildpack-ruby/compare/v312...v313
 [v312]: https://github.com/heroku/heroku-buildpack-ruby/compare/v311...v312
 [v311]: https://github.com/heroku/heroku-buildpack-ruby/compare/v310...v311
diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb
index 4709d19f8..f5811abdc 100644
--- a/lib/language_pack/version.rb
+++ b/lib/language_pack/version.rb
@@ -2,6 +2,6 @@
 
 module LanguagePack
   class LanguagePack::Base
-    BUILDPACK_VERSION = "v313"
+    BUILDPACK_VERSION = "v314"
   end
 end

From 6fd0368ea8572188216afb4402fdb8a472a969ed Mon Sep 17 00:00:00 2001
From: "heroku-linguist[bot]"
 <136119646+heroku-linguist[bot]@users.noreply.github.com>
Date: Thu, 24 Jul 2025 16:22:48 +0000
Subject: [PATCH 1074/1195] Prepare release v315 (#1623)

Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com>
---
 CHANGELOG.md                 | 8 +++++++-
 lib/language_pack/version.rb | 2 +-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index f310a0fde..89b1c73d8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,11 @@
 ## [Unreleased]
 
 
+## [v315] - 2025-07-24
+
+- Ruby 3.2.9 and 3.3.9 is now available
+
+
 ## [v314] - 2025-07-18
 
 - JRuby 10.0.1.0 is now available
@@ -1731,7 +1736,8 @@ Bugfixes:
 * Change gem detection to use lockfile parser
 * use `$RACK_ENV` when thin is detected for rack apps
 
-[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v314...main
+[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v315...main
+[v315]: https://github.com/heroku/heroku-buildpack-ruby/compare/v314...v315
 [v314]: https://github.com/heroku/heroku-buildpack-ruby/compare/v313...v314
 [v313]: https://github.com/heroku/heroku-buildpack-ruby/compare/v312...v313
 [v312]: https://github.com/heroku/heroku-buildpack-ruby/compare/v311...v312
diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb
index f5811abdc..a96ef42b7 100644
--- a/lib/language_pack/version.rb
+++ b/lib/language_pack/version.rb
@@ -2,6 +2,6 @@
 
 module LanguagePack
   class LanguagePack::Base
-    BUILDPACK_VERSION = "v314"
+    BUILDPACK_VERSION = "v315"
   end
 end

From 1abdd0b6e21d32325e5ca3afc3fa81aef69176c4 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Tue, 5 Aug 2025 08:50:00 +0000
Subject: [PATCH 1075/1195] Bump thor from 1.3.2 to 1.4.0 (#1622)

Bumps [thor](https://github.com/rails/thor) from 1.3.2 to 1.4.0.
- [Release notes](https://github.com/rails/thor/releases)
- [Commits](https://github.com/rails/thor/compare/v1.3.2...v1.4.0)

---
updated-dependencies:
- dependency-name: thor
  dependency-version: 1.4.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] 
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
 Gemfile.lock | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Gemfile.lock b/Gemfile.lock
index 316e30823..3c87c0bd4 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -47,7 +47,7 @@ GEM
     rspec-retry (0.6.2)
       rspec-core (> 3.3)
     rspec-support (3.13.4)
-    thor (1.3.2)
+    thor (1.4.0)
     threaded (0.0.4)
     toml-rb (4.0.0)
       citrus (~> 3.0, > 3.0)

From dd17c01c739caeb292268c38c654ec3f60a48726 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Tue, 5 Aug 2025 21:47:25 +0000
Subject: [PATCH 1076/1195] Bump the ruby-dependencies group with 3 updates
 (#1626)

Bumps the ruby-dependencies group with 3 updates: [heroku_hatchet](https://github.com/heroku/hatchet), [json](https://github.com/ruby/json) and [redis](https://github.com/redis/redis-rb).


Updates `heroku_hatchet` from 8.0.5 to 8.0.6
- [Changelog](https://github.com/heroku/hatchet/blob/main/CHANGELOG.md)
- [Commits](https://github.com/heroku/hatchet/compare/v8.0.5...v8.0.6)

Updates `json` from 2.12.2 to 2.13.2
- [Release notes](https://github.com/ruby/json/releases)
- [Changelog](https://github.com/ruby/json/blob/master/CHANGES.md)
- [Commits](https://github.com/ruby/json/compare/v2.12.2...v2.13.2)

Updates `redis` from 5.4.0 to 5.4.1
- [Changelog](https://github.com/redis/redis-rb/blob/master/CHANGELOG.md)
- [Commits](https://github.com/redis/redis-rb/compare/v5.4.0...v5.4.1)

---
updated-dependencies:
- dependency-name: heroku_hatchet
  dependency-version: 8.0.6
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: ruby-dependencies
- dependency-name: json
  dependency-version: 2.13.2
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: ruby-dependencies
- dependency-name: redis
  dependency-version: 5.4.1
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: ruby-dependencies
...

Signed-off-by: dependabot[bot] 
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
 Gemfile.lock | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/Gemfile.lock b/Gemfile.lock
index 3c87c0bd4..56662887a 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,7 +1,7 @@
 GEM
   remote: https://rubygems.org/
   specs:
-    base64 (0.2.0)
+    base64 (0.3.0)
     citrus (3.0.2)
     connection_pool (2.5.3)
     diff-lcs (1.6.2)
@@ -14,15 +14,15 @@ GEM
       moneta
       multi_json (>= 1.9.2)
       webrick
-    heroku_hatchet (8.0.5)
+    heroku_hatchet (8.0.6)
       excon (< 2)
       platform-api (~> 3)
       rrrretry (~> 1)
       thor (~> 1)
       threaded (~> 0)
-    json (2.12.2)
+    json (2.13.2)
     moneta (1.0.0)
-    multi_json (1.15.0)
+    multi_json (1.17.0)
     parallel (1.27.0)
     parallel_split_test (0.10.0)
       parallel (>= 0.5.13)
@@ -34,9 +34,9 @@ GEM
     racc (1.8.1)
     rake (13.3.0)
     rate_throttle_client (0.1.2)
-    redis (5.4.0)
+    redis (5.4.1)
       redis-client (>= 0.22.0)
-    redis-client (0.24.0)
+    redis-client (0.25.1)
       connection_pool
     rrrretry (1.0.0)
     rspec-core (3.13.5)

From 09c1c86f453e462552d9baaee1cd1fc3eb4740fb Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Tue, 5 Aug 2025 17:22:33 -0500
Subject: [PATCH 1077/1195] Bump excon from 0.110.0 to 1.2.8 (#1627)

Bumps [excon](https://github.com/excon/excon) from 0.110.0 to 1.2.8.
- [Changelog](https://github.com/excon/excon/blob/master/changelog.txt)
- [Commits](https://github.com/excon/excon/compare/v0.110.0...v1.2.8)

---
updated-dependencies:
- dependency-name: excon
  dependency-version: 1.2.8
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] 
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
 Gemfile.lock | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Gemfile.lock b/Gemfile.lock
index 56662887a..54bd0f744 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -6,7 +6,8 @@ GEM
     connection_pool (2.5.3)
     diff-lcs (1.6.2)
     erubis (2.7.0)
-    excon (0.110.0)
+    excon (1.2.8)
+      logger
     heroics (0.1.3)
       base64
       erubis (~> 2.0)
@@ -21,6 +22,7 @@ GEM
       thor (~> 1)
       threaded (~> 0)
     json (2.13.2)
+    logger (1.7.0)
     moneta (1.0.0)
     multi_json (1.17.0)
     parallel (1.27.0)

From 215828f6cab08236e1f90f6935b5982cc3be4643 Mon Sep 17 00:00:00 2001
From: Richard Schneeman 
Date: Tue, 5 Aug 2025 17:22:51 -0500
Subject: [PATCH 1078/1195] Default Ruby version now 3.3.9 (#1624)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The [default Ruby version for new Ruby applications is 3.3.9](https://devcenter.heroku.com/articles/ruby-support#default-ruby-version-for-new-apps). You’ll only get the default if the application does not specify a Ruby version.

Heroku highly recommends specifying your desired Ruby version. You can specify a Ruby version in your `Gemfile`:

```ruby
ruby "3.3.9"
```

Once you have a Ruby version specified in your `Gemfile`, update the `Gemfile.lock` by running the following command:

```term
$ bundle update --ruby
```

Make sure you commit the results to git before attempting to deploy again:

```term
$ git add Gemfile Gemfile.lock
$ git commit -m "update ruby version"
```
---
 .github/workflows/ci.yml                  |  2 +-
 .github/workflows/hatchet_app_cleaner.yml |  2 +-
 CHANGELOG.md                              |  1 +
 Gemfile                                   |  2 +-
 Gemfile.lock                              |  2 +-
 buildpack.toml                            |  2 +-
 changelogs/unreleased/default_v339.md     | 22 ++++++++++++++++++++++
 changelogs/v309/default_ruby.md           |  2 +-
 lib/language_pack/ruby_version.rb         |  4 ++--
 9 files changed, 31 insertions(+), 8 deletions(-)
 create mode 100644 changelogs/unreleased/default_v339.md

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 68ae223bd..e5104519e 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -39,7 +39,7 @@ jobs:
           uses: ruby/setup-ruby@v1
           with:
             bundler-cache: true
-            ruby-version: "3.3.8"
+            ruby-version: "3.3.9"
         - name: Hatchet setup
           run: bundle exec hatchet ci:setup
         - name: Run Hatchet integration tests
diff --git a/.github/workflows/hatchet_app_cleaner.yml b/.github/workflows/hatchet_app_cleaner.yml
index 3254d5b90..f5106361e 100644
--- a/.github/workflows/hatchet_app_cleaner.yml
+++ b/.github/workflows/hatchet_app_cleaner.yml
@@ -24,7 +24,7 @@ jobs:
         uses: ruby/setup-ruby@v1
         with:
           bundler-cache: true
-          ruby-version: "3.3.8"
+          ruby-version: "3.3.9"
       - name: Run Hatchet destroy
         # Only apps older than 10 minutes are destroyed, to ensure that any
         # in progress CI runs are not interrupted.
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 89b1c73d8..28e16fadb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,7 @@
 
 ## [Unreleased]
 
+- Default Ruby version is now 3.3.9 (https://github.com/heroku/heroku-buildpack-ruby/pull/1624)
 
 ## [v315] - 2025-07-24
 
diff --git a/Gemfile b/Gemfile
index fde180d25..845f30339 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,7 +1,7 @@
 source "https://rubygems.org"
 git_source(:github) { |repo| "https://github.com/#{repo}.git" }
 
-ruby "3.3.8"
+ruby "3.3.9"
 
 group :development, :test do
   gem "toml-rb"
diff --git a/Gemfile.lock b/Gemfile.lock
index 54bd0f744..15636544d 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -72,7 +72,7 @@ DEPENDENCIES
   toml-rb
 
 RUBY VERSION
-   ruby 3.3.8p144
+   ruby 3.3.9p170
 
 BUNDLED WITH
    2.5.22
diff --git a/buildpack.toml b/buildpack.toml
index f6e1e2f23..ce9393270 100644
--- a/buildpack.toml
+++ b/buildpack.toml
@@ -1,6 +1,6 @@
 [buildpack]
 name = "Ruby"
-ruby_version = "3.3.8"
+ruby_version = "3.3.9"
 
 [publish.Ignore]
 files = [
diff --git a/changelogs/unreleased/default_v339.md b/changelogs/unreleased/default_v339.md
new file mode 100644
index 000000000..00e77c025
--- /dev/null
+++ b/changelogs/unreleased/default_v339.md
@@ -0,0 +1,22 @@
+## Default Ruby version for new apps is now 3.3.9
+
+The [default Ruby version for new Ruby applications is 3.3.9](https://devcenter.heroku.com/articles/ruby-support#default-ruby-version-for-new-apps). You’ll only get the default if the application does not specify a Ruby version.
+
+Heroku highly recommends specifying your desired Ruby version. You can specify a Ruby version in your `Gemfile`:
+
+```ruby
+ruby "3.3.9"
+```
+
+Once you have a Ruby version specified in your `Gemfile`, update the `Gemfile.lock` by running the following command:
+
+```term
+$ bundle update --ruby
+```
+
+Make sure you commit the results to git before attempting to deploy again:
+
+```term
+$ git add Gemfile Gemfile.lock
+$ git commit -m "update ruby version"
+```
diff --git a/changelogs/v309/default_ruby.md b/changelogs/v309/default_ruby.md
index 173a3a743..92d78578b 100644
--- a/changelogs/v309/default_ruby.md
+++ b/changelogs/v309/default_ruby.md
@@ -5,7 +5,7 @@ The [default Ruby version for new Ruby applications is 3.3.8](https://devcenter.
 Heroku highly recommends specifying your desired Ruby version. You can specify a Ruby version in your `Gemfile`:
 
 ```ruby
-ruby "3.3.8"
+ruby "3.3.9"
 ```
 
 Once you have a Ruby version specified in your `Gemfile`, update the `Gemfile.lock` by running the following command:
diff --git a/lib/language_pack/ruby_version.rb b/lib/language_pack/ruby_version.rb
index ff74ad1d8..2f19c7c45 100644
--- a/lib/language_pack/ruby_version.rb
+++ b/lib/language_pack/ruby_version.rb
@@ -12,8 +12,8 @@ def initialize(output = "")
       end
     end
 
-    BOOTSTRAP_VERSION_NUMBER = "3.3.8".freeze
-    DEFAULT_VERSION_NUMBER = "3.3.8".freeze
+    BOOTSTRAP_VERSION_NUMBER = "3.3.9".freeze
+    DEFAULT_VERSION_NUMBER = "3.3.9".freeze
     DEFAULT_VERSION        = "ruby-#{DEFAULT_VERSION_NUMBER}".freeze
     RUBY_VERSION_REGEX     = %r{
         (?\d+\.\d+\.\d+){0}

From 173feeff1eba3b052389671d6494c672a6ed9ea5 Mon Sep 17 00:00:00 2001
From: Richard Schneeman 
Date: Wed, 6 Aug 2025 14:44:32 -0500
Subject: [PATCH 1079/1195] Better errors on bootstrap failure (#1629)

* Show original error on bootstrap failed download

Current

```
curl --fail --retry 3 --retry-connrefused --connect-timeout "3" --silent --location -o "/tmp/ruby.tgz" "https://heroku-buildpack-ruby.s3.us-east-1.amazonaws.com/heroku-20/ruby-3.3.9.tgz"; echo "Done $?"
# => Done 22
```

After

```
curl --fail --show-error --retry 3 --retry-connrefused --connect-timeout "3" --silent --location -o "/tmp/ruby.tgz" "https://heroku-buildpack-ruby.s3.us-east-1.amazonaws.com/heroku-20/ruby-3.3.9.tgz"; echo "Done $?"
# => curl: (22) The requested URL returned error: 404
# => Done 22
```

Ref https://github.com/heroku/heroku-buildpack-ruby/issues/1628

* Don't silently ignore bash failures

This output reported in https://github.com/heroku/heroku-buildpack-ruby/issues/1628 is confusing.

```
remote: /tmp/buildpackLSI7t/bin/compile: line 35:   Failed to download a Ruby executable for bootstrapping!
remote:
remote:   This is most likely a temporary internal error. If the problem
remote:   persists, make sure that you are not running a custom or forked
remote:   version of the Heroku Ruby buildpack which may need updating.
remote:
remote:   url: https://heroku-buildpack-ruby.s3.us-east-1.amazonaws.com/heroku-20/ruby-3.3.9.tgz
remote: /tmp/tmp.PDOWE1VL34/bin/ruby: File name too long
```

Even though that function exits non-zero, it doesn't propagate due to a missing `set -e` at the top level. This ensures all top level `bin/` executables exit on failure.

* Explicit heroku-20 check and failure

Issue https://github.com/heroku/heroku-buildpack-ruby/issues/1628 shows that it's unclear when a Ruby version cannot be found on an unsupported stack, and that it is expected behavior. To avoid this confusion, we can explicitly error when using a recently EOL stack.

* Better stack error message

This guards against execution using unknown or unexpected stacks. In addition, its behavior is tested.

* Fix shellcheck

When I added this function with local variable:

```
function checks::ensure_supported_stack() {
	local stack="${1}"
```

It triggered this shellcheck failure on an unrelated line:

```
$ shellcheck bin/support/bash_functions.sh -x

In bin/support/bash_functions.sh line 35:
  if [ "$STACK" == "heroku-24" ]; then
        ^----^ SC2153 (info): Possible misspelling: STACK may not be assigned. Did you mean stack?
```

This fixes the lint.
---
 CHANGELOG.md                     |  1 +
 bin/compile                      |  4 +++
 bin/detect                       |  4 ++-
 bin/support/bash_functions.sh    | 43 +++++++++++++++++++++++++++++++-
 bin/support/download_ruby        |  2 +-
 bin/test                         |  2 ++
 spec/unit/bash_functions_spec.rb | 28 +++++++++++++++++----
 7 files changed, 76 insertions(+), 8 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 28e16fadb..a5f351a63 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,7 @@
 
 ## [Unreleased]
 
+- Explicitly error on end-of-life (EOL) stack `heroku-20` (https://github.com/heroku/heroku-buildpack-ruby/pull/1629)
 - Default Ruby version is now 3.3.9 (https://github.com/heroku/heroku-buildpack-ruby/pull/1624)
 
 ## [v315] - 2025-07-24
diff --git a/bin/compile b/bin/compile
index 30bd8da0c..29c0c9e11 100755
--- a/bin/compile
+++ b/bin/compile
@@ -2,6 +2,8 @@
 # The actual compilation code lives in `bin/support/ruby_compile`. This file instead
 # bootstraps the ruby needed and then executes `bin/support/ruby_compile`
 
+set -euo pipefail
+
 BUILD_DIR=$1
 CACHE_DIR=$2
 ENV_DIR=$3
@@ -11,6 +13,8 @@ BUILDPACK_DIR=$(dirname "$BIN_DIR")
 # shellcheck source=bin/support/bash_functions.sh
 source "$BIN_DIR/support/bash_functions.sh"
 
+checks::ensure_supported_stack "${STACK:?Required env var STACK is not set}"
+
 bootstrap_ruby_dir=$(install_bootstrap_ruby "$BIN_DIR" "$BUILDPACK_DIR")
 export PATH="$bootstrap_ruby_dir/bin/:$PATH"
 unset GEM_PATH
diff --git a/bin/detect b/bin/detect
index e25db8c44..cd8903b28 100755
--- a/bin/detect
+++ b/bin/detect
@@ -1,4 +1,6 @@
-#!/bin/sh
+#!/usr/bin/env bash
+
+set -euo pipefail
 
 APP_DIR=$1
 
diff --git a/bin/support/bash_functions.sh b/bin/support/bash_functions.sh
index 425129f14..c5043c89e 100755
--- a/bin/support/bash_functions.sh
+++ b/bin/support/bash_functions.sh
@@ -30,9 +30,10 @@ install_bootstrap_ruby()
 {
   local bin_dir=$1
   local buildpack_dir=$2
+  local stack="${STACK:?Required env var STACK is not set}"
 
   # Multi-arch aware stack support
-  if [ "$STACK" == "heroku-24" ]; then
+  if [ "$stack" == "heroku-24" ]; then
     local arch
     arch=$(dpkg --print-architecture)
     local heroku_buildpack_ruby_dir="$buildpack_dir/vendor/ruby/$STACK/$arch"
@@ -154,3 +155,43 @@ compile_buildpack_v2()
   fi
 }
 
+# After a stack is EOL, updates to the buildpack may fail with unexpected or unhelpful errors.
+# This can happen when the buildpack is being used off of the platform such as with `dokku`
+# which is not officially supported.
+function checks::ensure_supported_stack() {
+	local stack="${1}"
+
+	case "${stack}" in
+		# When removing support from a stack, move it to the bottom of the list
+		heroku-22 | heroku-24)
+			return 0
+			;;
+		heroku-18 | heroku-20)
+			# This error will only ever be seen on non-Heroku environments, since the
+			# Heroku build system rejects builds using EOL stacks.
+			cat <<-EOF
+				Error: The '${stack}' stack is no longer supported.
+
+				This buildpack no longer supports the '${stack}' stack since it has
+				reached its end-of-life:
+				https://devcenter.heroku.com/articles/stack#stack-support-details
+
+				Upgrade to a newer stack to continue using this buildpack.
+			EOF
+			exit 1
+			;;
+		*)
+			cat <<-EOF
+				Error: The '${stack}' stack isn't recognised.
+
+				This buildpack doesn't recognise or support the '${stack}' stack.
+
+				If '${stack}' is a valid stack, make sure that you are using the latest
+				version of this buildpack and haven't pinned to an older release:
+				https://devcenter.heroku.com/articles/managing-buildpacks#view-your-buildpacks
+				https://devcenter.heroku.com/articles/managing-buildpacks#classic-buildpacks-references
+			EOF
+			exit 1
+			;;
+	esac
+}
diff --git a/bin/support/download_ruby b/bin/support/download_ruby
index 81522de35..0cc3832b6 100755
--- a/bin/support/download_ruby
+++ b/bin/support/download_ruby
@@ -51,7 +51,7 @@ fi
 
 mkdir -p "$RUBY_BOOTSTRAP_DIR"
 
-curl_retry_on_18 --fail --retry 3 --retry-connrefused --connect-timeout "${CURL_CONNECT_TIMEOUT:-3}" --silent --location -o "$RUBY_BOOTSTRAP_DIR/ruby.tgz" "$heroku_buildpack_ruby_url" || {
+curl_retry_on_18 --fail --show-error --retry 3 --retry-connrefused --connect-timeout "${CURL_CONNECT_TIMEOUT:-3}" --silent --location -o "$RUBY_BOOTSTRAP_DIR/ruby.tgz" "$heroku_buildpack_ruby_url" || {
 cat<
Date: Wed, 6 Aug 2025 19:53:15 +0000
Subject: [PATCH 1080/1195] Prepare release v316 (#1630)

Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com>
---
 CHANGELOG.md                                    | 6 +++++-
 changelogs/{unreleased => v316}/default_v339.md | 0
 lib/language_pack/version.rb                    | 2 +-
 3 files changed, 6 insertions(+), 2 deletions(-)
 rename changelogs/{unreleased => v316}/default_v339.md (100%)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index a5f351a63..854447a8e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,9 @@
 
 ## [Unreleased]
 
+
+## [v316] - 2025-08-06
+
 - Explicitly error on end-of-life (EOL) stack `heroku-20` (https://github.com/heroku/heroku-buildpack-ruby/pull/1629)
 - Default Ruby version is now 3.3.9 (https://github.com/heroku/heroku-buildpack-ruby/pull/1624)
 
@@ -1738,7 +1741,8 @@ Bugfixes:
 * Change gem detection to use lockfile parser
 * use `$RACK_ENV` when thin is detected for rack apps
 
-[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v315...main
+[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v316...main
+[v316]: https://github.com/heroku/heroku-buildpack-ruby/compare/v315...v316
 [v315]: https://github.com/heroku/heroku-buildpack-ruby/compare/v314...v315
 [v314]: https://github.com/heroku/heroku-buildpack-ruby/compare/v313...v314
 [v313]: https://github.com/heroku/heroku-buildpack-ruby/compare/v312...v313
diff --git a/changelogs/unreleased/default_v339.md b/changelogs/v316/default_v339.md
similarity index 100%
rename from changelogs/unreleased/default_v339.md
rename to changelogs/v316/default_v339.md
diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb
index a96ef42b7..e0793a318 100644
--- a/lib/language_pack/version.rb
+++ b/lib/language_pack/version.rb
@@ -2,6 +2,6 @@
 
 module LanguagePack
   class LanguagePack::Base
-    BUILDPACK_VERSION = "v315"
+    BUILDPACK_VERSION = "v316"
   end
 end

From 119931076d4286a5c8fc9db6adc4d37b7ec15b38 Mon Sep 17 00:00:00 2001
From: "heroku-linguist[bot]"
 <136119646+heroku-linguist[bot]@users.noreply.github.com>
Date: Thu, 7 Aug 2025 19:08:08 +0000
Subject: [PATCH 1081/1195] Prepare release v317 (#1631)

Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com>
---
 CHANGELOG.md                 | 8 +++++++-
 lib/language_pack/version.rb | 2 +-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 854447a8e..b0fa9cff3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,11 @@
 ## [Unreleased]
 
 
+## [v317] - 2025-08-07
+
+- JRuby 10.0.2.0 is now available
+
+
 ## [v316] - 2025-08-06
 
 - Explicitly error on end-of-life (EOL) stack `heroku-20` (https://github.com/heroku/heroku-buildpack-ruby/pull/1629)
@@ -1741,7 +1746,8 @@ Bugfixes:
 * Change gem detection to use lockfile parser
 * use `$RACK_ENV` when thin is detected for rack apps
 
-[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v316...main
+[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v317...main
+[v317]: https://github.com/heroku/heroku-buildpack-ruby/compare/v316...v317
 [v316]: https://github.com/heroku/heroku-buildpack-ruby/compare/v315...v316
 [v315]: https://github.com/heroku/heroku-buildpack-ruby/compare/v314...v315
 [v314]: https://github.com/heroku/heroku-buildpack-ruby/compare/v313...v314
diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb
index e0793a318..d263106f8 100644
--- a/lib/language_pack/version.rb
+++ b/lib/language_pack/version.rb
@@ -2,6 +2,6 @@
 
 module LanguagePack
   class LanguagePack::Base
-    BUILDPACK_VERSION = "v316"
+    BUILDPACK_VERSION = "v317"
   end
 end

From 388a518f24cccf1644a9190fb6db157504f56965 Mon Sep 17 00:00:00 2001
From: Richard Schneeman 
Date: Mon, 11 Aug 2025 12:15:21 -0500
Subject: [PATCH 1082/1195] Fix unbound variable warning (#1632)

* Fix variable scope

```
/var/lib/buildpack/bin/support/bash_functions.sh: line 53: heroku_buildpack_ruby_dir: unbound variable
```

* Prefer local variable

The local `stack` is set from `STACK` earlier. Prefer it everywhere in the function.

* Test behavior change

* CHANGELOG

* Change bash variable scope

The local `heroku_buildpack_ruby_dir` is not available inside of the function `atexit`. Moving the code out of a function means the local doesn't need to be present at exit.

* Remove vendored buildpack detection

The old buildpack logic would pre-vendor a Ruby version at deploy in `vendor/ruby/$stack/$arch` of the buildpack dir. There were problems when the Ruby buildpack was specified to run twice so a check was added for that condition.

The logic was changed to always download the Ruby verison and not pre-vendor details in the PR https://github.com/heroku/heroku-buildpack-ruby/pull/1481.

Since that's no longer happening, we can avoid the check and just create a tempdir every time. This simplifies the logic.

* Remove stack as it's no longer used

* Inline bash function

Fixing the previously hidden warning introduced a new error:

```
       remote: -----> Ruby app detected
       remote: /tmp/codon/tmp/buildpacks/ed3d993430eab40cdfcb6130d0909c19a1b9ae24/bin/compile: line 39: /tmp/tmp.Uu0SIOeXEb/bin/ruby: No such file or directory
```

What's happening here is that the `trap` to cleanup the bootstrap dir was firing on subshell exit, and since we were capturing the output of that function via `bootstrap_ruby=$(...)` it was creating the directory and immediately deleting it.

This was previously not a problem as the local variable scoping prevented the `rm -rf` from firing correctly. But fixing that variable scoping error introduced this problem. We can fix by moving that trap out of a sub-shell. Since this function is really only 3 lines long at this point, there's not much benefit in having it as a function, especially if it cannot provide the automatic cleanup behavior as desired.
---
 CHANGELOG.md                  |  1 +
 bin/compile                   |  6 +++--
 bin/support/bash_functions.sh | 48 -----------------------------------
 bin/test                      |  6 +++--
 bin/test-compile              |  6 +++--
 spec/hatchet/ruby_spec.rb     |  2 ++
 6 files changed, 15 insertions(+), 54 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index b0fa9cff3..a44904031 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,7 @@
 
 ## [Unreleased]
 
+- Fix `heroku_buildpack_ruby_dir: unbound variable` warning (https://github.com/heroku/heroku-buildpack-ruby/pull/1632)
 
 ## [v317] - 2025-08-07
 
diff --git a/bin/compile b/bin/compile
index 29c0c9e11..77f8f449e 100755
--- a/bin/compile
+++ b/bin/compile
@@ -8,14 +8,16 @@ BUILD_DIR=$1
 CACHE_DIR=$2
 ENV_DIR=$3
 BIN_DIR=$(cd "$(dirname "$0")" || exit; pwd) # absolute path
-BUILDPACK_DIR=$(dirname "$BIN_DIR")
 
 # shellcheck source=bin/support/bash_functions.sh
 source "$BIN_DIR/support/bash_functions.sh"
 
 checks::ensure_supported_stack "${STACK:?Required env var STACK is not set}"
 
-bootstrap_ruby_dir=$(install_bootstrap_ruby "$BIN_DIR" "$BUILDPACK_DIR")
+bootstrap_ruby_dir=$(mktemp -d)
+"$BIN_DIR"/support/download_ruby "$BIN_DIR" "$bootstrap_ruby_dir"
+trap 'rm -rf "$bootstrap_ruby_dir"' EXIT
+
 export PATH="$bootstrap_ruby_dir/bin/:$PATH"
 unset GEM_PATH
 
diff --git a/bin/support/bash_functions.sh b/bin/support/bash_functions.sh
index c5043c89e..93375724d 100755
--- a/bin/support/bash_functions.sh
+++ b/bin/support/bash_functions.sh
@@ -10,54 +10,6 @@ curl_retry_on_18() {
   return $ec
 }
 
-# This function will install a version of Ruby onto the
-# system for the buildpack to use. It coordinates download
-# and setting appropriate env vars for execution
-#
-# Example:
-#
-#   install_bootstrap_ruby "$BIN_DIR" "$BUILDPACK_DIR"
-#
-# Takes two arguments, the first is the location of the buildpack's
-# `bin` directory. This is where the `download_ruby` script can be
-# found. The second argument is the root directory where Ruby
-# can be installed.
-#
-# This function relies on the env var `$STACK` being set. This
-# is set in codon outside of the buildpack. An example of a stack
-# would be "heroku-24".
-install_bootstrap_ruby()
-{
-  local bin_dir=$1
-  local buildpack_dir=$2
-  local stack="${STACK:?Required env var STACK is not set}"
-
-  # Multi-arch aware stack support
-  if [ "$stack" == "heroku-24" ]; then
-    local arch
-    arch=$(dpkg --print-architecture)
-    local heroku_buildpack_ruby_dir="$buildpack_dir/vendor/ruby/$STACK/$arch"
-  else
-    local heroku_buildpack_ruby_dir="$buildpack_dir/vendor/ruby/$STACK"
-  fi
-
-  # The -d flag checks to see if a file exists and is a directory.
-  # This directory may be non-empty if a previous compile has
-  # already placed a Ruby executable here.
-  if [ ! -d "$heroku_buildpack_ruby_dir" ]; then
-    heroku_buildpack_ruby_dir=$(mktemp -d)
-    # bootstrap ruby
-    "$bin_dir"/support/download_ruby "$bin_dir" "$heroku_buildpack_ruby_dir"
-    function atexit {
-      # shellcheck disable=SC2317
-      rm -rf "$heroku_buildpack_ruby_dir"
-    }
-    trap atexit EXIT
-  fi
-
-  echo "$heroku_buildpack_ruby_dir"
-}
-
 which_java()
 {
   which java > /dev/null
diff --git a/bin/test b/bin/test
index 915d5e869..467880514 100755
--- a/bin/test
+++ b/bin/test
@@ -5,12 +5,14 @@
 set -euo pipefail
 
 BIN_DIR=$(cd "$(dirname "$0")" || exit; pwd) # absolute path
-BUILDPACK_DIR=$(dirname "$BIN_DIR")
 
 # shellcheck source=bin/support/bash_functions.sh
 source "$BIN_DIR/support/bash_functions.sh"
 
-bootstrap_ruby_dir=$(install_bootstrap_ruby "$BIN_DIR" "$BUILDPACK_DIR")
+bootstrap_ruby_dir=$(mktemp -d)
+"$BIN_DIR"/support/download_ruby "$BIN_DIR" "$bootstrap_ruby_dir"
+trap 'rm -rf "$bootstrap_ruby_dir"' EXIT
+
 export PATH="$bootstrap_ruby_dir/bin/:$PATH"
 unset GEM_PATH
 
diff --git a/bin/test-compile b/bin/test-compile
index cc4565ca0..f72a2ca87 100755
--- a/bin/test-compile
+++ b/bin/test-compile
@@ -6,12 +6,14 @@ BUILD_DIR=$1
 CACHE_DIR=$2
 ENV_DIR=$3
 BIN_DIR=$(cd "$(dirname "$0")" || exit; pwd) # absolute path
-BUILDPACK_DIR=$(dirname "$BIN_DIR")
 
 # shellcheck source=bin/support/bash_functions.sh
 source "$BIN_DIR/support/bash_functions.sh"
 
-bootstrap_ruby_dir=$(install_bootstrap_ruby "$BIN_DIR" "$BUILDPACK_DIR")
+bootstrap_ruby_dir=$(mktemp -d)
+"$BIN_DIR"/support/download_ruby "$BIN_DIR" "$bootstrap_ruby_dir"
+trap 'rm -rf "$bootstrap_ruby_dir"' EXIT
+
 export PATH="$bootstrap_ruby_dir/bin/:$PATH"
 unset GEM_PATH
 
diff --git a/spec/hatchet/ruby_spec.rb b/spec/hatchet/ruby_spec.rb
index b609584c9..51c63d502 100644
--- a/spec/hatchet/ruby_spec.rb
+++ b/spec/hatchet/ruby_spec.rb
@@ -246,6 +246,8 @@
         end
 
         app.deploy do |app|
+          expect(app.output).to_not include("unbound variable")
+
           # Intentionally different than the default ruby version
           expect(app.output).to         match("#{version}")
           expect(app.run("ruby -v")).to match("#{version}")

From a6d124492aafe7f7ee0dd42d7a79284b6552d675 Mon Sep 17 00:00:00 2001
From: "heroku-linguist[bot]"
 <136119646+heroku-linguist[bot]@users.noreply.github.com>
Date: Mon, 11 Aug 2025 18:27:59 +0000
Subject: [PATCH 1083/1195] Prepare release v318 (#1633)

Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com>
---
 CHANGELOG.md                 | 6 +++++-
 lib/language_pack/version.rb | 2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index a44904031..4a95f84cb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,9 @@
 
 ## [Unreleased]
 
+
+## [v318] - 2025-08-11
+
 - Fix `heroku_buildpack_ruby_dir: unbound variable` warning (https://github.com/heroku/heroku-buildpack-ruby/pull/1632)
 
 ## [v317] - 2025-08-07
@@ -1747,7 +1750,8 @@ Bugfixes:
 * Change gem detection to use lockfile parser
 * use `$RACK_ENV` when thin is detected for rack apps
 
-[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v317...main
+[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v318...main
+[v318]: https://github.com/heroku/heroku-buildpack-ruby/compare/v317...v318
 [v317]: https://github.com/heroku/heroku-buildpack-ruby/compare/v316...v317
 [v316]: https://github.com/heroku/heroku-buildpack-ruby/compare/v315...v316
 [v315]: https://github.com/heroku/heroku-buildpack-ruby/compare/v314...v315
diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb
index d263106f8..55b36d622 100644
--- a/lib/language_pack/version.rb
+++ b/lib/language_pack/version.rb
@@ -2,6 +2,6 @@
 
 module LanguagePack
   class LanguagePack::Base
-    BUILDPACK_VERSION = "v317"
+    BUILDPACK_VERSION = "v318"
   end
 end

From c8ab72913e0f655e806236ff082c7e39fd7e1146 Mon Sep 17 00:00:00 2001
From: Richard Schneeman 
Date: Tue, 26 Aug 2025 05:25:37 -0500
Subject: [PATCH 1084/1195] Track origin of Ruby version (#1636)

* Track origin of Ruby version

Previously "default" was a boolean. In the future we will add other locations such as the `.ruby-version` file.

GUS-W-19310637

* Track unique version number

Both JRuby and MRI share the same `ruby.version` value. i.e. `3.4.2` to distinguish we are switching to the `version-for-download` which includes the information about the engine, this will make queries more clear whether they include jruby or not.

The prior value is moved to "spec" version as engines such as JRuby will implement to a spec such as `3.4.2`.

GUS-W-19310643

* Update key names

Brings key names closer to python's https://github.com/heroku/heroku-buildpack-python/blob/3c27de9acc7a7bbcaf27d281e1381cd81c793999/bin/report#L69-L72. Adds docs over each since the names alone might be confusing.
---
 .../installers/heroku_ruby_installer.rb       | 36 ++++++++---
 lib/language_pack/ruby_version.rb             | 16 ++++-
 spec/hatchet/ruby_spec.rb                     |  2 +-
 spec/helpers/heroku_ruby_installer_spec.rb    | 63 +++++++++++++++----
 4 files changed, 94 insertions(+), 23 deletions(-)

diff --git a/lib/language_pack/installers/heroku_ruby_installer.rb b/lib/language_pack/installers/heroku_ruby_installer.rb
index a79cc97ec..e7465d914 100644
--- a/lib/language_pack/installers/heroku_ruby_installer.rb
+++ b/lib/language_pack/installers/heroku_ruby_installer.rb
@@ -21,14 +21,36 @@ def initialize(stack: , multi_arch_stacks: , arch: , report: HerokuBuildReport::
 
   def install(ruby_version, install_dir)
     @report.capture(
-      "ruby.version" => ruby_version.ruby_version,
-      "ruby.engine" => ruby_version.engine,
-      "ruby.engine.version" => ruby_version.engine_version,
-      "ruby.major" => ruby_version.major,
-      "ruby.minor" => ruby_version.minor,
-      "ruby.patch" => ruby_version.patch,
-      "ruby.default" => ruby_version.default?,
+      # i.e. `jruby` or `ruby`
+      "ruby_version_engine" => ruby_version.engine,
+      # i.e. `ruby-3.4.2-jruby-10.0.2.0` or `ruby-3.4.2` or `ruby-3.5.0.pre1`
+      "ruby_version_unique" => ruby_version.version_for_download,
+      # i.e. `default` or `Gemfile.lock`
+      "ruby_version_origin" => ruby_version.default? ? "default" : "Gemfile.lock",
     )
+
+    case ruby_version.engine
+    when :ruby
+      @report.capture(
+        "ruby_version_major_minor" => "#{ruby_version.major}.#{ruby_version.minor}",
+        "ruby_version_full" => ruby_version.engine_version_full
+      )
+    when :jruby
+      @report.capture(
+        # i.e. `3.4.2` the target spec ruby version
+        "jruby_version_ruby_version" => ruby_version.ruby_version,
+        # i.e. `10.0.2.0` the version of jruby
+        "jruby_version_full" => ruby_version.engine_version_full,
+        # i.e. `9.4` or `10.0`
+        "jruby_version_major_minor" => [
+          ruby_version.engine_version.split(".")[0],
+          ruby_version.engine_version.split(".")[1]
+        ].join(".")
+      )
+    else
+      raise "Internal error: Unknown engine: #{ruby_version.engine}"
+    end
+
     fetch_unpack(ruby_version, install_dir)
     setup_binstubs(install_dir)
   end
diff --git a/lib/language_pack/ruby_version.rb b/lib/language_pack/ruby_version.rb
index 2f19c7c45..e35d48da8 100644
--- a/lib/language_pack/ruby_version.rb
+++ b/lib/language_pack/ruby_version.rb
@@ -88,14 +88,26 @@ def initialize(
         @engine_version = engine_version
     end
 
+    # Also used as for metrics to track unique installs
     # i.e. `ruby-3.4.2`
     def version_for_download
       if @engine == :jruby
         "ruby-#{ruby_version}-jruby-#{engine_version}"
+      else
+        "ruby-#{engine_version_full}"
+      end
+    end
+
+    # Full qualifier for the version including pre-release information
+    # i.e. `3.5.0.preview1` or `3.5.0` or `3.5.0.rc1` for ruby
+    # i.e. `9.4.9.0` for jruby
+    def engine_version_full
+      if @engine == :jruby
+        engine_version
       elsif @pre
-        "ruby-#{ruby_version}.#{@pre}"
+        "#{engine_version}.#{@pre}"
       else
-        "ruby-#{ruby_version}"
+        "#{engine_version}"
       end
     end
 
diff --git a/spec/hatchet/ruby_spec.rb b/spec/hatchet/ruby_spec.rb
index 51c63d502..2961c6ca8 100644
--- a/spec/hatchet/ruby_spec.rb
+++ b/spec/hatchet/ruby_spec.rb
@@ -189,7 +189,7 @@
             expect(report_match).to be_truthy
             yaml = report_match[:yaml].gsub(/remote: /, "")
             report = YAML.load(yaml)
-            expect(report.fetch("ruby.version")).to eq(expected)
+            expect(report.fetch("ruby_version_full")).to eq(expected)
           rescue Exception => e
             puts app.output
             puts yaml if yaml
diff --git a/spec/helpers/heroku_ruby_installer_spec.rb b/spec/helpers/heroku_ruby_installer_spec.rb
index d9ee8cc56..40b2721f1 100644
--- a/spec/helpers/heroku_ruby_installer_spec.rb
+++ b/spec/helpers/heroku_ruby_installer_spec.rb
@@ -10,6 +10,10 @@ def installer(report: HerokuBuildReport::GLOBAL)
     )
   end
 
+  def sort_hash(hash)
+    hash.sort_by { |k, _| k.to_s }.to_h
+  end
+
   def ruby_version
     LanguagePack::RubyVersion.bundle_platform_ruby(bundler_output: "ruby-3.1.7")
   end
@@ -26,7 +30,7 @@ def ruby_version
     end
   end
 
-  describe "#install" do
+  describe "ruby installation" do
     it "should install ruby and setup binstubs" do
       Dir.mktmpdir do |dir|
         Dir.chdir(dir) do
@@ -37,12 +41,41 @@ def ruby_version
           expect(File.symlink?("#{dir}/bin/ruby.exe")).to be true
           expect(File).to exist("#{dir}/vendor/ruby/bin/ruby")
 
-          expect(report.data["ruby.version"]).to eq("3.1.7")
-          expect(report.data["ruby.engine"]).to eq(:ruby)
-          expect(report.data["ruby.engine.version"]).to eq(report.data["ruby.version"])
-          expect(report.data["ruby.major"]).to eq(3)
-          expect(report.data["ruby.minor"]).to eq(1)
-          expect(report.data["ruby.patch"]).to eq(7)
+          expected = {
+            "ruby_version_engine" => :ruby,
+            "ruby_version_full" => "3.1.7",
+            "ruby_version_major_minor" => "3.1",
+            "ruby_version_origin" => "Gemfile.lock",
+            "ruby_version_unique" => "ruby-3.1.7"
+          }
+
+          expect(sort_hash(report.data)).to eq(sort_hash(expected))
+        end
+      end
+    end
+
+    it "should work with pre-release versions" do
+      Dir.mktmpdir do |dir|
+        Dir.chdir(dir) do
+          report = HerokuBuildReport.dev_null
+          installer(report: report).install(
+            LanguagePack::RubyVersion.bundle_platform_ruby(bundler_output: "ruby-3.5.0.preview1"),
+            "#{dir}/vendor/ruby"
+          )
+
+          expect(File.symlink?("#{dir}/bin/ruby")).to be true
+          expect(File.symlink?("#{dir}/bin/ruby.exe")).to be true
+          expect(File).to exist("#{dir}/vendor/ruby/bin/ruby")
+
+          expected = {
+            "ruby_version_engine" => :ruby,
+            "ruby_version_major_minor" => "3.5",
+            "ruby_version_full" => "3.5.0.preview1",
+            "ruby_version_origin" => "Gemfile.lock",
+            "ruby_version_unique" => "ruby-3.5.0.preview1"
+          }
+
+          expect(sort_hash(report.data)).to eq(sort_hash(expected))
         end
       end
     end
@@ -62,12 +95,16 @@ def ruby_version
             "#{dir}/vendor/ruby"
           )
 
-          expect(report.data["ruby.version"]).to eq("3.1.4")
-          expect(report.data["ruby.engine"]).to eq(:jruby)
-          expect(report.data["ruby.engine.version"]).to eq("9.4.9.0")
-          expect(report.data["ruby.major"]).to eq(3)
-          expect(report.data["ruby.minor"]).to eq(1)
-          expect(report.data["ruby.patch"]).to eq(4)
+          expected = {
+            "ruby_version_engine" => :jruby,
+            "jruby_version_full" => "9.4.9.0",
+            "jruby_version_major_minor" => "9.4",
+            "jruby_version_ruby_version" => "3.1.4",
+            "ruby_version_origin" => "Gemfile.lock",
+            "ruby_version_unique" => "ruby-3.1.4-jruby-9.4.9.0"
+          }
+
+          expect(sort_hash(report.data)).to eq(sort_hash(expected))
         end
       end
     end

From 7e97aa63401842fe140283d77a099d86f30e0653 Mon Sep 17 00:00:00 2001
From: Richard Schneeman 
Date: Tue, 26 Aug 2025 16:26:25 -0500
Subject: [PATCH 1085/1195] Add bash based metrics collection (#1635)

* Introduce bash based metrics

* Fix/test duration metrics test

* Standardize on Ruby yaml format

* Shellcheck metrics file

* Re-use bash YAML file in Ruby

* Capture problems with build report file

If the env var is missing or the file does not exist, print that information.

* Add docs to bin/report

* Stricter bash

* Capture manually installing JVM

* Capture known stack failures

* Add failure reasons for compile_buildpack_v2

* Capture if `which java` is detected

* Move metrics into main bash functions file

Simplifies calling metrics functions inside of bash functions, and it's relatively small.

* Namespace env var

* Capture boostrap failure

* Fix Shellcheck

```
Run shellcheck bin/support/bash_functions.sh bin/support/download_ruby -x &&

In bin/support/bash_functions.sh line 234:
	local timestamp=$(date +%s%3N 2>/dev/null)
              ^-------^ SC2155 (warning): Declare and assign separately to avoid masking return values.

In bin/support/bash_functions.sh line 243:
	local seconds=$(date +%s)
              ^-----^ SC2155 (warning): Declare and assign separately to avoid masking return values.

In bin/support/bash_functions.sh line 244:
	local nanoseconds=$(date +%N 2>/dev/null || echo "000000000")
              ^---------^ SC2155 (warning): Declare and assign separately to avoid masking return values.
```

* Changelog

* Fix missing export

```
       +remote: Updated 2 paths from 60b426a
       +remote: Compressing source files... done.
       +remote: Building source:
       +remote:
       +remote: -----> Building on the Heroku-24 stack
       +remote: -----> Using buildpack: https://github.com/heroku/heroku-buildpack-ruby#schneems/bash-metrics-initial
       +remote: -----> Ruby app detected
       +remote: /tmp/codon/tmp/buildpacks/bc6628ed5814e6d8925d4527655dd8e7dda421f4/bin/support/ruby_compile:14:in `fetch': key not found: "HEROKU_RUBY_BUILD_REPORT_FILE" (KeyError)
       +remote: 	from /tmp/codon/tmp/buildpacks/bc6628ed5814e6d8925d4527655dd8e7dda421f4/bin/support/ruby_compile:14:in `
' +remote: ! Push rejected, failed to compile Ruby app. +remote: +remote: ! Push failed +remote: Verifying deploy... +remote: +remote: ! Push rejected to hatchet-t-90251d64ed. +remote: +To https://git.heroku.com/hatchet-t-90251d64ed.git + ! [remote rejected] HEAD -> main (pre-receive hook declined) +error: failed to push some refs to 'https://git.heroku.com/hatchet-t-90251d64ed.git' # ./vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.4/lib/rspec/support.rb:110:in `block in ' ``` * Fix shellcheck ``` In bin/compile line 12: BUILDPACK_DIR=$(cd "$(dirname "$(dirname "${BASH_SOURCE[0]}")")" && pwd) ^-----------^ SC2034 (warning): BUILDPACK_DIR appears unused. Verify use (or export if used externally). In bin/test line 9: BUILDPACK_DIR=$(cd "$(dirname "$(dirname "${BASH_SOURCE[0]}")")" && pwd) ^-----------^ SC2034 (warning): BUILDPACK_DIR appears unused. Verify use (or export if used externally). In bin/test line 15: metrics::init "${CACHE_DIR}" ^----------^ SC2153 (info): Possible misspelling: CACHE_DIR may not be assigned. Did you mean cache_dir? In bin/test-compile line 12: BUILDPACK_DIR=$(cd "$(dirname "$(dirname "${BASH_SOURCE[0]}")")" && pwd) ^-----------^ SC2034 (warning): BUILDPACK_DIR appears unused. Verify use (or export if used externally). For more information: https://www.shellcheck.net/wiki/SC2034 -- BUILDPACK_DIR appears unused. Ver... https://www.shellcheck.net/wiki/SC2153 -- Possible misspelling: CACHE_DIR m... ``` * Add and fix shellcheck for bin/report * Fix docs * Fix spec The file now relies on importing bash functions which weren't being copied. This fixes the error. * bin/test has no cache dir ``` $ bin/test BUILD_DIR ENV_DIR ``` https://devcenter.heroku.com/articles/testpack-api * Use JSON for bash metrics The python buildpack was modified to use JSON instead of YAML as it's easier to use `jq` to format and handle issues such as escaping. This preserves the same API, but changes the format and adopts the strategy from https://github.com/heroku/heroku-buildpack-python/pull/1878. * Update Ruby build report to use json output Previously the bash build output helpers were adjusted to emit json. This wires up the Ruby metrics code to be compatible with that change. * Apply suggestions from code review Co-authored-by: Ed Morley <501702+edmorley@users.noreply.github.com> Signed-off-by: Richard Schneeman * Use EPOCHREALTIME Inspired by https://github.com/heroku/heroku-buildpack-python/pull/1881. This works locally and on Heroku. It works in bash, but not zsh by default (have to `zmodload zsh/datetime` to get it to work). We're explicitly using bash in these scripts. * metrics:: prefix to build_data:: prefix Metrics implies numeric data. While we derive numeric data by counting the outputs, it contains other values and has other uses. `build_data` is an accurate representation of the domain. * Update bash docs Switched from emitting YMAL to emitting JSON. * Change metric name Address feedback from https://github.com/heroku/heroku-buildpack-ruby/pull/1635/files#r2293428233 > (optional) If I were looking through a Ruby event in Honeycomb (eg if I were paged in the night) and saw a field named which_java I might struggle to understand what it meant. My first guess is that the values for such a key would be the path to the Java being used or similar, rather than a bool. Is there another name that might be clearer here and less coupled to the Bash function names? Switching away from boolean and to a string field with two values either `ruby_buildpack` or `previously_installed` * Delete removed function * Remove error handling from printing Comment https://github.com/heroku/heroku-buildpack-ruby/pull/1635/files#r2293616228 ``` I'm not too sure about this error handling implementation. If the env var isn't set, it's a buildpack bug, and with the :-'(unset) fallback removed that bug would correctly be caught by bash error on undefined env vars (which which file enables). As-is, this fallback masks the issue and causes bin/report to exit zero when it actually hit an internal error case. Also, if the report file is missing, that's also an internal buildpack bug (and not a user facing error case). Currently cytokine logs an error if a buildpack has a bin/report and it exits 1 (having set a minimal build report), which I think might be a better way to catch these cases? If we did still want to customise the report in this scenario, implementing it in cytokine (rather than each buildpack) would allow standardising across buildpacks more easily. ``` Adds in a check for when the exported env var HEROKU_RUBY_BUILD_REPORT_FILE is mutated to error. * print -> print_bin_report_json Align API with python https://github.com/heroku/heroku-buildpack-python/blob/30086f2e8da2bf50d1b669b2e9ca82d479bf0892/lib/build_data.sh * Update docs * Use /dev/null in unsupported bin/ executables The bin/report script does not work on bin/test-compile or bin/test. We don't want to hint that data can be collected about usage in those cases. The shared code still calls `build_data::kv` functions so those need to not error. Setting to `/dev/null` allows these calls to work without error even if no data is being collected. * Update docs * Update shellcheck CI call So we don't forget any files by mistake https://github.com/heroku/heroku-buildpack-ruby/pull/1635#discussion_r2293351740 * Fix test We have another test for when the variables differ, this test is supposed to show using a bad file raises an error. Fixes this failure 1) Bash functions metrics prints error when report env var is set to a non-existent file Failure/Error: expect(out).to include("No such file or directory") expected "Error: HEROKU_RUBY_BUILD_REPORT_FILE does not match BUILD_DATA_FILE\nHEROKU_RUBY_BUILD_REPORT_FILE: /dev/null\nBUILD_DATA_FILE: /var/folders/yr/yytf3z3n3q336f1tj2b2j0gw0000gn/T/d20250822-87942-cz2rfj/does-not-exist\n" to include "No such file or directory" Diff: @@ -1 +1,3 @@ -No such file or directory +Error: HEROKU_RUBY_BUILD_REPORT_FILE does not match BUILD_DATA_FILE +HEROKU_RUBY_BUILD_REPORT_FILE: /dev/null +BUILD_DATA_FILE: /var/folders/yr/yytf3z3n3q336f1tj2b2j0gw0000gn/T/d20250822-87942-cz2rfj/does-not-exist # /Users/rschneeman/.gem/ruby/3.3.9/gems/rspec-support-3.13.4/lib/rspec/support.rb:110:in `block in ' # /Users/rschneeman/.gem/ruby/3.3.9/gems/rspec-support-3.13.4/lib/rspec/support.rb:119:in `notify_failure' * Prefer bash if/else Mentioned in https://github.com/heroku/heroku-buildpack-ruby/pull/1635#discussion_r2293410457 the `|| {}` style of bash error handling was not behaving as expected. * Fix missing error output Before ``` -----> Downloading Buildpack: heroku/jvm ``` After ``` -----> Downloading Buildpack: heroku/jvm curl: (22) The requested URL returned error: 403 Failed to download https://buildpack-registry.s3.us-east-1.amazonaws.com/buildpacks/heroku/oops.tgz ``` * Prefer quiet commands to routing to dev/null - tar: Remove verbose `v` - git clone: Add --quiet * Track loading bad json results in metric When deserializing a prior json input fails, capture that status. This doesn't technically * Apply suggestions from code review Co-authored-by: Ed Morley <501702+edmorley@users.noreply.github.com> Signed-off-by: Richard Schneeman * Add .rb suffix to ruby executables This provides a more robust grep for the shellcheck exclude. https://github.com/heroku/heroku-buildpack-ruby/pull/1635#discussion_r2296086270 * Fix Error Calling `build_data::init "/dev/null" does not actually allow `build_data::kv_*` calls as it behaves differently than the test. It sets the data file to `/dev/null/build-data/ruby.json` which doesn't exist so those calls fail. The default of that file is already `/dev/null` we can use that instead. https://github.com/heroku/heroku-buildpack-ruby/pull/1635#discussion_r2296103747 * Use null termination for xargs inputs The shellcheck command now uses git ls-files -z to output null-separated file paths, which requires xargs -0 to properly handle filenames containing spaces or special characters. Without the -0 flag, xargs treats newlines as separators and may incorrectly parse complex file paths, leading to unreliable behavior when processing the file list. Added a link to docs that mention the exclude syntax > After a path matches any non-exclude pathspec, it will be run through all exclude pathspecs (magic signature: ! or its synonym ^). If it matches, the path is ignored. When there is no non-exclude pathspec, the exclusion is applied to the result set as if invoked without any pathspec. * Use verbose `git ls-files` exclude syntax > "In the long form, the leading colon : is followed by an open parenthesis (, a comma-separated list of zero or more "magic words", and a close parentheses ), and the remainder is the pattern to match against the path." It's not clear looking at the docs but the header itself qualifies as a "magic word" ``` exclude After a path matches any non-exclude pathspec, it will be run through all exclude pathspecs (magic signature: ! or its synonym ^). If it matches, the path is ignored. When there is no non-exclude pathspec, the exclusion is applied to the result set as if invoked without any pathspec. ``` This allows us to use `(exclude)` as syntax here. https://github.com/heroku/heroku-buildpack-ruby/pull/1635#discussion_r2300592267 --------- Signed-off-by: Richard Schneeman Co-authored-by: Ed Morley <501702+edmorley@users.noreply.github.com> --- .github/workflows/ci.yml | 6 +- CHANGELOG.md | 1 + bin/compile | 14 +- bin/report | 38 ++- bin/support/bash_functions.sh | 251 ++++++++++++++++-- bin/support/download_ruby | 6 +- bin/support/{ruby_compile => ruby_compile.rb} | 8 +- ...ruby_test-compile => ruby_test-compile.rb} | 0 bin/support/{ruby_test => ruby_test.rb} | 0 bin/test | 9 +- bin/test-compile | 11 +- hatchet.lock | 2 +- lib/heroku_build_report.rb | 33 ++- spec/hatchet/ruby_spec.rb | 7 +- spec/helpers/bundler_wrapper_spec.rb | 2 +- spec/helpers/heroku_build_report_spec.rb | 57 ++-- spec/unit/bash_functions_spec.rb | 134 +++++++++- 17 files changed, 501 insertions(+), 78 deletions(-) rename bin/support/{ruby_compile => ruby_compile.rb} (86%) rename bin/support/{ruby_test-compile => ruby_test-compile.rb} (100%) rename bin/support/{ruby_test => ruby_test.rb} (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e5104519e..84bea42fd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,8 +18,10 @@ jobs: uses: actions/checkout@v4 - name: Run ShellCheck bin top level run: | - shellcheck bin/support/bash_functions.sh bin/support/download_ruby -x && - shellcheck bin/compile bin/detect bin/release bin/test bin/test-compile -x + # All bash files that don't end in '.rb' + # https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefpathspecapathspec + git ls-files -z --cached --others --exclude-standard ':(exclude)*.rb' 'bin/*' '*/bin/*' '*.sh' | \ + xargs -0 shellcheck --check-sourced --color=always integration-test: runs-on: ubuntu-24.04 diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a95f84cb..4e84f4a69 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## [Unreleased] +- Add bash based failure metrics reporting for `bin/report`. This allows the buildpack to distinguish beteween types of failures that occur before Ruby code in the buildpack has executed (such as when bootstrapping). (https://github.com/heroku/heroku-buildpack-ruby/pull/1635) ## [v318] - 2025-08-11 diff --git a/bin/compile b/bin/compile index 77f8f449e..952cdd340 100755 --- a/bin/compile +++ b/bin/compile @@ -12,10 +12,19 @@ BIN_DIR=$(cd "$(dirname "$0")" || exit; pwd) # absolute path # shellcheck source=bin/support/bash_functions.sh source "$BIN_DIR/support/bash_functions.sh" +# Initialize metrics for bin/report +build_data::init "${CACHE_DIR}" +build_data::clear + checks::ensure_supported_stack "${STACK:?Required env var STACK is not set}" bootstrap_ruby_dir=$(mktemp -d) -"$BIN_DIR"/support/download_ruby "$BIN_DIR" "$bootstrap_ruby_dir" +if "$BIN_DIR"/support/download_ruby "$BIN_DIR" "$bootstrap_ruby_dir"; then + : +else + build_data::kv_string "failure_reason" "bootstrap_ruby_fail" + exit 1 +fi trap 'rm -rf "$bootstrap_ruby_dir"' EXIT export PATH="$bootstrap_ruby_dir/bin/:$PATH" @@ -35,7 +44,8 @@ if detect_needs_java "$BUILD_DIR"; then EOM + build_data::kv_string "java_origin" "ruby_buildpack" compile_buildpack_v2 "$BUILD_DIR" "$CACHE_DIR" "$ENV_DIR" "https://buildpack-registry.s3.us-east-1.amazonaws.com/buildpacks/heroku/jvm.tgz" "heroku/jvm" fi -"$bootstrap_ruby_dir"/bin/ruby "$BIN_DIR/support/ruby_compile" "$@" +"$bootstrap_ruby_dir"/bin/ruby "$BIN_DIR/support/ruby_compile.rb" "$@" diff --git a/bin/report b/bin/report index 7e7a33331..6e9bf2662 100755 --- a/bin/report +++ b/bin/report @@ -1,13 +1,35 @@ #!/usr/bin/env bash +# Usage: bin/report + +# Produces a build report containing metadata about the build, that's consumed by the build system. +# This script is run for both successful and failing builds, so it should not assume the build ran +# to completion (e.g. Python or other tools may not even have been installed). +# +# Metrics are collected from the part of the buildpack written in Ruby and the +# part written in Bash (that is used to bootstrap Ruby). They both write to the +# same JSON file on disk. +# +# Metadata must be emitted to stdout as valid un-nested json (values must not be objects or arrays). +# +# Example valid stdout: +# { +# "ruby_version": "X.Y.Z", +# "ruby_install_duration": 1.234 +# } +# +# Failures in this script don't cause the overall build to fail (and won't appear in user +# facing build logs) to avoid breaking builds unnecessarily / causing confusion. To debug +# issues check the internal build system logs for `buildpack.report.failed` events, or +# when developing run `make run` in this repo locally, which runs `bin/report` too. set -euo pipefail CACHE_DIR="${2}" -REPORT_FILE="${CACHE_DIR}/.heroku/ruby/build_report.yml" - -# Whilst the release file is always written by the buildpack, some apps use -# third-party slug cleaner buildpacks to remove this and other files, so we -# cannot assume it still exists by the time the release step runs. -if [[ -f "${REPORT_FILE}" ]]; then - cat "${REPORT_FILE}" -fi +# The absolute path to the root of the buildpack. +BIN_DIR=$(cd "$(dirname "$0")" || exit; pwd) # absolute path + +# Initialize metrics for bin/report +# shellcheck source=bin/support/bash_functions.sh +source "$BIN_DIR/support/bash_functions.sh" +build_data::init "${CACHE_DIR}" +build_data::print_bin_report_json diff --git a/bin/support/bash_functions.sh b/bin/support/bash_functions.sh index 93375724d..8545ce81c 100755 --- a/bin/support/bash_functions.sh +++ b/bin/support/bash_functions.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +set -euo pipefail + curl_retry_on_18() { local ec=18; local attempts=0; @@ -25,6 +27,7 @@ detect_needs_java() local skip_java_install=1 if which_java; then + build_data::kv_string "java_origin" "previously_installed" return $skip_java_install fi @@ -64,45 +67,77 @@ compile_buildpack_v2() if [[ "$url" =~ \.tgz$ ]] || [[ "$url" =~ \.tgz\? ]]; then mkdir -p "$dir" - curl_retry_on_18 -s --fail --retry 3 --retry-connrefused --connect-timeout "${CURL_CONNECT_TIMEOUT:-3}" "$url" | tar xvz -C "$dir" >/dev/null 2>&1 + if curl_retry_on_18 -s --fail --show-error --retry 3 --retry-connrefused --connect-timeout "${CURL_CONNECT_TIMEOUT:-3}" "$url" | tar xz -C "$dir"; then + : + else + echo "Failed to download $url" + build_data::kv_string "failure_reason" "compile_buildpack_v2_download_fail" + build_data::kv_string "failure_detail" "url: $url" + exit 1 + fi else - git clone "$url" "$dir" >/dev/null 2>&1 + if git clone --quiet "$url" "$dir"; then + : + else + echo "Failed to clone $url" + build_data::kv_string "failure_reason" "compile_buildpack_v2_download_fail" + build_data::kv_string "failure_detail" "url: $url" + exit 1 + fi fi cd "$dir" || return if [ "$branch" != "" ]; then - git checkout "$branch" >/dev/null 2>&1 + if git checkout "$branch" >/dev/null 2>&1; then + : + else + echo "Failed to checkout branch $branch" + build_data::kv_string "failure_reason" "compile_buildpack_v2_checkout_fail" + build_data::kv_string "failure_detail" "buildpack: $buildpack, branch: $branch" + exit 1 + fi fi # we'll get errors later if these are needed and don't exist chmod -f +x "$dir/bin/{detect,compile,release}" || true - framework=$("$dir"/bin/detect "$build_dir") + if framework=$("$dir"/bin/detect "$build_dir"); then + : + else + echo "Couldn't detect any framework for this buildpack. Exiting." + build_data::kv_string "failure_reason" "compile_buildpack_v2_detect_fail" + build_data::kv_string "failure_detail" "buildpack: $buildpack" - # shellcheck disable=SC2181 - if [ $? == 0 ]; then - echo "-----> Detected Framework: $framework" - "$dir"/bin/compile "$build_dir" "$cache_dir" "$env_dir" + exit 1 + fi - # shellcheck disable=SC2181 - if [ $? != 0 ]; then - exit 1 - fi + echo "-----> Detected Framework: $framework" + if "$dir"/bin/compile "$build_dir" "$cache_dir" "$env_dir"; then + : + else + echo "Failed to compile with $buildpack" + build_data::kv_string "failure_reason" "compile_buildpack_v2_compile_fail" + build_data::kv_string "failure_detail" "buildpack: $buildpack" + exit 1 + fi - # check if the buildpack left behind an environment for subsequent ones - if [ -e "$dir/export" ]; then - set +u # http://redsymbol.net/articles/unofficial-bash-strict-mode/#sourcing-nonconforming-document - # shellcheck disable=SC1091 - source "$dir/export" - set -u # http://redsymbol.net/articles/unofficial-bash-strict-mode/#sourcing-nonconforming-document - fi + # check if the buildpack left behind an environment for subsequent ones + if [ -e "$dir/export" ]; then + set +u # http://redsymbol.net/articles/unofficial-bash-strict-mode/#sourcing-nonconforming-document + # shellcheck disable=SC1091 + source "$dir/export" + set -u # http://redsymbol.net/articles/unofficial-bash-strict-mode/#sourcing-nonconforming-document + fi - if [ -x "$dir/bin/release" ]; then - "$dir"/bin/release "$build_dir" > "$1"/last_pack_release.out + if [ -x "$dir/bin/release" ]; then + if "$dir"/bin/release "$build_dir" > "$1"/last_pack_release.out; then + : + else + echo "Failed bin/release with $buildpack" + build_data::kv_string "failure_reason" "compile_buildpack_v2_release_fail" + build_data::kv_string "failure_detail" "buildpack: $buildpack" + exit 1 fi - else - echo "Couldn't detect any framework for this buildpack. Exiting." - exit 1 fi fi } @@ -119,6 +154,8 @@ function checks::ensure_supported_stack() { return 0 ;; heroku-18 | heroku-20) + build_data::kv_string "failure_reason" "stack_eol" + build_data::kv_string "failure_detail" "${stack} stack" # This error will only ever be seen on non-Heroku environments, since the # Heroku build system rejects builds using EOL stacks. cat <<-EOF @@ -133,6 +170,8 @@ function checks::ensure_supported_stack() { exit 1 ;; *) + build_data::kv_string "failure_reason" "stack_unknown" + build_data::kv_string "failure_detail" "${stack} stack" cat <<-EOF Error: The '${stack}' stack isn't recognised. @@ -147,3 +186,167 @@ function checks::ensure_supported_stack() { ;; esac } + +## ============================== +# Start of build_data section +## ============================== + +# Contains functions for storing build data from the buildpack in bash. +# +# The format of the report file is JSON. +# +# Example: +# { +# "ruby_version": "3.3.3", +# "ruby_install_duration": 1.234 +# } +# +# All keys get `ruby.` prepended to them in the backend automatically. + +# Variables shared by this whole module +BUILD_DATA_FILE="/dev/null" +# Exported for use by Ruby code +HEROKU_RUBY_BUILD_REPORT_FILE="/dev/null" + +# Must be called before you can use any other methods +# +# Usage: +# ``` +# build_data::init "${CACHE_DIR}" +# ``` +build_data::init() { + local cache_dir="${1}" + BUILD_DATA_FILE="${cache_dir}/build-data/ruby.json" + HEROKU_RUBY_BUILD_REPORT_FILE="${BUILD_DATA_FILE}" + + # Used later in the `HerokuBuildReport.set_global` call in `bin/support/ruby_compile` + export HEROKU_RUBY_BUILD_REPORT_FILE +} + +# Clears any prior build data since it persists between builds +# +# Usage: +# ``` +# build_data::init "${CACHE_DIR}" +# build_data::clear +# ``` +build_data::clear() { + mkdir -p "$(dirname "${BUILD_DATA_FILE}")" + echo "{}" >"${BUILD_DATA_FILE}" +} + +# Adds a key-value pair to the report file without any attempt to quote or escape the value. +# +# Usage: +# ``` +# build_data::kv_raw "ruby_version_major" "3" +# build_data::kv_raw "ruby_version_default" "true" +# ``` +build_data::kv_raw() { + local key="${1}" + local value="${2}" + build_report::_set "${key}" "${value}" "false" +} + +# Adds a key-value pair to the report file, quoting the value. +# +# Usage: +# ``` +# build_data::kv_string "ruby_version" "3.3.3" +# ``` +build_data::kv_string() { + local key="${1}" + local value="${2}" + build_report::_set "${key}" "${value}" "true" +} + +# Internal helper to write a key/value pair to the build data store. The buildpack shouldn't call this directly. +# Takes a key, value, and a boolean flag indicating whether the value needs to be quoted. +# +# Usage: +# ``` +# build_report::_set "foo_string" "quote me" "true" +# build_report::_set "bar_number" "99" "false" +# ``` +function build_report::_set() { + local key="${1}" + # Truncate the value to an arbitrary 200 characters since it will sometimes contain user-provided + # inputs which may be unbounded in size. Ideally individual call sites will perform more aggressive + # truncation themselves based on the expected value size, however this is here as a fallback. + # (Honeycomb supports string fields up to 64KB in size, however, it's not worth filling up the + # build data store or bloating the payload passed back to Vacuole/submitted to Honeycomb given the + # extra content in those cases is not normally useful.) + local value="${2:0:200}" + local needs_quoting="${3}" + + if [[ "${needs_quoting}" == "true" ]]; then + # Values passed using `--arg` are treated as strings, and so have double quotes added and any JSON + # special characters (such as newlines, carriage returns, double quotes, backslashes) are escaped. + local jq_args=(--arg value "${value}") + else + # Values passed using `--argjson` are treated as raw JSON values, and so aren't escaped or quoted. + local jq_args=(--argjson value "${value}") + fi + + local new_data_file_contents + new_data_file_contents="$(jq --arg key "${key}" "${jq_args[@]}" '. + { ($key): ($value) }' "${BUILD_DATA_FILE}")" + echo "${new_data_file_contents}" >"${BUILD_DATA_FILE}" +} + +# Returns the current time since the UNIX Epoch, as a float with microseconds precision. +# +# Usage (2025-08-22 11:15 UTC): +# ``` +# build_data::current_unix_realtime +# # => 1755879324.771610 +# ``` +build_data::current_unix_realtime() { + # We use a subshell with `LC_ALL=C` to ensure the output format isn't affected by system locale. + ( + LC_ALL=C + echo "${EPOCHREALTIME}" + ) +} + +# Adds a key=duration to the report file. +# +# Usage: +# ``` +# start_time=$(build_data::current_unix_realtime) +# sleep 1 +# build_data::kv_duration_since "ruby_install" "${start_time}" +# +# build_data::print_bin_report_json +# # => { "ruby_install": 1.234 } +# ``` +build_data::kv_duration_since() { + local key="${1}" + local start_time="${2}" + local end_time duration + end_time="$(build_data::current_unix_realtime)" + duration="$(awk -v start="${start_time}" -v end="${end_time}" 'BEGIN { printf "%f", (end - start) }')" + + build_data::kv_raw "${key}" "${duration}" +} + +# Prints the build data in JSON format. +# +# Usage: +# ``` +# build_data::print_bin_report_json +# # => { "ruby_install": 1.234 } +# ``` +build_data::print_bin_report_json() { + if [ "${HEROKU_RUBY_BUILD_REPORT_FILE}" != "${BUILD_DATA_FILE}" ]; then + echo "Error: HEROKU_RUBY_BUILD_REPORT_FILE does not match BUILD_DATA_FILE" + echo "HEROKU_RUBY_BUILD_REPORT_FILE: ${HEROKU_RUBY_BUILD_REPORT_FILE}" + echo "BUILD_DATA_FILE: ${BUILD_DATA_FILE}" + exit 1 + fi + + jq --sort-keys '.' "${BUILD_DATA_FILE}" +} + +## ============================== +# End of build data section +## ============================== diff --git a/bin/support/download_ruby b/bin/support/download_ruby index 0cc3832b6..b8e1de319 100755 --- a/bin/support/download_ruby +++ b/bin/support/download_ruby @@ -51,7 +51,9 @@ fi mkdir -p "$RUBY_BOOTSTRAP_DIR" -curl_retry_on_18 --fail --show-error --retry 3 --retry-connrefused --connect-timeout "${CURL_CONNECT_TIMEOUT:-3}" --silent --location -o "$RUBY_BOOTSTRAP_DIR/ruby.tgz" "$heroku_buildpack_ruby_url" || { +if curl_retry_on_18 --fail --show-error --retry 3 --retry-connrefused --connect-timeout "${CURL_CONNECT_TIMEOUT:-3}" --silent --location -o "$RUBY_BOOTSTRAP_DIR/ruby.tgz" "$heroku_buildpack_ruby_url"; then + : +else cat< "3.4.2" # ) module HerokuBuildReport - # Accumulates data in memory and writes it to the specified path in YAML format + # Accumulates data in memory and writes it to the specified path in JSON format # # Writes data to disk on every capture. Later `bin/report` emits the disk contents - class YamlReport + class JsonReport + MALFORMED_JSON_KEY = "build_report_file_malformed" attr_reader :data - def initialize(path: ) + def initialize(path: , io: $stdout) + @io = io @path = Pathname(path).expand_path @path.dirname.mkpath FileUtils.touch(@path) - @data = {} + @data = safe_load(@path.read) + + if @data[MALFORMED_JSON_KEY] + @path.write(@data.to_json) + end end - def clear! - @data.clear - @path.write("") + def safe_load(contents) + if !contents || contents.empty? + {} + else + JSON.parse(contents) + end + rescue => e + @io.puts "Internal Warning: Expected build report to be JSON, but it is malformed: #{contents.inspect}" + { MALFORMED_JSON_KEY => true } end def complex_object?(value) @@ -46,13 +59,13 @@ def capture(metrics = {}) @data["#{key}"] = value end - @path.write(@data.to_yaml) + @path.write(@data.to_json) end end # Current load order of the various "language packs" def self.set_global(path: ) - YamlReport.new(path: path).tap { |report| + JsonReport.new(path: path).tap { |report| # Silence warning about setting a constant begin old_verbose = $VERBOSE @@ -66,7 +79,7 @@ def self.set_global(path: ) # Stores data in memory only, does not persist to disk def self.dev_null - YamlReport.new(path: "/dev/null") + JsonReport.new(path: "/dev/null") end GLOBAL = self.dev_null # Changed via `set_global` diff --git a/spec/hatchet/ruby_spec.rb b/spec/hatchet/ruby_spec.rb index 2961c6ca8..3ca12ccea 100644 --- a/spec/hatchet/ruby_spec.rb +++ b/spec/hatchet/ruby_spec.rb @@ -171,9 +171,14 @@ EOF end + bash_functions_contents = Pathname(__dir__).join("..").join("..").join("bin").join("support").join("bash_functions.sh").read + bin.join("support").tap(&:mkpath).join("bash_functions.sh").write(<<~EOF) + #{bash_functions_contents} + EOF + compile.write(<<~EOF) #!/usr/bin/env bash - REPORT_FILE="${CACHE_DIR}/.heroku/ruby/build_report.yml" + echo "## PRINTING REPORT FILE ##" #{Pathname(__dir__).join("..").join("..").join("bin").join("report").read} echo "## REPORT FILE DONE ##" diff --git a/spec/helpers/bundler_wrapper_spec.rb b/spec/helpers/bundler_wrapper_spec.rb index bdfedc8ea..3d2f1e796 100644 --- a/spec/helpers/bundler_wrapper_spec.rb +++ b/spec/helpers/bundler_wrapper_spec.rb @@ -117,7 +117,7 @@ def wrapper.topic(*args); end # Silence output in tests Bundler.with_unbundled_env do @bundler.install - expect(@bundler.ruby_version).to eq("ruby-2.3.1-p0-jruby-9.1.7.0") + expect(@bundler.ruby_version).to eq("ruby-3.4.2-p0-jruby-10.0.2.0") end end end diff --git a/spec/helpers/heroku_build_report_spec.rb b/spec/helpers/heroku_build_report_spec.rb index 069da1cbc..0d6c1e5f2 100644 --- a/spec/helpers/heroku_build_report_spec.rb +++ b/spec/helpers/heroku_build_report_spec.rb @@ -1,10 +1,36 @@ require 'spec_helper' describe "Build report" do + it "loads previously written report" do + Dir.mktmpdir do |dir| + path = Pathname(dir).join(".report.json").tap {|p| p.write('{ "prior": true }') } + io = StringIO.new + report = HerokuBuildReport::JsonReport.new( + io: io, + path: path + ) + report.capture("key" => "value") + expect(report.data).to eq({"prior" => true, "key" => "value"}) + end + end + + it "handles malformed json" do + Dir.mktmpdir do |dir| + path = Pathname(dir).join(".report.json").tap {|p| p.write('zomg') } + io = StringIO.new + report = HerokuBuildReport::JsonReport.new( + io: io, + path: path + ) + report.capture("key" => "value") + expect(report.data).to eq({"build_report_file_malformed" => true, "key" => "value"}) + end + end + it "handles complex object serialization by converting them to strings" do Dir.mktmpdir do |dir| - path = Pathname(dir).join(".report.yml") - report = HerokuBuildReport::YamlReport.new( + path = Pathname(dir).join(".report.json") + report = HerokuBuildReport::JsonReport.new( path: path ) value = Gem::Version.new("3.4.2") @@ -13,17 +39,16 @@ report.capture("key" => value) expect(report.data).to eq({"key" => "3.4.2"}) - expect(path.read).to eq(<<~EOF) - --- - key: 3.4.2 + expect(path.read.strip).to eq(<<~EOF.strip) + {"key":"3.4.2"} EOF end end - it "writes valid yaml" do + it "writes valid json" do Dir.mktmpdir do |dir| - path = Pathname(dir).join(".report.yml") - report = HerokuBuildReport::YamlReport.new( + path = Pathname(dir).join(".report.json") + report = HerokuBuildReport::JsonReport.new( path: path ) report.capture( @@ -33,13 +58,15 @@ "boolean" => true, ) - expect(path.read).to eq(<<~EOF) - --- - string: "'with single quotes'" - string_plain: plain - number: 22 - boolean: true - EOF + parsed = JSON.parse(path.read).sort_by {|k, _| k}.to_h + expect(parsed).to eq( + { + "string" => "'with single quotes'", + "string_plain" => "plain", + "number" => 22, + "boolean" => true + } + ) end end end diff --git a/spec/unit/bash_functions_spec.rb b/spec/unit/bash_functions_spec.rb index 245196b93..67cebffcc 100644 --- a/spec/unit/bash_functions_spec.rb +++ b/spec/unit/bash_functions_spec.rb @@ -1,8 +1,122 @@ require 'spec_helper' describe "Bash functions" do + describe "metrics" do + it "does not error when collecting metrics and the target file is not set" do + Dir.mktmpdir do |dir| + file = Pathname(dir).join("does-not-exist").expand_path + out = exec_with_bash_file(code: <<~EOM, file: bash_functions_file, strip_output: true) + build_data::kv_string "ruby_version" "3.3.0" + build_data::kv_raw "ruby_major" "3" + + build_data::print_bin_report_json + EOM + + expect(out).to eq("") + end + end + + it "prints error when report env var is set to a non-existent file" do + Dir.mktmpdir do |dir| + file = Pathname(dir).join("does-not-exist").expand_path + out = exec_with_bash_file(code: <<~EOM, file: bash_functions_file, strip_output: false, raise_on_fail: false) + export HEROKU_RUBY_BUILD_REPORT_FILE="#{file}" + export BUILD_DATA_FILE="#{file}" + build_data::print_bin_report_json + EOM + + expect($?.success?).to be_falsey, "Expected command failure but got unexpected success. Output:\n\n#{out}" + expect(out).to include("No such file or directory") + end + end + + it "detects env var mutation and raise an error" do + Dir.mktmpdir do |dir| + file = Pathname(dir).join("does-not-exist").expand_path + out = exec_with_bash_file(code: <<~EOM, file: bash_functions_file, strip_output: false, raise_on_fail: false) + export BUILD_DATA_FILE="#{file}" + build_data::print_bin_report_json + EOM + + expect($?.success?).to be_falsey, "Expected command failure but got unexpected success. Output:\n\n#{out}" + expect(out).to include("Error: HEROKU_RUBY_BUILD_REPORT_FILE does not match BUILD_DATA_FILE") + end + end + + it "kv_duration_since" do + out = exec_with_bash_file(code: <<~EOM, file: bash_functions_file, strip_output: false) + build_data::init "$(mktemp -d)" + build_data::clear + + timer=$(build_data::current_unix_realtime) + sleep 0.1 + build_data::kv_duration_since "ruby_install_ms" "${timer}" + build_data::print_bin_report_json + EOM + + begin + ruby_install_s = JSON.parse(out).fetch("ruby_install_ms").to_f + expect(ruby_install_s).to be_between(0.1, 1) + rescue + puts "Output: #{out}" + raise + end + end + + it "kv_string" do + out = exec_with_bash_file(code: <<~EOM, file: bash_functions_file, strip_output: false) + build_data::init "$(mktemp -d)" + build_data::clear + + build_data::kv_string "ruby_version" "3.3.0" + build_data::print_bin_report_json + EOM + + expect(out).to eq(<<~EOM) + { + "ruby_version": "3.3.0" + } + EOM + end + + it "kv_string" do + out = exec_with_bash_file(code: <<~EOM, file: bash_functions_file, strip_output: false) + build_data::init "$(mktemp -d)" + build_data::clear + + build_data::kv_string "ruby_version" "3.3.0" + build_data::print_bin_report_json + EOM + + expect(out).to eq(<<~EOM) + { + "ruby_version": "3.3.0" + } + EOM + end + + it "kv_raw" do + out = exec_with_bash_file(code: <<~EOM, file: bash_functions_file, strip_output: false) + build_data::init "$(mktemp -d)" + build_data::clear + + build_data::kv_raw "ruby_minor" "3" + build_data::print_bin_report_json + EOM + + expect(out).to eq(<<~EOM) + { + "ruby_minor": 3 + } + EOM + end + end + it "fails on old stacks" do out = exec_with_bash_functions(<<~EOM, raise_on_fail: false) + build_data::init "$(mktemp -d)" + build_data::clear + checks::ensure_supported_stack "heroku-20" EOM @@ -70,6 +184,9 @@ EOM out = exec_with_bash_functions <<~EOM + build_data::init "$(mktemp -d)" + build_data::clear + which_java() { return 0 @@ -86,19 +203,18 @@ end end - def bash_functions_file root_dir.join("bin", "support", "bash_functions.sh") end - def exec_with_bash_functions(code, stack: "heroku-24", raise_on_fail: true) + def exec_with_bash_file(file:, code:, stack: "heroku-24", raise_on_fail: true, strip_output: true) contents = <<~EOM #! /usr/bin/env bash set -eu STACK="#{stack}" - #{bash_functions_file.read} + #{file.read} #{code} EOM @@ -112,7 +228,8 @@ def exec_with_bash_functions(code, stack: "heroku-24", raise_on_fail: true) success = false begin Timeout.timeout(60) do - out = `#{file.path} 2>&1`.strip + out = `#{file.path} 2>&1` + out = out.strip if strip_output success = $?.success? end rescue Timeout::Error @@ -138,4 +255,13 @@ def exec_with_bash_functions(code, stack: "heroku-24", raise_on_fail: true) out end end + + def exec_with_bash_functions(code, stack: "heroku-24", raise_on_fail: true) + exec_with_bash_file( + code: code, + file: bash_functions_file, + stack: stack, + raise_on_fail: raise_on_fail + ) + end end From c28003b7dced55456046764f71d2d1aa6dceed73 Mon Sep 17 00:00:00 2001 From: "heroku-linguist[bot]" <136119646+heroku-linguist[bot]@users.noreply.github.com> Date: Wed, 27 Aug 2025 14:42:52 +0000 Subject: [PATCH 1086/1195] Prepare release v319 (#1637) Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com> --- CHANGELOG.md | 6 +++++- lib/language_pack/version.rb | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e84f4a69..3fdf20ec7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased] + +## [v319] - 2025-08-27 + - Add bash based failure metrics reporting for `bin/report`. This allows the buildpack to distinguish beteween types of failures that occur before Ruby code in the buildpack has executed (such as when bootstrapping). (https://github.com/heroku/heroku-buildpack-ruby/pull/1635) ## [v318] - 2025-08-11 @@ -1751,7 +1754,8 @@ Bugfixes: * Change gem detection to use lockfile parser * use `$RACK_ENV` when thin is detected for rack apps -[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v318...main +[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v319...main +[v319]: https://github.com/heroku/heroku-buildpack-ruby/compare/v318...v319 [v318]: https://github.com/heroku/heroku-buildpack-ruby/compare/v317...v318 [v317]: https://github.com/heroku/heroku-buildpack-ruby/compare/v316...v317 [v316]: https://github.com/heroku/heroku-buildpack-ruby/compare/v315...v316 diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 55b36d622..8a5b19c5b 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v318" + BUILDPACK_VERSION = "v319" end end From a2fee69bf7c5fe369e529af97e4a3a707bb7d667 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 8 Sep 2025 20:52:15 +0000 Subject: [PATCH 1087/1195] Bump excon from 1.2.8 to 1.3.0 in the ruby-dependencies group (#1639) Bumps the ruby-dependencies group with 1 update: [excon](https://github.com/excon/excon). Updates `excon` from 1.2.8 to 1.3.0 - [Changelog](https://github.com/excon/excon/blob/master/changelog.txt) - [Commits](https://github.com/excon/excon/compare/v1.2.8...v1.3.0) --- updated-dependencies: - dependency-name: excon dependency-version: 1.3.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: ruby-dependencies ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 15636544d..4b7839392 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -6,7 +6,7 @@ GEM connection_pool (2.5.3) diff-lcs (1.6.2) erubis (2.7.0) - excon (1.2.8) + excon (1.3.0) logger heroics (0.1.3) base64 From b19faa35c33aab17ed9354005c7457d7666924c8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 8 Sep 2025 20:52:41 +0000 Subject: [PATCH 1088/1195] Bump actions/checkout from 4 to 5 (#1640) Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v4...v5) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '5' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/check_changelog.yml | 2 +- .github/workflows/ci.yml | 4 ++-- .github/workflows/hatchet_app_cleaner.yml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/check_changelog.yml b/.github/workflows/check_changelog.yml index c0cc43b77..f1a2526a7 100644 --- a/.github/workflows/check_changelog.yml +++ b/.github/workflows/check_changelog.yml @@ -13,7 +13,7 @@ jobs: if: (!contains(github.event.pull_request.labels.*.name, 'skip changelog')) steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Check that CHANGELOG is touched run: | git fetch origin ${{ github.base_ref }} --depth 1 && \ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 84bea42fd..b1d655bf6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Run ShellCheck bin top level run: | # All bash files that don't end in '.rb' @@ -36,7 +36,7 @@ jobs: RSPEC_RETRY_RETRY_COUNT: 1 steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Install Ruby and dependencies uses: ruby/setup-ruby@v1 with: diff --git a/.github/workflows/hatchet_app_cleaner.yml b/.github/workflows/hatchet_app_cleaner.yml index f5106361e..5abc2739c 100644 --- a/.github/workflows/hatchet_app_cleaner.yml +++ b/.github/workflows/hatchet_app_cleaner.yml @@ -19,7 +19,7 @@ jobs: HEROKU_DISABLE_AUTOUPDATE: 1 steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Install Ruby and dependencies uses: ruby/setup-ruby@v1 with: From 25a5921ed1a901b277f4113873e7992ddfaa4720 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Tue, 9 Sep 2025 10:30:18 -0500 Subject: [PATCH 1089/1195] Default PUMA_PERSISTENT_TIMEOUT to match router 2.0 (#1641) * Default PUMA_PERSISTENT_TIMEOUT to match router 2.0 Router 2.0 introduced keepalive support. It will close connections idle after 90 seconds https://devcenter.heroku.com/articles/http-routing#keepalives. We want to avoid a situation where they send a request right before puma closes the connection. We can do that by setting it to the same timeout the router uses + some value (such as 5 seconds). Puma 7.0 was just released, and I helped make that value configurable via env var https://github.com/puma/puma/pull/3378. This sets the value for any puma user to do this manually, in their `config/puma.rb`, and for Puma 7+ users they will get that value by default. * Remove hardcoded value from test * Asset PUMA_PERSISTENT_TIMEOUT available from env --- CHANGELOG.md | 1 + changelogs/puma_persistent_timeout.md | 16 ++++++++++++++++ lib/language_pack/rack.rb | 7 ++++--- spec/hatchet/ruby_spec.rb | 6 ++++-- 4 files changed, 25 insertions(+), 5 deletions(-) create mode 100644 changelogs/puma_persistent_timeout.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fdf20ec7..f6cb2825b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## [Unreleased] +- Set `export PUMA_PERSISTENT_TIMEOUT=95` to match recommended router 2.0 settings (https://github.com/heroku/heroku-buildpack-ruby/pull/1641) ## [v319] - 2025-08-27 diff --git a/changelogs/puma_persistent_timeout.md b/changelogs/puma_persistent_timeout.md new file mode 100644 index 000000000..dc6e6880c --- /dev/null +++ b/changelogs/puma_persistent_timeout.md @@ -0,0 +1,16 @@ +## Ruby apps now have `PUMA_PERSISTENT_TIMEOUT=95` set by default + +All Ruby applications now have `PUMA_PERSISTENT_TIMEOUT` environment variable set to a default value of `95`. + +Puma [7.0](https://github.com/puma/puma/pull/3378) introduced the ability to configure the `persistent_timeout` value via an environment variable. Router 2.0 uses an idle timeout value of 90s https://devcenter.heroku.com/articles/http-routing#keepalives. To avoid a situation where a request is sent right before Puma closes the connection, the value needs to be slightly higher than the Router's value. + +Applications that are not on Puma 7+ can use it manually in their `config/puma.rb` file: + +```ruby +# config/puma.rb + +# Only required for Puma 6 and below +persistent_timeout(ENV.fetch("PUMA_PERSISTENT_TIMEOUT") || 95) +``` + +Other web server users can use this as a stable interface to retrieve a suggested idle timeout setting. diff --git a/lib/language_pack/rack.rb b/lib/language_pack/rack.rb index 75e89b798..bdf374cd9 100644 --- a/lib/language_pack/rack.rb +++ b/lib/language_pack/rack.rb @@ -15,9 +15,10 @@ def name end def default_config_vars - super.merge({ - "RACK_ENV" => env("RACK_ENV") || "production" - }) + out = super + out["RACK_ENV"] = env("RACK_ENV") || "production" + out["PUMA_PERSISTENT_TIMEOUT"] = env("PUMA_PERSISTENT_TIMEOUT") || "95" + out end def default_process_types diff --git a/spec/hatchet/ruby_spec.rb b/spec/hatchet/ruby_spec.rb index 3ca12ccea..aded91e15 100644 --- a/spec/hatchet/ruby_spec.rb +++ b/spec/hatchet/ruby_spec.rb @@ -305,11 +305,13 @@ describe "Rack" do it "should not overwrite already set environment variables" do - custom_env = "FFFUUUUUUU" + custom_env = SecureRandom.hex(16) app = Hatchet::Runner.new("default_ruby", config: {"RACK_ENV" => custom_env}) app.deploy do |app| - expect(app.run("env")).to match(custom_env) + environment_variables = app.run("env") + expect(environment_variables).to match(custom_env) + expect(environment_variables).to match("PUMA_PERSISTENT_TIMEOUT") end end end From fcb6c26776330f668f358e911b72eb0d3681e34c Mon Sep 17 00:00:00 2001 From: "heroku-linguist[bot]" <136119646+heroku-linguist[bot]@users.noreply.github.com> Date: Tue, 9 Sep 2025 15:36:18 +0000 Subject: [PATCH 1090/1195] Prepare release v320 (#1642) Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com> --- CHANGELOG.md | 6 +++++- lib/language_pack/version.rb | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f6cb2825b..8d22e6ba7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased] + +## [v320] - 2025-09-09 + - Set `export PUMA_PERSISTENT_TIMEOUT=95` to match recommended router 2.0 settings (https://github.com/heroku/heroku-buildpack-ruby/pull/1641) ## [v319] - 2025-08-27 @@ -1755,7 +1758,8 @@ Bugfixes: * Change gem detection to use lockfile parser * use `$RACK_ENV` when thin is detected for rack apps -[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v319...main +[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v320...main +[v320]: https://github.com/heroku/heroku-buildpack-ruby/compare/v319...v320 [v319]: https://github.com/heroku/heroku-buildpack-ruby/compare/v318...v319 [v318]: https://github.com/heroku/heroku-buildpack-ruby/compare/v317...v318 [v317]: https://github.com/heroku/heroku-buildpack-ruby/compare/v316...v317 diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 8a5b19c5b..2bf1d2822 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v319" + BUILDPACK_VERSION = "v320" end end From ac983e9f7f038c68acc9ebf3281be5e95a4b0568 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Tue, 9 Sep 2025 13:20:49 -0500 Subject: [PATCH 1091/1195] Move changelog item to the correct folder (#1643) It was supposed to be created in `changelogs/unreleased` it was created in `changelogs/` instead by accident. The automation will move it to the correct location https://github.com/heroku/heroku-buildpack-ruby/pull/1642, but only if it starts in the correct folder. --- changelogs/{ => v320}/puma_persistent_timeout.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename changelogs/{ => v320}/puma_persistent_timeout.md (100%) diff --git a/changelogs/puma_persistent_timeout.md b/changelogs/v320/puma_persistent_timeout.md similarity index 100% rename from changelogs/puma_persistent_timeout.md rename to changelogs/v320/puma_persistent_timeout.md From 0102a10fb81fc70cbfbd293688e27e4861a98e85 Mon Sep 17 00:00:00 2001 From: "heroku-linguist[bot]" <136119646+heroku-linguist[bot]@users.noreply.github.com> Date: Tue, 16 Sep 2025 14:15:41 +0000 Subject: [PATCH 1092/1195] Prepare release v321 (#1644) Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com> --- CHANGELOG.md | 8 +++++++- lib/language_pack/version.rb | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d22e6ba7..766e5587e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ ## [Unreleased] +## [v321] - 2025-09-16 + +- Ruby 3.4.6 is now available + + ## [v320] - 2025-09-09 - Set `export PUMA_PERSISTENT_TIMEOUT=95` to match recommended router 2.0 settings (https://github.com/heroku/heroku-buildpack-ruby/pull/1641) @@ -1758,7 +1763,8 @@ Bugfixes: * Change gem detection to use lockfile parser * use `$RACK_ENV` when thin is detected for rack apps -[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v320...main +[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v321...main +[v321]: https://github.com/heroku/heroku-buildpack-ruby/compare/v320...v321 [v320]: https://github.com/heroku/heroku-buildpack-ruby/compare/v319...v320 [v319]: https://github.com/heroku/heroku-buildpack-ruby/compare/v318...v319 [v318]: https://github.com/heroku/heroku-buildpack-ruby/compare/v317...v318 diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 2bf1d2822..4a1728b56 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v320" + BUILDPACK_VERSION = "v321" end end From 9ad875ac0208b3d47c16ac1a3b169d1e8dac1f77 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Mon, 29 Sep 2025 14:32:07 -0500 Subject: [PATCH 1093/1195] Set PUMA_PERSISTENT_TIMEOUT for Rails, add Puma version warnings and errors. (#1645) * Refactor default config vars * Fix PUMA_PERSISTENT_TIMEOUT not working on Rails Rails does not inherit from Rack, they both inherit from Ruby. GUS-W-19585440 * Add test for .profile.d/ (launch/runtime) env * Set default PUMA_PERSISTENT_TIMEOUT profile.d * Harden .profile.d check By checking the full output, it means any change will cause the build to fail rather than needing to explicitly check individual files. * Fix spelling * Refactor default_config_vars Standardize on using `out` as the variable name. Add documentation stating where it's inheriting from. * Remove outdated comment The "buildpack-env-args" refers to the ability of customers to have access to their config vars at build time, which used to not be possible. It has been on and the default for many years now. We can remove the comment. The comment also assumed implementation details of how it would work once implemented. The `||=` here means that any buildpacks that export an environment variable before us will take precedence, which is behavior that we want. These `default_config_vars` should not take precedence over another buildpack explicitly writing an environment variable to their `export`. * Refactor `default_env_vars` method out This method is used in a handful of places. We can replace that usage with the literal contents. * Remove `config_vars` from bin/release This field is not currently documented at https://devcenter.heroku.com/articles/buildpack-api#bin-release, but it is used for setting config vars for customers. The caveat is that it only affects apps on the first push, which isn't very useful. That's why it's not even documented anymore. The "correct" way to set an environment variable is: - `.profile.d/