simp-beaker-helpers 1.20.1 → 1.23.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,192 @@
1
+ # Build & Deploy RubyGem & GitHub release when a SemVer tag is pushed
2
+ #
3
+ # This workflow's jobs are only triggered in repos under the `simp` organization
4
+ # ------------------------------------------------------------------------------
5
+ #
6
+ # NOTICE: **This file is maintained with puppetsync**
7
+ #
8
+ # This file is updated automatically as part of a standardized asset baseline.
9
+ #
10
+ # The next baseline sync will overwrite any local changes to this file!
11
+ #
12
+ # ==============================================================================
13
+ #
14
+ # This pipeline uses the following GitHub Action Secrets:
15
+ #
16
+ # GitHub Secret variable Type Notes
17
+ # ------------------------ -------- ----------------------------------------
18
+ # RUBYGEMS_API_KEY Required
19
+ #
20
+ # ------------------------------------------------------------------------------
21
+ #
22
+ # NOTES:
23
+ #
24
+ # * The CHANGLOG text is altered to remove RPM-style date headers, which don't
25
+ # render well as markdown on the GitHub release pages
26
+ #
27
+ # * By default, the gem is built and released using the standard rake tasks
28
+ # from "bundler/gem_tasks". To override these, create a JSON file at
29
+ # `.github/workflows.local.json`, using the following format:
30
+ #
31
+ # {
32
+ # "gem_build_command": "bundle exec rake build",
33
+ # "gem_release_command": "bundle exec rake build release:rubygem_push",
34
+ # "gem_pkg_dir": "pkg"
35
+ # }
36
+ #
37
+ # All keys are optional.
38
+ #
39
+ ---
40
+ name: 'Tag: Release to GitHub & rubygems.org'
41
+
42
+ on:
43
+ push:
44
+ tags:
45
+ - '[0-9]+\.[0-9]+\.[0-9]+'
46
+
47
+ env:
48
+ PUPPET_VERSION: '~> 6'
49
+ LOCAL_WORKFLOW_CONFIG_FILE: .github/workflows.local.json
50
+
51
+ jobs:
52
+ releng-checks:
53
+ name: "RELENG checks"
54
+ if: github.repository_owner == 'simp'
55
+ runs-on: ubuntu-18.04
56
+ outputs:
57
+ build_command: ${{ steps.commands.outputs.build_command }}
58
+ release_command: ${{ steps.commands.outputs.release_command }}
59
+ pkg_dir: ${{ steps.commands.outputs.pkg_dir }}
60
+ steps:
61
+ - name: "Assert '${{ github.ref }}' is a tag"
62
+ run: '[[ "$GITHUB_REF" =~ ^refs/tags/ ]] || { echo "::error ::GITHUB_REF is not a tag: ${GITHUB_REF}"; exit 1 ; }'
63
+ - uses: actions/checkout@v2
64
+ with:
65
+ ref: ${{ github.ref }}
66
+ clean: true
67
+ - name: Determing build and release commands
68
+ id: commands
69
+ run: |
70
+ # By default, these are the standard tasks from "bundler/gem_tasks"
71
+ # To override them in the LOCAL_WORKFLOW_CONFIG_FILE
72
+ GEM_BUILD_COMMAND='bundle exec rake build'
73
+ GEM_RELEASE_COMMAND='bundle exec rake build release:rubygem_push'
74
+ GEM_PKG_DIR='pkg'
75
+ if jq -r '. | keys' "$LOCAL_WORKFLOW_CONFIG_FILE" 2>/dev/null | \
76
+ grep -w '"gem_pkg_dir"' &> /dev/null; then
77
+ GEM_PKG_DIR="$(jq -r .gem_pkg_dir "$LOCAL_WORKFLOW_CONFIG_FILE" )"
78
+ fi
79
+ if jq -r '. | keys' "$LOCAL_WORKFLOW_CONFIG_FILE" 2>/dev/null | \
80
+ grep -w '"gem_build_command"' &> /dev/null; then
81
+ GEM_BUILD_COMMAND="$(jq -r .gem_build_command "$LOCAL_WORKFLOW_CONFIG_FILE" )"
82
+ fi
83
+ if jq -r '. | keys' "$LOCAL_WORKFLOW_CONFIG_FILE" 2>/dev/null | \
84
+ grep -w '"gem_release_command"' &> /dev/null; then
85
+ GEM_RELEASE_COMMAND="$(jq -r .gem_release_command "$LOCAL_WORKFLOW_CONFIG_FILE" )"
86
+ fi
87
+ echo "::set-output name=build_command::${GEM_BUILD_COMMAND}"
88
+ echo "::set-output name=pkg_dir::${GEM_PKG_DIR}"
89
+ echo "::set-output name=release_command::${GEM_RELEASE_COMMAND}"
90
+ - uses: ruby/setup-ruby@v1
91
+ with:
92
+ ruby-version: 2.5
93
+ bundler-cache: true
94
+ - name: Test build the package
95
+ env:
96
+ GEM_BUILD_COMMAND: ${{ steps.commands.outputs.build_command }}
97
+ run: "$GEM_BUILD_COMMAND"
98
+ - name: "Assert '${{ github.ref }}' matches the package version"
99
+ run: |
100
+ tag="${GITHUB_REF/refs\/tags\//}"
101
+ [ -d "${{ steps.commands.outputs.pkg_dir }}" ] || \
102
+ { echo "::error ::No directory found at ${{ steps.commands.outputs.pkg_dir }}/" ; exit 3 ; }
103
+ ls -1 "${{ steps.commands.outputs.pkg_dir }}"/*.gem || \
104
+ { echo "::error ::No gem file found at ${{ steps.commands.outputs.pkg_dir }}/*.gem" ; exit 2 ; }
105
+ [ -f "${{ steps.commands.outputs.pkg_dir }}"/*-${tag}.gem ] || \
106
+ { echo "::error ::tag '${tag}' does not match package $(ls -1 ${{ steps.commands.outputs.pkg_dir }}/*.gem)"; exit 1 ; }
107
+
108
+ create-github-release:
109
+ name: Deploy GitHub Release
110
+ needs: [ releng-checks ]
111
+ if: github.repository_owner == 'simp'
112
+ runs-on: ubuntu-18.04
113
+ steps:
114
+ - name: Checkout code
115
+ uses: actions/checkout@v2
116
+ with:
117
+ ref: ${{ github.ref }}
118
+ clean: true
119
+ fetch-depth: 0
120
+ - name: Get tag & annotation info (${{github.ref}})
121
+ id: tag-check
122
+ run: |
123
+ tag="${GITHUB_REF/refs\/tags\//}"
124
+ annotation="$(git for-each-ref "$GITHUB_REF" --format='%(contents)' --count=1)"
125
+ annotation_title="$(echo "$annotation" | head -1)"
126
+
127
+ echo "::set-output name=tag::${tag}"
128
+ echo "::set-output name=annotation_title::${annotation_title}"
129
+
130
+ # Prepare annotation body as a file for the next step
131
+ #
132
+ # * The GitHub Release render the text in this file as markdown
133
+ # * The file is needed because :set-output only supports single lines
134
+ # * The `perl -pe` removes RPM-style date headers from the CHANGELOG,
135
+ # because they don't render well as markdown on the Release page
136
+ #
137
+ echo "$annotation" | tail -n +2 | \
138
+ perl -pe 'BEGIN{undef $/;} s/\n\* (Mon|Tue|Wed|Thu|Fri|Sat|Sun) .*?\n//smg;' > /tmp/annotation.body
139
+
140
+ - name: Create Release
141
+ uses: actions/create-release@v1
142
+ id: create_release
143
+ env:
144
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
145
+ with:
146
+ tag_name: ${{ github.ref }}
147
+ release_name: ${{ steps.tag-check.outputs.annotation_title }}
148
+ body_path: /tmp/annotation.body
149
+ draft: false
150
+ prerelease: false
151
+
152
+ deploy-rubygem:
153
+ name: Deploy RubyGem Release
154
+ needs: [ releng-checks ]
155
+ if: github.repository_owner == 'simp'
156
+ runs-on: ubuntu-18.04
157
+ env:
158
+ RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
159
+ BUILD_COMMAND: ${{ needs.releng-checks.outputs.build_command }}
160
+ RELEASE_COMMAND: ${{ needs.releng-checks.outputs.release_command }}
161
+ PKG_DIR: ${{ needs.releng-checks.outputs.pkg_dir }}
162
+ steps:
163
+ - name: Checkout code
164
+ uses: actions/checkout@v2
165
+ with:
166
+ ref: ${{ github.ref }}
167
+ clean: true
168
+ - uses: ruby/setup-ruby@v1
169
+ with:
170
+ ruby-version: 2.5
171
+ bundler-cache: true
172
+ - name: Build RubyGem
173
+ run: |
174
+ echo "Setting up file permissions..."
175
+ chmod -R go=u-w .
176
+
177
+ echo "Running '$BUILD_COMMAND'..."
178
+ $BUILD_COMMAND
179
+
180
+ - name: Release RubyGem
181
+ run: |
182
+ echo "Setting up gem credentials..."
183
+ mkdir -p ~/.gem
184
+
185
+ cat << EOF > ~/.gem/credentials
186
+ ---
187
+ :rubygems_api_key: ${RUBYGEMS_API_KEY}
188
+ EOF
189
+ chmod 0600 ~/.gem/credentials
190
+
191
+ echo "Running '$RELEASE_COMMAND'..."
192
+ $RELEASE_COMMAND
data/.gitlab-ci.yml CHANGED
@@ -1,11 +1,4 @@
1
1
  # ------------------------------------------------------------------------------
2
- # NOTICE: **This file is maintained with puppetsync**
3
- #
4
- # This file is updated automatically as part of a puppet module baseline.
5
- #
6
- # The next baseline sync will overwrite any local changes to everything above
7
- # the line "# Repo-specific content"
8
- # ------------------------------------------------------------------------------
9
2
  # The testing matrix considers ruby/puppet versions supported by SIMP and PE:
10
3
  #
11
4
  # https://puppet.com/docs/pe/2019.8/component_versions_in_recent_pe_releases.html
@@ -216,28 +209,28 @@ variables:
216
209
  # Puppet Versions
217
210
  #-----------------------------------------------------------------------
218
211
 
219
- .pup_5: &pup_5
212
+ .pup_5_x: &pup_5_x
220
213
  image: 'ruby:2.4'
221
214
  variables:
222
215
  PUPPET_VERSION: '~> 5.0'
223
216
  BEAKER_PUPPET_COLLECTION: 'puppet5'
224
217
  MATRIX_RUBY_VERSION: '2.4'
225
218
 
226
- .pup_6: &pup_6
219
+ .pup_6_x: &pup_6_x
227
220
  image: 'ruby:2.5'
228
221
  variables:
229
222
  PUPPET_VERSION: '~> 6.0'
230
223
  BEAKER_PUPPET_COLLECTION: 'puppet6'
231
224
  MATRIX_RUBY_VERSION: '2.5'
232
225
 
233
- .pup_6_18_0: &pup_6_18_0
226
+ .pup_6_pe: &pup_6_pe
234
227
  image: 'ruby:2.5'
235
228
  variables:
236
229
  PUPPET_VERSION: '6.18.0'
237
230
  BEAKER_PUPPET_COLLECTION: 'puppet6'
238
231
  MATRIX_RUBY_VERSION: '2.5'
239
232
 
240
- .pup_7: &pup_7
233
+ .pup_7_x: &pup_7_x
241
234
  image: 'ruby:2.7'
242
235
  variables:
243
236
  PUPPET_VERSION: '~> 7.0'
@@ -280,24 +273,18 @@ variables:
280
273
  # Unit Tests
281
274
  #-----------------------------------------------------------------------
282
275
 
283
- pup5-unit:
284
- <<: *pup_5
276
+ pup5.x-unit:
277
+ <<: *pup_5_x
285
278
  <<: *unit_tests
286
279
 
287
- pup6-unit:
288
- <<: *pup_6
280
+ pup6.x-unit:
281
+ <<: *pup_6_x
289
282
  <<: *unit_tests
290
283
 
291
- pup7-unit:
292
- <<: *pup_7
284
+ pup7.x-unit:
285
+ <<: *pup_7_x
293
286
  <<: *unit_tests
294
287
 
295
- # ------------------------------------------------------------------------------
296
- # NOTICE: **This file is maintained with puppetsync**
297
- #
298
- # Everything above the "Repo-specific content" comment will be overwritten by
299
- # the next puppetsync.
300
- # ------------------------------------------------------------------------------
301
288
 
302
289
  # Repo-specific content
303
290
  # ==============================================================================
@@ -305,20 +292,20 @@ pup7-unit:
305
292
  #=======================================================================
306
293
  # Packaging test
307
294
 
308
- pup5-pkg:
309
- <<: *pup_5
295
+ pup5.x-pkg:
296
+ <<: *pup_5_x
310
297
  <<: *unit_tests
311
298
  script:
312
299
  'bundle exec rake pkg:gem'
313
300
 
314
- pup6-pkg:
315
- <<: *pup_6
301
+ pup6.x-pkg:
302
+ <<: *pup_6_x
316
303
  <<: *unit_tests
317
304
  script:
318
305
  'bundle exec rake pkg:gem'
319
306
 
320
- pup7-pkg:
321
- <<: *pup_7
307
+ pup7.x-pkg:
308
+ <<: *pup_7_x
322
309
  <<: *unit_tests
323
310
  script:
324
311
  'bundle exec rake pkg:gem'
@@ -326,49 +313,49 @@ pup7-pkg:
326
313
  #=======================================================================
327
314
  # Acceptance tests
328
315
  default:
329
- <<: *pup_6
316
+ <<: *pup_6_x
330
317
  <<: *acceptance_base
331
318
  script:
332
319
  - bundle exec rake beaker:suites[default]
333
320
 
334
321
  default-fips:
335
- <<: *pup_6
322
+ <<: *pup_6_x
336
323
  <<: *acceptance_base
337
324
  script:
338
325
  - BEAKER_fips=yes bundle exec rake beaker:suites[default]
339
326
 
340
327
  fips_from_fixtures:
341
- <<: *pup_6
328
+ <<: *pup_6_x
342
329
  <<: *acceptance_base
343
330
  script:
344
331
  - bundle exec rake beaker:suites[fips_from_fixtures]
345
332
 
346
333
  puppet5_collections:
347
- <<: *pup_5
334
+ <<: *pup_5_x
348
335
  <<: *acceptance_base
349
336
  script:
350
337
  - bundle exec rake beaker:suites[puppet_collections]
351
338
 
352
339
  puppet6_collections:
353
- <<: *pup_6
340
+ <<: *pup_6_x
354
341
  <<: *acceptance_base
355
342
  script:
356
343
  - bundle exec rake beaker:suites[puppet_collections]
357
344
 
358
345
  puppet7_collections:
359
- <<: *pup_7
346
+ <<: *pup_7_x
360
347
  <<: *acceptance_base
361
348
  script:
362
349
  - bundle exec rake beaker:suites[puppet_collections]
363
350
 
364
351
  windows:
365
- <<: *pup_6
352
+ <<: *pup_6_x
366
353
  <<: *acceptance_base
367
354
  script:
368
355
  - bundle exec rake beaker:suites[windows]
369
356
 
370
357
  snapshot:
371
- <<: *pup_6
358
+ <<: *pup_6_x
372
359
  <<: *acceptance_base
373
360
  # This is prone to breakage in the underlying system
374
361
  allow_failure: true
data/CHANGELOG.md CHANGED
@@ -1,3 +1,59 @@
1
+ ### 1.23.0 / 2021-03-16
2
+ * Added:
3
+ * For `podman` support:
4
+ * Bumped the required beaker-docker to between 0.8.3 and 2.0.0
5
+ * Added a dependency on docker-api between 2.1.0 and 3.0.0
6
+ * Make SSG failures have verbose output to make remediation easier
7
+ * Fixed:
8
+ * Ensure that containers use the correct method for copying files
9
+
10
+ ### 1.22.1 / 2021-03-01
11
+ * Fixed: enable_epel_on() now installs the correct EPEL repository
12
+ package on OracleLinux
13
+
14
+ ### 1.22.0 / 2021-01-27
15
+ * Fixed:
16
+ * Ensure that the simp-crypto_policy module is installed when flipping to FIPS
17
+ mode
18
+ * Only attempt to install the simp repos once in case they are broken for some
19
+ reason
20
+ * Added:
21
+ * Documentation for all of the beaker environment variables
22
+ * set_simp_repo_release() for setting the release and release_type of the
23
+ public SIMP yum repos
24
+ * set_yum_opts_on() method for setting bulk yum config options
25
+ * set_yum_opt_on() method for setting singular yum config options
26
+ * install_package_unless_present_on() method
27
+ * Allow users to set repos to disable using an environment variable
28
+ * A total run time summary for beaker suites
29
+
30
+ ### 1.21.4 / 2021-01-21
31
+ * Fixed:
32
+ * Reverted the use of OpenStruct due to issues with seralization
33
+ * Hash objects have a 'dig' method as of Ruby 2.3 so pinned this gem to a
34
+ minimum version of Ruby 2.3
35
+
36
+ ### 1.21.3 / 2021-01-20
37
+ * Fixed:
38
+ * Allow all methods that can safely take SUT arrays to do so
39
+ * Ensure that pfact_on returns a Hash if appropriate
40
+ * Fix container support in copy_to
41
+ * Added:
42
+ * Explicitly support podman local and remote in copy_to
43
+
44
+ ### 1.21.2 / 2021-01-15
45
+ * Fixed version mismatch. 1.21.1 was tagged with an incorrect version
46
+ in version.rb.
47
+
48
+ ### 1.21.1 / 2021-01-13
49
+ * Added:
50
+ * update_package_from_centos_stream method
51
+ * install_latest_package_on method
52
+ * Fixed:
53
+ * Removed some of the extraneous calls to facter
54
+ * Automatically pull the CentOS 8 kernel to the latest version in
55
+ CentOS-Stream to work around issues on FIPS systems
56
+
1
57
  ### 1.20.1 / 2021-01-08
2
58
  * Fixed:
3
59
  * Ensure that yum calls commands appropriately depending on whether or not
data/Gemfile CHANGED
@@ -13,7 +13,7 @@ gem 'bundler'
13
13
  gem 'rake'
14
14
 
15
15
  group :system_tests do
16
- beaker_gem_options = ENV.fetch('BEAKER_GEM_OPTIONS', ['>= 4.17.0', '< 5.0.0'])
16
+ beaker_gem_options = ENV.fetch('BEAKER_GEM_OPTIONS', ['>= 4.28.1', '< 5.0.0'])
17
17
 
18
18
  if "#{beaker_gem_options}".include?(':')
19
19
  # Just pass in BEAKER_GEM_OPTIONS as a string that would represent the usual
data/README.md CHANGED
@@ -13,6 +13,8 @@ Methods to assist beaker acceptance tests for SIMP.
13
13
  * [`rake beaker:suites`](#rake-beakersuites)
14
14
  * [Suite Execution](#suite-execution)
15
15
  * [Environment Variables](#environment-variables)
16
+ * [Beaker Management](#beaker-management)
17
+ * [Beaker Helpers Adjustments](#beaker-helpers-adjustments)
16
18
  * [Global Suite Configuration](#global-suite-configuration)
17
19
  * [Supported Config:](#supported-config)
18
20
  * [Individual Suite Configuration](#individual-suite-configuration)
@@ -112,12 +114,68 @@ sensitive).
112
114
 
113
115
  #### Environment Variables
114
116
 
115
- * BEAKER_suite_runall
117
+ ##### Beaker Management
118
+
119
+ * BEAKER_suite_runall [yes|no]
116
120
  * Run all Suites
117
121
 
118
- * BEAKER_suite_basedir
122
+ * BEAKER_suite_basedir [String]
119
123
  * The base directory where suites will be defined
120
- * Default: spec/acceptance
124
+ * Default: `spec/acceptance`
125
+
126
+ ##### Beaker Helpers Adjustments
127
+
128
+ * BEAKER_SIMP_parallel [yes|no]
129
+ * `yes` => Run simp-beaker-helpers methods on SUTs in parallel if possible
130
+ * `no` => Do not run methods in parallel
131
+
132
+ * BEAKER_docker_cmd [String]
133
+ * The specific command to use for performing `docker` operations
134
+
135
+ * BEAKER_helpers_verbose [yes|no]
136
+ * `yes` => Enable verbose output
137
+ * `no` => Do not enable verbose output
138
+
139
+ * BEAKER_copy_fixtures [yes|no]
140
+ * `yes` => Enable copying fixtures to the SUT
141
+ * `no` => Disable copying fixtures to the SUT
142
+
143
+ * BEAKER_use_fixtures_dir_for_modules [yes|no]
144
+ * `yes` => Pull fixtures directly from `spec/fixtures/modules`
145
+ * `no` => Ignore `spec/fixtures/modules` content
146
+
147
+ * BEAKER_stringify_facts [yes|no]
148
+ * `yes` => Enable fact stringification
149
+
150
+ * BEAKER_fips_module_version [String]
151
+ * The specific version of the FIPS module to install from the puppet forge
152
+
153
+ * BEAKER_RHSM_USER [String]
154
+ * The username for using with RHSM
155
+
156
+ * BEAKER_RHSM_PASS [String]
157
+ * The password for using with RHSM
158
+
159
+ * BEAKER_fips [yes|no]
160
+ * `yes` => Enable FIPS on the SUT
161
+ * `no` => Do not manage FIPS on the SUT (will not disable if enabled)
162
+
163
+ * BEAKER_no_fix_interfaces [Boolean]
164
+ * If present, will not try to fix the interfaces on the SUT
165
+
166
+ * BEAKER_SIMP_install_repos [yes|no]
167
+ * `yes` => Install the SIMP YUM repositories
168
+ * `no` => No not install the SIMP YUM repositories
169
+
170
+ * BEAKER_SIMP_disable_repos [String]
171
+ * Comma delimited list of YUM repositories to disable on the SUT
172
+
173
+ * BEAKER_SIMP_repo_release [String]
174
+ * The release of SIMP to target in the YUM repos (usually a number)
175
+
176
+ * BEAKER_SIMP_repo_release_type [String]
177
+ * The release type of SIMP to target in the YUM repos
178
+ * Something like `stable`, `rolling`, or `unstable`
121
179
 
122
180
  #### Global Suite Configuration
123
181
 
@@ -406,7 +464,7 @@ might try to install packages before subscription manager is configured.
406
464
  The version of InSpec to use when running inspec tests. Currently hard-coded to
407
465
  `4.16.14` due to a bug introduced in `4.16.15`.
408
466
 
409
- Let to 'latest' to use the latest available in the upstream repos.
467
+ Set to 'latest' to use the latest available in the upstream repos.
410
468
 
411
469
  ## Examples
412
470
 
@@ -510,7 +568,7 @@ underlying OS configuration.
510
568
 
511
569
  `Simp::BeakerHelpers::Snapshot.save(sut, '<name of snapshot>')` will save a
512
570
  snapshot with the given name. If the snapshot already exists, it will be
513
- forceably overwritten.
571
+ forcibly overwritten.
514
572
 
515
573
 
516
574
  ##### Base Snapshots