simp-beaker-helpers 2.0.4 → 2.0.5

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: 3916923de88666ed3a88a41f3053dca5791fb456d6386121c6a85c40641113e6
4
- data.tar.gz: f1ebb8c0b1c9faf276537948cf31432305715921476132e4c39fff0411a36c79
3
+ metadata.gz: '01691b723cf1d20c20093a46cc90eaba1f0d3bd947e517388d963c86c086a406'
4
+ data.tar.gz: 5cdc26846cbefaf342a15200542dd801c00947677b9e553ec741bc0bd62ae71b
5
5
  SHA512:
6
- metadata.gz: d639af43846bb7c711d42348f035e096c54afcc1b7a8e6db537412dbee093d5d2618e2f329a8fd95865d5514d59d2ecc0d33842334d1d1978e1f984e65b92497
7
- data.tar.gz: 3b77cd3c5403c706a4198e8cc95465e504aac01640e5e614a6bf3aa1b8390a5e0a9e8a170852c9448f7738cf38ecdbb1299e84b02a770b3ac215946493809d36
6
+ metadata.gz: fcfbe6df23fe2fcb941349958cdd4d1645ffc61592c417ad52ce28975de51b44f795e6be786e297b9a8e6ca8a23aaf01898a0ef181f075dea6219ff5a595aa8d
7
+ data.tar.gz: 1efc45ea2fb279ffa9795c4f31510be99ae565dcb36bdc5366bf8056d11a9d0bf8d6fd5dcbca1d18fc1d38c3a4912c965290ff88489f12bb1a55476fea08e4f0
@@ -15,7 +15,7 @@ jobs:
15
15
  name: Add issue to project
16
16
  runs-on: ubuntu-latest
17
17
  steps:
18
- - uses: actions/add-to-project@v1.0.2
18
+ - uses: actions/add-to-project@v2
19
19
  with:
20
20
  project-url: https://github.com/orgs/simp/projects/11
21
21
  github-token: ${{ secrets.AUTO_TRIAGE_TOKEN }}
@@ -51,7 +51,7 @@ jobs:
51
51
  PUPPET_VERSION: ${{matrix.puppet.puppet_version}}
52
52
  steps:
53
53
  - name: checkout repo
54
- uses: actions/checkout@v5
54
+ uses: actions/checkout@v6
55
55
  - name: setup ruby
56
56
  uses: ruby/setup-ruby@v1
57
57
  with:
@@ -32,11 +32,11 @@ jobs:
32
32
  runs-on: ubuntu-latest
33
33
  continue-on-error: true
34
34
  steps:
35
- - uses: actions/checkout@v5
35
+ - uses: actions/checkout@v6
36
36
  - name: "Install Ruby 3.2"
37
37
  uses: ruby/setup-ruby@v1
38
38
  with:
39
- ruby-version: 3.2
39
+ ruby-version: 4.0.5
40
40
  bundler-cache: true
41
41
  - run: |
42
42
  bundle show
@@ -59,7 +59,7 @@ jobs:
59
59
  env:
60
60
  PUPPET_VERSION: ${{matrix.puppet.puppet_version}}
61
61
  steps:
62
- - uses: actions/checkout@v5
62
+ - uses: actions/checkout@v6
63
63
  - name: 'Install Ruby ${{matrix.puppet.ruby_version}}'
64
64
  uses: ruby/setup-ruby@v1
65
65
  with:
@@ -63,7 +63,7 @@ jobs:
63
63
  steps:
64
64
  - name: "Assert '${{ github.ref }}' is a tag"
65
65
  run: '[[ "$GITHUB_REF" =~ ^refs/tags/ ]] || { echo "::error ::GITHUB_REF is not a tag: ${GITHUB_REF}"; exit 1 ; }'
66
- - uses: actions/checkout@v5
66
+ - uses: actions/checkout@v6
67
67
  with:
68
68
  ref: ${{ github.ref }}
69
69
  clean: true
@@ -92,7 +92,7 @@ jobs:
92
92
  echo "release_command=$GEM_RELEASE_COMMAND" | tee -a "$GITHUB_OUTPUT"
93
93
  - uses: ruby/setup-ruby@v1
94
94
  with:
95
- ruby-version: 2.7
95
+ ruby-version: 4.0.5
96
96
  bundler-cache: true
97
97
  - name: Test build the package
98
98
  run: "${{ steps.commands.outputs.build_command }}"
@@ -116,7 +116,7 @@ jobs:
116
116
  tag: ${{ steps.tag-check.outputs.tag }}
117
117
  steps:
118
118
  - name: Checkout code
119
- uses: actions/checkout@v5
119
+ uses: actions/checkout@v6
120
120
  with:
121
121
  ref: ${{ github.ref }}
122
122
  clean: true
@@ -178,13 +178,13 @@ jobs:
178
178
  PKG_DIR: ${{ needs.releng-checks.outputs.pkg_dir }}
179
179
  steps:
180
180
  - name: Checkout code
181
- uses: actions/checkout@v5
181
+ uses: actions/checkout@v6
182
182
  with:
183
183
  ref: ${{ github.ref }}
184
184
  clean: true
185
185
  - uses: ruby/setup-ruby@v1
186
186
  with:
187
- ruby-version: 2.7
187
+ ruby-version: 4.0.5
188
188
  bundler-cache: true
