puppet_litmus 0.34.6 → 0.36.1

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: 2e6995f6c4a1cd2d14abbbf0d617ef28b18b029c3b3b3a342d7e1a98b0673394
4
- data.tar.gz: 86fd172c61f5775906e666732cdcb949a28c62c6cb7e9e67c8c4638195dba488
3
+ metadata.gz: f9a130b9a5ccaf0b18f53a163b9e65dd207eef1fbe23db2921df3b4b534f44ab
4
+ data.tar.gz: b2f1d8367e536d2f83104b839438e26e7cfc4da9f06ba714730e7dbbb2de6f6c
5
5
  SHA512:
6
- metadata.gz: 4ffef8459fcd7b032a6fc43a376ebc833be88f344f59364b4b622e7d0bddf8cf7a4d8681e6fa3012b6914ab6922a5b59d4d7e41b286e740dd543ff5e59b80887
7
- data.tar.gz: 8789b4289c68186345dd097bda8539d8f5006184eb3b58f8cf544ca0fe80bb35d54ca6f43d7ddaa3fd53785b5d6e6dcf01e3fce4185e6a1fb27e3f4588f86773
6
+ metadata.gz: 9e5852a7557b51cf4ee81a50d169d58a7de90aebb6f4c0f53258274632b49f7e8d93175176b60b3435023326df6cabf27f68d10209d5bfdf100911f32a438869
7
+ data.tar.gz: 4c70b9fb01b6a32b374e287d2a8444896d31d9d38a0a8b7e18cc1cc10f5b531fcfad811a8269f707b9cc05f7085a5f94f94c28acf84a0a5858ebe5ef43db1e4f
@@ -5,6 +5,25 @@
5
5
 
6
6
  require 'json'
7
7
 
