puppet_litmus 0.23.0 → 0.26.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7c3c6a488e0f0aa8b61b2f1d6678fd54d093aa11693b8ab004f57205f72049c9
4
- data.tar.gz: 65ce0b461f8c1b0683f9b608aa08ede12d44794d766d007da423472fbb856535
3
+ metadata.gz: 3bdab1c08e816eff65e739dedfb40a8d4c28070db7e6e615f9ff522f24b6a936
4
+ data.tar.gz: 2c24faff1b04809ef56fbce9094967e0de7205940b1bd8c117e597ccce910d9e
5
5
  SHA512:
6
- metadata.gz: 2191d39436024913ac79e2e4e1ea16306f4c4ece91c6ff3782a0d67eeda849ccc1079ac8976ed1c7e1edb5d9cb5fd92b86ef1a2f9261cde1134710267e08f29c
7
- data.tar.gz: 0661730c8fd0a5e4152840ff84edf917bd76d46691d580981d1d265d957457358aa4afa04ba6f573db9a97dfec2cb10fee74a5638249e4f31e40f7893b21e5f1
6
+ metadata.gz: 4bd688cb89cb681e564d26ce30cb9f829efbd7643e747b6c3ecec2546ffe168f5666de91d8237c393061a357c52f35f9c7240bde66f01420d2400601c645cab9
7
+ data.tar.gz: a209e6862ceaa6834134420181632e01ff15193220bc3c8618f1196f5523e03d2fad334494583ac9d39fd3e966f1382064b87e216a2773871766e5ae80b4634e
@@ -35,9 +35,8 @@ DOCKER_PLATFORMS = [
35
35
  # This table uses the latest version in each collection for accurate
36
36
  # comparison when evaluating puppet requirements from the metadata
37
37
  COLLECTION_TABLE = {
38
- '5.5.22' => 'puppet5',
39
- '6.19.1' => 'puppet6-nightly',
40
- '7.0.0' => 'puppet7-nightly',
38
+ '6.21.0' => 'puppet6-nightly',
39
+ '7.4.0' => 'puppet7-nightly',
41
40
  }.freeze
42
41
 
43
42
  matrix = {
@@ -0,0 +1,124 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ # this script creates a build matrix for github actions from the claimed supported platforms and puppet versions in metadata.json
5
+
6
+ require 'json'
7
+
8
+ IMAGE_TABLE = {
9
+ 'RedHat-7' => 'rhel-7',
10
+ 'RedHat-8' => 'rhel-8',
11
+ 'SLES-12' => 'sles-12',
12
+ 'SLES-15' => 'sles-15',
13
+ 'Windows-2012 R2' => 'windows-2012-r2-core',
14
+ 'Windows-2016' => 'windows-2016',
15
+ 'Windows-2019' => 'windows-2019-core',
16
+ }.freeze
17
+
18
+ DOCKER_PLATFORMS = {
19
+ 'CentOS-6' => 'litmusimage/centos:6',
20
+ 'CentOS-7' => 'litmusimage/centos:7',
21
+ 'CentOS-8' => 'litmusimage/centos:8',
22
+ 'Debian-10' => 'litmusimage/debian:10',
23
+ # 'Debian-8' => 'litmusimage/debian:8', Removing from testing: https://puppet.com/docs/pe/2021.0/supported_operating_systems.html
24
+ 'Debian-9' => 'litmusimage/debian:9',
25
+ 'OracleLinux-6' => 'litmusimage/oraclelinux:6',
26
+ 'OracleLinux-7' => 'litmusimage/oraclelinux:7',
27
+ 'Scientific-6' => 'litmusimage/scientificlinux:6',
28
+ 'Scientific-7' => 'litmusimage/scientificlinux:7',
29
+ # 'Ubuntu-14.04' => 'litmusimage/ubuntu:14.04', Removing from testing: https://puppet.com/docs/pe/2021.0/supported_operating_systems.html
30
+ 'Ubuntu-16.04' => 'litmusimage/ubuntu:16.04',
31
+ 'Ubuntu-18.04' => 'litmusimage/ubuntu:18.04',
32
+ 'Ubuntu-20.04' => 'litmusimage/ubuntu:20.04',
33
+ }.freeze
34
+
35
+ # This table uses the latest version in each collection for accurate
36
+ # comparison when evaluating puppet requirements from the metadata
37
+ COLLECTION_TABLE = [
38
+ {
39
+ puppet_maj_version: 6,
40
+ ruby_version: 2.5,
41
+ },
42
+ {
43
+ puppet_maj_version: 7,
44
+ ruby_version: 2.7,
45
+ },
46
+ ].freeze
47
+
48
+ matrix = {
49
+ platforms: [],
50
+ collection: [],
51
+ }
52
+
53
+ spec_matrix = {
54
+ include: [],
55
+ }
56
+
57
+ metadata = JSON.parse(File.read('metadata.json'))
58
+ # Set platforms based on declared operating system support
59
+ metadata['operatingsystem_support'].sort_by { |a| a['operatingsystem'] }.each do |sup|
60
+ os = sup['operatingsystem']
61
+ sup['operatingsystemrelease'].sort_by { |a| a.to_i }.each do |ver|
62
+ image_key = "#{os}-#{ver}"
63
+ if IMAGE_TABLE.key? image_key
64
+ matrix[:platforms] << {
65
+ label: image_key,
66
+ provider: 'provision::provision_service',
67
+ image: IMAGE_TABLE[image_key],
68
+ }
69
+ elsif DOCKER_PLATFORMS.key? image_key
70
+ matrix[:platforms] << {
71
+ label: image_key,
72
+ provider: 'provision::docker',
73
+ image: DOCKER_PLATFORMS[image_key],
74
+ }
75
+ else
76
+ puts "::warning::Cannot find image for #{image_key}"
77
+ end
78
+ end
79
+ end
80
+
81
+ # Set collections based on puppet version requirements
82
+ if metadata.key?('requirements') && metadata['requirements'].length.positive?
83
+ metadata['requirements'].each do |req|
84
+ next unless req.key?('name') && req.key?('version_requirement') && req['name'] == 'puppet'
85
+
86
+ ver_regexp = %r{^([>=<]{1,2})\s*([\d.]+)\s+([>=<]{1,2})\s*([\d.]+)$}
87
+ match = ver_regexp.match(req['version_requirement'])
88
+ if match.nil?
89
+ puts "::warning::Didn't recognize version_requirement '#{req['version_requirement']}'"
90
+ break
91
+ end
92
+
93
+ cmp_one, ver_one, cmp_two, ver_two = match.captures
94
+ reqs = ["#{cmp_one} #{ver_one}", "#{cmp_two} #{ver_two}"]
95
+
96
+ COLLECTION_TABLE.each do |collection|
97
+ # Test against the "largest" puppet version in a collection, e.g. `7.9999` to allow puppet requirements with a non-zero lower bound on minor/patch versions.
98
+ # 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.
99
+ next unless Gem::Requirement.create(reqs).satisfied_by?(Gem::Version.new("#{collection[:puppet_maj_version]}.9999"))
100
+
101
+ matrix[:collection] << "puppet#{collection[:puppet_maj_version]}-nightly"
102
+ spec_matrix[:include] << { puppet_version: "~> #{collection[:puppet_maj_version]}.0", ruby_version: collection[:ruby_version] }
103
+ end
104
+ end
105
+ end
106
+
107
+ # Set to defaults (all collections) if no matches are found
108
+ if matrix[:collection].empty?
109
+ matrix[:collection] = COLLECTION_TABLE.map { |collection| "puppet#{collection[:puppet_maj_version]}-nightly" }
110
+ end
111
+
112
+ # Just to make sure there aren't any duplicates
113
+ matrix[:platforms] = matrix[:platforms].uniq.sort { |a, b| a[:label] <=> b[:label] }
114
+ matrix[:collection] = matrix[:collection].uniq.sort
115
+
116
+ puts "::set-output name=matrix::#{JSON.generate(matrix)}"
117
+ puts "::set-output name=spec_matrix::#{JSON.generate(spec_matrix)}"
118
+
119
+ acceptance_test_cell_count = matrix[:platforms].length * matrix[:collection].length
120
+ spec_test_cell_count = spec_matrix[:include].length
121
+
122
+ puts "Created matrix with #{acceptance_test_cell_count + spec_test_cell_count} cells:"
123
+ puts " - Acceptance Test Cells: #{acceptance_test_cell_count}"
124
+ puts " - Spec Test Cells: #{spec_test_cell_count}"
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # helper functions for running puppet commands. They execute a target system specified by ENV['TARGET_HOST']
4
- # heavily uses functions from here https://github.com/puppetlabs/bolt/blob/master/developer-docs/bolt_spec-run.md
4
+ # heavily uses functions from here https://github.com/puppetlabs/bolt/blob/main/developer-docs/bolt_spec-run.md
5
5
  module PuppetLitmus::PuppetHelpers
6
6
  # Applies a manifest twice. First checking for errors. Secondly to make sure no changes occur.
7
7
  #
@@ -11,7 +11,7 @@ module PuppetLitmus::PuppetHelpers
11
11
  Honeycomb.start_span(name: 'litmus.idempotent_apply') do |span|
12
12
  ENV['HONEYCOMB_TRACE'] = span.to_trace_header
13
13
  manifest_file_location = create_manifest_file(manifest)
14
- apply_manifest(nil, expect_failures: false, manifest_file_location: manifest_file_location)
14
+ apply_manifest(nil, catch_failures: true, manifest_file_location: manifest_file_location)
15
15
  apply_manifest(nil, catch_changes: true, manifest_file_location: manifest_file_location)
16
16
  end
17
17
  end
@@ -75,7 +75,13 @@ module PuppetLitmus::PuppetHelpers
75
75
  span.add_field('litmus.node_name', target_node_name)
76
76
  add_platform_field(inventory_hash, target_node_name)
77
77
 
78
- command_to_run = "#{opts[:prefix_command]} puppet apply #{manifest_file_location}"
78
+ # Forcibly set the locale of the command
79
+ locale = if os[:family] != 'windows'
80
+ 'LC_ALL=en_US.UTF-8 '
81
+ else
82
+ ''
83
+ end
84
+ command_to_run = "#{locale}#{opts[:prefix_command]} puppet apply #{manifest_file_location}"
79
85
  command_to_run += ' --trace' if !opts[:trace].nil? && (opts[:trace] == true)
80
86
  command_to_run += " --modulepath #{Dir.pwd}/spec/fixtures/modules" if target_node_name == 'litmus_localhost'
81
87
  command_to_run += " --hiera_config='#{opts[:hiera_config]}'" unless opts[:hiera_config].nil?
@@ -2,5 +2,5 @@
2
2
 
3
3
  # version of this gem
4
4
  module PuppetLitmus
5
- VERSION ||= '0.23.0'
5
+ VERSION ||= '0.26.0'
6
6
  end
@@ -16,7 +16,7 @@ describe 'litmus rake tasks' do
16
16
  'operatingsystem_support' =>
17
17
  [{ 'operatingsystem' => 'RedHat', 'operatingsystemrelease' => ['5'] },
18
18
  { 'operatingsystem' => 'Ubuntu', 'operatingsystemrelease' => ['14.04', '18.04'] }],
19
- 'template-ref' => 'heads/master-0-g7827fc2' }
19
+ 'template-ref' => 'heads/main-0-g7827fc2' }
20
20
  expect(File).to receive(:read).with(any_args).once
