Skip to content

Commit

Permalink
Use the none collection on some distros
Browse files Browse the repository at this point in the history
voxpupuli-acceptance 2.1.0 has added support for the "none" collection
which typically implies the distro package is used. This starts using
that for Archlinux and Gentoo. It means we no longer know which version
of Puppet is used, but that's technically correct. It just mentions the
distro Puppet.
  • Loading branch information
ekohl authored and bastelfreak committed Jul 14, 2023
1 parent 4abecc9 commit 0dcad53
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2023-07-05 07:08:46 UTC using RuboCop version 1.50.2.
# on 2023-07-14 11:59:53 UTC using RuboCop version 1.54.2.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
Expand Down Expand Up @@ -54,7 +54,7 @@ RSpec/ContextWording:
# Offense count: 7
# Configuration parameters: CountAsOne.
RSpec/ExampleLength:
Max: 20
Max: 21

# Offense count: 4
# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet_metadata/beaker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def os_release_to_setfile(os, release, use_fqdn: false, pidfile_workaround: fals
return unless os_supported?(os)

name = "#{os.downcase}#{release.tr('.', '')}-64"
hostname = puppet_version.nil? ? name : "#{name}-#{puppet_version}"
hostname = (puppet_version.nil? && puppet_version != 'none') ? name : "#{name}-#{puppet_version}"
domain ||= 'example.com' if use_fqdn

options = {}
Expand Down
10 changes: 8 additions & 2 deletions lib/puppet_metadata/github_actions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,16 @@ def puppet_unit_test_matrix
def beaker_os_releases
majors = puppet_major_versions

distro_puppet_version = {
name: 'Distro Puppet',
value: nil, # We don't know the version and since it's rolling, it can be anything
collection: 'none',
}

metadata.operatingsystems.each do |os, releases|
case os
when 'Archlinux', 'Gentoo'
yield [os, 'rolling', majors.max_by { |v| v[:value] }]
yield [os, 'rolling', distro_puppet_version]
else
releases&.each do |release|
majors.each do |puppet_version|
Expand Down Expand Up @@ -87,7 +93,7 @@ def github_action_test_matrix
end

def puppet_version_below_minimum?(version)
return false unless options[:minimum_major_puppet_version]
return false unless version && options[:minimum_major_puppet_version]

Gem::Version.new(version) < Gem::Version.new(options[:minimum_major_puppet_version])
end
Expand Down
7 changes: 7 additions & 0 deletions spec/github_actions_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
},
],
operatingsystem_support: [
{
operatingsystem: 'Archlinux',
},
{
operatingsystem: 'CentOS',
operatingsystemrelease: %w[7 8 9],
Expand Down Expand Up @@ -114,6 +117,7 @@

it 'is expected to contain supported os / puppet version combinations' do
expect(subject).to contain_exactly(
{ setfile: { name: 'Archlinux rolling', value: 'archlinuxrolling-64' }, puppet: { collection: 'none', name: 'Distro Puppet', value: nil } },
{ setfile: { name: 'CentOS 7', value: 'centos7-64' }, puppet: { collection: 'puppet5', name: 'Puppet 5', value: 5 } },
{ setfile: { name: 'CentOS 7', value: 'centos7-64' }, puppet: { collection: 'puppet6', name: 'Puppet 6', value: 6 } },
{ setfile: { name: 'CentOS 7', value: 'centos7-64' }, puppet: { collection: 'puppet7', name: 'Puppet 7', value: 7 } },
Expand All @@ -140,6 +144,7 @@

it 'is expected to contain supported os / puppet version combinations excluding puppet 5' do
expect(subject).to contain_exactly(
{ setfile: { name: 'Archlinux rolling', value: 'archlinuxrolling-64' }, puppet: { collection: 'none', name: 'Distro Puppet', value: nil } },
{ setfile: { name: 'CentOS 7', value: 'centos7-64' }, puppet: { collection: 'puppet6', name: 'Puppet 6', value: 6 } },
{ setfile: { name: 'CentOS 7', value: 'centos7-64' }, puppet: { collection: 'puppet7', name: 'Puppet 7', value: 7 } },
{ setfile: { name: 'CentOS 7', value: 'centos7-64' }, puppet: { collection: 'puppet8', name: 'Puppet 8', value: 8 } },
Expand All @@ -163,6 +168,7 @@

it 'is expected to contain supported os / puppet version combinations with image option' do
expect(subject).to contain_exactly(
{ setfile: { name: 'Archlinux rolling', value: 'archlinuxrolling-64' }, puppet: { collection: 'none', name: 'Distro Puppet', value: nil } },
{ setfile: { name: 'CentOS 7', value: 'centos7-64{image=centos:7.6.1810}' }, puppet: { name: 'Puppet 8', value: 8, collection: 'puppet8' } },
{ setfile: { name: 'CentOS 7', value: 'centos7-64{image=centos:7.6.1810}' }, puppet: { name: 'Puppet 7', value: 7, collection: 'puppet7' } },
{ setfile: { name: 'CentOS 7', value: 'centos7-64{image=centos:7.6.1810}' }, puppet: { name: 'Puppet 6', value: 6, collection: 'puppet6' } },
Expand All @@ -186,6 +192,7 @@

it 'is expected to contain supported os / puppet version combinations with hostname option' do
expect(subject).to contain_exactly(
{ setfile: { name: 'Archlinux rolling', value: 'archlinuxrolling-64{hostname=archlinuxrolling-64.example.com}' }, puppet: { collection: 'none', name: 'Distro Puppet', value: nil } },
{ setfile: { name: 'CentOS 7', value: 'centos7-64{hostname=centos7-64-puppet8.example.com}' }, puppet: { name: 'Puppet 8', value: 8, collection: 'puppet8' } },
{ setfile: { name: 'CentOS 7', value: 'centos7-64{hostname=centos7-64-puppet7.example.com}' }, puppet: { name: 'Puppet 7', value: 7, collection: 'puppet7' } },
{ setfile: { name: 'CentOS 7', value: 'centos7-64{hostname=centos7-64-puppet6.example.com}' }, puppet: { name: 'Puppet 6', value: 6, collection: 'puppet6' } },
Expand Down

0 comments on commit 0dcad53

Please sign in to comment.