Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ Install Litmus as a gem by running `gem install puppet_litmus`.

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

## Install a specific puppet agent version

To install a specific version of the puppet agent, you can export the `PUPPET_VERSION` env var, like below:
```
export PUPPET_VERSION=8.8.1
```

When set, the `litmus:install_agent` rake task will install the specified version. The default is `latest`.

## matrix_from_metadata_v3

matrix_from_metadata_v3 tool generates a github action matrix from the supported operating systems listed in the module's metadata.json.
Expand Down
2 changes: 1 addition & 1 deletion exe/matrix_from_metadata_v2
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ if metadata.key?('requirements') && metadata['requirements'].length.positive?
# 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.
next unless Gem::Requirement.create(reqs).satisfied_by?(Gem::Version.new("#{collection[:puppet_maj_version]}.9999"))

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

include_version = {
8 => "~> #{collection[:puppet_maj_version]}.0",
Expand Down
2 changes: 1 addition & 1 deletion exe/matrix_from_metadata_v3
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ options[:metadata]['requirements']&.each do |req|
# 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.
next unless gem_req.satisfied_by?(Gem::Version.new("#{collection['puppet'].to_i}.9999"))

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

spec_matrix[:include] << {
puppet_version: "~> #{collection['puppet']}",
Expand Down
10 changes: 5 additions & 5 deletions lib/puppet_litmus/rake_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,11 @@ def tear_down(node_name, inventory_hash)

def install_agent(collection, targets, inventory_hash)
include ::BoltSpec::Run
params = if collection.nil?
{}
else
{ 'collection' => collection }
end
puppet_version = ENV.fetch('PUPPET_VERSION', nil)
params = {}
params['collection'] = collection if collection
params['version'] = puppet_version if puppet_version

raise "puppet_agent was not found in #{DEFAULT_CONFIG_DATA['modulepath']}, please amend the .fixtures.yml file" \
unless File.directory?(File.join(DEFAULT_CONFIG_DATA['modulepath'], 'puppet_agent'))

Expand Down
8 changes: 4 additions & 4 deletions spec/exe/matrix_from_metadata_v2_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
'{"label":"Ubuntu-22.04-arm","provider":"provision_service","image":"ubuntu-2204-lts-arm64"}',
'],',
'"collection":[',
'"puppet7-nightly","puppet8-nightly"',
'"puppet7","puppet8"',
']',
'}'
].join
Expand Down Expand Up @@ -75,7 +75,7 @@
'{"label":"Ubuntu-22.04-arm","provider":"provision_service","image":"ubuntu-2204-lts-arm64"}',
'],',
'"collection":[',
'"puppet7-nightly","puppet8-nightly"',
'"puppet7","puppet8"',
']',
'}'
].join
Expand Down Expand Up @@ -114,7 +114,7 @@
'{"label":"Ubuntu-22.04-arm","provider":"provision_service","image":"ubuntu-2204-lts-arm64"}',
'],',
'"collection":[',
'"puppet7-nightly","puppet8-nightly"',
'"puppet7","puppet8"',
']',
'}'
].join
Expand Down Expand Up @@ -153,7 +153,7 @@
'{"label":"Ubuntu-22.04","provider":"docker","image":"litmusimage/ubuntu:22.04"}',
'],',
'"collection":[',
'"puppet7-nightly","puppet8-nightly"',
'"puppet7","puppet8"',
']',
'}'
].join
Expand Down
14 changes: 7 additions & 7 deletions spec/exe/matrix_from_metadata_v3_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
'{"label":"Ubuntu-22.04","provider":"docker","arch":"x86_64","image":"litmusimage/ubuntu:22.04","runner":"ubuntu-latest"}',
'],',
'"collection":[',
'"puppet8-nightly"',
'"puppet8"',
']',
'}'
].join
Expand Down Expand Up @@ -63,7 +63,7 @@
'{"label":"Ubuntu-22.04-arm","provider":"provision_service","arch":"arm","image":"ubuntu-2204-lts-arm64","runner":"ubuntu-latest"}',
'],',
'"collection":[',
'"puppet8-nightly"',
'"puppet8"',
']',
'}'
].join
Expand Down Expand Up @@ -103,7 +103,7 @@
'{"label":"Ubuntu-22.04-arm","provider":"provision_service","arch":"arm","image":"ubuntu-2204-lts-arm64","runner":"ubuntu-latest"}',
'],',
'"collection":[',
'"puppet8-nightly"',
'"puppet8"',
']',
'}'
].join
Expand Down Expand Up @@ -142,7 +142,7 @@
'{"label":"Ubuntu-22.04-arm","provider":"provision_service","arch":"arm","image":"ubuntu-2204-lts-arm64","runner":"ubuntu-latest"}',
'],',
'"collection":[',
'"puppet8-nightly"',
'"puppet8"',
']',
'}'
].join
Expand Down Expand Up @@ -175,7 +175,7 @@
'"platforms":[',
'],',
'"collection":[',
'"puppet8-nightly"',
'"puppet8"',
']',
'}'
].join
Expand Down Expand Up @@ -215,7 +215,7 @@
'{"label":"Ubuntu-22.04","provider":"docker","arch":"x86_64","image":"litmusimage/ubuntu:22.04","runner":"ubuntu-latest"}',
'],',
'"collection":[',
'"puppet8-nightly"',
'"puppet8"',
']',
'}'
].join
Expand All @@ -233,7 +233,7 @@
'::group::spec_matrix'
)
expect(github_output_content).to include(
'"collection":["2023.8.0-puppet_enterprise","2021.7.9-puppet_enterprise","puppet8-nightly"'
'"collection":["2023.8.0-puppet_enterprise","2021.7.9-puppet_enterprise","puppet8"'
)
expect(github_output_content).to include(
'spec_matrix={"include":[{"puppet_version":"~> 8.0","ruby_version":3.2}]}'
Expand Down