From ca7165644ac4623cdcdf63412bee45140aa01a5e Mon Sep 17 00:00:00 2001 From: Lukas Audzevicius Date: Wed, 16 Apr 2025 07:44:27 +0100 Subject: [PATCH 1/3] (CAT-2286) Remove puppet 7 infrastructure Puppet 7 is EOL. Therefore, we can remove the test infrastructure for it. This commit aims to clear up any testing/config infrastructure related to Puppet 7 and, by extension, Ruby 2.7. --- .github/workflows/ci.yml | 1 - .github/workflows/nightly.yml | 1 - .rubocop.yml | 2 +- puppet_litmus.gemspec | 2 +- 4 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 004f0236..bd15064f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,6 @@ jobs: fail-fast: false matrix: ruby_version: - - '2.7' - '3.2' name: "spec (ruby ${{ matrix.ruby_version }})" uses: "puppetlabs/cat-github-actions/.github/workflows/gem_ci.yml@main" diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 6e74a119..4ca32123 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -11,7 +11,6 @@ jobs: fail-fast: false matrix: ruby_version: - - '2.7' - '3.2' name: "spec (ruby ${{ matrix.ruby_version }})" uses: "puppetlabs/cat-github-actions/.github/workflows/gem_ci.yml@main" diff --git a/.rubocop.yml b/.rubocop.yml index 86f0f0b0..faad379c 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -12,7 +12,7 @@ AllCops: - vendor/bundle/**/* NewCops: enable SuggestExtensions: false - TargetRubyVersion: '2.7' + TargetRubyVersion: '3.1' # Disabled Style/ClassAndModuleChildren: diff --git a/puppet_litmus.gemspec b/puppet_litmus.gemspec index a7d6092e..f0aa5246 100644 --- a/puppet_litmus.gemspec +++ b/puppet_litmus.gemspec @@ -24,7 +24,7 @@ Gem::Specification.new do |spec| Providing a simple command line tool for puppet content creators, to enable simple and complex test deployments. EOF spec.summary = 'Providing a simple command line tool for puppet content creators, to enable simple and complex test deployments.' - spec.required_ruby_version = Gem::Requirement.new('>= 2.7.0') + spec.required_ruby_version = Gem::Requirement.new('>= 3.1.0') spec.add_runtime_dependency 'bolt', '~> 4.0' spec.add_runtime_dependency 'docker-api', '>= 1.34', '< 3.0.0' spec.add_runtime_dependency 'parallel' From 7411eaba42515134e5e14d14a23ee255743fd692 Mon Sep 17 00:00:00 2001 From: Lukas Audzevicius Date: Wed, 16 Apr 2025 07:47:12 +0100 Subject: [PATCH 2/3] Rubocop safe autocorrections --- exe/matrix_from_metadata_v3 | 8 ++++---- lib/puppet_litmus/puppet_helpers.rb | 6 +++--- lib/puppet_litmus/spec_helper_acceptance.rb | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/exe/matrix_from_metadata_v3 b/exe/matrix_from_metadata_v3 index 7cee60d9..a1349503 100755 --- a/exe/matrix_from_metadata_v3 +++ b/exe/matrix_from_metadata_v3 @@ -308,10 +308,10 @@ options[:metadata]['operatingsystem_support'].each do |os_sup| end os_ver_platforms << { - label: label, + label:, provider: provisioner, - arch: arch, - image: image, + arch:, + image:, runner: runner.nil? ? options[:runner] : runner } end @@ -330,7 +330,7 @@ Action.group('matrix', matrix, pretty: true).group('spec_matrix', spec_matrix, p Action.error('no supported puppet versions') if matrix[:collection].empty? if Action.type == 'stdout' - $stdout.puts JSON.generate({ matrix: matrix, spec_matrix: spec_matrix }) + $stdout.puts JSON.generate({ matrix:, spec_matrix: }) else Action.set_output('matrix', matrix).set_output('spec_matrix', spec_matrix) end diff --git a/lib/puppet_litmus/puppet_helpers.rb b/lib/puppet_litmus/puppet_helpers.rb index c4b759cc..86637d29 100644 --- a/lib/puppet_litmus/puppet_helpers.rb +++ b/lib/puppet_litmus/puppet_helpers.rb @@ -20,8 +20,8 @@ module PuppetLitmus::PuppetHelpers # @return [Boolean] The result of the 2 apply manifests. def idempotent_apply(manifest, opts = {}) manifest_file_location = create_manifest_file(manifest) - apply_manifest(nil, **opts, catch_failures: true, manifest_file_location: manifest_file_location) - apply_manifest(nil, **opts, catch_changes: true, manifest_file_location: manifest_file_location) + apply_manifest(nil, **opts, catch_failures: true, manifest_file_location:) + apply_manifest(nil, **opts, catch_changes: true, manifest_file_location:) end # Applies a manifest. returning the result of that apply. Mimics the apply_manifest from beaker @@ -230,7 +230,7 @@ def bolt_upload_file(source, destination, opts = {}, options = {}) target_node_name = search_for_target(target_option, inventory_hash) end - bolt_result = upload_file(source, destination, target_node_name, options: options, config: nil, inventory: inventory_hash) + bolt_result = upload_file(source, destination, target_node_name, options:, config: nil, inventory: inventory_hash) result_obj = { exit_code: 0, diff --git a/lib/puppet_litmus/spec_helper_acceptance.rb b/lib/puppet_litmus/spec_helper_acceptance.rb index 8a15504e..57a8e160 100644 --- a/lib/puppet_litmus/spec_helper_acceptance.rb +++ b/lib/puppet_litmus/spec_helper_acceptance.rb @@ -88,9 +88,9 @@ def self.configure! endpoint.path = '/wsman' opts = { - user: user, + user:, password: pass, - endpoint: endpoint, + endpoint:, operation_timeout: 300 } From e01c392f0109cd88b760098935b190d38fa2f066 Mon Sep 17 00:00:00 2001 From: Lukas Audzevicius Date: Wed, 16 Apr 2025 09:39:06 +0100 Subject: [PATCH 3/3] Removing Puppet 7 from default supported list --- exe/matrix.json | 6 +-- spec/exe/matrix_from_metadata_v3_spec.rb | 52 ++++++++++++------------ 2 files changed, 27 insertions(+), 31 deletions(-) diff --git a/exe/matrix.json b/exe/matrix.json index 4d2148a5..329e26c7 100755 --- a/exe/matrix.json +++ b/exe/matrix.json @@ -1,9 +1,5 @@ { "collections": [ - { - "puppet": 7.24, - "ruby": 2.7 - }, { "puppet": 8.0, "ruby": 3.2 @@ -90,7 +86,7 @@ }, "github_runner": { "docker": { - "^(AmazonLinux-2|(CentOS|OracleLinux|Scientific)-7|Ubuntu-18|Debian-10)": "ubuntu-20.04" + "^(AmazonLinux-2|(CentOS|OracleLinux|Scientific)-7|Ubuntu-18|Debian-10)": "ubuntu-22.04" } } } diff --git a/spec/exe/matrix_from_metadata_v3_spec.rb b/spec/exe/matrix_from_metadata_v3_spec.rb index 4dbc2836..32b94c26 100644 --- a/spec/exe/matrix_from_metadata_v3_spec.rb +++ b/spec/exe/matrix_from_metadata_v3_spec.rb @@ -24,13 +24,13 @@ matrix = [ 'matrix={', '"platforms":[', - '{"label":"AmazonLinux-2","provider":"docker","arch":"x86_64","image":"litmusimage/amazonlinux:2","runner":"ubuntu-20.04"},', - '{"label":"AmazonLinux-2023","provider":"docker","arch":"x86_64","image":"litmusimage/amazonlinux:2023","runner":"ubuntu-20.04"},', - '{"label":"Ubuntu-18.04","provider":"docker","arch":"x86_64","image":"litmusimage/ubuntu:18.04","runner":"ubuntu-20.04"},', + '{"label":"AmazonLinux-2","provider":"docker","arch":"x86_64","image":"litmusimage/amazonlinux:2","runner":"ubuntu-22.04"},', + '{"label":"AmazonLinux-2023","provider":"docker","arch":"x86_64","image":"litmusimage/amazonlinux:2023","runner":"ubuntu-22.04"},', + '{"label":"Ubuntu-18.04","provider":"docker","arch":"x86_64","image":"litmusimage/ubuntu:18.04","runner":"ubuntu-22.04"},', '{"label":"Ubuntu-22.04","provider":"docker","arch":"x86_64","image":"litmusimage/ubuntu:22.04","runner":"ubuntu-latest"}', '],', '"collection":[', - '"puppet7-nightly","puppet8-nightly"', + '"puppet8-nightly"', ']', '}' ].join @@ -41,7 +41,7 @@ '::group::spec_matrix' ) expect(github_output_content).to include(matrix) - expect(github_output_content).to include('spec_matrix={"include":[{"puppet_version":"~> 7.24","ruby_version":2.7},{"puppet_version":"~> 8.0","ruby_version":3.2}]}') + expect(github_output_content).to include('spec_matrix={"include":[{"puppet_version":"~> 8.0","ruby_version":3.2}]}') end end @@ -53,17 +53,17 @@ [ 'matrix={', '"platforms":[', - '{"label":"AmazonLinux-2","provider":"docker","arch":"x86_64","image":"litmusimage/amazonlinux:2","runner":"ubuntu-20.04"},', - '{"label":"AmazonLinux-2023","provider":"docker","arch":"x86_64","image":"litmusimage/amazonlinux:2023","runner":"ubuntu-20.04"},', + '{"label":"AmazonLinux-2","provider":"docker","arch":"x86_64","image":"litmusimage/amazonlinux:2","runner":"ubuntu-22.04"},', + '{"label":"AmazonLinux-2023","provider":"docker","arch":"x86_64","image":"litmusimage/amazonlinux:2023","runner":"ubuntu-22.04"},', '{"label":"RedHat-8","provider":"provision_service","arch":"x86_64","image":"rhel-8","runner":"ubuntu-latest"},', '{"label":"RedHat-9","provider":"provision_service","arch":"x86_64","image":"rhel-9","runner":"ubuntu-latest"},', '{"label":"RedHat-9-arm","provider":"provision_service","arch":"arm","image":"rhel-9-arm64","runner":"ubuntu-latest"},', - '{"label":"Ubuntu-18.04","provider":"docker","arch":"x86_64","image":"litmusimage/ubuntu:18.04","runner":"ubuntu-20.04"},', + '{"label":"Ubuntu-18.04","provider":"docker","arch":"x86_64","image":"litmusimage/ubuntu:18.04","runner":"ubuntu-22.04"},', '{"label":"Ubuntu-22.04","provider":"docker","arch":"x86_64","image":"litmusimage/ubuntu:22.04","runner":"ubuntu-latest"},', '{"label":"Ubuntu-22.04-arm","provider":"provision_service","arch":"arm","image":"ubuntu-2204-lts-arm64","runner":"ubuntu-latest"}', '],', '"collection":[', - '"puppet7-nightly","puppet8-nightly"', + '"puppet8-nightly"', ']', '}' ].join @@ -82,7 +82,7 @@ ) expect(github_output_content).to include(matrix) expect(github_output_content).to include( - 'spec_matrix={"include":[{"puppet_version":"~> 7.24","ruby_version":2.7},{"puppet_version":"~> 8.0","ruby_version":3.2}]}' + 'spec_matrix={"include":[{"puppet_version":"~> 8.0","ruby_version":3.2}]}' ) end end @@ -93,17 +93,17 @@ [ 'matrix={', '"platforms":[', - '{"label":"AmazonLinux-2","provider":"docker","arch":"x86_64","image":"litmusimage/amazonlinux:2","runner":"ubuntu-20.04"},', - '{"label":"AmazonLinux-2023","provider":"docker","arch":"x86_64","image":"litmusimage/amazonlinux:2023","runner":"ubuntu-20.04"},', + '{"label":"AmazonLinux-2","provider":"docker","arch":"x86_64","image":"litmusimage/amazonlinux:2","runner":"ubuntu-22.04"},', + '{"label":"AmazonLinux-2023","provider":"docker","arch":"x86_64","image":"litmusimage/amazonlinux:2023","runner":"ubuntu-22.04"},', '{"label":"RedHat-8","provider":"provision_service","arch":"x86_64","image":"rhel-8","runner":"ubuntu-latest"},', '{"label":"RedHat-9","provider":"provision_service","arch":"x86_64","image":"rhel-9","runner":"ubuntu-latest"},', '{"label":"RedHat-9-arm","provider":"provision_service","arch":"arm","image":"rhel-9-arm64","runner":"ubuntu-latest"},', - '{"label":"Ubuntu-18.04","provider":"docker","arch":"x86_64","image":"litmusimage/ubuntu:18.04","runner":"ubuntu-20.04"},', + '{"label":"Ubuntu-18.04","provider":"docker","arch":"x86_64","image":"litmusimage/ubuntu:18.04","runner":"ubuntu-22.04"},', '{"label":"Ubuntu-22.04","provider":"docker","arch":"x86_64","image":"litmusimage/ubuntu:22.04","runner":"ubuntu-latest"},', '{"label":"Ubuntu-22.04-arm","provider":"provision_service","arch":"arm","image":"ubuntu-2204-lts-arm64","runner":"ubuntu-latest"}', '],', '"collection":[', - '"puppet7-nightly","puppet8-nightly"', + '"puppet8-nightly"', ']', '}' ].join @@ -122,7 +122,7 @@ ) expect(github_output_content).to include(matrix) expect(github_output_content).to include( - 'spec_matrix={"include":[{"puppet_version":"~> 7.24","ruby_version":2.7},{"puppet_version":"~> 8.0","ruby_version":3.2}]}' + 'spec_matrix={"include":[{"puppet_version":"~> 8.0","ruby_version":3.2}]}' ) end end @@ -133,8 +133,8 @@ [ 'matrix={', '"platforms":[', - '{"label":"AmazonLinux-2","provider":"docker","arch":"x86_64","image":"litmusimage/amazonlinux:2","runner":"ubuntu-20.04"},', - '{"label":"AmazonLinux-2023","provider":"docker","arch":"x86_64","image":"litmusimage/amazonlinux:2023","runner":"ubuntu-20.04"},', + '{"label":"AmazonLinux-2","provider":"docker","arch":"x86_64","image":"litmusimage/amazonlinux:2","runner":"ubuntu-22.04"},', + '{"label":"AmazonLinux-2023","provider":"docker","arch":"x86_64","image":"litmusimage/amazonlinux:2023","runner":"ubuntu-22.04"},', '{"label":"RedHat-8","provider":"provision_service","arch":"x86_64","image":"rhel-8","runner":"ubuntu-latest"},', '{"label":"RedHat-9","provider":"provision_service","arch":"x86_64","image":"rhel-9","runner":"ubuntu-latest"},', '{"label":"RedHat-9-arm","provider":"provision_service","arch":"arm","image":"rhel-9-arm64","runner":"ubuntu-latest"},', @@ -142,7 +142,7 @@ '{"label":"Ubuntu-22.04-arm","provider":"provision_service","arch":"arm","image":"ubuntu-2204-lts-arm64","runner":"ubuntu-latest"}', '],', '"collection":[', - '"puppet7-nightly","puppet8-nightly"', + '"puppet8-nightly"', ']', '}' ].join @@ -162,7 +162,7 @@ ) expect(github_output_content).to include(matrix) expect(github_output_content).to include( - 'spec_matrix={"include":[{"puppet_version":"~> 7.24","ruby_version":2.7},{"puppet_version":"~> 8.0","ruby_version":3.2}]}' + 'spec_matrix={"include":[{"puppet_version":"~> 8.0","ruby_version":3.2}]}' ) end end @@ -175,7 +175,7 @@ '"platforms":[', '],', '"collection":[', - '"puppet7-nightly","puppet8-nightly"', + '"puppet8-nightly"', ']', '}' ].join @@ -198,7 +198,7 @@ ) expect(github_output_content).to include(matrix) expect(github_output_content).to include( - 'spec_matrix={"include":[{"puppet_version":"~> 7.24","ruby_version":2.7},{"puppet_version":"~> 8.0","ruby_version":3.2}]}' + 'spec_matrix={"include":[{"puppet_version":"~> 8.0","ruby_version":3.2}]}' ) end end @@ -209,13 +209,13 @@ [ 'matrix={', '"platforms":[', - '{"label":"AmazonLinux-2","provider":"docker","arch":"x86_64","image":"litmusimage/amazonlinux:2","runner":"ubuntu-20.04"},', + '{"label":"AmazonLinux-2","provider":"docker","arch":"x86_64","image":"litmusimage/amazonlinux:2","runner":"ubuntu-22.04"},', '{"label":"AmazonLinux-2023","provider":"docker","arch":"x86_64","image":"litmusimage/amazonlinux:2023","runner":"ubuntu-20.04"},', - '{"label":"Ubuntu-18.04","provider":"docker","arch":"x86_64","image":"litmusimage/ubuntu:18.04","runner":"ubuntu-20.04"},', + '{"label":"Ubuntu-18.04","provider":"docker","arch":"x86_64","image":"litmusimage/ubuntu:18.04","runner":"ubuntu-22.04"},', '{"label":"Ubuntu-22.04","provider":"docker","arch":"x86_64","image":"litmusimage/ubuntu:22.04","runner":"ubuntu-latest"}', '],', '"collection":[', - '"puppet7-nightly","puppet8-nightly"', + '"puppet8-nightly"', ']', '}' ].join @@ -233,10 +233,10 @@ '::group::spec_matrix' ) expect(github_output_content).to include( - '"collection":["2023.8.0-puppet_enterprise","2021.7.9-puppet_enterprise","puppet7-nightly","puppet8-nightly"' + '"collection":["2023.8.0-puppet_enterprise","2021.7.9-puppet_enterprise","puppet8-nightly"' ) expect(github_output_content).to include( - 'spec_matrix={"include":[{"puppet_version":"~> 7.24","ruby_version":2.7},{"puppet_version":"~> 8.0","ruby_version":3.2}]}' + 'spec_matrix={"include":[{"puppet_version":"~> 8.0","ruby_version":3.2}]}' ) end end