8
+ # Sets an output variable in GitHub Actions. If the GITHUB_OUTPUT environment
9
+ # variable is not set, this will fail with an exit code of 1 and
10
+ # send an ::error:: message to the GitHub Actions log.
11
+ # @param name [String] The name of the output variable
12
+ # @param value [String] The value of the output variable
13
+
14
+ def set_output(name, value)
15
+ # Get the output path
16
+ output = ENV.fetch('GITHUB_OUTPUT')
17
+
18
+ # Write the output variable to GITHUB_OUTPUT
19
+ File.open(output, 'a') do |f|
20
+ f.puts "#{name}=#{value}"
21
+ end
22
+ rescue KeyError
23
+ puts '::error::GITHUB_OUTPUT environment variable not set.'
24
+ exit 1
25
+ end
26
+
8
27
  IMAGE_TABLE = {
9
28
  'RedHat-7' => 'rhel-7',
10
29
  'RedHat-8' => 'rhel-8',
@@ -92,6 +111,5 @@ end
92
111
  matrix[:platform] = matrix[:platform].uniq.sort
93
112
  matrix[:collection] = matrix[:collection].uniq.sort
94
113
 
95
- puts "::set-output name=matrix::#{JSON.generate(matrix)}"
96
-
114
+ set_output('matrix', JSON.generate(matrix))
97
115
  puts "Created matrix with #{matrix[:platform].length * matrix[:collection].length} cells."
@@ -5,6 +5,25 @@
5
5
 
6
6
  require 'json'
7
7
 
8
+ # Sets an output variable in GitHub Actions. If the GITHUB_OUTPUT environment
9
+ # variable is not set, this will fail with an exit code of 1 and
10
+ # send an ::error:: message to the GitHub Actions log.
11
+ # @param name [String] The name of the output variable
12
+ # @param value [String] The value of the output variable
13
+
14
+ def set_output(name, value)
15
+ # Get the output path
16
+ output = ENV.fetch('GITHUB_OUTPUT')
17
+
18
+ # Write the output variable to GITHUB_OUTPUT
19
+ File.open(output, 'a') do |f|
20
+ f.puts "#{name}=#{value}"
21
+ end
22
+ rescue KeyError
23
+ puts '::error::GITHUB_OUTPUT environment variable not set.'
24
+ exit 1
25
+ end
26
+
8
27
  IMAGE_TABLE = {
9
28
  'RedHat-7' => 'rhel-7',
10
29
  'RedHat-8' => 'rhel-8',
@@ -48,6 +67,10 @@ COLLECTION_TABLE = [
48
67
  puppet_maj_version: 7,
49
68
  ruby_version: 2.7,
50
69
  },
70
+ {
71
+ puppet_maj_version: 8,
72
+ ruby_version: 3.2,
73
+ },
51
74
  ].freeze
52
75
 
53
76
  matrix = {
@@ -123,7 +146,11 @@ if metadata.key?('requirements') && metadata['requirements'].length.positive?
123
146
  next unless Gem::Requirement.create(reqs).satisfied_by?(Gem::Version.new("#{collection[:puppet_maj_version]}.9999"))
124
147
 
125
148
  matrix[:collection] << "puppet#{collection[:puppet_maj_version]}-nightly"
126
- spec_matrix[:include] << { puppet_version: "~> #{collection[:puppet_maj_version]}.0", ruby_version: collection[:ruby_version] }
149
+ spec_matrix[:include] << if collection[:puppet_maj_version] == 8
150
+ { puppet_version: 'https://github.com/puppetlabs/puppet', ruby_version: collection[:ruby_version] }
151
+ else
152
+ { puppet_version: "~> #{collection[:puppet_maj_version]}.0", ruby_version: collection[:ruby_version] }
153
+ end
127
154
  end
128
155
  end
129
156
  end
@@ -137,8 +164,8 @@ end
137
164
  matrix[:platforms] = matrix[:platforms].uniq.sort { |a, b| a[:label] <=> b[:label] }
138
165
  matrix[:collection] = matrix[:collection].uniq.sort
139
166
 
140
- puts "::set-output name=matrix::#{JSON.generate(matrix)}"
141
- puts "::set-output name=spec_matrix::#{JSON.generate(spec_matrix)}"
167
+ set_output('matrix', JSON.generate(matrix))
168
+ set_output('spec_matrix', JSON.generate(spec_matrix))
142
169
 
143
170
  acceptance_test_cell_count = matrix[:platforms].length * matrix[:collection].length
144
171
  spec_test_cell_count = spec_matrix[:include].length
@@ -2,5 +2,5 @@
2
2
 
3
3
  # version of this gem
4
4
  module PuppetLitmus
5
- VERSION ||= '0.34.6'
5
+ VERSION ||= '0.36.1'
6
6
  end
@@ -37,10 +37,10 @@
37
37
  "requirements": [
38
38
  {
39
39
  "name": "puppet",
40
- "version_requirement": ">= 6.0.0 < 8.0.0"
40
+ "version_requirement": ">= 7.0.0 < 9.0.0"
41
41
  }
42
42
  ],
43
43
  "template-url": "https://github.com/puppetlabs/pdk-templates.git#main",
44
- "template-ref": "heads/main-0-g2381db6",
45
- "pdk-version": "2.1.1"
44
+ "template-ref": "tags/2.7.4",
45
+ "pdk-version": "2.7.4"
46
46
  }
@@ -4,38 +4,50 @@ require 'spec_helper'
4
4
 
5
5
  RSpec.describe 'matrix_from_metadata_v2' do
6
6
  context 'without arguments' do
7
+ let(:github_output) { Tempfile.new('github_output') }
8
+ let(:github_output_content) { github_output.read }
7
9
  let(:result) { run_matrix_from_metadata_v2 }
8
10
 
11
+ before(:each) do
12
+ ENV['GITHUB_OUTPUT'] = github_output.path
13
+ end
14
+
9
15
  it 'run successfully' do
10
16
  expect(result.status_code).to eq 0
11
17
  end
12
18
 
13
19
  it 'generates the matrix' do
14
20
  expect(result.stdout).to include('::warning::Cannot find image for Ubuntu-14.04')
15
- expect(result.stdout).to include(
21
+ expect(github_output_content).to include(
16
22
  [
17
- '::set-output name=matrix::{',
23
+ 'matrix={',
18
24
  '"platforms":[',
19
25
  '{"label":"CentOS-6","provider":"provision::docker","image":"litmusimage/centos:6"},',
20
26
  '{"label":"RedHat-8","provider":"provision::provision_service","image":"rhel-8"},',
21
27
  '{"label":"Ubuntu-18.04","provider":"provision::docker","image":"litmusimage/ubuntu:18.04"}',
22
28
  '],',
23
29
  '"collection":[',
24
- '"puppet6-nightly","puppet7-nightly"',
30
+ '"puppet7-nightly","puppet8-nightly"',
25
31
  ']',
26
32
  '}',
27
33
  ].join,
28
34
  )
29
- expect(result.stdout).to include(
30
- '::set-output name=spec_matrix::{"include":[{"puppet_version":"~> 6.0","ruby_version":2.5},{"puppet_version":"~> 7.0","ruby_version":2.7}]}',
35
+ expect(github_output_content).to include(
36
+ 'spec_matrix={"include":[{"puppet_version":"~> 7.0","ruby_version":2.7},{"puppet_version":"~> 8.0","ruby_version":3.2}]}',
31
37
  )
32
38
  expect(result.stdout).to include("Created matrix with 8 cells:\n - Acceptance Test Cells: 6\n - Spec Test Cells: 2")
33
39
  end
34
40
  end
35
41
 
36
42
  context 'with --exclude-platforms ["ubuntu-18.04"]' do
43
+ let(:github_output) { Tempfile.new('github_output') }
44
+ let(:github_output_content) { github_output.read }
37
45
  let(:result) { run_matrix_from_metadata_v2({ '--exclude-platforms' => ['ubuntu-18.04'] }) }
38
46
 
47
+ before(:each) do
48
+ ENV['GITHUB_OUTPUT'] = github_output.path
49
+ end
50
+
39
51
  it 'run successfully' do
40
52
  expect(result.status_code).to eq 0
41
53
  end
@@ -43,29 +55,35 @@ RSpec.describe 'matrix_from_metadata_v2' do
43
55
  it 'generates the matrix without excluded platforms' do
44
56
  expect(result.stdout).to include('::warning::Cannot find image for Ubuntu-14.04')
45
57
  expect(result.stdout).to include('::warning::Ubuntu-18.04 was excluded from testing')
46
- expect(result.stdout).to include(
58
+ expect(github_output_content).to include(
47
59
  [
48
- '::set-output name=matrix::{',
60
+ 'matrix={',
49
61
  '"platforms":[',
50
62
  '{"label":"CentOS-6","provider":"provision::docker","image":"litmusimage/centos:6"},',
51
63
  '{"label":"RedHat-8","provider":"provision::provision_service","image":"rhel-8"}',
52
64
  '],',
53
65
  '"collection":[',
54
- '"puppet6-nightly","puppet7-nightly"',
66
+ '"puppet7-nightly","puppet8-nightly"',
55
67
  ']',
56
68
  '}',
57
69
  ].join,
58
70
  )
59
- expect(result.stdout).to include(
60
- '::set-output name=spec_matrix::{"include":[{"puppet_version":"~> 6.0","ruby_version":2.5},{"puppet_version":"~> 7.0","ruby_version":2.7}]}',
71
+ expect(github_output_content).to include(
72
+ 'spec_matrix={"include":[{"puppet_version":"~> 7.0","ruby_version":2.7},{"puppet_version":"~> 8.0","ruby_version":3.2}]}',
61
73
  )
62
74
  expect(result.stdout).to include("Created matrix with 6 cells:\n - Acceptance Test Cells: 4\n - Spec Test Cells: 2")
63
75
  end
64
76
  end
65
77
 
66
78
  context 'with --exclude-platforms \'["ubuntu-18.04","redhat-8"]\'' do
79
+ let(:github_output) { Tempfile.new('github_output') }
80
+ let(:github_output_content) { github_output.read }
67
81
  let(:result) { run_matrix_from_metadata_v2({ '--exclude-platforms' => ['ubuntu-18.04', 'redhat-8'] }) }
68
82
 
83
+ before(:each) do
84
+ ENV['GITHUB_OUTPUT'] = github_output.path
85
+ end
86
+
69
87
  it 'run successfully' do
70
88
  expect(result.status_code).to eq 0
71
89
  end
@@ -74,20 +92,20 @@ RSpec.describe 'matrix_from_metadata_v2' do
74
92
  expect(result.stdout).to include('::warning::Cannot find image for Ubuntu-14.04')
75
93
  expect(result.stdout).to include('::warning::Ubuntu-18.04 was excluded from testing')
76
94
  expect(result.stdout).to include('::warning::RedHat-8 was excluded from testing')
77
- expect(result.stdout).to include(
95
+ expect(github_output_content).to include(
78
96
  [
79
- '::set-output name=matrix::{',
97
+ 'matrix={',
80
98
  '"platforms":[',
81
99
  '{"label":"CentOS-6","provider":"provision::docker","image":"litmusimage/centos:6"}',
82
100
  '],',
83
101
  '"collection":[',
84
- '"puppet6-nightly","puppet7-nightly"',
102
+ '"puppet7-nightly","puppet8-nightly"',
85
103
  ']',
86
104
  '}',
87
105
  ].join,
88
106
  )
89
- expect(result.stdout).to include(
90
- '::set-output name=spec_matrix::{"include":[{"puppet_version":"~> 6.0","ruby_version":2.5},{"puppet_version":"~> 7.0","ruby_version":2.7}]}',
107
+ expect(github_output_content).to include(
108
+ 'spec_matrix={"include":[{"puppet_version":"~> 7.0","ruby_version":2.7},{"puppet_version":"~> 8.0","ruby_version":3.2}]}',
91
109
  )
92
110
  expect(result.stdout).to include("Created matrix with 4 cells:\n - Acceptance Test Cells: 2\n - Spec Test Cells: 2")
93
111
  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: 0.34.6
4
+ version: 0.36.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet, Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-03-09 00:00:00.000000000 Z
11
+ date: 2023-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bolt
@@ -154,20 +154,6 @@ dependencies:
154
154
  - - ">="
155
155
  - !ruby/object:Gem::Version
156
156
  version: '0'
157
- - !ruby/object:Gem::Dependency
158
- name: r10k
159
- requirement: !ruby/object:Gem::Requirement
160
- requirements:
161
- - - '='
162
- - !ruby/object:Gem::Version
163
- version: 3.15.1
164
- type: :runtime
165
- prerelease: false
166
- version_requirements: !ruby/object:Gem::Requirement
167
- requirements:
168
- - - '='
169
- - !ruby/object:Gem::Version
170
- version: 3.15.1
171
157
  description: " Providing a simple command line tool for puppet content creators,
172
158
  to enable simple and complex test deployments.\n"
173
159
  email:
@@ -229,17 +215,17 @@ specification_version: 4
229
215
  summary: Providing a simple command line tool for puppet content creators, to enable
230
216
  simple and complex test deployments.
231
217
  test_files:
232
- - spec/spec_helper.rb
233
- - spec/support/inventory.rb
234
- - spec/support/inventorytesting.yaml
235
218
  - spec/exe/matrix_from_metadata_v2_spec.rb
236
219
  - spec/exe/fake_metadata.json
237
- - spec/data/jim.yaml
238
- - spec/data/doot.tar.gz
239
- - spec/data/inventory.yaml
240
- - spec/lib/puppet_litmus/rake_tasks_spec.rb
241
- - spec/lib/puppet_litmus/puppet_litmus_version_spec.rb
220
+ - spec/lib/puppet_litmus/util_spec.rb
242
221
  - spec/lib/puppet_litmus/inventory_manipulation_spec.rb
222
+ - spec/lib/puppet_litmus/rake_tasks_spec.rb
243
223
  - spec/lib/puppet_litmus/puppet_helpers_spec.rb
244
224
  - spec/lib/puppet_litmus/rake_helper_spec.rb
245
- - spec/lib/puppet_litmus/util_spec.rb
225
+ - spec/lib/puppet_litmus/puppet_litmus_version_spec.rb
226
+ - spec/spec_helper.rb
227
+ - spec/support/inventorytesting.yaml
228
+ - spec/support/inventory.rb
229
+ - spec/data/doot.tar.gz
230
+ - spec/data/inventory.yaml
231
+ - spec/data/jim.yaml