puppet_metadata 0.4.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/puppet_metadata/aio.rb +68 -0
- data/lib/puppet_metadata/beaker.rb +63 -46
- data/lib/puppet_metadata/github_actions.rb +20 -11
- data/lib/puppet_metadata/operatingsystem.rb +43 -40
- data/lib/puppet_metadata.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a51387ced797e16745c927b7a839fc3192ff47fc7269a0729ccf5ebebfe85bb6
|
4
|
+
data.tar.gz: 9d0187e002a2cbc5d90c080405370efb979bdd2a3eec1be295c9567ab20639cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73b3e503a1331f92f98a4b0ebcf9c6fa5c69474edee3cdecafd2899647728d40b8494802042c02422cfdbdee33a7573cd1d1c0dba7443ccae14ecf0031d43433
|
7
|
+
data.tar.gz: 3201c83529d017649552d63833e774971692cb59d0eca654e59bd08265f0287a08da5f3b994f1e9ad72e14e1b50cfd9a3959950cee3056c433ccc0988400e441
|
@@ -0,0 +1,68 @@
|
|
1
|
+
module PuppetMetadata
|
2
|
+
class AIO
|
3
|
+
COMPATIBLE = {
|
4
|
+
'AlmaLinux' => 'RedHat',
|
5
|
+
'Amazon' => 'RedHat',
|
6
|
+
'CentOS' => 'RedHat',
|
7
|
+
'OracleLinux' => 'RedHat',
|
8
|
+
'Rocky' => 'RedHat',
|
9
|
+
'Scientific' => 'RedHat',
|
10
|
+
}.freeze
|
11
|
+
|
12
|
+
BUILDS = {
|
13
|
+
# RPM-based
|
14
|
+
'RedHat' => {
|
15
|
+
'5' => 5..7,
|
16
|
+
'6' => 5..7,
|
17
|
+
'7' => 5..7,
|
18
|
+
'8' => 5..7,
|
19
|
+
},
|
20
|
+
'Fedora' => {
|
21
|
+
'26' => [5],
|
22
|
+
'27' => 5..6,
|
23
|
+
'28' => 5..6,
|
24
|
+
'29' => 5..6,
|
25
|
+
'30' => 5..7,
|
26
|
+
'31' => 5..7,
|
27
|
+
'32' => 6..7,
|
28
|
+
'34' => 6..7,
|
29
|
+
},
|
30
|
+
'SLES' => {
|
31
|
+
'11' => [7],
|
32
|
+
'12' => [7],
|
33
|
+
'15' => [7],
|
34
|
+
},
|
35
|
+
# deb-based
|
36
|
+
'Debian' => {
|
37
|
+
'7' => [5],
|
38
|
+
'8' => 5..6,
|
39
|
+
'9' => 5..7,
|
40
|
+
'10' => 5..7,
|
41
|
+
'11' => 6..7,
|
42
|
+
},
|
43
|
+
'Ubuntu' => {
|
44
|
+
'14.04' => 5..6,
|
45
|
+
'16.04' => 5..7,
|
46
|
+
'18.04' => 5..7,
|
47
|
+
'20.04' => 6..7,
|
48
|
+
},
|
49
|
+
}.freeze
|
50
|
+
|
51
|
+
PUPPET_RUBY_VERSIONS = {
|
52
|
+
4 => '2.1',
|
53
|
+
5 => '2.4',
|
54
|
+
6 => '2.5',
|
55
|
+
7 => '2.7',
|
56
|
+
}.freeze
|
57
|
+
|
58
|
+
class << self
|
59
|
+
def find_base_os(os)
|
60
|
+
COMPATIBLE.fetch(os, os)
|
61
|
+
end
|
62
|
+
|
63
|
+
def has_aio_build?(os, release, puppet_version)
|
64
|
+
BUILDS.dig(find_base_os(os), release)&.include?(puppet_version)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -4,62 +4,79 @@ module PuppetMetadata
|
|
4
4
|
# @see https://rubygems.org/gems/beaker
|
5
5
|
# @see https://rubygems.org/gems/beaker-hostgenerator
|
6
6
|
class Beaker
|
7
|
-
#
|
8
|
-
#
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
# needed when the daemon uses PIDFile in its service file and using
|
18
|
-
# Docker as a Beaker hypervisor. This is to work around Docker's
|
19
|
-
# limitations.
|
20
|
-
# When a boolean, it's applied on applicable operating systems. On arrays
|
21
|
-
# it's applied only when os is included in the provided array.
|
22
|
-
#
|
23
|
-
# @return [nil] If no setfile is available
|
24
|
-
# @return [Array<(String, String)>] The beaker setfile description with a readable name
|
25
|
-
def self.os_release_to_setfile(os, release, use_fqdn: false, pidfile_workaround: false)
|
26
|
-
return unless os_supported?(os)
|
7
|
+
# These images have an older systemd, which they work with
|
8
|
+
# PIDFile parameter
|
9
|
+
PIDFILE_COMPATIBLE_IMAGES = {
|
10
|
+
'CentOS' => {
|
11
|
+
'7' => 'centos:7.6.1810',
|
12
|
+
},
|
13
|
+
'Ubuntu' => {
|
14
|
+
'16.04' => 'ubuntu:xenial-20191212',
|
15
|
+
},
|
16
|
+
}.freeze
|
27
17
|
|
28
|
-
|
18
|
+
# There is no CentOS 8 image that works with PIDFile in systemd
|
19
|
+
# unit files
|
20
|
+
PIDFILE_INCOMPATIBLE = {
|
21
|
+
'CentOS' => ['8'],
|
22
|
+
}.freeze
|
23
|
+
class << self
|
24
|
+
# Convert an Operating System name with a release to a Beaker setfile
|
25
|
+
#
|
26
|
+
# @param [String] os
|
27
|
+
# The Operating System string as metadata.json knows it, which in turn is
|
28
|
+
# based on Facter's operatingsystem fact.
|
29
|
+
# @param [String] release The OS release
|
30
|
+
# @param [Boolean] use_fqdn
|
31
|
+
# Whether or not to use a FQDN, ensuring a domain
|
32
|
+
# @param [Boolean, Array[String]] pidfile_workaround
|
33
|
+
# Whether or not to apply the systemd PIDFile workaround. This is only
|
34
|
+
# needed when the daemon uses PIDFile in its service file and using
|
35
|
+
# Docker as a Beaker hypervisor. This is to work around Docker's
|
36
|
+
# limitations.
|
37
|
+
# When a boolean, it's applied on applicable operating systems. On arrays
|
38
|
+
# it's applied only when os is included in the provided array.
|
39
|
+
#
|
40
|
+
# @return [nil] If no setfile is available
|
41
|
+
# @return [Array<(String, String)>] The beaker setfile description with a readable name
|
42
|
+
def os_release_to_setfile(os, release, use_fqdn: false, pidfile_workaround: false)
|
43
|
+
return unless os_supported?(os)
|
29
44
|
|
30
|
-
|
31
|
-
options[:hostname] = "#{name}.example.com" if use_fqdn
|
45
|
+
name = "#{os.downcase}#{release.tr('.', '')}-64"
|
32
46
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
# unit files
|
44
|
-
return
|
47
|
+
options = {}
|
48
|
+
options[:hostname] = "#{name}.example.com" if use_fqdn
|
49
|
+
|
50
|
+
# Docker messes up cgroups and modern systemd can't deal with that when
|
51
|
+
# PIDFile is used.
|
52
|
+
if pidfile_workaround?(pidfile_workaround, os)
|
53
|
+
return if PIDFILE_INCOMPATIBLE[os]&.include?(release)
|
54
|
+
|
55
|
+
if (image = PIDFILE_COMPATIBLE_IMAGES.dig(os, release))
|
56
|
+
options[:image] = image
|
45
57
|
end
|
46
|
-
when 'Ubuntu'
|
47
|
-
options[:image] = 'ubuntu:xenial-20191212' if release == '16.04'
|
48
58
|
end
|
59
|
+
|
60
|
+
human_name = "#{os} #{release}"
|
61
|
+
|
62
|
+
[build_setfile(name, options), human_name]
|
49
63
|
end
|
50
64
|
|
51
|
-
setfile
|
52
|
-
|
65
|
+
# Return whether a Beaker setfile can be generated for the given OS
|
66
|
+
# @param [String] os The operating system
|
67
|
+
def os_supported?(os)
|
68
|
+
['CentOS', 'Fedora', 'Debian', 'Ubuntu'].include?(os)
|
69
|
+
end
|
53
70
|
|
54
|
-
|
71
|
+
private
|
55
72
|
|
56
|
-
|
57
|
-
|
73
|
+
def pidfile_workaround?(pidfile_workaround, os)
|
74
|
+
pidfile_workaround && (!pidfile_workaround.is_a?(Array) || pidfile_workaround.include?(os))
|
75
|
+
end
|
58
76
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
['CentOS', 'Fedora', 'Debian', 'Ubuntu'].include?(os)
|
77
|
+
def build_setfile(name, options)
|
78
|
+
"#{name}#{options.any? ? "{#{options.map { |key, value| "#{key}=#{value}" }.join(',')}}" : ''}"
|
79
|
+
end
|
63
80
|
end
|
64
81
|
end
|
65
82
|
end
|
@@ -13,6 +13,7 @@ module PuppetMetadata
|
|
13
13
|
beaker_setfiles: beaker_setfiles(beaker_use_fqdn, beaker_pidfile_workaround),
|
14
14
|
puppet_major_versions: puppet_major_versions,
|
15
15
|
puppet_unit_test_matrix: puppet_unit_test_matrix,
|
16
|
+
github_action_test_matrix: github_action_test_matrix(use_fqdn: beaker_use_fqdn, pidfile_workaround: beaker_pidfile_workaround),
|
16
17
|
}
|
17
18
|
end
|
18
19
|
|
@@ -41,7 +42,7 @@ module PuppetMetadata
|
|
41
42
|
|
42
43
|
def puppet_unit_test_matrix
|
43
44
|
metadata.puppet_major_versions.sort.reverse.map do |puppet|
|
44
|
-
ruby =
|
45
|
+
ruby = PuppetMetadata::AIO::PUPPET_RUBY_VERSIONS[puppet]
|
45
46
|
next unless ruby
|
46
47
|
|
47
48
|
{
|
@@ -51,16 +52,24 @@ module PuppetMetadata
|
|
51
52
|
end.compact
|
52
53
|
end
|
53
54
|
|
54
|
-
def
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
55
|
+
def github_action_test_matrix(use_fqdn: false, pidfile_workaround: false)
|
56
|
+
metadata.operatingsystems.each_with_object([]) do |(os, releases), matrix_include|
|
57
|
+
releases&.each do |release|
|
58
|
+
puppet_major_versions.each do |puppet_version|
|
59
|
+
next unless AIO.has_aio_build?(os, release, puppet_version[:value])
|
60
|
+
|
61
|
+
setfile = PuppetMetadata::Beaker.os_release_to_setfile(os, release, use_fqdn: use_fqdn, pidfile_workaround: pidfile_workaround)
|
62
|
+
next unless setfile
|
63
|
+
|
64
|
+
matrix_include << {
|
65
|
+
setfile: {
|
66
|
+
name: setfile[1],
|
67
|
+
value: setfile[0],
|
68
|
+
},
|
69
|
+
puppet: puppet_version
|
70
|
+
}
|
71
|
+
end
|
72
|
+
end
|
64
73
|
end
|
65
74
|
end
|
66
75
|
end
|
@@ -22,9 +22,10 @@ module PuppetMetadata
|
|
22
22
|
# https://wiki.debian.org/DebianReleases
|
23
23
|
'Debian' => {
|
24
24
|
# TODO: EOL is standard support, not the extended life cycle
|
25
|
+
'11' => nil, # '~2024',
|
25
26
|
'10' => nil, # '~2022',
|
26
|
-
'9' =>
|
27
|
-
'8' => '2018-06-
|
27
|
+
'9' => '2020-07-06',
|
28
|
+
'8' => '2018-06-17',
|
28
29
|
'7' => '2016-04-26',
|
29
30
|
'6' => '2015-05-31',
|
30
31
|
'5' => '2012-02-06',
|
@@ -113,47 +114,49 @@ module PuppetMetadata
|
|
113
114
|
'5.04' => '2006-10-31',
|
114
115
|
'4.10' => '2006-04-30',
|
115
116
|
},
|
116
|
-
}
|
117
|
+
}.freeze
|
117
118
|
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
119
|
+
class << self
|
120
|
+
# Return the EOL date for the given operating system release
|
121
|
+
# @param [String] operatingsystem
|
122
|
+
# The operating system
|
123
|
+
# @param [String] release
|
124
|
+
# The major version of the operating system
|
125
|
+
# @return [optional, Date]
|
126
|
+
# The EOL date for the given operating system release. Nil is returned
|
127
|
+
# when the either when the OS, the release or the EOL date is unknown
|
128
|
+
def eol_date(operatingsystem, release)
|
129
|
+
releases = EOL_DATES[operatingsystem]
|
130
|
+
return unless releases
|
131
|
+
date = releases[release]
|
132
|
+
return unless date
|
133
|
+
Date.parse(date)
|
134
|
+
end
|
133
135
|
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
136
|
+
# Return whether the given operating system release is EOL at the given
|
137
|
+
# date
|
138
|
+
#
|
139
|
+
# @param [String] operatingsystem
|
140
|
+
# The operating system
|
141
|
+
# @param [String] release
|
142
|
+
# The major version of the operating system
|
143
|
+
# @return [Boolean]
|
144
|
+
# The EOL date for the given operating system release. Nil is returned
|
145
|
+
# when the either when the OS, the release or the EOL date is unknown
|
146
|
+
def eol?(operatingsystem, release, at = nil)
|
147
|
+
date = eol_date(operatingsystem, release)
|
148
|
+
date && date < (at || Date.today)
|
149
|
+
end
|
148
150
|
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
151
|
+
# Return the latest known release for a given operating system
|
152
|
+
# @param [String] operatingsystem The operating system
|
153
|
+
# @return [optional, String]
|
154
|
+
# The latest major release for the given operating system, if any is
|
155
|
+
# known
|
156
|
+
def latest_release(operatingsystem)
|
157
|
+
releases = EOL_DATES[operatingsystem]
|
158
|
+
releases&.keys&.max_by { |release| Gem::Version.new(release) }
|
159
|
+
end
|
157
160
|
end
|
158
161
|
end
|
159
162
|
end
|
data/lib/puppet_metadata.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# A module that provides abstractions around Puppet's metadata format.
|
2
2
|
module PuppetMetadata
|
3
|
+
autoload :AIO, 'puppet_metadata/aio'
|
3
4
|
autoload :Beaker, 'puppet_metadata/beaker'
|
4
5
|
autoload :GithubActions, 'puppet_metadata/github_actions'
|
5
6
|
autoload :Metadata, 'puppet_metadata/metadata'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppet_metadata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vox Pupuli
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-
|
12
|
+
date: 2021-10-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: metadata-json-lint
|
@@ -127,6 +127,7 @@ files:
|
|
127
127
|
- README.md
|
128
128
|
- bin/metadata2gha
|
129
129
|
- lib/puppet_metadata.rb
|
130
|
+
- lib/puppet_metadata/aio.rb
|
130
131
|
- lib/puppet_metadata/beaker.rb
|
131
132
|
- lib/puppet_metadata/github_actions.rb
|
132
133
|
- lib/puppet_metadata/metadata.rb
|