21
21
  expect(JSON).to receive(:parse).with(any_args).and_return(metadata)
22
22
  expect($stdout).to receive(:puts).with('redhat-5-x86_64')
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.23.0
4
+ version: 0.26.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet, Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-02-01 00:00:00.000000000 Z
11
+ date: 2021-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bolt
@@ -166,12 +166,14 @@ email:
166
166
  - info@puppet.com
167
167
  executables:
168
168
  - matrix_from_metadata
169
+ - matrix_from_metadata_v2
169
170
  extensions: []
170
171
  extra_rdoc_files: []
171
172
  files:
172
173
  - LICENSE
173
174
  - README.md
174
175
  - exe/matrix_from_metadata
176
+ - exe/matrix_from_metadata_v2
175
177
  - lib/puppet_litmus.rb
176
178
  - lib/puppet_litmus/inventory_manipulation.rb
177
179
  - lib/puppet_litmus/puppet_helpers.rb
@@ -194,7 +196,7 @@ homepage: https://github.com/puppetlabs/puppet_litmus
194
196
  licenses:
195
197
  - Apache-2.0
196
198
  metadata: {}
197
- post_install_message:
199
+ post_install_message:
198
200
  rdoc_options: []
199
201
  require_paths:
200
202
  - lib
@@ -209,8 +211,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
209
211
  - !ruby/object:Gem::Version
210
212
  version: '0'
211
213
  requirements: []
212
- rubygems_version: 3.0.6
213
- signing_key:
214
+ rubygems_version: 3.0.3
215
+ signing_key:
214
216
  specification_version: 4
215
217
  summary: Providing a simple command line tool for puppet content creators, to enable
216
218
  simple and complex test deployments.