puppet_metadata 6.0.0 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9ac5190193748a7ec1f0d61f9c7ef2bac509bb78e1e854b373362e421cf4a656
4
- data.tar.gz: dcafc939d26360e09cd7525b72ca2e4268802d2e4103d4c61b14570a4700a402
3
+ metadata.gz: bbf0cec07a466deb7e97d1e4c20b75087243573b954c8350c605141f534fe1b9
4
+ data.tar.gz: 3522efe76946069d526bd87ac9023da1b054b0676d4cc0c0b3ac1f476f32c979
5
5
  SHA512:
6
- metadata.gz: 7e18f077b5298afce2a703c1c1c66d941f447a72740dc29105b57d9cd1cb929ed4c4a537a021950ca4ed2c1cda06eaf40d3f1e8c927f7b05212b1f241e0db331
7
- data.tar.gz: b16239f27e4a1c74174816fe1b59bd28f1503f4839fc52bfc952f3c6ce1fe3d70bdccacb138f136e1f75a1423ef1537d574c07b2625bc044a8a12094ade701a6
6
+ metadata.gz: 6149d30f3403cbf37f17ccb6d132ce15c86eae5e4d3de16d2dbc96362d5b3e82751e229919fe39afc7fa06528873cfea974ec123aed9165ab7f6f3531c205212
7
+ data.tar.gz: 8d759313fbb484738c39984190d0756712ba0aab483a7f909bebfebc629f9c9b80cf69695bb8690a0c3f23dc3eaa3654f6c80a7cb05b46215d4e89be6494f339
data/README.md CHANGED
@@ -8,7 +8,8 @@
8
8
  [![RubyGem Downloads](https://img.shields.io/gem/dt/puppet_metadata.svg)](https://rubygems.org/gems/puppet_metadata)
9
9
  [![Donated by Ewoud Kohl van Wijngaarden](https://img.shields.io/badge/donated%20by-Ewoud%20Kohl%20van%20Wijngaarden-fb7047.svg)](#transfer-notice)
10
10
 
11
- The gem intends to provide an abstraction over Puppet's metadata.json file. Its API allow easy iteration over its illogical data structures.
11
+ The gem intends to provide an abstraction over Puppet's metadata.json file.
12
+ Its API allow easy iteration over its illogical data structures.
12
13
 
13
14
  - [puppet\_metadata](#puppet_metadata)
14
15
  - [New CLI interface in 6.0.0](#new-cli-interface-in-600)
@@ -126,7 +127,8 @@ Debian => 13
126
127
 
127
128
  ## Generating Github Actions outputs
128
129
 
129
- To get outputs [usable in Github Actions](https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions), there is the `metadata2gha` command available. This generates based on metadata.json, such as [Beaker](https://github.com/voxpupuli/beaker) setfiles, Puppet major versions and a Puppet unit test matrix.
130
+ To get outputs [usable in Github Actions](https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions), there is the `metadata2gha` command available.
131
+ This generates based on metadata.json, such as [Beaker](https://github.com/voxpupuli/beaker) setfiles, Puppet major versions and a Puppet unit test matrix.
130
132
 
131
133
  ```console
132
134
  $ metadata2gha
@@ -258,6 +260,75 @@ This results in the following JSON data
258
260
  ]
259
261
  ```
260
262
 
263
+ We can also limit the matrix to a specific collection:
264
+
265
+ ```console
266
+ $ metadata2gha --collection openvox8
267
+ ```
268
+
269
+ ```
270
+ [
271
+ {
272
+ "name": "OpenVox 8 - AlmaLinux 8",
273
+ "env": {
274
+ "BEAKER_PUPPET_COLLECTION": "openvox8",
275
+ "BEAKER_SETFILE": "almalinux8-64{hostname=almalinux8-64-openvox8}"
276
+ }
277
+ },
278
+ {
279
+ "name": "OpenVox 8 - AlmaLinux 9",
280
+ "env": {
281
+ "BEAKER_PUPPET_COLLECTION": "openvox8",
282
+ "BEAKER_SETFILE": "almalinux9-64{hostname=almalinux9-64-openvox8}"
283
+ }
284
+ },
285
+ {
286
+ "name": "OpenVox 8 - CentOS 9",
287
+ "env": {
288
+ "BEAKER_PUPPET_COLLECTION": "openvox8",
289
+ "BEAKER_SETFILE": "centos9-64{hostname=centos9-64-openvox8}"
290
+ }
291
+ },
292
+ {
293
+ "name": "OpenVox 8 - Debian 11",
294
+ "env": {
295
+ "BEAKER_PUPPET_COLLECTION": "openvox8",
296
+ "BEAKER_SETFILE": "debian11-64{hostname=debian11-64-openvox8}"
297
+ }
298
+ }
299
+ ]
300
+ ```
301
+
302
+ There is also the special collection `staging`.
303
+ This will generate a matrix for all OS releases with AIO packages.
304
+ The idea is to test unreleased packages.
305
+
306
+ ```
307
+ [
308
+ {
309
+ "name": "OpenVox 8 - AlmaLinux 8",
310
+ "env": {
311
+ "BEAKER_PUPPET_COLLECTION": "staging",
312
+ "BEAKER_SETFILE": "almalinux8-64{hostname=almalinux8-64-staging}"
313
+ }
314
+ },
315
+ {
316
+ "name": "OpenVox 8 - AlmaLinux 9",
317
+ "env": {
318
+ "BEAKER_PUPPET_COLLECTION": "staging",
319
+ "BEAKER_SETFILE": "almalinux9-64{hostname=almalinux9-64-staging}"
320
+ }
321
+ },
322
+ {
323
+ "name": "OpenVox 8 - CentOS 9",
324
+ "env": {
325
+ "BEAKER_PUPPET_COLLECTION": "staging",
326
+ "BEAKER_SETFILE": "centos9-64{hostname=centos9-64-staging}"
327
+ }
328
+ }
329
+ ]
330
+ ```
331
+
261
332
  ## Work with the API
262
333
 
263
334
  The API can be initialised like this:
data/bin/metadata2gha CHANGED
@@ -13,6 +13,7 @@ options = {
13
13
  OptionParser.new do |opts|
14
14
  opts.banner = "Usage: #{$0} [options] metadata"
15
15
 
16
+ opts.on('-c', '--collection VALUE', 'Limit GitHub jobs to only test this specific collection') { |opt| options[:collection] = opt }
16
17
  opts.on('-d', '--domain VALUE', 'the domain for the box, only used when --use-fqdn is set to true') { |opt| options[:domain] = opt }
17
18
  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 }
18
19
  opts.on('--beaker-facter FACT:LABEL:VALUES', 'Expand the matrix based on a fact. Separate values using commas') do |opt|
@@ -56,37 +56,63 @@ module PuppetMetadata
56
56
 
57
57
  def beaker_os_releases(at = nil)
58
58
  majors = beaker_major_versions
59
- distro_puppet_version = {
60
- name: 'Distro Puppet',
61
- value: nil, # We don't know the version and since it's rolling, it can be anything
62
- collection: 'none',
63
- requirement: 'puppet',
64
- }
65
- metadata.operatingsystems.each do |os, releases|
66
- case os
67
- when 'Archlinux', 'Gentoo'
68
- # both currently only ship puppet, not openvox yet
69
- yield [os, 'rolling', distro_puppet_version]
70
- else
59
+ # for staging, we don't want to have one job per major openvox/puppet version
60
+ # we just want to pull a specific, unreleased, package from a webserver
61
+ # and we only do this for AIO builds, because we don't have other packages
62
+ collection = options[:collection]
63
+ collection = nil if collection&.empty?
64
+ if collection == 'staging'
65
+ latest = majors.first.dup
66
+ latest[:collection] = 'staging'
67
+ metadata.operatingsystems.each do |os, releases|
68
+ # iterates on all releases for one OS
69
+ # `&` in case the OS has no releases in metadata.json
71
70
  releases&.each do |release|
72
- if PuppetMetadata::OperatingSystem.eol?(os, release, at)
73
- message = "Skipping EOL operating system #{os} #{release}"
74
-
75
- if ENV.key?('GITHUB_ACTIONS')
76
- # TODO: determine file and position within the file
77
- puts "::warning file=metadata.json::#{message}"
78
- else
79
- warn message
71
+ next if PuppetMetadata::OperatingSystem.eol?(os, release, at)
72
+
73
+ yield [os, release, latest] if AIO.has_aio_build?(os, release, latest[:value], latest[:requirement])
74
+ end
75
+ end
76
+ else
77
+ distro_puppet_version = {
78
+ name: 'Distro Puppet',
79
+ value: nil, # We don't know the version and since it's rolling, it can be anything
80
+ collection: 'none',
81
+ requirement: 'puppet',
82
+ }
83
+ metadata.operatingsystems.each do |os, releases|
84
+ case os
85
+ when 'Archlinux', 'Gentoo'
86
+ # we filter out the rolling distributions because we don't know which openvox/puppet version we get and we want a specific collection
87
+ next if collection
88
+
89
+ # both currently only ship puppet, not openvox yet
90
+ yield [os, 'rolling', distro_puppet_version]
91
+ else
92
+ releases&.each do |release|
93
+ if PuppetMetadata::OperatingSystem.eol?(os, release, at)
94
+ message = "Skipping EOL operating system #{os} #{release}"
95
+
96
+ if ENV.key?('GITHUB_ACTIONS')
97
+ # TODO: determine file and position within the file
98
+ puts "::warning file=metadata.json::#{message}"
99
+ else
100
+ warn message
101
+ end
102
+
103
+ next
80
104
  end
81
105
 
82
- next
83
- end
106
+ majors.each do |puppet_version|
107
+ # if a collection is set, it's not 'staging'
108
+ # we then want to filter out all results that don't match our provided collection
109
+ next if collection && puppet_version[:collection] != collection
84
110
 
85
- majors.each do |puppet_version|
86
- if AIO.has_aio_build?(os, release, puppet_version[:value], puppet_version[:requirement])
87
- yield [os, release, puppet_version]
88
- elsif PuppetMetadata::OperatingSystem.os_release_puppet_version(os, release) == puppet_version[:value]
89
- yield [os, release, distro_puppet_version.merge(value: puppet_version[:value])]
111
+ if AIO.has_aio_build?(os, release, puppet_version[:value], puppet_version[:requirement])
112
+ yield [os, release, puppet_version]
113
+ elsif PuppetMetadata::OperatingSystem.os_release_puppet_version(os, release) == puppet_version[:value]
114
+ yield [os, release, distro_puppet_version.merge(value: puppet_version[:value])]
115
+ end
90
116
  end
91
117
  end
92
118
  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: 6.0.0
4
+ version: 6.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vox Pupuli
@@ -118,14 +118,14 @@ dependencies:
118
118
  requirements:
119
119
  - - "~>"
120
120
  - !ruby/object:Gem::Version
121
- version: 5.1.0
121
+ version: 5.2.0
122
122
  type: :development
123
123
  prerelease: false
124
124
  version_requirements: !ruby/object:Gem::Requirement
125
125
  requirements:
126
126
  - - "~>"
127
127
  - !ruby/object:Gem::Version
128
- version: 5.1.0
128
+ version: 5.2.0
129
129
  - !ruby/object:Gem::Dependency
130
130
  name: yard
131
131
  requirement: !ruby/object:Gem::Requirement
@@ -191,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
191
191
  - !ruby/object:Gem::Version
192
192
  version: '0'
193
193
  requirements: []
194
- rubygems_version: 4.0.3
194
+ rubygems_version: 4.0.6
195
195
  specification_version: 4
196
196
  summary: Data structures for the Puppet Metadata
197
197
  test_files: []