puppet_metadata 3.3.0 → 3.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d41190de113b3a8b9f44f2f627fe9f67c1dcfc9886d674b69287f1adbef9ce06
4
- data.tar.gz: 1bb3c2e083ae08867f9baf04e901f1271f0d5f4b8bb088e74db6b1004062a572
3
+ metadata.gz: 6592e846ac0678664a4f88091a19002df675cbbf06d51159a0a54e9e68573ae7
4
+ data.tar.gz: c5975198c75b77e682c8ce263f0b2279f77bbb2df1fb941f5809b909416cf003
5
5
  SHA512:
6
- metadata.gz: 18f0597d9195fe59dbc21e719a65d4e251a67e91dc33e4fc6db575b7ab67f26fe21c4f5e1ebcfe86edec63aaad631cf4376b90dda32c4042569bf8cbb91c8d4f
7
- data.tar.gz: 3f8f49b5f3a552a22622740bc13a400846b8c0093ec8d2f5987fe5513a6314c924c405d013da6ce7c89879c9502627dcbd952cdb9ba42d39eaa67ad582e64e94
6
+ metadata.gz: 46c96e7c74f6f2967b0d7a9c3f0568564e5edcca10f0b57a4652edea19b33d6adad589971cb6141cbab0864eadd58a450554b540fd318bd22717d80e634f6060
7
+ data.tar.gz: c7a6da54b846424e3122206c6d6908dd8e4716450c7b79e1529a96df24e376a95c77a04cb73bc40519b5e901da43e08857a061cac0687e83b20da1284ff40565
data/bin/metadata2gha CHANGED
@@ -10,6 +10,7 @@ options = {
10
10
  beaker_pidfile_workaround: false,
11
11
  domain: nil,
12
12
  minimum_major_puppet_version: nil,
13
+ beaker_fact: nil,
13
14
  }
14
15
 
15
16
  OptionParser.new do |opts|
@@ -30,6 +31,15 @@ OptionParser.new do |opts|
30
31
  opts.on('--pidfile-workaround VALUE', 'Generate the systemd PIDFile workaround to work around a docker bug', PidfileWorkaround) { |opt| options[:beaker_pidfile_workaround] = opt }
31
32
  opts.on('-d', '--domain VALUE', 'the domain for the box, only used when --use-fqdn is set to true') { |opt| options[:domain] = opt }
32
33
  opts.on('--minimum-major-puppet-version VERSION', "Don't create actions for Puppet versions less than this major version") { |opt| options[:minimum_major_puppet_version] = opt }
34
+ opts.on('--beaker-facter FACT:LABEL:VALUES', 'Expand the matrix based on a fact. Separate values using commas') do |opt|
35
+ if opt != 'false'
36
+ fact, label, values = opt.split(':', 3)
37
+ label = fact if !label || label.empty?
38
+ raise OptionParser::InvalidArgument unless values
39
+
40
+ options[:beaker_facter] = [fact, label, values.split(',')]
41
+ end
42
+ end
33
43
  end.parse!
34
44
 
35
45
  filename = ARGV[0]
@@ -14,6 +14,8 @@ module PuppetMetadata
14
14
  {
15
15
  puppet_major_versions: puppet_major_versions,
16
16
  puppet_unit_test_matrix: puppet_unit_test_matrix,
17
+ puppet_beaker_test_matrix: puppet_beaker_test_matrix,
18
+ # Deprecated
17
19
  github_action_test_matrix: github_action_test_matrix,
18
20
  }
19
21
  end
@@ -61,8 +63,10 @@ module PuppetMetadata
61
63
  else
62
64
  releases&.each do |release|
63
65
  majors.each do |puppet_version|
64
- if AIO.has_aio_build?(os, release, puppet_version[:value]) # rubocop:disable Style/IfUnlessModifier
66
+ if AIO.has_aio_build?(os, release, puppet_version[:value])
65
67
  yield [os, release, puppet_version]
68
+ elsif PuppetMetadata::OperatingSystem.os_release_puppet_version(os, release) == puppet_version[:value]
69
+ yield [os, release, distro_puppet_version.merge(value: puppet_version[:value])]
66
70
  end
67
71
  end
68
72
  end
@@ -70,16 +74,49 @@ module PuppetMetadata
70
74
  end
71
75
  end
72
76
 
