From d9656ff91742fe2be724d8f4df8c1971c658dcfb Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Thu, 4 Jun 2020 12:05:10 -0700 Subject: [PATCH 1/5] Revert "Require Ruby 2.7 minimum to guarantee bundler 2.x" This reverts commit 705319306af061bca966c7e95e4538030d7d0afd. --- chef-cli.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chef-cli.gemspec b/chef-cli.gemspec index 7d52c3f47..b6ed9cf60 100644 --- a/chef-cli.gemspec +++ b/chef-cli.gemspec @@ -29,7 +29,7 @@ Gem::Specification.new do |gem| gem.license = "Apache-2.0" gem.homepage = "https://www.chef.io/" - gem.required_ruby_version = ">= 2.7" + gem.required_ruby_version = ">= 2.6" gem.files = %w{Rakefile LICENSE} + Dir.glob("Gemfile*") + # Includes Gemfile and locks From 4a7199981ac35a4c4fc3223f9f537e1e17461a7e Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Thu, 4 Jun 2020 12:07:03 -0700 Subject: [PATCH 2/5] Require Ruby 2.5+ Keep the chef dep the same since 15 installs on 2.5 Signed-off-by: Tim Smith --- .expeditor/verify.pipeline.yml | 16 ++++++++++++++++ Gemfile | 1 + chef-cli.gemspec | 3 +-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/.expeditor/verify.pipeline.yml b/.expeditor/verify.pipeline.yml index 277646171..e22a8dcb1 100644 --- a/.expeditor/verify.pipeline.yml +++ b/.expeditor/verify.pipeline.yml @@ -11,6 +11,22 @@ expeditor: steps: +- label: run-specs-ruby-2.5 + command: + - .expeditor/run_linux_tests.sh rspec + expeditor: + executor: + docker: + image: ruby:2.5-buster + +- label: run-specs-ruby-2.6 + command: + - .expeditor/run_linux_tests.sh rspec + expeditor: + executor: + docker: + image: ruby:2.6-buster + - label: run-specs-ruby-2.7 command: - .expeditor/run_linux_tests.sh rspec diff --git a/Gemfile b/Gemfile index 2fd16e53c..ee0bf59bd 100644 --- a/Gemfile +++ b/Gemfile @@ -15,6 +15,7 @@ group :test do gem "rspec-mocks", "~> 3.8" gem "cookstyle" gem "chefstyle" + gem "test-kitchen", "> 2.5" end group :development do diff --git a/chef-cli.gemspec b/chef-cli.gemspec index b6ed9cf60..ea263d825 100644 --- a/chef-cli.gemspec +++ b/chef-cli.gemspec @@ -29,7 +29,7 @@ Gem::Specification.new do |gem| gem.license = "Apache-2.0" gem.homepage = "https://www.chef.io/" - gem.required_ruby_version = ">= 2.6" + gem.required_ruby_version = ">= 2.5" gem.files = %w{Rakefile LICENSE} + Dir.glob("Gemfile*") + # Includes Gemfile and locks @@ -50,6 +50,5 @@ Gem::Specification.new do |gem| gem.add_dependency "diff-lcs", "~> 1.0" gem.add_dependency "paint", ">= 1", "< 3" gem.add_dependency "license-acceptance", "~> 1.0", ">= 1.0.11" - gem.add_development_dependency "test-kitchen", "> 2.5" gem.add_dependency "ffi", "< 1.13" end From 6e158335fc95ee4ffa27bf73fcd59d8226c78c2b Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Thu, 4 Jun 2020 12:12:33 -0700 Subject: [PATCH 3/5] Make sure we have the right version of chef-zero on Ruby 2.5 Signed-off-by: Tim Smith --- Gemfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Gemfile b/Gemfile index ee0bf59bd..7375a75e8 100644 --- a/Gemfile +++ b/Gemfile @@ -16,6 +16,9 @@ group :test do gem "cookstyle" gem "chefstyle" gem "test-kitchen", "> 2.5" + if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.6") + gem "chef-zero", "~> 14" + end end group :development do From ece500869f9e87a63aa8dfe418c7eb7f8be7a39a Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Thu, 4 Jun 2020 12:19:28 -0700 Subject: [PATCH 4/5] Support older releases of Bundler Signed-off-by: Tim Smith --- Gemfile | 3 ++- lib/chef-cli/cli.rb | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 7375a75e8..fb6f17f01 100644 --- a/Gemfile +++ b/Gemfile @@ -18,12 +18,13 @@ group :test do gem "test-kitchen", "> 2.5" if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.6") gem "chef-zero", "~> 14" + gem "chef", "~> 15" end end group :development do gem "pry" gem "pry-byebug" - gem "pry-stack_explorer" + gem "pry-stack_explorer", "~> 0.4.0" gem "rb-readline" end diff --git a/lib/chef-cli/cli.rb b/lib/chef-cli/cli.rb index d1f973bd6..ec01b73a1 100644 --- a/lib/chef-cli/cli.rb +++ b/lib/chef-cli/cli.rb @@ -122,7 +122,13 @@ def show_version_via_shell_out "Test Kitchen": "kitchen", "Cookstyle": "cookstyle", }.each do |name, cli| - result = Bundler.with_unbundled_env { shell_out("#{cli} --version") } + # @todo when Ruby 2.5/2.6 support goes away this if statement can go away + if Gem::Version.new(Bundler::VERSION) >= Gem::Version.new("2") + result = Bundler.with_unbundled_env { shell_out("#{cli} --version") } + else + result = Bundler.with_clean_env { shell_out("#{cli} --version") } + end + if result.exitstatus != 0 msg("#{name} version: ERROR") else From a93dcb0774b0077e6557d0a7917fa6e06998c175 Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Thu, 4 Jun 2020 13:56:36 -0700 Subject: [PATCH 5/5] Add Ruby 2.6 on Windows testing Signed-off-by: Tim Smith --- .expeditor/verify.pipeline.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.expeditor/verify.pipeline.yml b/.expeditor/verify.pipeline.yml index e22a8dcb1..aaaac0e99 100644 --- a/.expeditor/verify.pipeline.yml +++ b/.expeditor/verify.pipeline.yml @@ -35,7 +35,16 @@ steps: docker: image: ruby:2.7-buster -- label: run-specs-windows +- label: run-specs-windows-2.6 + command: + - powershell .expeditor/run_windows_tests.ps1 rspec + expeditor: + executor: + docker: + host_os: windows + image: rubydistros/windows-2019:2.6 + +- label: run-specs-windows-2.7 command: - powershell .expeditor/run_windows_tests.ps1 rspec expeditor: