Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CentOS Stream 9 support #179

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions .github/workflows/pr_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tag_deploy_rubygem.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
Expand Down Expand Up @@ -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: |
Expand Down
16 changes: 10 additions & 6 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
---

Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -43,9 +43,10 @@ group :system_tests do

gem 'beaker-rspec'
gem 'beaker-windows'
gem 'net-ssh'
gem 'net-ssh', '< 7.0' if Gem::Requirement.create('< 2.6').satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem 'bcrypt_pbkdf' unless RUBY_PLATFORM == 'java'
gem 'puppet', ENV.fetch('PUPPET_VERSION', '~> 7.0')
gem 'puppetlabs_spec_helper', '~> 4.0'
gem 'rubocop'
gem 'rubocop-rspec'
gem 'puppetlabs_spec_helper', '~> 4.0'
end
34 changes: 30 additions & 4 deletions lib/simp/beaker_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -650,17 +650,39 @@ 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 ['CentOS','AlmaLinux','Rocky'].include?(os_info['name'])
if os_maj_rel == '8'
if os_maj_rel > '7'
# 8.0 fallback
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:
trevor-vaughan marked this conversation as resolved.
Show resolved Hide resolved
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}"
Expand Down Expand Up @@ -823,6 +845,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'
]
}
}
Expand Down Expand Up @@ -1556,7 +1582,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}

Expand Down
18 changes: 18 additions & 0 deletions lib/simp/beaker_helpers/ssg.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ class SSG
'libarchive'
]

EL9_PACKAGES = EL8_PACKAGES

OS_INFO = {
'RedHat' => {
'6' => {
Expand All @@ -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' => {
Expand All @@ -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' => {
Expand Down
2 changes: 1 addition & 1 deletion simp-beaker-helpers.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down
32 changes: 32 additions & 0 deletions spec/acceptance/nodesets/el9.yml
Original file line number Diff line number Diff line change
@@ -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}- ") %>
50 changes: 50 additions & 0 deletions spec/acceptance/suites/default/99_install_simp_deps_repo_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
require 'spec_helper_acceptance'

hosts.each do |host|
unsupported_host = false
if hosts_with_role(hosts, 'el9').include?(host)
unsupported_host = true
end

describe '#install_simp_repos' do
if unsupported_host
it "does not support #{host}"
else
it 'should install yum utils' do
host.install_package('yum-utils')
end

context 'default settings' do
before(:all) { install_simp_repos(host) }

it 'enables the correct repos' do
on(host, 'yum -y list simp')
on(host, 'yum -y list postgresql96')
end
end

context 'when targeting a release type' do
it 'adjusts the SIMP release target' do
set_simp_repo_release(host, 'rolling')
expect(file_content_on(host, '/etc/yum/vars/simpreleasetype').strip).to eq('rolling')
end

it 'lists the simp rpm' do
on(host, 'yum list simp')
end
end

context 'when passed a disabled list ' do
before(:all) { install_simp_repos(host, ['simp-community-simp'] ) }

it 'enables the correct repos' do
on(host, 'yum -y list postgresql96')
end

it 'disables the correct repos' do
on(host, 'yum -y list simp', :acceptable_exit_codes => [1])
end
end
end
end
end
49 changes: 0 additions & 49 deletions spec/acceptance/suites/default/install_simp_deps_repo_spec.rb

This file was deleted.