From 2a6717f79abe83c28f4746cbcb2e2e5365f8e2f5 Mon Sep 17 00:00:00 2001 From: John Date: Tue, 18 Apr 2023 08:08:14 -0700 Subject: [Chef-17] 1 of X - Updating Ruby versions Signed-off-by: John --- .expeditor/scripts/bk_win_functional.ps1 | 37 ++++++++++++++++++++++++++------ .expeditor/verify.pipeline.yml | 10 ++++----- .rubocop.yml | 2 +- chef-config/chef-config.gemspec | 2 +- chef-utils/chef-utils.gemspec | 2 +- chef.gemspec | 2 +- knife/knife.gemspec | 2 +- 7 files changed, 41 insertions(+), 16 deletions(-) diff --git a/.expeditor/scripts/bk_win_functional.ps1 b/.expeditor/scripts/bk_win_functional.ps1 index a2f93378dd..db348cb2b0 100644 --- a/.expeditor/scripts/bk_win_functional.ps1 +++ b/.expeditor/scripts/bk_win_functional.ps1 @@ -7,11 +7,36 @@ Remove-Item -Path C:\ProgramData\chocolatey\bin\choco.exe -ErrorAction SilentlyC $ErrorActionPreference = 'Stop' -Write-Output "--- Enable Ruby 2.7" +Write-Output "--- Enable Ruby 3.0" -Write-Output "Register Installed Ruby Version 2.7 With Uru" -Start-Process "uru_rt.exe" -ArgumentList 'admin add C:\ruby27\bin' -Wait -uru 27 +# Ruby is not installed at this point for some reason. Installing it now +$pkg_version="3.0.3" +$pkg_revision="1" +$pkg_source="https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-${pkg_version}-${pkg_revision}/rubyinstaller-devkit-${pkg_version}-${pkg_revision}-x64.exe" + +if (Get-Command Ruby -ErrorAction SilentlyContinue){ + $old_version = Ruby --version + } +else { + $old_version = $null +} + +if(-not($old_version -match "3.0")){ + Write-Output "Downloading Ruby + DevKit"; + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; + $package_destination = "$env:temp\rubyinstaller-devkit-$pkg_version-$pkg_revision-x64.exe" + (New-Object System.Net.WebClient).DownloadFile($pkg_source, $package_destination); + Write-Output "`rDid the file download?" + Test-Path $package_destination + Write-Output "`rInstalling Ruby + DevKit"; + Start-Process $package_destination -ArgumentList "/verysilent /dir=C:\ruby30" -Wait ; + Write-Output "Cleaning up installation"; + Remove-Item $package_destination -Force; +} + +Write-Output "Register Installed Ruby Version 3.0 With Uru" +Start-Process "uru_rt.exe" -ArgumentList 'admin add C:\ruby30\bin' -Wait +uru 30 if (-not $?) { throw "Can't Activate Ruby. Did Uru Registration Succeed?" } ruby -v if (-not $?) { throw "Can't run Ruby. Is it installed?" } @@ -20,10 +45,10 @@ Write-Output "--- configure winrm" winrm quickconfig -q Write-Output "--- bundle install" -bundle config set --local without 'omnibus_package' +bundle config set --local without "omnibus_package" bundle install --jobs=3 --retry=3 if (-not $?) { throw "Unable to install gem dependencies" } Write-Output "+++ bundle exec rake spec:functional" -bundle exec rake spec:functional +bundle exec rake spec:functional SPEC_OPTS="--format documentation" if (-not $?) { throw "Chef functional specs failing." } diff --git a/.expeditor/verify.pipeline.yml b/.expeditor/verify.pipeline.yml index dcd8d5cc85..20b3496197 100644 --- a/.expeditor/verify.pipeline.yml +++ b/.expeditor/verify.pipeline.yml @@ -12,10 +12,10 @@ expeditor: steps: ######################################################################### - # Tests Ruby 2.6 + # Tests Ruby 2.7 ######################################################################### -- label: "chef-utils Unit :ruby: 2.6" +- label: "chef-utils Unit :ruby: 2.7" commands: - /workdir/.expeditor/scripts/bk_container_prep.sh - cd chef-utils @@ -26,9 +26,9 @@ steps: expeditor: executor: docker: - image: rubydistros/ubuntu-18.04:2.6 + image: rubydistros/ubuntu-18.04:2.7 -- label: "chef-config Unit :ruby: 2.6" +- label: "chef-config Unit :ruby: 2.7" commands: - /workdir/.expeditor/scripts/bk_container_prep.sh - cd chef-config @@ -39,7 +39,7 @@ steps: expeditor: executor: docker: - image: rubydistros/ubuntu-18.04:2.6 + image: rubydistros/ubuntu-18.04:2.7 ######################################################################### # Tests Ruby 3.0 diff --git a/.rubocop.yml b/.rubocop.yml index 0f6a38295d..53f23d84b8 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,5 +1,5 @@ AllCops: - TargetRubyVersion: 2.6 + TargetRubyVersion: 2.7 Exclude: - "spec/data/**/*" - "knife/spec/data/**/*" diff --git a/chef-config/chef-config.gemspec b/chef-config/chef-config.gemspec index 0cd5b263b8..c36e322ae3 100644 --- a/chef-config/chef-config.gemspec +++ b/chef-config/chef-config.gemspec @@ -12,7 +12,7 @@ Gem::Specification.new do |spec| spec.homepage = "https://github.com/chef/chef" spec.license = "Apache-2.0" - spec.required_ruby_version = ">= 2.6" + spec.required_ruby_version = ">= 2.7" spec.metadata = { "bug_tracker_uri" => "https://github.com/chef/chef/issues", diff --git a/chef-utils/chef-utils.gemspec b/chef-utils/chef-utils.gemspec index e885aae175..50fe6e8283 100644 --- a/chef-utils/chef-utils.gemspec +++ b/chef-utils/chef-utils.gemspec @@ -13,7 +13,7 @@ Gem::Specification.new do |spec| spec.homepage = "https://github.com/chef/chef/tree/main/chef-utils" spec.license = "Apache-2.0" - spec.required_ruby_version = ">= 2.6" + spec.required_ruby_version = ">= 2.7" spec.metadata = { "bug_tracker_uri" => "https://github.com/chef/chef/issues", diff --git a/chef.gemspec b/chef.gemspec index 76cee183e4..0db3db410a 100644 --- a/chef.gemspec +++ b/chef.gemspec @@ -22,7 +22,7 @@ Gem::Specification.new do |s| s.email = "adam@chef.io" s.homepage = "https://www.chef.io" - s.required_ruby_version = ">= 2.6.0" + s.required_ruby_version = ">= 2.7.0" s.add_dependency "chef-config", "= #{Chef::VERSION}" s.add_dependency "chef-utils", "= #{Chef::VERSION}" diff --git a/knife/knife.gemspec b/knife/knife.gemspec index ad7cfaf230..2c5442c7c2 100644 --- a/knife/knife.gemspec +++ b/knife/knife.gemspec @@ -13,7 +13,7 @@ Gem::Specification.new do |s| s.email = "adam@chef.io" # These seem a bit out of date, and this address probably doesn't go anywhere anymore? s.homepage = "https://www.chef.io" - s.required_ruby_version = ">= 2.7.0" + s.required_ruby_version = ">= 3.0.0" s.add_dependency "chef-config", ">= #{Chef::Knife::VERSION.split(".").first}" s.add_dependency "chef-utils", ">= #{Chef::Knife::VERSION.split(".").first}" -- cgit v1.2.1