puppet_litmus 0.24.0 → 0.25.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c30427123e4564bc48f1ab51d5ba1a309d51a92cfaa960ca879cf0bc9646b811
|
4
|
+
data.tar.gz: 0c84f4661ece76aa2c69e375c7c82b0a2c8eef4d9b644edd6e50c516e3eb2b5b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b188680048a9f7c9aa78f579555cf2ce892b74a9dbf03d7463a6f12f097b17db4dcde1fb0173c1037e1817a9cc423cf948c2888c18cf141499dd57adcc9607bf
|
7
|
+
data.tar.gz: bd2df6cd288d01181384eb9ecd943b3f508d8c5262062acb4cbe88c1b694c578e435769fc067cbaea0032c3e224f9b8193485cab34f3aaa75e91d8dfed9d31ea
|
@@ -0,0 +1,105 @@
|
|
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',
|
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',
|
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
|
+
'6.24.0' => 'puppet6-nightly',
|
39
|
+
'7.4.0' => 'puppet7-nightly',
|
40
|
+
}.freeze
|
41
|
+
|
42
|
+
matrix = {
|
43
|
+
platforms: [],
|
44
|
+
collection: [],
|
45
|
+
}
|
46
|
+
|
47
|
+
metadata = JSON.parse(File.read('metadata.json'))
|
48
|
+
# Set platforms based on declared operating system support
|
49
|
+
metadata['operatingsystem_support'].sort_by { |a| a['operatingsystem'] }.each do |sup|
|
50
|
+
os = sup['operatingsystem']
|
51
|
+
sup['operatingsystemrelease'].sort_by { |a| a.to_i }.each do |ver|
|
52
|
+
image_key = "#{os}-#{ver}"
|
53
|
+
if IMAGE_TABLE.key? image_key
|
54
|
+
matrix[:platforms] << {
|
55
|
+
label: image_key,
|
56
|
+
provider: 'provision::provision_service',
|
57
|
+
image: IMAGE_TABLE[image_key],
|
58
|
+
}
|
59
|
+
elsif DOCKER_PLATFORMS.key? image_key
|
60
|
+
matrix[:platforms] << {
|
61
|
+
label: image_key,
|
62
|
+
provider: 'provision::docker',
|
63
|
+
image: DOCKER_PLATFORMS[image_key],
|
64
|
+
}
|
65
|
+
else
|
66
|
+
puts "::warning::Cannot find image for #{image_key}"
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
# Set collections based on puppet version requirements
|
72
|
+
if metadata.key?('requirements') && metadata['requirements'].length.positive?
|
73
|
+
metadata['requirements'].each do |req|
|
74
|
+
next unless req.key?('name') && req.key?('version_requirement') && req['name'] == 'puppet'
|
75
|
+
|
76
|
+
ver_regexp = %r{^([>=<]{1,2})\s*([\d.]+)\s+([>=<]{1,2})\s*([\d.]+)$}
|
77
|
+
match = ver_regexp.match(req['version_requirement'])
|
78
|
+
if match.nil?
|
79
|
+
puts "::warning::Didn't recognize version_requirement '#{req['version_requirement']}'"
|
80
|
+
break
|
81
|
+
end
|
82
|
+
|
83
|
+
cmp_one, ver_one, cmp_two, ver_two = match.captures
|
84
|
+
reqs = ["#{cmp_one} #{ver_one}", "#{cmp_two} #{ver_two}"]
|
85
|
+
|
86
|
+
COLLECTION_TABLE.each do |key, val|
|
87
|
+
if Gem::Requirement.create(reqs).satisfied_by?(Gem::Version.new(key))
|
88
|
+
matrix[:collection] << val
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
# Set to defaults (all collections) if no matches are found
|
95
|
+
if matrix[:collection].empty?
|
96
|
+
matrix[:collection] = COLLECTION_TABLE.values
|
97
|
+
end
|
98
|
+
|
99
|
+
# Just to make sure there aren't any duplicates
|
100
|
+
matrix[:platforms] = matrix[:platforms].uniq.sort { |a, b| a[:label] <=> b[:label] }
|
101
|
+
matrix[:collection] = matrix[:collection].uniq.sort
|
102
|
+
|
103
|
+
puts "::set-output name=matrix::#{JSON.generate(matrix)}"
|
104
|
+
|
105
|
+
puts "Created matrix with #{matrix[:platforms].length * matrix[:collection].length} cells."
|
@@ -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/
|
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
|
#
|
@@ -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/
|
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.
|
4
|
+
version: 0.25.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: 2021-02-
|
11
|
+
date: 2021-02-25 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
|