189
189
  - name: Build RubyGem
190
190
  run: |
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ### 2.0.5 / 2026-06-06
2
+ * Fixed:
3
+ * Additional cleanup for rubocop
4
+
1
5
  ### 2.0.4 / 2025-10-16
2
6
  * Fixed:
3
7
  * `install_puppet` failure on Windows (#266)
data/Gemfile CHANGED
@@ -40,6 +40,7 @@ group :system_tests do
40
40
  gem 'beaker-windows'
41
41
  gem 'ed25519'
42
42
  gem 'net-ssh'
43
+ # renovate: datasource=rubygems versioning=ruby
43
44
  gem 'openvox', ENV.fetch('OPENVOX_VERSION', ENV.fetch('PUPPET_VERSION', ['>= 7.0.0', '< 9.0.0']))
44
45
  gem 'pry-byebug', '~> 3.10.0'
45
46
  gem 'puppetlabs_spec_helper', '>= 4.0.0', '< 9.0.0'
@@ -47,8 +48,8 @@ group :system_tests do
47
48
  end
48
49
 
49
50
  group :tests do
50
- gem 'rubocop', '~> 1.81.0'
51
+ gem 'rubocop', '~> 1.87.0'
51
52
  gem 'rubocop-performance', '~> 1.26.0'
52
53
  gem 'rubocop-rake', '~> 0.7.0'
53
- gem 'rubocop-rspec', '~> 3.7.0'
54
+ gem 'rubocop-rspec', '~> 3.8.0'
54
55
  end
@@ -2,7 +2,7 @@
2
2
  module Simp; end
3
3
 
4
4
  # SIMP Beaker helper methods for testing
5
- module Simp::BeakerHelpers
5
+ module Simp::BeakerHelpers # rubocop:disable Style/OneClassPerFile
6
6
  # This is the *oldest* puppet-agent version that the latest release of SIMP supports
7
7
  #
8
8
  # This is done so that we know if some new thing that we're using breaks the
@@ -3,6 +3,6 @@
3
3
  # SIMP namespace
4
4
  module Simp; end
5
5
 
6
- module Simp::BeakerHelpers
7
- VERSION = '2.0.4'
6
+ module Simp::BeakerHelpers # rubocop:disable Style/OneClassPerFile
7
+ VERSION = '2.0.5'
8
8
  end
@@ -1,10 +1,10 @@
1
1
  # SIMP namespace
2
2
  module Simp; end
3
3
  # SIMP Beaker helper methods for testing
4
- module Simp::BeakerHelpers; end
4
+ module Simp::BeakerHelpers; end # rubocop:disable Style/OneClassPerFile
5
5
 
6
6
  # Windows-specific helper methods
7
- module Simp::BeakerHelpers::Windows
7
+ module Simp::BeakerHelpers::Windows # rubocop:disable Style/OneClassPerFile
8
8
  begin
9
9
  require 'beaker-windows'
10
10
  rescue LoadError
@@ -7,7 +7,7 @@ require 'bundler'
7
7
  module Simp; end
8
8
 
9
9
  # SIMP Beaker helper methods for testing
10
- module Simp::BeakerHelpers
10
+ module Simp::BeakerHelpers # rubocop:disable Style/OneClassPerFile
11
11
  include BeakerPuppetHelpers
12
12
  include BeakerPuppetHelpers::DSL
13
13
 
@@ -1235,13 +1235,13 @@ module Simp::BeakerHelpers
1235
1235
  data_dir = Dir.mktmpdir('hieradata')
1236
1236
  @temp_hieradata_dirs << data_dir
1237
1237
 
1238
- fh = File.open(File.join(data_dir, 'common.yaml'), 'w')
1239
- if hieradata.is_a?(String)
1240
- fh.puts(hieradata)
1241
- else
1242
- fh.puts(hieradata.to_yaml)
1238
+ File.open(File.join(data_dir, 'common.yaml'), 'w') do |fh|
1239
+ if hieradata.is_a?(String)
1240
+ fh.puts(hieradata)
1241
+ else
1242
+ fh.puts(hieradata.to_yaml)
1243
+ end
1243
1244
  end
1244
- fh.close
1245
1245
 
1246
1246
  copy_hiera_data_to sut, File.join(data_dir, 'common.yaml')
1247
1247
  end
@@ -9,10 +9,10 @@ require 'puppetlabs_spec_helper/tasks/fixtures'
9
9
  # Simp namespace
10
10
  module Simp; end
11
11
  # Simp::Rake namespace
12
- module Simp::Rake; end
12
+ module Simp::Rake; end # rubocop:disable Style/OneClassPerFile
13
13
 
14
14
  # Rake tasks for SIMP Beaker testing
15
- class Simp::Rake::Beaker < ::Rake::TaskLib
15
+ class Simp::Rake::Beaker < ::Rake::TaskLib # rubocop:disable Style/OneClassPerFile
16
16
  def initialize(base_dir) # rubocop:disable Lint/MissingSuper
17
17
  @base_dir = base_dir
18
18
  @clean_list = []
data/renovate.json CHANGED
@@ -1,6 +1,8 @@
1
1
  {
2
2
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3
3
  "extends": [
4
- "config:recommended"
4
+ "config:recommended",
5
+ "github>simp/renovate-config",
6
+ "github>simp/renovate-config:ruby.json"
5
7
  ]
6
8
  }
@@ -1,19 +1,25 @@
1
1
  require 'spec_helper_acceptance'
2
2
 
3
- unless ENV['PUPPET_VERSION'] || ENV['BEAKER_PUPPET_COLLECTION']
4
- raise('You must set either PUPPET_VERSION or BEAKER_PUPPET_COLLECTION as an environment variable')
5
- end
3
+ def target_version
4
+ return @target_version if @target_version
5
+
6
+ unless ENV['PUPPET_VERSION'] || ENV['BEAKER_PUPPET_COLLECTION']
7
+ raise('You must set either PUPPET_VERSION or BEAKER_PUPPET_COLLECTION as an environment variable')
8
+ end
9
+
10
+ if ENV['BEAKER_PUPPET_COLLECTION']
11
+ @target_version = ENV['BEAKER_PUPPET_COLLECTION'][%r{(\d+)$}, 1]
12
+ elsif ENV['PUPPET_VERSION']
13
+ @target_version = ENV['PUPPET_VERSION'].split('.').first
14
+ end
6
15
 
7
- if ENV['BEAKER_PUPPET_COLLECTION']
8
- target_version = ENV['BEAKER_PUPPET_COLLECTION'][%r{(\d+)$}, 1]
9
- elsif ENV['PUPPET_VERSION']
10
- target_version = ENV['PUPPET_VERSION'].split('.').first
16
+ @target_version
11
17
  end
12
18
 
13
19
  hosts.each do |host|
14
20
  describe 'make sure puppet version is valid' do
15
21
  context "on #{host}" do
16
- client_puppet_version = on(host, 'puppet --version').output.lines.last.strip
22
+ let(:client_puppet_version) { on(host, 'puppet --version').output.lines.last.strip }
17
23
 
18
24
  it "is running puppet version #{target_version}" do
19
25
  expect(Gem::Version.new(client_puppet_version)).to be >= Gem::Version.new(target_version)
@@ -32,7 +32,7 @@ context 'after copy_fixture_modules_to( hosts )' do
32
32
  end
33
33
 
34
34
  describe "pfact_on(default,'fips_enabled')" do
35
- expected = (ENV['BEAKER_fips'] == 'yes')
35
+ let(:expected) { ENV['BEAKER_fips'] == 'yes' }
36
36
 
37
37
  it 'returns false' do
38
38
  expect(pfact_on(default, 'fips_enabled')).to eq expected
@@ -1,11 +1,14 @@
1
1
  require 'spec_helper_acceptance'
2
2
 
3
- hosts.each do |host|
4
- expect_failures = false
5
- if hosts_with_role(hosts, 'el9').include?(host)
6
- expect_failures = true
7
- end
3
+ def expect_failures?(host)
4
+ os = fact_on(host, 'os')
5
+
6
+ return true if os['family'] == 'RedHat' && os['release']['major'].to_i >= 9
8
7
 
8
+ false
9
+ end
10
+
11
+ hosts.each do |host|
9
12
  describe '#install_simp_repos' do
10
13
  it 'installs yum utils' do
11
14
  host.install_package('yum-utils')
@@ -15,12 +18,12 @@ hosts.each do |host|
15
18
  before(:all) do
16
19
  install_simp_repos(host)
17
20
  rescue => e
18
- raise e unless expect_failures
21
+ raise e unless expect_failures?(host)
19
22
  warn e.message
20
23
  end
21
24
 
22
25
  it 'enables the correct repos' do
23
- skip "#{host} is not supported yet" if expect_failures
26
+ skip "#{host} is not supported yet" if expect_failures?(host)
24
27
  on(host, 'yum -y list simp')
25
28
  on(host, 'yum -y list postgresql96')
26
29
  end
@@ -33,7 +36,7 @@ hosts.each do |host|
33
36
  end
34
37
 
35
38
  it 'lists the simp rpm' do
36
- skip "#{host} is not supported yet" if expect_failures
39
+ skip "#{host} is not supported yet" if expect_failures?(host)
37
40
  on(host, 'yum list simp')
38
41
  end
39
42
  end
@@ -42,12 +45,12 @@ hosts.each do |host|
42
45
  before(:all) do
43
46
  install_simp_repos(host, ['simp-community-simp'])
44
47
  rescue => e
45
- raise e unless expect_failures
48
+ raise e unless expect_failures?(host)
46
49
  warn e.message
47
50
  end
48
51
 
49
52
  it 'enables the correct repos' do
50
- skip "#{host} is not supported yet" if expect_failures
53
+ skip "#{host} is not supported yet" if expect_failures?(host)
51
54
  on(host, 'yum -y list postgresql96')
52
55
  end
53
56
 
@@ -24,8 +24,13 @@ context 'PKI operations' do
24
24
  end
25
25
 
26
26
  describe 'a Fake CA under /root' do
27
- tmp_keydist_dir = Dir.mktmpdir 'simp-beaker-helpers__pki-tests'
28
- run_fake_pki_ca_on(default, hosts, tmp_keydist_dir)
27
+ def tmp_keydist_dir
28
+ @tmp_keydist_dir ||= Dir.mktmpdir 'simp-beaker-helpers__pki-tests'
29
+ end
30
+
31
+ before(:all) do
32
+ run_fake_pki_ca_on(default, hosts, tmp_keydist_dir)
33
+ end
29
34
 
30
35
  it 'creates /root/pki' do
31
36
  on(default, 'test -d /root/pki')
@@ -35,15 +40,19 @@ context 'PKI operations' do
35
40
  end
36
41
 
37
42
  describe 'after copy_keydist_to' do
38
- test_dir = '/etc/puppetlabs/code/environments/production/modules/pki/files/keydist'
39
- copy_keydist_to(default)
40
- it_behaves_like 'a correctly copied keydist/ tree', test_dir
43
+ before(:all) do
44
+ copy_keydist_to(default)
45
+ end
46
+
47
+ it_behaves_like 'a correctly copied keydist/ tree', '/etc/puppetlabs/code/environments/production/modules/pki/files/keydist'
41
48
  end
42
49
 
43
- describe 'after copy_keydist_to(default,"/tmp/foo")' do
44
- test_dir = '/tmp/foo'
45
- copy_keydist_to(default, test_dir)
46
- it_behaves_like 'a correctly copied keydist/ tree', test_dir
50
+ describe 'after copy_keydist_to(default, "/tmp/foo")' do
51
+ before(:all) do
52
+ copy_keydist_to(default, '/tmp/foo')
53
+ end
54
+
55
+ it_behaves_like 'a correctly copied keydist/ tree', '/tmp/foo'
47
56
  end
48
57
  end
49
58
  end
@@ -10,7 +10,11 @@ end
10
10
  require 'yaml'
11
11
  require 'tempfile'
12
12
 
13
- alt_fixtures = File.absolute_path('.fips_fixtures.yml')
13
+ def alt_fixtures
14
+ return @alt_fixtures if @alt_fixtures
15
+
16
+ @alt_fixtures = File.absolute_path('.fips_fixtures.yml')
17
+ end
14
18
 
15
19
  new_fixtures = {
16
20
  'fixtures' => {
@@ -1,19 +1,21 @@
1
1
  require 'spec_helper_acceptance'
2
2
 
3
- unless ENV['PUPPET_VERSION'] || ENV['BEAKER_PUPPET_COLLECTION']
4
- raise('You must set either PUPPET_VERSION or BEAKER_PUPPET_COLLECTION as an environment variable')
5
- end
3
+ def target_version
4
+ unless ENV['PUPPET_VERSION'] || ENV['BEAKER_PUPPET_COLLECTION']
5
+ raise('You must set either PUPPET_VERSION or BEAKER_PUPPET_COLLECTION as an environment variable')
6
+ end
6
7
 
7
- if ENV['BEAKER_PUPPET_COLLECTION']
8
- target_version = ENV['BEAKER_PUPPET_COLLECTION'][%r{(\d+)$}, 1]
9
- elsif ENV['PUPPET_VERSION']
10
- target_version = ENV['PUPPET_VERSION'].split('.').first
8
+ if ENV['BEAKER_PUPPET_COLLECTION']
9
+ ENV['BEAKER_PUPPET_COLLECTION'][%r{(\d+)$}, 1]
10
+ elsif ENV['PUPPET_VERSION']
11
+ ENV['PUPPET_VERSION'].split('.').first
12
+ end
11
13
  end
12
14
 
13
15
  hosts.each do |host|
14
16
  describe 'make sure puppet version is valid' do
15
17
  context "on #{host}" do
16
- client_puppet_version = on(host, 'puppet --version').output.lines.last.strip
18
+ let(:client_puppet_version) { on(host, 'puppet --version').output.lines.last.strip }
17
19
 
18
20
  it "is running puppet version #{target_version}" do
19
21
  expect(Gem::Version.new(client_puppet_version)).to be >= Gem::Version.new(target_version)
@@ -1 +1 @@
1
- spec/fixtures/inspec_profiles/RedHat-7-disa_stig
1
+ RedHat-7-disa_stig
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simp-beaker-helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.4
4
+ version: 2.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Tessmer
8
8
  - Trevor Vaughan
9
- autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2025-10-16 00:00:00.000000000 Z
11
+ date: 2026-06-07 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: beaker
@@ -181,7 +180,6 @@ files:
181
180
  - ".github/workflows/pr_tests.yml"
182
181
  - ".github/workflows/tag_deploy_rubygem.yml"
183
182
  - ".gitignore"
184
- - ".gitlab-ci.yml"
185
183
  - ".rspec"
186
184
  - ".rubocop.yml"
187
185
  - CHANGELOG.md
@@ -251,7 +249,6 @@ licenses:
251
249
  - Apache-2.0
252
250
  metadata:
253
251
  issue_tracker: https://github.com/simp/rubygem-simp-beaker-helpers/issues
254
- post_install_message:
255
252
  rdoc_options: []
256
253
  require_paths:
257
254
  - lib
@@ -266,8 +263,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
266
263
  - !ruby/object:Gem::Version
267
264
  version: '0'
268
265
  requirements: []
269
- rubygems_version: 3.1.6
270
- signing_key:
266
+ rubygems_version: 4.0.10
271
267
  specification_version: 4
272
268
  summary: beaker helper methods for SIMP
273
269
  test_files: []
data/.gitlab-ci.yml DELETED
@@ -1,386 +0,0 @@
1
- # ------------------------------------------------------------------------------
2
- # The testing matrix considers ruby/puppet versions supported by SIMP and PE:
3
- #
4
- # https://puppet.com/docs/pe/2019.8/component_versions_in_recent_pe_releases.html
5
- # https://puppet.com/misc/puppet-enterprise-lifecycle
6
- # ------------------------------------------------------------------------------
7
- # Release Puppet Ruby EOL
8
- # PE 2021.7 7.24 2.7.7 LTS EOS: 2024-08 EOL: 2025-02
9
- # PE 2023.Y 7.24 2.7.7 Biannual updates
10
- ---
11
-
12
- stages:
13
- - 'validation'
14
- - 'acceptance'
15
- - 'compliance'
16
- - 'deployment'
17
-
18
- variables:
19
- # PUPPET_VERSION is a canary variable!
20
- #
21
- # The value `UNDEFINED` will (intentionally) cause `bundler install|update` to
22
- # fail. The intended value for PUPPET_VERSION is provided by the `pup_#` YAML
23
- # anchors. If it is still `UNDEFINED`, all the other setting from the job's
24
- # anchor are also missing.
25
- PUPPET_VERSION: 'UNDEFINED' # <- Matrixed jobs MUST override this (or fail)
26
- BUNDLER_VERSION: '2.2.19'
27
- SIMP_MATRIX_LEVEL: '1'
28
- SIMP_FORCE_RUN_MATRIX: 'no'
29
-
30
- # Force dependencies into a path the gitlab-runner user can write to.
31
- # (This avoids some failures on Runners with misconfigured ruby environments.)
32
- GEM_HOME: .vendor/gem_install
33
- BUNDLE_CACHE_PATH: .vendor/bundle
34
- BUNDLE_PATH: .vendor/bundle
35
- BUNDLE_BIN: .vendor/gem_install/bin
36
- BUNDLE_NO_PRUNE: 'true'
37
-
38
- .snippets:
39
- before_beaker_google:
40
- # Logic for beaker-google environments
41
- - echo -e "\e[0Ksection_start:`date +%s`:before_script05[collapsed=true]\r\e[0KGCP environment checks"
42
- - "if [ \"$BEAKER_HYPERVISOR\" == google ]; then mkdir -p ~/.ssh; chmod 700 ~/.ssh; test -f ~/.ssh/google_compute_engine || ssh-keygen -f ~/.ssh/google_compute_engine < /dev/null; echo 'gem \"beaker-google\"' >> Gemfile.local ; fi"
43
- - echo -e "\e[0Ksection_end:`date +%s`:before_script05\r\e[0K"
44
-
45
- before:
46
- # Print important environment variables that may affect this job
47
- - 'ruby -e "puts %(\n\n), %q(=)*80, %(\nSIMP-relevant Environment Variables:\n\n#{e=ENV.keys.grep(/^PUPPET|^SIMP|^BEAKER|MATRIX|GOOGLE/); pad=((e.map{|x| x.size}.max||0)+1); e.map{|v| %( * #{%(#{v}:).ljust(pad)} #{39.chr + ENV[v] + 39.chr}\n)}.join}\n), %q(=)*80, %(\n\n)" || :'
48
-
49
- - echo -e "\e[0Ksection_start:`date +%s`:before_script10[collapsed=true]\r\e[0KDiagnostic ruby & gem information"
50
- # Diagnostic ruby & gem information
51
- - 'which ruby && ruby --version || :'
52
- - "[[ $- == *i* ]] && echo 'Interactive shell session' || echo 'Non-interactive shell session'"
53
- - "shopt -q login_shell && echo 'Login shell' || echo 'Not a login shell'"
54
- - 'rvm ls || :'
55
- - echo -e "\e[0Ksection_end:`date +%s`:before_script10\r\e[0K"
56
-
57
- # If RVM is available, make SURE it's using the right Ruby:
58
- # * Source rvm (to run in non-login shells)
59
- # * If any $MATRIX_RUBY_VERSION rubies are available, use the latest
60
- # * Otherwise: install & use ${MATRIX_RUBY_VERSION}-head (e.g., latest)
61
- # * ^^ This could be wonky and introduce variations across runners
62
- # * ^^ maybe it should just fail if there is no $MATRIX_RUBY_VERSION installed?
63
- - "command -v rvm && { if declare -p rvm_path &> /dev/null; then source \"${rvm_path}/scripts/rvm\"; else source \"$HOME/.rvm/scripts/rvm\" || source /etc/profile.d/rvm.sh; fi; }"
64
- - "command -v rvm && { LATEST_RVM_RUBY_XY=\"$(rvm ls | grep \"$MATRIX_RUBY_VERSION\" | tail -1 | sed -e 's/^.*\\([0-9]\\+\\.[0-9]\\+\\.[0-9]\\+\\).*$/\\1/g')\"; if [ -z \"$LATEST_RVM_RUBY_XY\" ]; then LATEST_RVM_RUBY_XY=\"${MATRIX_RUBY_VERSION}-head\"; rvm install \"$LATEST_RVM_RUBY\" --no-docs; else echo \"Found RVM Ruby: '${LATEST_RVM_RUBY_XY}'\"; fi; rvm use \"$LATEST_RVM_RUBY_XY\" ; }"
65
- - 'ruby --version || :'
66
- - 'gem list sync || :'
67
- - echo -e "\e[0Ksection_end:`date +%s`:before_script20\r\e[0K"
68
-
69
- # Bundle gems (preferring cached > local > downloaded resources)
70
- # * Try to use cached and local resources before downloading dependencies
71
- - echo -e "\e[0Ksection_start:`date +%s`:before_script30[collapsed=true]\r\e[0KBundle gems (preferring cached > local > downloaded resources)"
72
- - 'declare GEM_BUNDLER_VER=(-v "~> ${BUNDLER_VERSION:-2.2.6}")'
73
- - 'declare GEM_INSTALL_CMD=(gem install --no-document)'
74
- - 'declare BUNDLER_INSTALL_CMD=(bundle install --no-binstubs --jobs $(nproc) "${FLAGS[@]}")'
75
- - 'mkdir -p ${GEM_HOME} ${BUNDLER_BIN}'
76
- - 'gem list -ie "${GEM_BUNDLER_VER[@]}" --silent bundler || "${GEM_INSTALL_CMD[@]}" --local "${GEM_BUNDLER_VER[@]}" bundler || "${GEM_INSTALL_CMD[@]}" "${GEM_BUNDLER_VER[@]}" bundler'
77
- - 'rm -rf pkg/ || :'
78
- - 'bundle check || rm -f Gemfile.lock && ("${BUNDLER_INSTALL_CMD[@]}" --local || "${BUNDLER_INSTALL_CMD[@]}" || bundle pristine || "${BUNDLER_INSTALL_CMD[@]}") || { echo "PIPELINE: Bundler could not install everything (see log output above)" && exit 99 ; }'
79
- - echo -e "\e[0Ksection_end:`date +%s`:before_script30\r\e[0K"
80
-
81
- # Diagnostic bundler, ruby, and gem checks:
82
- - echo -e "\e[0Ksection_start:`date +%s`:before_script40[collapsed=true]\r\e[0KDiagnostic bundler, ruby, and gem checks"
83
- - 'bundle exec rvm ls || :'
84
- - 'bundle exec which ruby || :'
85
- - 'bundle show sync || :'
86
- - 'bundle exec gem list sync || :'
87
- - echo -e "\e[0Ksection_end:`date +%s`:before_script40\r\e[0K"
88
-
89
- # bundler dependencies and caching
90
- #
91
- # - Cache bundler gems between pipelines foreach Ruby version
92
- # - Try to use cached and local resources before downloading dependencies
93
- # --------------------------------------
94
- .setup_bundler_env: &setup_bundler_env
95
- cache:
96
- key: "${CI_PROJECT_NAMESPACE}_ruby-${MATRIX_RUBY_VERSION}_bundler"
97
- paths:
98
- - '.vendor'
99
- before_script:
100
- !reference [.snippets, before]
101
-
102
-
103
- # Assign a matrix level when your test will run. Heavier jobs get higher numbers
104
- # NOTE: To skip all jobs with a SIMP_MATRIX_LEVEL, set SIMP_MATRIX_LEVEL=0
105
- # ------------------------------------------------------------------------------
106
-
107
- .relevant_file_conditions_trigger_spec_tests: &relevant_file_conditions_trigger_spec_tests
108
- changes:
109
- - .gitlab-ci.yml
110
- - .fixtures.yml
111
- - .rspec
112
- - metadata.json
113
- - "spec/spec_helper.rb"
114
- - "spec/{classes,unit,defines,type_aliases,types,hosts,lib}/**/*.rb"
115
- - "{SIMP,data,manifests,files,types,lib}/**/*"
116
- - "templates/**/*.{erb,epp}"
117
- - "Gemfile"
118
- exists:
119
- - "spec/{classes,unit,defines,type_aliases,types,hosts,lib}/**/*_spec.rb"
120
-
121
- .relevant_file_conditions_trigger_acceptance_tests: &relevant_file_conditions_trigger_acceptance_tests
122
- changes:
123
- - .gitlab-ci.yml
124
- - .fixtures.yml
125
- - "spec/spec_helper_acceptance.rb"
126
- - "spec/acceptance/**/*"
127
- - "{SIMP,data,manifests,files,types,lib}/**/*"
128
- - "templates/**/*.{erb,epp}"
129
- - "Gemfile"
130
- exists:
131
- - "spec/acceptance/**/*_spec.rb"
132
-
133
- # For some reason, the rule regexes stopped matching line starts inside
134
- # $CI_COMMIT_MESSAGE with carets /^/, so we're using /\n?/ as a workaround.
135
- .skip_job_when_commit_message_says_to: &skip_job_when_commit_message_says_to
136
- if: '$CI_COMMIT_MESSAGE =~ /\n?CI: (SKIP MATRIX|MATRIX LEVEL 0)/'
137
- when: never
138
-
139
- .force_run_job_when_commit_message_lvl_1_or_above: &force_run_job_when_commit_mssage_lvl_1_or_above
140
- if: '$CI_COMMIT_MESSAGE =~ /\n?CI: MATRIX LEVEL [123]/'
141
- when: on_success
142
-
143
- .force_run_job_when_commit_message_lvl_2_or_above: &force_run_job_when_commit_mssage_lvl_2_or_above
144
- if: '$CI_COMMIT_MESSAGE =~ /\n?CI: MATRIX LEVEL [23]/'
145
- when: on_success
146
-
147
- .force_run_job_when_commit_message_lvl_3_or_above: &force_run_job_when_commit_mssage_lvl_3_or_above
148
- if: '$CI_COMMIT_MESSAGE =~ /\n?CI: MATRIX LEVEL [3]/'
149
- when: on_success
150
-
151
- # check for $CI_PIPELINE_SOURCE needed because this is combined w/when:changes
152
- .run_job_when_level_1_or_above_w_changes: &run_job_when_level_1_or_above_w_changes
153
- if: '$SIMP_MATRIX_LEVEL =~ /^[123]$/ && $CI_COMMIT_BRANCH && $CI_PIPELINE_SOURCE == "push"'
154
- when: on_success
155
-
156
- .run_job_when_level_2_or_above_w_changes: &run_job_when_level_2_or_above_w_changes
157
- if: '$SIMP_MATRIX_LEVEL =~ /^[23]$/ && $CI_COMMIT_BRANCH && $CI_PIPELINE_SOURCE == "push"'
158
- when: on_success
159
-
160
- .run_job_when_level_3_or_above_w_changes: &run_job_when_level_3_or_above_w_changes
161
- if: '$SIMP_MATRIX_LEVEL =~ /^[3]$/ && $CI_COMMIT_BRANCH && $CI_PIPELINE_SOURCE == "push"'
162
- when: on_success
163
-
164
- .force_run_job_when_var_and_lvl_1_or_above: &force_run_job_when_var_and_lvl_1_or_above
165
- if: '$SIMP_FORCE_RUN_MATRIX == "yes" && $SIMP_MATRIX_LEVEL =~ /^[123]$/'
166
- when: on_success
167
-
168
- .force_run_job_when_var_and_lvl_2_or_above: &force_run_job_when_var_and_lvl_2_or_above
169
- if: '$SIMP_FORCE_RUN_MATRIX == "yes" && $SIMP_MATRIX_LEVEL =~ /^[23]$/'
170
- when: on_success
171
-
172
- .force_run_job_when_var_and_lvl_3_or_above: &force_run_job_when_var_and_lvl_3_or_above
173
- if: '$SIMP_FORCE_RUN_MATRIX == "yes" && $SIMP_MATRIX_LEVEL =~ /^[3]$/'
174
- when: on_success
175
-
176
-
177
-
178
- # SIMP_MATRIX_LEVEL=1: Intended to run every commit
179
- .with_SIMP_ACCEPTANCE_MATRIX_LEVEL_1: &with_SIMP_ACCEPTANCE_MATRIX_LEVEL_1
180
- rules:
181
- - <<: *skip_job_when_commit_message_says_to
182
- - <<: *force_run_job_when_var_and_lvl_1_or_above
183
- - <<: *force_run_job_when_commit_mssage_lvl_1_or_above
184
- - <<: *run_job_when_level_1_or_above_w_changes
185
- <<: *relevant_file_conditions_trigger_acceptance_tests
186
- - when: never
187
-
188
- .with_SIMP_SPEC_MATRIX_LEVEL_1: &with_SIMP_SPEC_MATRIX_LEVEL_1
189
- rules:
190
- - <<: *skip_job_when_commit_message_says_to
191
- - <<: *force_run_job_when_commit_mssage_lvl_1_or_above
192
- - <<: *force_run_job_when_var_and_lvl_1_or_above
193
- - <<: *run_job_when_level_1_or_above_w_changes
194
- <<: *relevant_file_conditions_trigger_spec_tests
195
- - when: never
196
-
197
- # SIMP_MATRIX_LEVEL=2: Resource-heavy or redundant jobs
198
- .with_SIMP_ACCEPTANCE_MATRIX_LEVEL_2: &with_SIMP_ACCEPTANCE_MATRIX_LEVEL_2
199
- rules:
200
- - <<: *skip_job_when_commit_message_says_to
201
- - <<: *force_run_job_when_var_and_lvl_2_or_above
202
- - <<: *force_run_job_when_commit_mssage_lvl_2_or_above
203
- - <<: *run_job_when_level_2_or_above_w_changes
204
- <<: *relevant_file_conditions_trigger_acceptance_tests
205
- - when: never
206
-
207
- .with_SIMP_SPEC_MATRIX_LEVEL_2: &with_SIMP_SPEC_MATRIX_LEVEL_2
208
- rules:
209
- - <<: *skip_job_when_commit_message_says_to
210
- - <<: *force_run_job_when_commit_mssage_lvl_2_or_above
211
- - <<: *force_run_job_when_var_and_lvl_2_or_above
212
- - <<: *run_job_when_level_2_or_above_w_changes
213
- <<: *relevant_file_conditions_trigger_spec_tests
214
- - when: never
215
-
216
- # SIMP_MATRIX_LEVEL=3: Reserved for FULL matrix testing
217
- .with_SIMP_ACCEPTANCE_MATRIX_LEVEL_3: &with_SIMP_ACCEPTANCE_MATRIX_LEVEL_3
218
- rules:
219
- - <<: *skip_job_when_commit_message_says_to
220
- - <<: *force_run_job_when_var_and_lvl_3_or_above
221
- - <<: *force_run_job_when_commit_mssage_lvl_3_or_above
222
- - <<: *run_job_when_level_3_or_above_w_changes
223
- <<: *relevant_file_conditions_trigger_acceptance_tests
224
- - when: never
225
-
226
-
227
- # Puppet Versions
228
- #-----------------------------------------------------------------------
229
-
230
- .pup_7_x: &pup_7_x
231
- image: 'ruby:2.7'
232
- variables:
233
- PUPPET_VERSION: '~> 7.0'
234
- BEAKER_PUPPET_COLLECTION: 'puppet7'
235
- MATRIX_RUBY_VERSION: '2.7'
236
-
237
- .pup_8_x: &pup_8_x
238
- image: 'ruby:3.2'
239
- variables:
240
- PUPPET_VERSION: '~> 8.0'
241
- BEAKER_PUPPET_COLLECTION: 'puppet8'
242
- MATRIX_RUBY_VERSION: '3.2'
243
-
244
-
245
- # Testing Environments
246
- #-----------------------------------------------------------------------
247
-
248
- .lint_tests: &lint_tests
249
- stage: 'validation'
250
- tags: ['docker']
251
- <<: *setup_bundler_env
252
- script:
253
- - 'bundle exec rake syntax'
254
- - 'bundle exec rake lint'
255
- - 'bundle exec rake metadata_lint'
256
-
257
- .unit_tests: &unit_tests
258
- stage: 'validation'
259
- tags: ['docker']
260
- <<: *setup_bundler_env
261
- <<: *with_SIMP_SPEC_MATRIX_LEVEL_1
262
- script:
263
- - 'bundle exec rake spec'
264
-
265
- .beaker: &beaker
266
- image: ruby:2.7.8 # must be 2.7.2 if running in GCP
267
- tags:
268
- - beaker
269
- before_script:
270
- - !reference [.snippets, before_beaker_google]
271
- - !reference [.snippets, before]
272
-
273
-
274
-
275
- .acceptance_base: &acceptance_base
276
- stage: 'acceptance'
277
- <<: *setup_bundler_env
278
- <<: *with_SIMP_ACCEPTANCE_MATRIX_LEVEL_1
279
- <<: *beaker
280
-
281
- .compliance_base: &compliance_base
282
- stage: 'compliance'
283
- <<: *setup_bundler_env
284
- <<: *with_SIMP_ACCEPTANCE_MATRIX_LEVEL_1
285
- <<: *beaker
286
-
287
-
288
- # Unit Tests
289
- #-----------------------------------------------------------------------
290
-
291
- pup7.x-unit:
292
- <<: *pup_7_x
293
- <<: *unit_tests
294
-
295
- pup8.x-unit:
296
- <<: *pup_8_x
297
- <<: *unit_tests
298
-
299
- # Repo-specific content
300
- # ==============================================================================
301
-
302
- #=======================================================================
303
- # Packaging test
304
-
305
- pup7.x-pkg:
306
- <<: *pup_7_x
307
- <<: *unit_tests
308
- script:
309
- 'bundle exec rake pkg:gem'
310
-
311
- pup8.x-pkg:
312
- <<: *pup_8_x
313
- <<: *unit_tests
314
- script:
315
- 'bundle exec rake pkg:gem'
316
-
317
- #=======================================================================
318
- # Acceptance tests
319
-
320
- # Verify a suite fails when an explicitly-specified nodeset does not exist.
321
- # It is significantly quicker to test here (where rvm is already installed
322
- # and the bundle is configured with this version of simp-beaker-helpers)
323
- # than in an acceptance test with a build user.
324
- default-bad-nodeset:
325
- <<: *pup_8_x
326
- <<: *acceptance_base
327
- script:
328
- - 'RESULT=`bundle exec rake beaker:suites[default,oops] 1>/dev/null; echo $?`; (test $RESULT == "1")'
329
- - echo 'beaker:suites correctly failed with unknown nodeset'
330
-
331
- default:
332
- <<: *pup_8_x
333
- <<: *acceptance_base
334
- script:
335
- - bundle exec rake beaker:suites[default]
336
-
337
- default-amzn2:
338
- <<: *pup_8_x
339
- <<: *acceptance_base
340
- script:
341
- - bundle exec rake beaker:suites[default,amzn2]
342
-
343
- default-fips:
344
- <<: *pup_8_x
345
- <<: *acceptance_base
346
- script:
347
- - BEAKER_fips=yes bundle exec rake beaker:suites[default]
348
-
349
- fips_from_fixtures:
350
- <<: *pup_8_x
351
- <<: *acceptance_base
352
- script:
353
- - bundle exec rake beaker:suites[fips_from_fixtures]
354
-
355
- puppet8_collections:
356
- <<: *pup_8_x
357
- <<: *acceptance_base
358
- script:
359
- - bundle exec rake beaker:suites[puppet_collections]
360
-
361
- puppet7_collections:
362
- <<: *pup_7_x
363
- <<: *acceptance_base
364
- script:
365
- - bundle exec rake beaker:suites[puppet_collections]
366
-
367
- oel_ssg:
368
- <<: *pup_8_x
369
- <<: *acceptance_base
370
- script:
371
- - bundle exec rake beaker:suites[ssg,oel]
372
-
373
- windows:
374
- <<: *pup_8_x
375
- <<: *acceptance_base
376
- allow_failure: true
377
- script:
378
- - bundle exec rake beaker:suites[windows]
379
-
380
- snapshot:
381
- <<: *pup_8_x
382
- <<: *acceptance_base
383
- # This is prone to breakage in the underlying system
384
- allow_failure: true
385
- script:
386
- - BEAKER_simp_snapshot=yes bundle exec rake beaker:suites[snapshot]