puppet_litmus 2.2.0 → 2.3.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 +4 -4
- data/README.md +1 -0
- data/exe/matrix.json +1 -1
- data/exe/matrix_from_metadata_v3 +36 -3
- data/lib/puppet_litmus/version.rb +1 -1
- data/spec/exe/matrix_from_metadata_v3_spec.rb +21 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e2ad6ea0b4f8ee3598ab6ede1cd5a7ae69182c6e7f63f8c3ea8ee96efa4bef7
|
4
|
+
data.tar.gz: 18ff23ee19ef67c034985342ae4de1d2e8b3263312caad20773cdfed5794663f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9da34a392feada10b9517a263bd1c42c81c59059750b91aad9821ae015a218a64f6de9257880d46669e84a5388a4052e859d0f42771c278ddf21f586120a891e
|
7
|
+
data.tar.gz: 16bf3d8cc98f8ec297d714c713bfef84d1b02c26d4d5ad0698866d2fd403e795d02aa63162e9ad11ddf7669e4f2291984a044d7aa613755f81fb785f6d446ce6
|
data/README.md
CHANGED
@@ -74,6 +74,7 @@ in the project module root directory run `bundle exec matrix_from_metadata_v3`
|
|
74
74
|
| --provision-include | NAME | all | Select provisioner |
|
75
75
|
| --provision-exclude | NAME | provision_service | Filter provisioner |
|
76
76
|
| --nightly | | | Install from the nightly puppetcore images |
|
77
|
+
| --latest-agent | | | Return the latest agent version as part of the matrix. Note: This changes how the collection is returned |
|
77
78
|
|
78
79
|
> Refer to the [built-in matrix.json](https://github.com/puppetlabs/puppet_litmus/blob/main/exe/matrix.json) for a list of supported collection, provisioners, and platforms.
|
79
80
|
|
data/exe/matrix.json
CHANGED
data/exe/matrix_from_metadata_v3
CHANGED
@@ -163,11 +163,14 @@ begin
|
|
163
163
|
opt.on('--provision-exclude NAME', String, "Filter provisioner (default: #{default_options[:'provision-exclude'] || 'none'})") { |o| options.provision_exclude.push(*o.split(',')) }
|
164
164
|
|
165
165
|
opt.on('--nightly', TrueClass, 'Enable nightly builds') { |o| options.nightly = o }
|
166
|
+
opt.on('--latest-agent', TrueClass, 'Return the latest agent build as part of the matrix') { |o| options.latest_agent = o }
|
166
167
|
end.parse!
|
167
168
|
|
168
169
|
Action.config(debug: true) if options[:debug]
|
169
170
|
Action.config(notice: false) if options[:quiet] && !options[:debug]
|
170
171
|
|
172
|
+
raise OptionParser::InvalidArgument, 'latest-agent and pe-include are mutually exclusive options' if options[:latest_agent] && options[:pe_include]
|
173
|
+
|
171
174
|
# validate provisioners
|
172
175
|
options[:provision_include].select! do |p|
|
173
176
|
options[:matrix]['provisioners'].key?(p) or raise OptionParser::InvalidArgument, "--provision-include '#{p}' not found in provisioners"
|
@@ -262,12 +265,42 @@ options[:metadata]['requirements']&.each do |req|
|
|
262
265
|
# This assumes that such a boundary will always allow the latest actually existing puppet version of a release stream, trading off simplicity vs accuracy here.
|
263
266
|
next unless gem_req.satisfied_by?(Gem::Version.new("#{collection['puppet'].to_i}.9999"))
|
264
267
|
|
268
|
+
# # If requested, return the latest agent version for the collection's puppet version
|
269
|
+
# # If not requested, return the value latest
|
270
|
+
agent_version = if options[:latest_agent] && collection['puppet'] != 'nightly'
|
271
|
+
require 'net/http'
|
272
|
+
require 'json'
|
273
|
+
require 'uri'
|
274
|
+
|
275
|
+
uri = URI('https://forgeapi.puppet.com/private/versions/puppet-agent')
|
276
|
+
response = Net::HTTP.get_response(uri)
|
277
|
+
json_data = JSON.parse(response.body)
|
278
|
+
all_versions = json_data.keys
|
279
|
+
versionx = all_versions.select { |v| v.start_with?("#{collection['puppet'].to_i}.") }
|
280
|
+
versionx.sort_by { |v| Gem::Version.new(v) }.last # rubocop:disable Style/RedundantSort
|
281
|
+
end
|
282
|
+
|
265
283
|
version = collection['puppet'].to_i
|
266
284
|
prefix = 'puppetcore'
|
267
|
-
|
268
|
-
|
285
|
+
group = if options[:nightly]
|
286
|
+
"#{prefix}#{version}-nightly"
|
287
|
+
else
|
288
|
+
"#{prefix}#{version}"
|
289
|
+
end
|
290
|
+
matrix[:collection] << if options[:latest_agent] && collection['puppet'] != 'nightly'
|
291
|
+
require 'net/http'
|
292
|
+
require 'json'
|
293
|
+
require 'uri'
|
294
|
+
|
295
|
+
uri = URI('https://forgeapi.puppet.com/private/versions/puppet-agent')
|
296
|
+
response = Net::HTTP.get_response(uri)
|
297
|
+
json_data = JSON.parse(response.body)
|
298
|
+
all_versions = json_data.keys
|
299
|
+
versionx = all_versions.select { |v| v.start_with?("#{collection['puppet'].to_i}.") }
|
300
|
+
versionx.sort_by { |v| Gem::Version.new(v) }.last # rubocop:disable Style/RedundantSort
|
301
|
+
{ collection: group, version: agent_version }
|
269
302
|
else
|
270
|
-
|
303
|
+
group
|
271
304
|
end
|
272
305
|
|
273
306
|
spec_matrix[:include] << {
|
@@ -280,4 +280,25 @@ RSpec.describe 'matrix_from_metadata_v3' do
|
|
280
280
|
)
|
281
281
|
end
|
282
282
|
end
|
283
|
+
|
284
|
+
context 'with argument --latest-agent' do
|
285
|
+
let(:result) { run_matrix_from_metadata_v3(['--puppetlabs', '--latest-agent']) }
|
286
|
+
|
287
|
+
it 'run successfully' do
|
288
|
+
expect(result.status_code).to eq 0
|
289
|
+
end
|
290
|
+
|
291
|
+
it 'generates the matrix' do
|
292
|
+
expect(result.stdout).to include(
|
293
|
+
'::warning::CentOS-6 no provisioner found',
|
294
|
+
'::warning::Ubuntu-14.04 no provisioner found',
|
295
|
+
'::group::matrix',
|
296
|
+
'::group::spec_matrix'
|
297
|
+
)
|
298
|
+
expect(github_output_content).to match(/{"collection":"puppetcore8","version":"\d+\.\d+\.\d+"}/)
|
299
|
+
expect(github_output_content).to include(
|
300
|
+
'spec_matrix={"include":[{"puppet_version":"~> 8.0","ruby_version":3.2}]}'
|
301
|
+
)
|
302
|
+
end
|
303
|
+
end
|
283
304
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppet_litmus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-08-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bolt
|