Skip to content

Commit

Permalink
use rhel platform for all el8 and rhel 9+ (#1297)
Browse files Browse the repository at this point in the history
fixes #1276

Signed-off-by: Ben Dean <[email protected]>
  • Loading branch information
b-dean authored Jan 16, 2025
1 parent 138ddc7 commit e7721cb
Show file tree
Hide file tree
Showing 3 changed files with 127 additions and 2 deletions.
12 changes: 12 additions & 0 deletions kitchen.dokken.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,18 @@ platforms:
image: dokken/oraclelinux-9
pid_one_command: /usr/lib/systemd/systemd

- name: rhel-8
driver:
image: registry.access.redhat.com/ubi8/ubi-init
pid_one_command: /sbin/init

- name: rhel-9
driver:
image: registry.access.redhat.com/ubi9/ubi-init
pid_one_command: /sbin/init
intermediate_instructions:
- RUN dnf install -y libxcrypt-compat

- name: rockylinux-8
driver:
image: dokken/rockylinux-8
Expand Down
10 changes: 9 additions & 1 deletion resources/installation_package.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ def el7?
false
end

def el8?
return true if platform_family?('rhel') && node['platform_version'].to_i == 8
false
end

def fedora?
return true if platform?('fedora')
false
Expand Down Expand Up @@ -124,7 +129,10 @@ def version_string(v)
if platform?('fedora')
'fedora'
# s390x is only available under rhel platform
elsif platform?('redhat') && arch == 's390x'
elsif platform?('redhat', 'oracle') && (arch == 's390x' || !el7?)
'rhel'
# use rhel for all el8 since CentOS 8 is dead
elsif el8? && !platform?('centos')
'rhel'
else
'centos'
Expand Down
107 changes: 106 additions & 1 deletion spec/docker_test/installation_package_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,25 @@
end
end

context 'CentOS (s390x): testing default action, default properties' do
context 'CentOS 9: testing default action, default properties' do
platform 'centos-stream', '9'
cached(:subject) { chef_run }

it 'installs docker' do
expect(chef_run).to create_docker_installation_package('default')
end
it do
expect(chef_run).to create_yum_repository('Docker').with(
baseurl: 'https://download.docker.com/linux/centos/9/x86_64/stable',
gpgkey: 'https://download.docker.com/linux/centos/gpg',
description: 'Docker Stable repository',
gpgcheck: true,
enabled: true
)
end
end

context 'RHEL (s390x): testing default action, default properties' do
platform 'redhat', '8'
cached(:subject) { chef_run }
automatic_attributes['kernel']['machine'] = 's390x'
Expand All @@ -88,6 +106,93 @@
end
end

context 'RHEL 8: testing default action, default properties' do
platform 'redhat', '8'
cached(:subject) { chef_run }

it 'installs docker' do
expect(chef_run).to create_docker_installation_package('default')
end
it do
expect(chef_run).to create_yum_repository('Docker').with(
baseurl: 'https://download.docker.com/linux/rhel/8/x86_64/stable',
gpgkey: 'https://download.docker.com/linux/rhel/gpg',
description: 'Docker Stable repository',
gpgcheck: true,
enabled: true
)
end
end

context 'RHEL 9: testing default action, default properties' do
platform 'redhat', '9'
cached(:subject) { chef_run }

it 'installs docker' do
expect(chef_run).to create_docker_installation_package('default')
end
it do
expect(chef_run).to create_yum_repository('Docker').with(
baseurl: 'https://download.docker.com/linux/rhel/9/x86_64/stable',
gpgkey: 'https://download.docker.com/linux/rhel/gpg',
description: 'Docker Stable repository',
gpgcheck: true,
enabled: true
)
end
end

context 'Oracle 7: testing default action, default properties' do
platform 'oracle', '7'
cached(:subject) { chef_run }
it 'installs docker' do
expect(chef_run).to create_docker_installation_package('default')
end
it do
expect(chef_run).to create_yum_repository('Docker').with(
baseurl: 'https://download.docker.com/linux/centos/7/x86_64/stable',
gpgkey: 'https://download.docker.com/linux/centos/gpg',
description: 'Docker Stable repository',
gpgcheck: true,
enabled: true
)
end
end

context 'Oracle 8: testing default action, default properties' do
platform 'oracle', '8'
cached(:subject) { chef_run }
it 'installs docker' do
expect(chef_run).to create_docker_installation_package('default')
end
it do
expect(chef_run).to create_yum_repository('Docker').with(
baseurl: 'https://download.docker.com/linux/rhel/8/x86_64/stable',
gpgkey: 'https://download.docker.com/linux/rhel/gpg',
description: 'Docker Stable repository',
gpgcheck: true,
enabled: true
)
end
end

context 'Oracle 9: testing default action, default properties' do
platform 'oracle', '9'
cached(:subject) { chef_run }
it 'installs docker' do
expect(chef_run).to create_docker_installation_package('default')
end
it do
expect(chef_run).to create_yum_repository('Docker').with(
baseurl: 'https://download.docker.com/linux/rhel/9/x86_64/stable',
gpgkey: 'https://download.docker.com/linux/rhel/gpg',
description: 'Docker Stable repository',
gpgcheck: true,
enabled: true
)
end
end

# Coverage of all recent docker versions
# To ensure test coverage and backwards compatibility
# With the frequent changes in package naming convention
Expand Down

0 comments on commit e7721cb

Please sign in to comment.