Skip to content

Commit 4349ff2

Browse files
Merge pull request #582 from puppetlabs/use_public_puppet_repos
fix: update matrix_from_metadata v2/v3 to install from public repos
2 parents 7e51dbf + 2faa636 commit 4349ff2

File tree

6 files changed

+27
-18
lines changed

6 files changed

+27
-18
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,15 @@ Install Litmus as a gem by running `gem install puppet_litmus`.
2929

3030
- Note if you choose to override the `litmus_inventory.yaml` location, please ensure that the directory structure you define exists.
3131

32+
## Install a specific puppet agent version
33+
34+
To install a specific version of the puppet agent, you can export the `PUPPET_VERSION` env var, like below:
35+
```
36+
export PUPPET_VERSION=8.8.1
37+
```
38+
39+
When set, the `litmus:install_agent` rake task will install the specified version. The default is `latest`.
40+
3241
## matrix_from_metadata_v3
3342

3443
matrix_from_metadata_v3 tool generates a github action matrix from the supported operating systems listed in the module's metadata.json.

exe/matrix_from_metadata_v2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ if metadata.key?('requirements') && metadata['requirements'].length.positive?
217217
# 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.
218218
next unless Gem::Requirement.create(reqs).satisfied_by?(Gem::Version.new("#{collection[:puppet_maj_version]}.9999"))
219219

220-
matrix[:collection] << "puppet#{collection[:puppet_maj_version]}-nightly"
220+
matrix[:collection] << "puppet#{collection[:puppet_maj_version]}"
221221

222222
include_version = {
223223
8 => "~> #{collection[:puppet_maj_version]}.0",

exe/matrix_from_metadata_v3

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ options[:metadata]['requirements']&.each do |req|
260260
# 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.
261261
next unless gem_req.satisfied_by?(Gem::Version.new("#{collection['puppet'].to_i}.9999"))
262262

263-
matrix[:collection] << "puppet#{collection['puppet'].to_i}-nightly"
263+
matrix[:collection] << "puppet#{collection['puppet'].to_i}"
264264

265265
spec_matrix[:include] << {
266266
puppet_version: "~> #{collection['puppet']}",

lib/puppet_litmus/rake_helper.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,11 @@ def tear_down(node_name, inventory_hash)
129129

130130
def install_agent(collection, targets, inventory_hash)
131131
include ::BoltSpec::Run
132-
params = if collection.nil?
133-
{}
134-
else
135-
{ 'collection' => collection }
136-
end
132+
puppet_version = ENV.fetch('PUPPET_VERSION', nil)
133+
params = {}
134+
params['collection'] = collection if collection
135+
params['version'] = puppet_version if puppet_version
136+
137137
raise "puppet_agent was not found in #{DEFAULT_CONFIG_DATA['modulepath']}, please amend the .fixtures.yml file" \
138138
unless File.directory?(File.join(DEFAULT_CONFIG_DATA['modulepath'], 'puppet_agent'))
139139

spec/exe/matrix_from_metadata_v2_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
'{"label":"Ubuntu-22.04-arm","provider":"provision_service","image":"ubuntu-2204-lts-arm64"}',
3434
'],',
3535
'"collection":[',
36-
'"puppet7-nightly","puppet8-nightly"',
36+
'"puppet7","puppet8"',
3737
']',
3838
'}'
3939
].join
@@ -75,7 +75,7 @@
7575
'{"label":"Ubuntu-22.04-arm","provider":"provision_service","image":"ubuntu-2204-lts-arm64"}',
7676
'],',
7777
'"collection":[',
78-
'"puppet7-nightly","puppet8-nightly"',
78+
'"puppet7","puppet8"',
7979
']',
8080
'}'
8181
].join
@@ -114,7 +114,7 @@
114114
'{"label":"Ubuntu-22.04-arm","provider":"provision_service","image":"ubuntu-2204-lts-arm64"}',
115115
'],',
116116
'"collection":[',
117-
'"puppet7-nightly","puppet8-nightly"',
117+
'"puppet7","puppet8"',
118118
']',
119119
'}'
120120
].join
@@ -153,7 +153,7 @@
153153
'{"label":"Ubuntu-22.04","provider":"docker","image":"litmusimage/ubuntu:22.04"}',
154154
'],',
155155
'"collection":[',
156-
'"puppet7-nightly","puppet8-nightly"',
156+
'"puppet7","puppet8"',
157157
']',
158158
'}'
159159
].join

spec/exe/matrix_from_metadata_v3_spec.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
'{"label":"Ubuntu-22.04","provider":"docker","arch":"x86_64","image":"litmusimage/ubuntu:22.04","runner":"ubuntu-latest"}',
3131
'],',
3232
'"collection":[',
33-
'"puppet8-nightly"',
33+
'"puppet8"',
3434
']',
3535
'}'
3636
].join
@@ -63,7 +63,7 @@
6363
'{"label":"Ubuntu-22.04-arm","provider":"provision_service","arch":"arm","image":"ubuntu-2204-lts-arm64","runner":"ubuntu-latest"}',
6464
'],',
6565
'"collection":[',
66-
'"puppet8-nightly"',
66+
'"puppet8"',
6767
']',
6868
'}'
6969
].join
@@ -103,7 +103,7 @@
103103
'{"label":"Ubuntu-22.04-arm","provider":"provision_service","arch":"arm","image":"ubuntu-2204-lts-arm64","runner":"ubuntu-latest"}',
104104
'],',
105105
'"collection":[',
106-
'"puppet8-nightly"',
106+
'"puppet8"',
107107
']',
108108
'}'
109109
].join
@@ -142,7 +142,7 @@
142142
'{"label":"Ubuntu-22.04-arm","provider":"provision_service","arch":"arm","image":"ubuntu-2204-lts-arm64","runner":"ubuntu-latest"}',
143143
'],',
144144
'"collection":[',
145-
'"puppet8-nightly"',
145+
'"puppet8"',
146146
']',
147147
'}'
148148
].join
@@ -175,7 +175,7 @@
175175
'"platforms":[',
176176
'],',
177177
'"collection":[',
178-
'"puppet8-nightly"',
178+
'"puppet8"',
179179
']',
180180
'}'
181181
].join
@@ -215,7 +215,7 @@
215215
'{"label":"Ubuntu-22.04","provider":"docker","arch":"x86_64","image":"litmusimage/ubuntu:22.04","runner":"ubuntu-latest"}',
216216
'],',
217217
'"collection":[',
218-
'"puppet8-nightly"',
218+
'"puppet8"',
219219
']',
220220
'}'
221221
].join
@@ -233,7 +233,7 @@
233233
'::group::spec_matrix'
234234
)
235235
expect(github_output_content).to include(
236-
'"collection":["2023.8.0-puppet_enterprise","2021.7.9-puppet_enterprise","puppet8-nightly"'
236+
'"collection":["2023.8.0-puppet_enterprise","2021.7.9-puppet_enterprise","puppet8"'
237237
)
238238
expect(github_output_content).to include(
239239
'spec_matrix={"include":[{"puppet_version":"~> 8.0","ruby_version":3.2}]}'

0 commit comments

Comments
 (0)