puppet_metadata 3.3.0 → 3.4.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: 556224029dca3954a88bc2965c547e73976f2dfcff434ec8c4404b116c73ac8b
4
+ data.tar.gz: 6f6101c35a3d4bad3a4f575dac4de02788dd454bec93a2a7a6d3328d8f576402
5
5
  SHA512:
6
- metadata.gz: 18f0597d9195fe59dbc21e719a65d4e251a67e91dc33e4fc6db575b7ab67f26fe21c4f5e1ebcfe86edec63aaad631cf4376b90dda32c4042569bf8cbb91c8d4f
7
- data.tar.gz: 3f8f49b5f3a552a22622740bc13a400846b8c0093ec8d2f5987fe5513a6314c924c405d013da6ce7c89879c9502627dcbd952cdb9ba42d39eaa67ad582e64e94
6
+ metadata.gz: c54f5c54e35607a332ed08006c387511b089066f2b9f330a1feb89ee691cb1b4aa062f7246eb5f025a3125a7ce36122ac8fbe7f1c394e757bb2d736957dda558
7
+ data.tar.gz: 9b114a9fb73bfe479a0ea425565c3b2bf98228a756a281caadb6ea262fffd1e746dfe706cac85cd6f06e4191812aa4e98e1b975209113495cb8fff146d7d47b6
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
@@ -70,16 +72,49 @@ module PuppetMetadata
70
72
  end
71
73
  end
72
74
 
73
- def github_action_test_matrix
75
+ def puppet_beaker_test_matrix
74
76
  matrix_include = []
75
77
 
76
78
  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
- )
79
+ next if puppet_version_below_minimum?(puppet_version[:value])
80
+
81
+ setfile = os_release_to_beaker_setfile(os, release, puppet_version[:collection])
80
82
  next unless setfile
83
+
84
+ name = "#{puppet_version[:name]} - #{setfile[1]}"
85
+ env = {
86
+ 'BEAKER_PUPPET_COLLECTION' => puppet_version[:collection],
87
+ 'BEAKER_SETFILE' => setfile[0],
88
+ }
89
+
90
+ if options[:beaker_facter]
91
+ fact, label, values = options[:beaker_facter]
92
+ values.each do |value|
93
+ matrix_include << {
94
+ name: "#{name} - #{label || fact} #{value}",
95
+ env: env.merge("BEAKER_FACTER_#{fact}" => value),
96
+ }
97
+ end
98
+ else
99
+ matrix_include << {
100
+ name: name,
101
+ env: env,
102
+ }
103
+ end
104
+ end
105
+
106
+ matrix_include
107
+ end
108
+
109
+ def github_action_test_matrix
110
+ matrix_include = []
111
+
112
+ beaker_os_releases do |os, release, puppet_version|
81
113
  next if puppet_version_below_minimum?(puppet_version[:value])
82
114
 
115
+ setfile = os_release_to_beaker_setfile(os, release, puppet_version[:collection])
116
+ next unless setfile
117
+
83
118
  matrix_include << {
84
119
  name: "#{puppet_version[:name]} - #{setfile[1]}",
85
120
  setfile: {
@@ -98,5 +133,16 @@ module PuppetMetadata
98
133
 
99
134
  Gem::Version.new(version) < Gem::Version.new(options[:minimum_major_puppet_version])
100
135
  end
136
+
137
+ def os_release_to_beaker_setfile(os, release, puppet_collection)
138
+ PuppetMetadata::Beaker.os_release_to_setfile(
139
+ os,
140
+ release,
141
+ use_fqdn: options[:beaker_use_fqdn],
142
+ pidfile_workaround: options[:beaker_pidfile_workaround],
143
+ domain: options[:domain],
144
+ puppet_version: puppet_collection,
145
+ )
146
+ end
101
147
  end
102
148
  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.4.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-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: metadata-json-lint