From 3334c38b087486ddbc8214b18ce6f46561316294 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Sun, 13 Feb 2022 14:12:42 +0100 Subject: [PATCH 1/2] Factor out OS iteration in GHA This meaks it easier to change the logic for an individual OS which may behave differently. --- lib/puppet_metadata/github_actions.rb | 42 +++++++++++++++++---------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/lib/puppet_metadata/github_actions.rb b/lib/puppet_metadata/github_actions.rb index 9f67e77..3ef5cfb 100644 --- a/lib/puppet_metadata/github_actions.rb +++ b/lib/puppet_metadata/github_actions.rb @@ -52,25 +52,37 @@ def puppet_unit_test_matrix end.compact end - def github_action_test_matrix(use_fqdn: false, pidfile_workaround: false) - metadata.operatingsystems.each_with_object([]) do |(os, releases), matrix_include| - releases&.each do |release| - puppet_major_versions.each do |puppet_version| - next unless AIO.has_aio_build?(os, release, puppet_version[:value]) - - setfile = PuppetMetadata::Beaker.os_release_to_setfile(os, release, use_fqdn: use_fqdn, pidfile_workaround: pidfile_workaround) - next unless setfile + def beaker_os_releases + majors = puppet_major_versions - matrix_include << { - setfile: { - name: setfile[1], - value: setfile[0], - }, - puppet: puppet_version - } + metadata.operatingsystems.each do |os, releases| + releases&.each do |release| + majors.each do |puppet_version| + if AIO.has_aio_build?(os, release, puppet_version[:value]) + yield [os, release, puppet_version] + end end end end end + + def github_action_test_matrix(use_fqdn: false, pidfile_workaround: false) + matrix_include = [] + + beaker_os_releases do |os, release, puppet_version| + setfile = PuppetMetadata::Beaker.os_release_to_setfile(os, release, use_fqdn: use_fqdn, pidfile_workaround: pidfile_workaround) + next unless setfile + + matrix_include << { + setfile: { + name: setfile[1], + value: setfile[0], + }, + puppet: puppet_version + } + end + + matrix_include + end end end From 990ab18c9d2f660bd28cc15360febad9ac8dcc5a Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Sun, 13 Feb 2022 14:11:58 +0100 Subject: [PATCH 2/2] Add Arch Linux support Arch Linux has a rolling release so it ignores the actual releases. It also only supports the latest Puppet version so it doesn't make sense to look at the actually supported Puppet versions. --- lib/puppet_metadata/beaker.rb | 2 +- lib/puppet_metadata/github_actions.rb | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/puppet_metadata/beaker.rb b/lib/puppet_metadata/beaker.rb index 8d5eea7..9f8c305 100644 --- a/lib/puppet_metadata/beaker.rb +++ b/lib/puppet_metadata/beaker.rb @@ -65,7 +65,7 @@ def os_release_to_setfile(os, release, use_fqdn: false, pidfile_workaround: fals # Return whether a Beaker setfile can be generated for the given OS # @param [String] os The operating system def os_supported?(os) - ['CentOS', 'Fedora', 'Debian', 'Ubuntu'].include?(os) + ['Archlinux', 'CentOS', 'Fedora', 'Debian', 'Ubuntu'].include?(os) end private diff --git a/lib/puppet_metadata/github_actions.rb b/lib/puppet_metadata/github_actions.rb index 3ef5cfb..f0682e8 100644 --- a/lib/puppet_metadata/github_actions.rb +++ b/lib/puppet_metadata/github_actions.rb @@ -56,10 +56,15 @@ def beaker_os_releases majors = puppet_major_versions metadata.operatingsystems.each do |os, releases| - releases&.each do |release| - majors.each do |puppet_version| - if AIO.has_aio_build?(os, release, puppet_version[:value]) - yield [os, release, puppet_version] + case os + when 'Archlinux', 'Gentoo' + yield [os, 'rolling', majors.max_by { |v| v[:value] }] + else + releases&.each do |release| + majors.each do |puppet_version| + if AIO.has_aio_build?(os, release, puppet_version[:value]) + yield [os, release, puppet_version] + end end end end