From 65ae62b4dddc61c7e8230a47814e12342ee23816 Mon Sep 17 00:00:00 2001 From: Trevor Vaughan Date: Tue, 19 Apr 2022 17:54:42 -0400 Subject: [PATCH] Add CentOS Stream 9 support * SSG doesn't have a profile for EL9 * No SIMP repos for EL9 so those tests won't work * Manually verified * Bump to ruby 2.6 for net-ssh updates --- .github/workflows/pr_tests.yml | 10 ++---- .github/workflows/tag_deploy_rubygem.yml | 4 +-- .gitlab-ci.yml | 16 +++++---- Gemfile | 8 +++-- lib/simp/beaker_helpers.rb | 42 +++++++++++++++++------- lib/simp/beaker_helpers/ssg.rb | 18 ++++++++++ simp-beaker-helpers.gemspec | 2 +- spec/acceptance/nodesets/el9.yml | 32 ++++++++++++++++++ 8 files changed, 101 insertions(+), 31 deletions(-) create mode 100644 spec/acceptance/nodesets/el9.yml diff --git a/.github/workflows/pr_tests.yml b/.github/workflows/pr_tests.yml index 74f7b8f..bc67865 100644 --- a/.github/workflows/pr_tests.yml +++ b/.github/workflows/pr_tests.yml @@ -11,8 +11,6 @@ # The testing matrix considers ruby/puppet versions supported by SIMP and PE: # ------------------------------------------------------------------------------ # Release Puppet Ruby EOL -# SIMP 6.4 5.5 2.40 TBD -# PE 2018.1 5.5 2.40 2021-01 (LTS overlap) # PE 2019.8 6.18 2.5 2022-12 (LTS) # # https://puppet.com/docs/pe/2018.1/component_versions_in_recent_pe_releases.html @@ -46,7 +44,7 @@ jobs: - name: "Install Ruby ${{matrix.puppet.ruby_version}}" uses: ruby/setup-ruby@v1 with: - ruby-version: 2.5 + ruby-version: 2.6 bundler-cache: true - run: | bundle show @@ -60,10 +58,8 @@ jobs: puppet: - label: 'Puppet 6.18 [SIMP 6.5/PE 2019.8]' puppet_version: '~> 6.18.0' - ruby_version: '2.5' - - label: 'Puppet 5.5 [SIMP 6.4/PE 2018.1]' - puppet_version: '~> 5.5.22' - ruby_version: '2.4' + # Needed for net-ssh updates and EL9 + ruby_version: '2.6' - label: 'Puppet 7.x' puppet_version: '~> 7.0' ruby_version: '2.7' diff --git a/.github/workflows/tag_deploy_rubygem.yml b/.github/workflows/tag_deploy_rubygem.yml index b377601..df3b951 100644 --- a/.github/workflows/tag_deploy_rubygem.yml +++ b/.github/workflows/tag_deploy_rubygem.yml @@ -92,7 +92,7 @@ jobs: echo "::set-output name=release_command::${GEM_RELEASE_COMMAND}" - uses: ruby/setup-ruby@v1 with: - ruby-version: 2.5 + ruby-version: 2.6 bundler-cache: true - name: Test build the package run: "${{ steps.commands.outputs.build_command }}" @@ -183,7 +183,7 @@ jobs: clean: true - uses: ruby/setup-ruby@v1 with: - ruby-version: 2.5 + ruby-version: 2.6 bundler-cache: true - name: Build RubyGem run: | diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b244a01..7913ac4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,8 +6,6 @@ # https://puppet.com/docs/pe/2018.1/overview/getting_support_for_pe.html # ------------------------------------------------------------------------------ # Release Puppet Ruby EOL -# SIMP 6.4 5.5 2.4.10 TBD -# PE 2018.1 5.5 2.4.10 2021-01 (LTS overlap) # PE 2019.8 6.18 2.5.7 2022-12 (LTS) --- @@ -210,18 +208,18 @@ variables: #----------------------------------------------------------------------- .pup_6_x: &pup_6_x - image: 'ruby:2.5' + image: 'ruby:2.6' variables: PUPPET_VERSION: '~> 6.0' BEAKER_PUPPET_COLLECTION: 'puppet6' - MATRIX_RUBY_VERSION: '2.5' + MATRIX_RUBY_VERSION: '2.6' .pup_6_pe: &pup_6_pe - image: 'ruby:2.5' + image: 'ruby:2.6' variables: PUPPET_VERSION: '6.18.0' BEAKER_PUPPET_COLLECTION: 'puppet6' - MATRIX_RUBY_VERSION: '2.5' + MATRIX_RUBY_VERSION: '2.6' .pup_7_x: &pup_7_x image: 'ruby:2.7' @@ -319,6 +317,12 @@ default-amzn2: script: - bundle exec rake beaker:suites[default,amzn2] +default-el9: + <<: *pup_6_x + <<: *acceptance_base + script: + - bundle exec rake beaker:suites[default,el9] + default-fips: <<: *pup_6_x <<: *acceptance_base diff --git a/Gemfile b/Gemfile index 5f3a941..9b83732 100644 --- a/Gemfile +++ b/Gemfile @@ -13,7 +13,7 @@ gem 'bundler' gem 'rake' group :system_tests do - beaker_gem_options = ENV.fetch('BEAKER_GEM_OPTIONS', ['>= 4.28.1', '< 5.0.0']) + beaker_gem_options = ENV.fetch('BEAKER_GEM_OPTIONS', ['>= 4.33.0', '< 5.0.0']) if "#{beaker_gem_options}".include?(':') # Just pass in BEAKER_GEM_OPTIONS as a string that would represent the usual @@ -43,9 +43,11 @@ group :system_tests do gem 'beaker-rspec' gem 'beaker-windows' - gem 'net-ssh' + # Need at least 85ebe31 for EL9 support + gem 'net-ssh', :git => "https://github.com/net-ssh/net-ssh", :ref => 'v7.0.0.beta1' + gem 'bcrypt_pbkdf' unless RUBY_PLATFORM == 'java' gem 'puppet', ENV.fetch('PUPPET_VERSION', '~> 7.0') + gem 'puppetlabs_spec_helper', '~> 3.0' gem 'rubocop' gem 'rubocop-rspec' - gem 'puppetlabs_spec_helper', '~> 4.0' end diff --git a/lib/simp/beaker_helpers.rb b/lib/simp/beaker_helpers.rb index 5d09ffe..96f967a 100644 --- a/lib/simp/beaker_helpers.rb +++ b/lib/simp/beaker_helpers.rb @@ -637,12 +637,6 @@ def enable_epel_on(suts) # This is based on the official EPEL docs https://fedoraproject.org/wiki/EPEL case os_info['name'] when 'RedHat','CentOS' - install_latest_package_on( - sut, - 'epel-release', - "https://dl.fedoraproject.org/pub/epel/epel-release-latest-#{os_maj_rel}.noarch.rpm", - ) - if os_info['name'] == 'RedHat' if os_maj_rel == '7' on sut, %{subscription-manager repos --enable "rhel-*-optional-rpms"} @@ -650,23 +644,43 @@ def enable_epel_on(suts) on sut, %{subscription-manager repos --enable "rhel-ha-for-rhel-*-server-rpms"} end - if os_maj_rel == '8' - on sut, %{subscription-manager repos --enable "codeready-builder-for-rhel-8-#{os_info['architecture']}-rpms"} + if os_maj_rel > '7' + on sut, %{subscription-manager repos --enable "codeready-builder-for-rhel-#{os_maj_rel}-#{os_info['architecture']}-rpms"} end end if os_info['name'] == 'CentOS' - if os_maj_rel == '8' - # 8.0 fallback + if os_maj_rel > '7' install_latest_package_on(sut, 'dnf-plugins-core') + end + if os_maj_rel == '8' on sut, %{dnf config-manager --set-enabled powertools || dnf config-manager --set-enabled PowerTools} end + if os_maj_rel == '9' + on sut, %{dnf config-manager --set-enabled crb} + end + end + + if os_maj_rel < '8' + install_latest_package_on( + sut, + 'epel-release', + "https://dl.fedoraproject.org/pub/epel/epel-release-latest-#{os_maj_rel}.noarch.rpm", + ) + else + # Workaround because of :shrug: + on(sut, "cd /etc/pki/rpm-gpg; curl -L -O https://www.centos.org/keys/RPM-GPG-KEY-CentOS-SIG-Extras") + + install_latest_package_on(sut, 'epel-release') + + if os_info['id'] == 'CentOSStream' + install_latest_package_on(sut, 'epel-next-release') + end end when 'OracleLinux' package_name = "oracle-epel-release-el#{os_maj_rel}" install_latest_package_on(sut,package_name) end - end end end @@ -815,6 +829,10 @@ def rhel_rhsm_subscribe(suts, *opts) '8' => [ 'rhel-8-for-x86_64-baseos-rpms', 'rhel-8-for-x86_64-supplementary-rpms' + ], + '9' => [ + 'rhel-9-for-x86_64-baseos-rpms', + 'rhel-9-for-x86_64-supplementary-rpms' ] } } @@ -1541,7 +1559,7 @@ def install_simp_repos(suts, disable = []) # from YUM. This does not actually "enable" the repos, that would require # the "--enable" option (from yum-config-manager) :-D. # - # Note: Certain versions of EL8 do not dump by default and EL7 does not + # Note: Certain versions of EL8+ do not dump by default and EL7 does not # have the '--dump' option. available_repos = on(sut, %{yum-config-manager --enablerepo="*" || yum-config-manager --enablerepo="*" --dump}).stdout.lines.grep(/\A\[(.+)\]\Z/){|x| $1} diff --git a/lib/simp/beaker_helpers/ssg.rb b/lib/simp/beaker_helpers/ssg.rb index c1fac46..0aaaf2d 100644 --- a/lib/simp/beaker_helpers/ssg.rb +++ b/lib/simp/beaker_helpers/ssg.rb @@ -46,6 +46,8 @@ class SSG 'libarchive' ] + EL9_PACKAGES = EL8_PACKAGES + OS_INFO = { 'RedHat' => { '6' => { @@ -71,6 +73,14 @@ class SSG 'build_target' => 'rhel8', 'datastream' => 'ssg-rhel8-ds.xml' } + }, + '9' => { + 'required_packages' => EL9_PACKAGES, + 'ssg' => { + 'profile_target' => 'rhel9', + 'build_target' => 'rhel9', + 'datastream' => 'ssg-rhel9-ds.xml' + } } }, 'CentOS' => { @@ -97,6 +107,14 @@ class SSG 'build_target' => 'centos8', 'datastream' => 'ssg-centos8-ds.xml' } + }, + '9' => { + 'required_packages' => EL9_PACKAGES, + 'ssg' => { + 'profile_target' => 'centos9', + 'build_target' => 'centos9', + 'datastream' => 'ssg-centos9-ds.xml' + } } }, 'Rocky' => { diff --git a/simp-beaker-helpers.gemspec b/simp-beaker-helpers.gemspec index 0e2e3a2..23949ee 100644 --- a/simp-beaker-helpers.gemspec +++ b/simp-beaker-helpers.gemspec @@ -21,7 +21,7 @@ Gem::Specification.new do |s| s.required_ruby_version = '>= 2.3.0' - s.add_runtime_dependency 'beaker' , ['>= 4.17.0', '< 5.0.0'] + s.add_runtime_dependency 'beaker' , ['>= 4.33.0', '< 5.0.0'] s.add_runtime_dependency 'beaker-rspec' , '~> 7.1' s.add_runtime_dependency 'beaker-puppet' , ['>= 1.18.14', '< 2.0.0'] s.add_runtime_dependency 'beaker-docker' , ['>= 0.8.3', '< 2.0.0'] diff --git a/spec/acceptance/nodesets/el9.yml b/spec/acceptance/nodesets/el9.yml new file mode 100644 index 0000000..73a8d64 --- /dev/null +++ b/spec/acceptance/nodesets/el9.yml @@ -0,0 +1,32 @@ +<% + hypervisor = ENV.fetch('BEAKER_HYPERVISOR', 'vagrant') +-%> +HOSTS: + el9: + roles: + - el9 + - master + - default + platform: el-9-x86_64 + box: centos/9 + box_url: https://cloud.centos.org/centos/9-stream/x86_64/images/CentOS-Stream-Vagrant-9-20220509.0.x86_64.vagrant-virtualbox.box + hypervisor: <%= hypervisor %> + +CONFIG: + log_level: verbose + type: aio + vagrant_cpus: 2 +<% if ENV['BEAKER_PUPPET_COLLECTION'] -%> + puppet_collection: <%= ENV['BEAKER_PUPPET_COLLECTION'] %> +<% end -%> + ssh: + keepalive: true + keepalive_interval: 10 + host_key: + - <%= Net::SSH::Transport::Algorithms::ALGORITHMS[:host_key].join("\n#{' '*6}- ") %> + kex: + - <%= Net::SSH::Transport::Algorithms::ALGORITHMS[:kex].join("\n#{' '*6}- ") %> + encryption: + - <%= Net::SSH::Transport::Algorithms::ALGORITHMS[:encryption].join("\n#{' '*6}- ") %> + hmac: + - <%= Net::SSH::Transport::Algorithms::ALGORITHMS[:hmac].join("\n#{' '*6}- ") %>