Skip to content

Commit

Permalink
Add Arch Linux support
Browse files Browse the repository at this point in the history
  • Loading branch information
bastelfreak committed Feb 13, 2022
1 parent 3977d94 commit 4ca3143
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 18 deletions.
9 changes: 5 additions & 4 deletions lib/puppet_metadata/beaker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,18 @@ class << self
def os_release_to_setfile(os, release, use_fqdn: false, pidfile_workaround: false)
return unless os_supported?(os)

name = "#{os.downcase}#{release.tr('.', '')}-64"
real_release = ['Gentoo', 'Archlinux'].include?(os) ? 'rolling' : release
name = "#{os.downcase}#{real_release.tr('.', '')}-64"

options = {}
options[:hostname] = "#{name}.example.com" if use_fqdn

# Docker messes up cgroups and some systemd versions can't deal with
# that when PIDFile is used.
if pidfile_workaround?(pidfile_workaround, os)
return if PIDFILE_INCOMPATIBLE[os]&.include?(release)
return if PIDFILE_INCOMPATIBLE[os]&.include?(real_release)

if (image = PIDFILE_COMPATIBLE_IMAGES.dig(os, release))
if (image = PIDFILE_COMPATIBLE_IMAGES.dig(os, real_release))
options[:image] = image
end
end
Expand All @@ -65,7 +66,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)
['CentOS', 'Fedora', 'Debian', 'Ubuntu', 'Archlinux'].include?(os)
end

private
Expand Down
29 changes: 16 additions & 13 deletions lib/puppet_metadata/github_actions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,24 @@ def puppet_unit_test_matrix
end

def github_action_test_matrix(use_fqdn: false, pidfile_workaround: false)
latest_supported_puppet_major_version = metadata.latest_supported_puppet_major_version
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
case os
when 'Archlinux', 'Gentoo'
setfile = PuppetMetadata::Beaker.os_release_to_setfile(os, 'rolling', use_fqdn: use_fqdn, pidfile_workaround: pidfile_workaround)
if setfile
matrix_include << construct_matrix_include(setfile, latest_supported_puppet_major_version)
end
else
releases.each do |release|
puppet_major_versions.each do |puppet_version|
# we currently support beaker jobs in GitHub only for operatingsystems with AIO packages from Puppet Inc
next unless AIO.has_aio_build?(os, release, puppet_version[:value])

matrix_include << {
setfile: {
name: setfile[1],
value: setfile[0],
},
puppet: puppet_version
}
setfile = PuppetMetadata::Beaker.os_release_to_setfile(os, release, use_fqdn: use_fqdn, pidfile_workaround: pidfile_workaround)
next unless setfile
matrix_include << construct_matrix_include(setfile, puppet_version)
end
end
end
end
Expand Down
15 changes: 14 additions & 1 deletion lib/puppet_metadata/metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,18 @@ def puppet_major_versions
end
end

# @return [Integer] The newest/latest supported puppet major version
# @see #puppet_major_versions
def latest_supported_puppet_major_version
puppet_major_versions.sort.last
end

# @return [Integer] The oldest supported puppet major version
# @see #puppet_major_versions
def oldest_supported_puppet_major_version
puppet_major_versions.sort.first
end

# A hash representation of the dependencies
#
# Every element in the original array is converted. The name is used as a
Expand Down Expand Up @@ -197,7 +209,8 @@ def github_actions
def beaker_setfiles(use_fqdn: false, pidfile_workaround: false)
operatingsystems.each do |os, releases|
next unless PuppetMetadata::Beaker.os_supported?(os)
releases&.each do |release|
real_releases = ['Gentoo', 'Archlinux'].include?(os) ? ['rolling'] : releases
real_releases&.each do |release|
setfile = PuppetMetadata::Beaker.os_release_to_setfile(os, release, use_fqdn: use_fqdn, pidfile_workaround: pidfile_workaround)
yield setfile if setfile
end
Expand Down

0 comments on commit 4ca3143

Please sign in to comment.