Skip to content

Commit

Permalink
(SIMP-8958) Standardize assets in pupmod-simp-acpid (#47)
Browse files Browse the repository at this point in the history
* (SIMP-8958) Standardize assets in pupmod-simp-acpid

This patch baselines the latest standardized assets for Puppet modules.
It also fixes a unit test broken by a previous commit.

SIMP-8985 #close
[SIMP-8958] #comment Standardized assets in pupmod-simp-acpid
[SIMP-8839] #comment Removed EL6 from pupmod-simp-acpid
[SIMP-8489] #comment Updated pupmod-simp-acpid GLCI pipeline to Puppet 6.18
[SIMP-8923] #comment Renamed 'sanity' to 'releng' in pupmod-simp-acpid
[SIMP-8984] #comment Updated pupmod-simp-acpid to new GLCI conventions
SIMP-9000 #close

Co-authored-by: lnemsick-simp <[email protected]>
  • Loading branch information
op-ct and lnemsick-simp authored Jan 11, 2021
1 parent b778728 commit 87d3cfb
Show file tree
Hide file tree
Showing 8 changed files with 131 additions and 66 deletions.
6 changes: 6 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# ------------------------------------------------------------------------------
# NOTICE: **This file is maintained with puppetsync**
#
# This file is automatically updated as part of a puppet module baseline.
# The next baseline sync will overwrite any local changes made to this file.
# ------------------------------------------------------------------------------
*.erb eol=lf
*.pp eol=lf
*.sh eol=lf
Expand Down
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# NOTE: This file is managed by puppetsync. Make sure any changes are
# reflected in the control repo.
# ------------------------------------------------------------------------------
# NOTICE: **This file is maintained with puppetsync**
#
# This file is automatically updated as part of a puppet module baseline.
# The next baseline sync will overwrite any local changes made to this file.
# ------------------------------------------------------------------------------
.*.sw?
.yardoc
.idea/
Expand Down
161 changes: 102 additions & 59 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# ------------------------------------------------------------------------------
# NOTICE: **This file is maintained with puppetsync**
#
# Everything above the "Repo-specific content" comment will be overwritten by
# the next puppetsync.
# This file is updated automatically as part of a puppet module baseline.
#
# The next baseline sync will overwrite any local changes to everything above
# the line "# Repo-specific content"
# ------------------------------------------------------------------------------
# The testing matrix considers ruby/puppet versions supported by SIMP and PE:
#
Expand All @@ -13,11 +15,10 @@
# Release Puppet Ruby EOL
# SIMP 6.4 5.5 2.4.10 TBD
# PE 2018.1 5.5 2.4.10 2021-01 (LTS overlap)
# PE 2019.8 6.16 2.5.7 2021-11 (LTS)
# PE 2019.8 6.18 2.5.7 2022-12 (LTS)
---

stages:
- 'sanity'
- 'validation'
- 'acceptance'
- 'compliance'
Expand Down Expand Up @@ -56,6 +57,25 @@ variables:
- '.vendor'
before_script:
- 'ruby -e "puts %(\n\n), %q(=)*80, %(\nSIMP-relevant Environment Variables:\n\n#{e=ENV.keys.grep(/^PUPPET|^SIMP|^BEAKER|MATRIX/); pad=e.map{|x| x.size}.max+1; e.map{|v| %( * #{%(#{v}:).ljust(pad)} #{39.chr + ENV[v] + 39.chr}\n)}.join}\n), %q(=)*80, %(\n\n)"'
# Diagnostic ruby & gem information
- 'which ruby && ruby --version || :'
- "[[ $- == *i* ]] && echo 'Interactive shell session' || echo 'Non-interactive shell session'"
- "shopt -q login_shell && echo 'Login shell' || echo 'Not a login shell'"
- 'rvm ls || :'

# If RVM is available, make SURE it's using the right Ruby:
# * Source rvm (to run in non-login shells)
# * If any $MATRIX_RUBY_VERSION rubies are available, use the latest
# * Otherwise: install & use ${MATRIX_RUBY_VERSION}-head (e.g., latest)
# * ^^ This could be wonky and introduce variations across runners
# * ^^ maybe it should just fail if there is no $MATRIX_RUBY_VERSION installed?
- "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; }"
- "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\" ; }"
- 'ruby --version || :'
- 'gem list sync || :'

# Bundle gems (preferring cached > local > downloaded resources)
# * Try to use cached and local resources before downloading dependencies
- 'declare GEM_BUNDLER_VER=(-v "~> ${BUNDLER_VERSION:-1.17.1}")'
- 'declare GEM_INSTALL_CMD=(gem install --no-document)'
- 'declare BUNDLER_INSTALL_CMD=(bundle install --no-binstubs --jobs $(nproc) "${FLAGS[@]}")'
Expand All @@ -64,6 +84,13 @@ variables:
- 'rm -rf pkg/ || :'
- '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 ; }'

# Diagnostic bundler, ruby, and gem checks:
- 'bundle exec rvm ls || :'
- 'bundle exec which ruby || :'
- 'bundle show sync || :'
- 'bundle exec gem list sync || :'


# Assign a matrix level when your test will run. Heavier jobs get higher numbers
# NOTE: To skip all jobs with a SIMP_MATRIX_LEVEL, set SIMP_MATRIX_LEVEL=0

Expand All @@ -72,21 +99,26 @@ variables:
- .gitlab-ci.yml
- .fixtures.yml
- "spec/spec_helper.rb"
- "spec/{classes,unit,defines,type_aliases,types,hosts}/**/*.rb"
- "{manifests,files,types}/**/*"
- "templates/*.{erb,epp}"
- "lib/**/*"
- "spec/{classes,unit,defines,type_aliases,types,hosts,lib}/**/*.rb"
- "{SIMP,data,manifests,files,types,lib,functions}/**/*"
- "templates/**/*.{erb,epp}"
- "Gemfile"
- "SIMP/**/*"
- "data/**/*"
exists:
- "spec/{classes,unit,defines,type_aliases,types,hosts}/**/*_spec.rb"

.relevant_file_conditions_trigger_acceptance_tests: &relevant_file_conditions_trigger_acceptance_tests
changes:
- .gitlab-ci.yml
- "spec/spec_helper_acceptance.rb"
- "spec/acceptance/**/*"
- "{manifests,files,types}/**/*"
- "templates/*.{erb,epp}"
- "lib/**/*"
- "spec/{helpers,acceptance}/**/*"
- "spec/inspec_*/**/*"
- "{SIMP,data,manifests,files,types,lib,functions}/**/*"
- "templates/**/*.{erb,epp}"
- "Gemfile"
- "SIMP/**/*"
- "data/**/*"
exists:
- "spec/acceptance/**/*_spec.rb"

Expand Down Expand Up @@ -141,17 +173,17 @@ variables:
- <<: *skip_job_when_commit_message_says_to
- <<: *force_run_job_when_var_and_lvl_1_or_above
- <<: *force_run_job_when_commit_mssage_lvl_1_or_above
- <<: *relevant_file_conditions_trigger_acceptance_tests
<<: *run_job_when_level_1_or_above_w_changes
- <<: *run_job_when_level_1_or_above_w_changes
<<: *relevant_file_conditions_trigger_acceptance_tests
- when: never

.with_SIMP_SPEC_MATRIX_LEVEL_1: &with_SIMP_SPEC_MATRIX_LEVEL_1
rules:
- <<: *skip_job_when_commit_message_says_to
- <<: *force_run_job_when_commit_mssage_lvl_1_or_above
- <<: *force_run_job_when_var_and_lvl_1_or_above
- <<: *relevant_file_conditions_trigger_spec_tests
<<: *run_job_when_level_1_or_above_w_changes
- <<: *run_job_when_level_1_or_above_w_changes
<<: *relevant_file_conditions_trigger_spec_tests
- when: never

# SIMP_MATRIX_LEVEL=2: Resource-heavy or redundant jobs
Expand Down Expand Up @@ -187,34 +219,41 @@ variables:
# Puppet Versions
#-----------------------------------------------------------------------

.pup_5: &pup_5
.pup_5_x: &pup_5_x
image: 'ruby:2.4'
variables:
PUPPET_VERSION: '~> 5.0'
BEAKER_PUPPET_COLLECTION: 'puppet5'
MATRIX_RUBY_VERSION: '2.4'

.pup_5_5_20: &pup_5_5_20
.pup_5_pe: &pup_5_pe
image: 'ruby:2.4'
variables:
PUPPET_VERSION: '5.5.20'
BEAKER_PUPPET_COLLECTION: 'puppet5'
MATRIX_RUBY_VERSION: '2.4'

.pup_6: &pup_6
.pup_6_x: &pup_6_x
image: 'ruby:2.5'
variables:
PUPPET_VERSION: '~> 6.0'
BEAKER_PUPPET_COLLECTION: 'puppet6'
MATRIX_RUBY_VERSION: '2.5'

.pup_6_16_0: &pup_6_16_0
.pup_6_pe: &pup_6_pe
image: 'ruby:2.5'
variables:
PUPPET_VERSION: '6.16.0'
PUPPET_VERSION: '6.18.0'
BEAKER_PUPPET_COLLECTION: 'puppet6'
MATRIX_RUBY_VERSION: '2.5'

.pup_7_x: &pup_7_x
image: 'ruby:2.7'
variables:
PUPPET_VERSION: '~> 7.0'
BEAKER_PUPPET_COLLECTION: 'puppet7'
MATRIX_RUBY_VERSION: '2.7'

# Testing Environments
#-----------------------------------------------------------------------

Expand Down Expand Up @@ -251,14 +290,13 @@ variables:
# Pipeline / testing matrix
#=======================================================================

sanity_checks:
<<: *pup_5
releng_checks:
<<: *pup_5_x
<<: *setup_bundler_env
stage: 'sanity'
stage: 'validation'
tags: ['docker']
script:
- 'if `hash apt-get`; then apt-get update; fi'
- 'if `hash apt-get`; then apt-get install -y rpm; fi'
- 'command -v rpm || if command -v apt-get; then apt-get update; apt-get install -y rpm; fi ||:'
- 'bundle exec rake check:dot_underscore'
- 'bundle exec rake check:test_file'
- 'bundle exec rake pkg:check_version'
Expand All @@ -269,33 +307,38 @@ sanity_checks:
# Linting
#-----------------------------------------------------------------------

pup5-lint:
<<: *pup_5
<<: *lint_tests
# NOTE: Don't add more lint checks here.
# puppet-lint is a validator, not a parser; it includes its own lexer and
# doesn't use the Puppet gem at all. Running multiple lint tests against
# different Puppet versions won't accomplish anything.

pup6-lint:
<<: *pup_6
pup-lint:
<<: *pup_6_x
<<: *lint_tests

# Unit Tests
#-----------------------------------------------------------------------

pup5-unit:
<<: *pup_5
pup5.x-unit:
<<: *pup_5_x
<<: *unit_tests
<<: *with_SIMP_SPEC_MATRIX_LEVEL_2

pup5.5.20-unit:
<<: *pup_5_5_20
pup5.pe-unit:
<<: *pup_5_pe
<<: *unit_tests

pup6-unit:
<<: *pup_6
pup6.x-unit:
<<: *pup_6_x
<<: *unit_tests
<<: *with_SIMP_SPEC_MATRIX_LEVEL_2

pup6.16.0-unit:
<<: *pup_6_16_0
pup6.pe-unit:
<<: *pup_6_pe
<<: *unit_tests

pup7.x-unit:
<<: *pup_7_x
<<: *unit_tests

# ------------------------------------------------------------------------------
Expand All @@ -308,63 +351,63 @@ pup6.16.0-unit:
# Repo-specific content
# ==============================================================================

pup5.5.20:
<<: *pup_5_5_20
pup5.pe:
<<: *pup_5_pe
<<: *acceptance_base
script:
- 'bundle exec rake beaker:suites[default]'

pup5.5.20-fips:
<<: *pup_5_5_20
pup5.pe-fips:
<<: *pup_5_pe
<<: *acceptance_base
script:
- 'BEAKER_fips=yes bundle exec rake beaker:suites[default]'

pup5.5.20-oel:
<<: *pup_5_5_20
pup5.pe-oel:
<<: *pup_5_pe
<<: *acceptance_base
script:
- 'bundle exec rake beaker:suites[default,oel]'

pup5.5.20-oel-fips:
<<: *pup_5_5_20
pup5.pe-oel-fips:
<<: *pup_5_pe
<<: *acceptance_base
<<: *with_SIMP_ACCEPTANCE_MATRIX_LEVEL_3
script:
- 'BEAKER_fips=yes bundle exec rake beaker:suites[default,oel]'

pup6:
<<: *pup_6
pup6.x:
<<: *pup_6_x
<<: *acceptance_base
script:
- 'bundle exec rake beaker:suites[default]'

pup6-fips:
<<: *pup_6
pup6.x-fips:
<<: *pup_6_x
<<: *acceptance_base
script:
- 'BEAKER_fips=yes bundle exec rake beaker:suites[default]'

pup6.16.0:
<<: *pup_6_16_0
pup6.pe:
<<: *pup_6_pe
<<: *acceptance_base
script:
- 'bundle exec rake beaker:suites[default]'

pup6.16.0-fips:
<<: *pup_6_16_0
pup6.pe-fips:
<<: *pup_6_pe
<<: *acceptance_base
script:
- 'BEAKER_fips=yes bundle exec rake beaker:suites[default]'

pup6.16.0-oel:
<<: *pup_6_16_0
pup6.pe-oel:
<<: *pup_6_pe
<<: *acceptance_base
script:
- 'bundle exec rake beaker:suites[default,oel]'

pup6.16.0-oel-fips:
<<: *pup_6_16_0
pup6.pe-oel-fips:
<<: *pup_6_pe
<<: *acceptance_base
<<: *with_SIMP_ACCEPTANCE_MATRIX_LEVEL_3
script:
Expand Down
6 changes: 4 additions & 2 deletions .pmtignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# .pmtignore is required to mask symlinks from the `puppet module build` test
# In the module's pipeline sanity checks
# ------------------------------------------------------------------------------
# NOTE: This file is managed by puppetsync. Make sure any changes are
# reflected in the control repo.
# NOTICE: **This file is maintained with puppetsync**
#
# This file is automatically updated as part of a puppet module baseline.
# The next baseline sync will overwrite any local changes made to this file.
# ------------------------------------------------------------------------------
.*.sw?
.yardoc
Expand Down
6 changes: 6 additions & 0 deletions .puppet-lint.rc
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# ------------------------------------------------------------------------------
# NOTICE: **This file is maintained with puppetsync**
#
# This file is automatically updated as part of a puppet module baseline.
# The next baseline sync will overwrite any local changes made to this file.
# ------------------------------------------------------------------------------
--log-format="%{path}:%{line}:%{check}:%{KIND}:%{message}"
--relative
--no-class_inherits_from_params_class-check
Expand Down
1 change: 0 additions & 1 deletion .ruby-version

This file was deleted.

6 changes: 6 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# ------------------------------------------------------------------------------
# NOTICE: **This file is maintained with puppetsync**
#
# This file is automatically updated as part of a puppet module baseline.
# The next baseline sync will overwrite any local changes made to this file.
# ------------------------------------------------------------------------------
gem_sources = ENV.fetch('GEM_SERVERS','https://rubygems.org').split(/[, ]+/)

ENV['PDK_DISABLE_ANALYTICS'] ||= 'true'
Expand Down
3 changes: 1 addition & 2 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
:ensure => 'running',
:enable => true,
:hasstatus => true,
:hasrestart => true,
:start => '/sbin/service haldaemon stop; /sbin/service acpid start; /sbin/service haldaemon start',
:hasrestart => true
})
}
end
Expand Down

0 comments on commit 87d3cfb

Please sign in to comment.