puppet_litmus 2.7.0 → 2.8.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 +5 -0
- data/exe/matrix_from_metadata_v3 +39 -0
- data/lib/puppet_litmus/version.rb +1 -1
- data/spec/exe/matrix_from_metadata_v3_spec.rb +50 -1
- 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: ddb31ff29d7e1d38620998447c3b0374b5d83c000a728c82335b792d31713f69
|
|
4
|
+
data.tar.gz: 577f054f113f94e527749b187567b04f62335ce2eae6f4d36d299a554cacc6ca
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 500e38ceadb721af5cb4c45ae84d38edf417bd55411f67e5b910d9b74090739be94169d370cf7663a86f445c4853ca92fcf5e43170aaf5d01719cc4ba4a7c943
|
|
7
|
+
data.tar.gz: 38fd30196f4b5c6eb952bee7f230d5c14a76b9d75cc45eed4681abb72eec1e5075d61d5963a44bdc4a13be51d3dcb739e12ec14ae99877184efe8f11fedefbbe
|
data/README.md
CHANGED
|
@@ -68,6 +68,7 @@ in the project module root directory run `bundle exec matrix_from_metadata_v3`
|
|
|
68
68
|
| --puppet-exclude | MAJOR | | Filter puppet major version |
|
|
69
69
|
| --platform-include | REGEX | | Select platform |
|
|
70
70
|
| --platform-exclude | REGEX | | Filter platform |
|
|
71
|
+
| --collection-platform-exclude | MAJOR:REGEX | | Filter a platform for one puppet major only, emitted as a GitHub Actions matrix exclude so the platform stays in other collections. Repeatable |
|
|
71
72
|
| --arch-include | REGEX | | Select architecture |
|
|
72
73
|
| --arch-exclude | REGEX | | Filter architecture |
|
|
73
74
|
| --provision-prefer | NAME | docker | Prefer provisioner |
|
|
@@ -88,6 +89,10 @@ in the project module root directory run `bundle exec matrix_from_metadata_v3`
|
|
|
88
89
|
```sh
|
|
89
90
|
matrix_from_metadata_v3 --platform-exclude redhat-7 --platform-exclude ubuntu-18.04
|
|
90
91
|
```
|
|
92
|
+
* Exclude a platform for one puppet major only (kept in other collections). E.g. ubuntu-20.04 has no Puppet 9 agent but is valid on Puppet 8:
|
|
93
|
+
```sh
|
|
94
|
+
matrix_from_metadata_v3 --nightly --collection-platform-exclude 9:ubuntu-20.04
|
|
95
|
+
```
|
|
91
96
|
* Exclude architecture
|
|
92
97
|
```sh
|
|
93
98
|
matrix_from_metadata_v3 --arch-exclude x86_64
|
data/exe/matrix_from_metadata_v3
CHANGED
|
@@ -86,6 +86,7 @@ options = OpenStruct.new(
|
|
|
86
86
|
puppet_include: [],
|
|
87
87
|
platform_exclude: [],
|
|
88
88
|
platform_include: [],
|
|
89
|
+
collection_platform_exclude: [],
|
|
89
90
|
arch_include: [],
|
|
90
91
|
arch_exclude: [],
|
|
91
92
|
provision_prefer: [],
|
|
@@ -155,6 +156,21 @@ begin
|
|
|
155
156
|
opt.on('--platform-include REGEX', Regexp, 'Select platform') { |o| options.platform_include << o }
|
|
156
157
|
opt.on('--platform-exclude REGEX', Regexp, 'Filter platform') { |o| options.platform_exclude << o }
|
|
157
158
|
|
|
159
|
+
opt.on('--collection-platform-exclude SPEC', String,
|
|
160
|
+
'Filter a platform for one puppet major only, as MAJOR:PLATFORM_REGEX (e.g. 9:ubuntu-20.04). ' \
|
|
161
|
+
'Emitted as a GitHub Actions matrix exclude so the platform stays in other collections. Repeatable.') do |o|
|
|
162
|
+
major, regex = o.split(':', 2)
|
|
163
|
+
raise OptionParser::InvalidArgument, "--collection-platform-exclude '#{o}' must be MAJOR:PLATFORM_REGEX" \
|
|
164
|
+
if regex.nil? || regex.empty? || major !~ /\A\d+\z/
|
|
165
|
+
|
|
166
|
+
begin
|
|
167
|
+
platform = Regexp.new(regex, Regexp::IGNORECASE)
|
|
168
|
+
rescue RegexpError => e
|
|
169
|
+
raise OptionParser::InvalidArgument, "--collection-platform-exclude '#{o}' has an invalid PLATFORM_REGEX: #{e.message}"
|
|
170
|
+
end
|
|
171
|
+
options.collection_platform_exclude << { major: major.to_i, platform: }
|
|
172
|
+
end
|
|
173
|
+
|
|
158
174
|
opt.on('--arch-include REGEX', Regexp, 'Select architecture') { |o| options.arch_include << o }
|
|
159
175
|
opt.on('--arch-exclude REGEX', Regexp, 'Filter architecture') { |o| options.arch_exclude << o }
|
|
160
176
|
|
|
@@ -370,6 +386,29 @@ options[:metadata]['operatingsystem_support'].each do |os_sup|
|
|
|
370
386
|
end
|
|
371
387
|
end
|
|
372
388
|
|
|
389
|
+
# Exclude specific platform x collection combinations (e.g. an OS a given puppet
|
|
390
|
+
# major ships no agent package for, such as ubuntu-20.04 on puppet 9). The platform
|
|
391
|
+
# and collection remain valid on their own, so this is emitted as a GitHub Actions
|
|
392
|
+
# matrix `exclude` that only drops the matching combinations.
|
|
393
|
+
unless options[:collection_platform_exclude].empty?
|
|
394
|
+
exclude = []
|
|
395
|
+
matrix[:collection].each do |coll|
|
|
396
|
+
coll_name = coll.is_a?(Hash) ? coll[:collection] : coll
|
|
397
|
+
major = coll_name.to_s[/\d+/]&.to_i
|
|
398
|
+
next if major.nil?
|
|
399
|
+
|
|
400
|
+
matrix[:platforms].each do |platform|
|
|
401
|
+
next unless options[:collection_platform_exclude].any? do |spec|
|
|
402
|
+
spec[:major] == major && platform[:label].match?(spec[:platform])
|
|
403
|
+
end
|
|
404
|
+
|
|
405
|
+
Action.notice("collection-platform-exclude filtered #{platform[:label]} x #{coll_name}")
|
|
406
|
+
exclude << { platforms: platform, collection: coll }
|
|
407
|
+
end
|
|
408
|
+
end
|
|
409
|
+
matrix[:exclude] = exclude unless exclude.empty?
|
|
410
|
+
end
|
|
411
|
+
|
|
373
412
|
Action.group('matrix', matrix, pretty: true).group('spec_matrix', spec_matrix, pretty: true) if Action.type == 'github' && Action.notice
|
|
374
413
|
|
|
375
414
|
Action.error('no supported puppet versions') if matrix[:collection].empty?
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'spec_helper'
|
|
4
|
+
require 'json'
|
|
4
5
|
|
|
5
6
|
RSpec.describe 'matrix_from_metadata_v3' do
|
|
6
7
|
let(:github_output) { Tempfile.new('github_output') }
|
|
@@ -239,7 +240,7 @@ RSpec.describe 'matrix_from_metadata_v3' do
|
|
|
239
240
|
'::group::matrix',
|
|
240
241
|
'::group::spec_matrix'
|
|
241
242
|
)
|
|
242
|
-
expect(github_output_content).to match(/"collection":\[(?:"\d{4}\.\d
|
|
243
|
+
expect(github_output_content).to match(/"collection":\[(?:"\d{4}\.\d+\.\d+-puppet_enterprise",)+"puppetcore8","puppetcore9"/)
|
|
243
244
|
expect(github_output_content).to include(
|
|
244
245
|
'spec_matrix={"include":[{"puppet_version":"~> 8.0","ruby_version":3.2},{"puppet_version":"~> 9.0","ruby_version":4.0}]}'
|
|
245
246
|
)
|
|
@@ -335,4 +336,52 @@ RSpec.describe 'matrix_from_metadata_v3' do
|
|
|
335
336
|
)
|
|
336
337
|
end
|
|
337
338
|
end
|
|
339
|
+
|
|
340
|
+
context 'with --collection-platform-exclude' do
|
|
341
|
+
let(:result) do
|
|
342
|
+
run_matrix_from_metadata_v3(
|
|
343
|
+
['--collection-platform-exclude', '9:ubuntu-18.04'],
|
|
344
|
+
env: { 'PUPPET_FORGE_TOKEN' => 'fake' }
|
|
345
|
+
)
|
|
346
|
+
end
|
|
347
|
+
|
|
348
|
+
it 'runs successfully' do
|
|
349
|
+
expect(result.status_code).to eq 0
|
|
350
|
+
end
|
|
351
|
+
|
|
352
|
+
it 'emits a matrix exclude for only the matching platform x collection' do
|
|
353
|
+
result
|
|
354
|
+
matrix = JSON.parse(github_output_content[/^matrix=(.+)$/, 1])
|
|
355
|
+
expect(matrix['exclude']).to contain_exactly(
|
|
356
|
+
'platforms' => {
|
|
357
|
+
'label' => 'Ubuntu-18.04', 'provider' => 'docker', 'arch' => 'x86_64',
|
|
358
|
+
'image' => 'litmusimage/ubuntu:18.04', 'runner' => 'ubuntu-22.04'
|
|
359
|
+
},
|
|
360
|
+
'collection' => 'puppetcore9'
|
|
361
|
+
)
|
|
362
|
+
end
|
|
363
|
+
|
|
364
|
+
it 'keeps the platform and the collection usable in other combinations' do
|
|
365
|
+
# Ubuntu-18.04 is still a platform and puppetcore9 is still a collection;
|
|
366
|
+
# only the single pair is excluded (so Ubuntu-18.04 still runs on puppetcore8).
|
|
367
|
+
result
|
|
368
|
+
expect(github_output_content).to include('{"label":"Ubuntu-18.04","provider":"docker",')
|
|
369
|
+
expect(github_output_content).to include('"collection":["puppetcore8","puppetcore9"]')
|
|
370
|
+
end
|
|
371
|
+
|
|
372
|
+
it 'logs the exclusion' do
|
|
373
|
+
expect(result.stdout).to include('::notice::collection-platform-exclude filtered Ubuntu-18.04 x puppetcore9')
|
|
374
|
+
end
|
|
375
|
+
end
|
|
376
|
+
|
|
377
|
+
context 'with an invalid --collection-platform-exclude spec' do
|
|
378
|
+
let(:result) do
|
|
379
|
+
run_matrix_from_metadata_v3(['--collection-platform-exclude', 'ubuntu-18.04'])
|
|
380
|
+
end
|
|
381
|
+
|
|
382
|
+
it 'fails with a helpful error' do
|
|
383
|
+
expect(result.status_code).not_to eq 0
|
|
384
|
+
expect(result.stdout).to include("--collection-platform-exclude 'ubuntu-18.04' must be MAJOR:PLATFORM_REGEX")
|
|
385
|
+
end
|
|
386
|
+
end
|
|
338
387
|
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.8.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: 2026-
|
|
11
|
+
date: 2026-08-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bolt
|