73
- def github_action_test_matrix
77
+ def puppet_beaker_test_matrix
74
78
  matrix_include = []
75
79
 
76
80
  beaker_os_releases do |os, release, puppet_version|
77
- setfile = PuppetMetadata::Beaker.os_release_to_setfile(
78
- os, release, use_fqdn: options[:beaker_use_fqdn], pidfile_workaround: options[:beaker_pidfile_workaround], domain: options[:domain], puppet_version: puppet_version[:collection]
79
- )
81
+ next if puppet_version_below_minimum?(puppet_version[:value])
82
+
83
+ setfile = os_release_to_beaker_setfile(os, release, puppet_version[:collection])
80
84
  next unless setfile
85
+
86
+ name = "#{puppet_version[:name]} - #{setfile[1]}"
87
+ env = {
88
+ 'BEAKER_PUPPET_COLLECTION' => puppet_version[:collection],
89
+ 'BEAKER_SETFILE' => setfile[0],
90
+ }
91
+
92
+ if options[:beaker_facter]
93
+ fact, label, values = options[:beaker_facter]
94
+ values.each do |value|
95
+ matrix_include << {
96
+ name: "#{name} - #{label || fact} #{value}",
97
+ env: env.merge("BEAKER_FACTER_#{fact}" => value),
98
+ }
99
+ end
100
+ else
101
+ matrix_include << {
102
+ name: name,
103
+ env: env,
104
+ }
105
+ end
106
+ end
107
+
108
+ matrix_include
109
+ end
110
+
111
+ def github_action_test_matrix
112
+ matrix_include = []
113
+
114
+ beaker_os_releases do |os, release, puppet_version|
81
115
  next if puppet_version_below_minimum?(puppet_version[:value])
82
116
 
117
+ setfile = os_release_to_beaker_setfile(os, release, puppet_version[:collection])
118
+ next unless setfile
119
+
83
120
  matrix_include << {
84
121
  name: "#{puppet_version[:name]} - #{setfile[1]}",
85
122
  setfile: {
@@ -98,5 +135,16 @@ module PuppetMetadata
98
135
 
99
136
  Gem::Version.new(version) < Gem::Version.new(options[:minimum_major_puppet_version])
100
137
  end
138
+
139
+ def os_release_to_beaker_setfile(os, release, puppet_collection)
140
+ PuppetMetadata::Beaker.os_release_to_setfile(
141
+ os,
142
+ release,
143
+ use_fqdn: options[:beaker_use_fqdn],
144
+ pidfile_workaround: options[:beaker_pidfile_workaround],
145
+ domain: options[:domain],
146
+ puppet_version: puppet_collection,
147
+ )
148
+ end
101
149
  end
102
150
  end
@@ -32,6 +32,7 @@ module PuppetMetadata
32
32
  # https://wiki.debian.org/DebianReleases
33
33
  'Debian' => {
34
34
  # TODO: EOL is standard support, not the extended life cycle
35
+ '12' => nil, # '~2026',
35
36
  '11' => nil, # '~2024',
36
37
  '10' => nil, # '~2022',
37
38
  '9' => '2020-07-06',
@@ -206,6 +207,33 @@ module PuppetMetadata
206
207
  releases.select { |_release, eol_date| !eol_date || Date.parse(eol_date) > today }.keys
207
208
  .sort_by { |release| Gem::Version.new(release) }
208
209
  end
210
+
211
+ # Return the Puppet major version in an OS release, if any
212
+ #
213
+ # Only tracks releases without an AIO build, since that's preferred.
214
+ #
215
+ # @param [String] operatingsystem
216
+ # The operating system name
217
+ # @param [String] release
218
+ # The operating system release version
219
+ #
220
+ # @return [Optional[Integer]] The Puppet major version, if any
221
+ def os_release_puppet_version(operatingsystem, release)
222
+ case operatingsystem
223
+ when 'Debian'
224
+ case release
225
+ when '12'
226
+ 7
227
+ end
228
+ when 'Fedora'
229
+ case release
230
+ when '39', '40'
231
+ 8
232
+ when '37', '38'
233
+ 7
234
+ end
235
+ end
236
+ end
209
237
  end
210
238
  end
211
239
  end
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: 3.3.0
4
+ version: 3.5.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: 2023-10-08 00:00:00.000000000 Z
12
+ date: 2023-10-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: metadata-json-lint