simp-beaker-helpers 1.20.0 → 1.22.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,152 @@
1
+ # Build & Deploy RubyGem & GitHub release when a SemVer tag is pushed
2
+ # ------------------------------------------------------------------------------
3
+ #
4
+ # NOTICE: **This file is maintained with puppetsync**
5
+ #
6
+ # This file is updated automatically as part of a standardized asset baseline.
7
+ #
8
+ # The next baseline sync will overwrite any local changes to this file!
9
+ #
10
+ # ==============================================================================
11
+ #
12
+ # This pipeline uses the following GitHub Action Secrets:
13
+ #
14
+ # GitHub Secret variable Type Notes
15
+ # ------------------------ -------- ----------------------------------------
16
+ # RUBYGEMS_API_KEY Required
17
+ #
18
+ # ------------------------------------------------------------------------------
19
+ #
20
+ # NOTES:
21
+ #
22
+ # * The CHANGLOG text is altered to remove RPM-style date headers, which don't
23
+ # render well as markdown on the GitHub release pages
24
+ ---
25
+ name: 'Tag: Release to GitHub & rubygems.org'
26
+
27
+ on:
28
+ push:
29
+ tags:
30
+ - '[0-9]+\.[0-9]+\.[0-9]+'
31
+
32
+ env:
33
+ PUPPET_VERSION: '~> 6'
34
+ LOCAL_WORKFLOW_CONFIG_FILE: .github/workflows.local.json
35
+
36
+ jobs:
37
+ releng-checks:
38
+ name: "RELENG checks"
39
+ runs-on: ubuntu-18.04
40
+ outputs:
41
+ build_command: ${{ steps.commands.outputs.build_command }}
42
+ release_command: ${{ steps.commands.outputs.release_command }}
43
+ steps:
44
+ - name: "Assert '${{ github.ref }}' is a tag"
45
+ run: '[[ "$GITHUB_REF" =~ ^refs/tags/ ]] || { echo "::error ::GITHUB_REF is not a tag: ${GITHUB_REF}"; exit 1 ; }'
46
+ - uses: actions/checkout@v2
47
+ with:
48
+ ref: ${{ github.ref }}
49
+ clean: true
50
+ - name: Determing build and release commands
51
+ id: commands
52
+ run: |
53
+ # By default, these are the standard tasks from "bundler/gem_tasks"
54
+ # To override them in the LOCAL_WORKFLOW_CONFIG_FILE
55
+ GEM_BUILD_COMMAND='bundle exec rake build'
56
+ GEM_RELEASE_COMMAND='gem push pkg/*.gem'
57
+ if jq -r '. | keys' "$LOCAL_WORKFLOW_CONFIG_FILE" 2>/dev/null | \
58
+ grep -w '"gem_build_command"' &> /dev/null; then
59
+ GEM_BUILD_COMMAND="$(jq .gem_build_command "$LOCAL_WORKFLOW_CONFIG_FILE" )"
60
+ fi
61
+ if jq -r '. | keys' "$LOCAL_WORKFLOW_CONFIG_FILE" 2>/dev/null | \
62
+ grep -w '"gem_release_command"' &> /dev/null; then
63
+ GEM_RELEASE_COMMAND="$(jq .gem_release_command "$LOCAL_WORKFLOW_CONFIG_FILE" )"
64
+ fi
65
+ echo "::set-output name=build_command::${GEM_BUILD_COMMAND}"
66
+ echo "::set-output name=release_command::${GEM_RELEASE_COMMAND}"
67
+ - uses: ruby/setup-ruby@v1
68
+ with:
69
+ ruby-version: 2.5
70
+ bundler-cache: true
71
+ - name: Test build the package
72
+ run: "${{ steps.commands.outputs.build_command }}"
73
+
74
+ create-github-release:
75
+ name: Deploy GitHub Release
76
+ needs: [ releng-checks ]
77
+ runs-on: ubuntu-18.04
78
+ steps:
79
+ - name: Checkout code
80
+ uses: actions/checkout@v2
81
+ with:
82
+ ref: ${{ github.ref }}
83
+ clean: true
84
+ fetch-depth: 0
85
+ - name: Get tag & annotation info (${{github.ref}})
86
+ id: tag-check
87
+ run: |
88
+ tag="${GITHUB_REF/refs\/tags\//}"
89
+ annotation="$(git for-each-ref "$GITHUB_REF" --format='%(contents)' --count=1)"
90
+ annotation_title="$(echo "$annotation" | head -1)"
91
+
92
+ echo "::set-output name=tag::${tag}"
93
+ echo "::set-output name=annotation_title::${annotation_title}"
94
+
95
+ # Prepare annotation body as a file for the next step
96
+ #
97
+ # * The GitHub Release render the text in this file as markdown
98
+ # * The file is needed because :set-output only supports single lines
99
+ # * The `perl -pe` removes RPM-style date headers from the CHANGELOG,
100
+ # because they don't render well as markdown on the Release page
101
+ #
102
+ echo "$annotation" | tail -n +2 | \
103
+ perl -pe 'BEGIN{undef $/;} s/\n\* (Mon|Tue|Wed|Thu|Fri|Sat|Sun) .*?\n//smg;' > /tmp/annotation.body
104
+
105
+ - name: Create Release
106
+ uses: actions/create-release@v1
107
+ id: create_release
108
+ env:
109
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
110
+ with:
111
+ tag_name: ${{ github.ref }}
112
+ release_name: ${{ steps.tag-check.outputs.annotation_title }}
113
+ body_path: /tmp/annotation.body
114
+ draft: false
115
+ prerelease: false
116
+
117
+ deploy-rubygem:
118
+ name: Deploy RubyGem Release
119
+ needs: [ releng-checks ]
120
+ runs-on: ubuntu-18.04
121
+ env:
122
+ RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
123
+ BUILD_COMMAND: ${{ needs.releng-checks.outputs.build_command }}
124
+ RELEASE_COMMAND: ${{ needs.releng-checks.outputs.release_command }}
125
+ steps:
126
+ - name: Checkout code
127
+ uses: actions/checkout@v2
128
+ with:
129
+ ref: ${{ github.ref }}
130
+ clean: true
131
+ - uses: ruby/setup-ruby@v1
132
+ with:
133
+ ruby-version: 2.5
134
+ bundler-cache: true
135
+ - name: Build RubyGem
136
+ run: '$BUILD_COMMAND'
137
+
138
+ - name: Release RubyGem
139
+ run: |
140
+ echo "Setting up gem credentials..."
141
+ mkdir -p ~/.gem
142
+
143
+ cat << EOF > ~/.gem/credentials
144
+ ---
145
+ :rubygems_api_key: ${RUBYGEMS_API_KEY}
146
+ EOF
147
+ chmod 0600 ~/.gem/credentials
148
+
149
+ chmod -R go=u-w .
150
+
151
+ echo "Running '$RELEASE_COMMAND'..."
152
+ $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,56 @@
1
+ ### 1.22.1 / 2021-03-01
2
+ * Fixed: enable_epel_on() now installs the correct EPEL repository
3
+ package on OracleLinux
4
+
5
+ ### 1.22.0 / 2021-01-27
6
+ * Fixed:
7
+ * Ensure that the simp-crypto_policy module is installed when flipping to FIPS
8
+ mode
9
+ * Only attempt to install the simp repos once in case they are broken for some
10
+ reason
11
+ * Added:
12
+ * Documentation for all of the beaker environment variables
13
+ * set_simp_repo_release() for setting the release and release_type of the
14
+ public SIMP yum repos
15
+ * set_yum_opts_on() method for setting bulk yum config options
16
+ * set_yum_opt_on() method for setting singular yum config options
17
+ * install_package_unless_present_on() method
18
+ * Allow users to set repos to disable using an environment variable
19
+ * A total run time summary for beaker suites
20
+
21
+ ### 1.21.4 / 2021-01-21
22
+ * Fixed:
23
+ * Reverted the use of OpenStruct due to issues with seralization
24
+ * Hash objects have a 'dig' method as of Ruby 2.3 so pinned this gem to a
25
+ minimum version of Ruby 2.3
26
+
27
+ ### 1.21.3 / 2021-01-20
28
+ * Fixed:
29
+ * Allow all methods that can safely take SUT arrays to do so
30
+ * Ensure that pfact_on returns a Hash if appropriate
31
+ * Fix container support in copy_to
32
+ * Added:
33
+ * Explicitly support podman local and remote in copy_to
34
+
35
+ ### 1.21.2 / 2021-01-15
36
+ * Fixed version mismatch. 1.21.1 was tagged with an incorrect version
37
+ in version.rb.
38
+
39
+ ### 1.21.1 / 2021-01-13
40
+ * Added:
41
+ * update_package_from_centos_stream method
42
+ * install_latest_package_on method
43
+ * Fixed:
44
+ * Removed some of the extraneous calls to facter
45
+ * Automatically pull the CentOS 8 kernel to the latest version in
46
+ CentOS-Stream to work around issues on FIPS systems
47
+
48
+ ### 1.20.1 / 2021-01-08
49
+ * Fixed:
50
+ * Ensure that yum calls commands appropriately depending on whether or not
51
+ packages are already installed.
52
+ * Also change all HostKeyAlgorithms settings for SSH connections
53
+
1
54
  ### 1.20.0 / 2021-01-05
2
55
  * Added:
3
56
  * A `enable_epel_on` function that follows the instructions on the EPEL
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