diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0c35bc5..520e38c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,249 +5,240 @@ # https://puppet.com/docs/pe/2018.1/overview/getting_support_for_pe.html # ------------------------------------------------------------------------------ # Release Puppet Ruby EOL -# PE 2016.4.15 4.10.12 2.1.9 2018-12 (LTS) -# SIMP 6.0 4.8.2 2.1.9 TBD # SIMP 6.1 4.10.6 2.1.9 TBD # SIMP 6.2 4.10.12 2.1.9 TBD +# PE 2016.4.15 4.10.12 2.1.9 2018-12 (LTS) +# PE 2017.3.10 5.3.8 2.4.4 2018-12 (STS) # SIMP 6.3 5.5.7 2.4.4 TBD*** # PE 2018.1 5.5.6 2.4.4 2020-05 (LTS)*** +# PE 2019.0 6.0 2.5.1 2019-08-31^^^ # # *** = Modules created for SIMP 6.3+ are not required to support Puppet < 5.5 +# ^^^ = SIMP doesn't support 6 yet; tests are info-only and allowed to fail --- -.cache_bundler: &cache_bundler +stages: + - 'sanity' + - 'validation' + - 'acceptance' + - 'compliance' + - 'deployment' + +image: 'ruby:2.4' + +variables: + PUPPET_VERSION: 'UNDEFINED' # <- Matrixed jobs MUST override this (or fail) + BUNDLER_VERSION: '1.17.1' + + # Force dependencies into a path the gitlab-runner user can write to. + # (This avoids some failures on Runners with misconfigured ruby environments.) + GEM_HOME: .vendor/gem_install + BUNDLE_CACHE_PATH: .vendor/bundle + BUNDLE_PATH: .vendor/bundle + BUNDLE_BIN: .vendor/gem_install/bin + BUNDLE_NO_PRUNE: 'true' + + +# bundler dependencies and caching +# +# - Cache bundler gems between pipelines foreach Ruby version +# - Try to use cached and local resources before downloading dependencies +# -------------------------------------- +.setup_bundler_env: &setup_bundler_env cache: untracked: true - # A broad attempt at caching between runs (ala Travis CI) - key: "${CI_PROJECT_NAMESPACE}__bundler" + key: "${CI_PROJECT_NAMESPACE}_ruby-${MATRIX_RUBY_VERSION}_bundler" paths: - '.vendor' - - 'vendor' - -.setup_bundler_env: &setup_bundler_env before_script: - - 'echo Files in cache: $(find .vendor | wc -l) || :' - - 'export GEM_HOME=.vendor/gem_install' - - 'export BUNDLE_CACHE_PATH=.vendor/bundler' - - 'declare GEM_BUNDLER_VER=(-v ''~> ${BUNDLER_VERSION:-1.16.0}'')' - - declare GEM_INSTALL=(gem install --no-document) - - declare BUNDLER_INSTALL=(bundle install --no-binstubs --jobs $(nproc) --path=.vendor "${FLAGS[@]}") - - gem list -ie "${GEM_BUNDLE_VER[@]}" --silent bundler || "${GEM_INSTALL[@]}" --local "${GEM_BUNDLE_VER[@]}" bundler || "${GEM_INSTALL[@]}" "${GEM_BUNDLE_VER[@]}" bundler + - 'ruby -e "puts %(Environment Variables:\n * #{ENV.keys.grep(/PUPPET|SIMP|BEAKER|MATRIX/).map{|v| %(#{v} = #{ENV[v]})}.join(%(\n * ))})"' + - 'declare GEM_BUNDLER_VER=(-v "~> ${BUNDLER_VERSION:-1.17.0}")' + - 'declare GEM_INSTALL_CMD=(gem install --no-document)' + - 'declare BUNDLER_INSTALL_CMD=(bundle install --no-binstubs --jobs $(nproc) "${FLAGS[@]}")' + - 'mkdir -p ${GEM_HOME} ${BUNDLER_BIN}' + - 'gem list -ie "${GEM_BUNDLER_VER[@]}" --silent bundler || "${GEM_INSTALL_CMD[@]}" --local "${GEM_BUNDLER_VER[@]}" bundler || "${GEM_INSTALL_CMD[@]}" "${GEM_BUNDLER_VER[@]}" bundler' - 'rm -rf pkg/ || :' - - bundle check || rm -f Gemfile.lock && ("${BUNDLER_INSTALL[@]}" --local || "${BUNDLER_INSTALL[@]}") - - -.validation_checks: &validation_checks - script: - - bundle exec rake syntax - - bundle exec rake check:dot_underscore - - bundle exec rake check:test_file - - bundle exec rake pkg:check_version - - bundle exec rake pkg:compare_latest_tag - - bundle exec rake lint - - bundle exec rake clean - - bundle exec puppet module build - -.spec_tests: &spec_tests - script: - - bundle exec rake spec + - '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 ; }' # To avoid running a prohibitive number of tests every commit, # don't set this env var in your gitlab instance .only_with_SIMP_FULL_MATRIX: &only_with_SIMP_FULL_MATRIX only: variables: - - $SIMP_FULL_MATRIX + - $SIMP_FULL_MATRIX == "yes" -stages: - - validation - - unit - - acceptance - - deploy +# Puppet Versions +#----------------------------------------------------------------------- -# Puppet 4.10 for PE 2017.2 support (EOL:2018-02-21) -# See: https://puppet.com/misc/puppet-enterprise-lifecycle -# -------------------------------------- -pup4_10-validation: - stage: validation - tags: - - docker - image: ruby:2.1 +.pup_4: &pup_4 + image: 'ruby:2.4' variables: - PUPPET_VERSION: '~> 4.10.0' - <<: *cache_bundler - <<: *setup_bundler_env - <<: *validation_checks + PUPPET_VERSION: '~> 4.0' + MATRIX_RUBY_VERSION: '2.1' -pup4_10-unit: - stage: unit - tags: - - docker - image: ruby:2.1 +.pup_4_10: &pup_4_10 + image: 'ruby:2.1' variables: - PUPPET_VERSION: '~> 4.10.0' - <<: *cache_bundler - <<: *setup_bundler_env - <<: *spec_tests + PUPPET_VERSION: '~> 4.10.4' + MATRIX_RUBY_VERSION: '2.1' - -# Puppet 5.5 for PE 2018.1 -# See: https://puppet.com/misc/puppet-enterprise-lifecycle -# -------------------------------------- -pup5_5-validation: - stage: validation - tags: - - docker - image: ruby:2.4 +.pup_5: &pup_5 + image: 'ruby:2.4' variables: - PUPPET_VERSION: '5.5.6' - <<: *cache_bundler - <<: *setup_bundler_env - <<: *validation_checks + PUPPET_VERSION: '~> 5.0' + BEAKER_PUPPET_COLLECTION: 'puppet5' + MATRIX_RUBY_VERSION: '2.4' -pup5_5-unit: - stage: unit - tags: - - docker - image: ruby:2.4 +.pup_5_3: &pup_5_3 + image: 'ruby:2.4' variables: - PUPPET_VERSION: '5.5.6' - <<: *cache_bundler - <<: *setup_bundler_env - <<: *spec_tests - + PUPPET_VERSION: '~> 5.3.0' + BEAKER_PUPPET_COLLECTION: 'puppet5' + MATRIX_RUBY_VERSION: '2.4' -# Keep an eye on the latest puppet 5 -# ---------------------------------- -pup5_latest-validation: - stage: validation - tags: - - docker - image: ruby:2.4 +.pup_5_5_7: &pup_5_5_7 + image: 'ruby:2.4' variables: - PUPPET_VERSION: '~> 5.0' - <<: *cache_bundler - <<: *setup_bundler_env - <<: *validation_checks + PUPPET_VERSION: '5.5.7' + BEAKER_PUPPET_COLLECTION: 'puppet5' + MATRIX_RUBY_VERSION: '2.4' -pup5_latest-unit: - stage: unit - tags: - - docker - image: ruby:2.4 +.pup_6: &pup_6 + allow_failure: true + image: 'ruby:2.5' variables: - PUPPET_VERSION: '~> 5.0' - <<: *cache_bundler - <<: *setup_bundler_env - <<: *spec_tests + PUPPET_VERSION: '~> 6.0' + BEAKER_PUPPET_COLLECTION: 'puppet6' + MATRIX_RUBY_VERSION: '2.5' +# Testing Environments +#----------------------------------------------------------------------- -# Acceptance tests -# ============================================================================== -default: - stage: acceptance - tags: - - beaker - <<: *cache_bundler +.lint_tests: &lint_tests + stage: 'validation' + tags: ['docker'] <<: *setup_bundler_env - variables: - PUPPET_VERSION: '~> 4.10.0' script: - - bundle exec rake spec_clean - - bundle exec rake beaker:suites[default] - -default-fips: - stage: acceptance - tags: - - beaker - <<: *cache_bundler + - 'bundle exec rake syntax' + - 'bundle exec rake lint' + - 'bundle exec rake metadata_lint' + +.unit_tests: &unit_tests + stage: 'validation' + tags: ['docker'] <<: *setup_bundler_env - <<: *only_with_SIMP_FULL_MATRIX - variables: - PUPPET_VERSION: '~> 4.10.0' - BEAKER_fips: 'yes' script: - - bundle exec rake spec_clean - - bundle exec rake beaker:suites[default] - -default-puppet5: - stage: acceptance - tags: - - beaker - <<: *cache_bundler + - 'bundle exec rake spec' + +.acceptance_tests: &acceptance_tests + stage: 'acceptance' + tags: ['beaker'] <<: *setup_bundler_env - variables: - PUPPET_VERSION: '~> 5.5.6' - BEAKER_PUPPET_COLLECTION: 'puppet5' - script: - - bundle exec rake spec_clean - - bundle exec rake beaker:suites[default] - -default-puppet5-fips: - stage: acceptance - tags: - - beaker - <<: *cache_bundler + +.compliance_tests: &compliance_tests + stage: 'compliance' + tags: ['beaker'] <<: *setup_bundler_env - variables: - PUPPET_VERSION: '~> 5.5.6' - BEAKER_PUPPET_COLLECTION: 'puppet5' - BEAKER_fips: 'yes' - script: - - bundle exec rake spec_clean - - bundle exec rake beaker:suites[default] - -default-oel: - stage: acceptance - tags: - - beaker - <<: *cache_bundler + + +# Pipeline / testing matrix +#======================================================================= + +sanity_checks: + <<: *pup_5 <<: *setup_bundler_env - <<: *only_with_SIMP_FULL_MATRIX - variables: - PUPPET_VERSION: '~> 4.10.0' + stage: 'sanity' + tags: ['docker'] script: - - bundle exec rake spec_clean - - bundle exec rake beaker:suites[default,oel] - -default-oel-fips: - stage: acceptance - tags: - - beaker - <<: *cache_bundler - <<: *setup_bundler_env + - 'if `hash apt-get`; then apt-get update; fi' + - 'if `hash apt-get`; then apt-get install -y rpm; fi' + - 'bundle exec rake check:dot_underscore' + - 'bundle exec rake check:test_file' + - 'bundle exec rake pkg:check_version' + - 'bundle exec rake pkg:compare_latest_tag' + - 'bundle exec rake pkg:create_tag_changelog' + - 'bundle exec puppet module build' + +# Linting +#----------------------------------------------------------------------- + +pup4-lint: + <<: *pup_4 + <<: *lint_tests + +pup5-lint: + <<: *pup_5 + <<: *lint_tests + +pup6-lint: + <<: *pup_6 + <<: *lint_tests + +# Unit Tests +#----------------------------------------------------------------------- + +pup4.10-unit: + <<: *pup_4_10 + <<: *unit_tests + +pup5-unit: + <<: *pup_5 + <<: *unit_tests + +pup5.3-unit: + <<: *pup_5_3 + <<: *unit_tests + +pup5.5.7-unit: + <<: *pup_5_5_7 + <<: *unit_tests + +pup6-unit: + <<: *pup_6 + <<: *unit_tests + +# Acceptance Tests +# ============================================================================== +pup4.10: + <<: *pup_4_10 + <<: *acceptance_tests + script: + - 'bundle exec rake beaker:suites' + +pup4.10-fips: + <<: *pup_4_10 + <<: *acceptance_tests <<: *only_with_SIMP_FULL_MATRIX - variables: - PUPPET_VERSION: '~> 4.10.0' - BEAKER_fips: 'yes' script: - - bundle exec rake spec_clean - - bundle exec rake beaker:suites[default,oel] - -default-oel-puppet5: - stage: acceptance - tags: - - beaker - <<: *cache_bundler - <<: *setup_bundler_env - variables: - PUPPET_VERSION: '~> 5.5.6' - BEAKER_PUPPET_COLLECTION: 'puppet5' + - 'BEAKER_fips=yes bundle exec rake beaker:suites' + +pup5.5.7: + <<: *pup_5_5_7 + <<: *acceptance_tests script: - - bundle exec rake spec_clean - - bundle exec rake beaker:suites[default,oel] - -default-oel-puppet5-fips: - stage: acceptance - tags: - - beaker - <<: *cache_bundler - <<: *setup_bundler_env + - 'bundle exec rake beaker:suites' + +pup5.5.7-fips: + <<: *pup_5_5_7 + <<: *acceptance_tests + script: + - 'BEAKER_fips=yes bundle exec rake beaker:suites' + +pup5.5.7-oel: + <<: *pup_5_5_7 + <<: *acceptance_tests + script: + - 'bundle exec rake beaker:suites[default,oel]' + +pup5.5.7-oel-fips: + <<: *pup_5_5_7 + <<: *acceptance_tests <<: *only_with_SIMP_FULL_MATRIX - variables: - PUPPET_VERSION: '~> 5.5.6' - BEAKER_PUPPET_COLLECTION: 'puppet5' - BEAKER_fips: 'yes' script: - - bundle exec rake spec_clean - - bundle exec rake beaker:suites[default,oel] + - 'BEAKER_fips=yes bundle exec rake beaker:suites[default,oel]' + +# pup5.5.7-compliance-fips: +# <<: *pup_5_5_7 +# <<: *compliance_tests +# script: +# - 'BEAKER_fips=yes bundle exec rake beaker:suites[compliance]' diff --git a/.travis.yml b/.travis.yml index e33d5a8..644b014 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,19 +5,27 @@ # https://puppet.com/docs/pe/2018.1/overview/getting_support_for_pe.html # ------------------------------------------------------------------------------ # Release Puppet Ruby EOL -# PE 2016.4.15 4.10.12 2.1.9 2018-12 (LTS) -# SIMP 6.0 4.8.2 2.1.9 TBD -# SIMP 6.1 4.10.6 2.1.9 TBD -# SIMP 6.2 4.10.12 2.1.9 TBD -# SIMP 6.3 5.5.7 2.4.4 TBD*** -# PE 2018.1 5.5.6 2.4.4 2020-05 (LTS)*** +# SIMP 6.2 4.10 2.1.9 TBD +# PE 2016.4 4.10 2.1.9 2018-12-31 (LTS) +# PE 2017.3 5.3 2.4.4 2018-12-31 +# SIMP 6.3 5.5 2.4.4 TBD*** +# PE 2018.1 5.5 2.4.4 2020-05 (LTS)*** +# PE 2019.0 6.0 2.5.1 2019-08-31^^^ # # *** = Modules created for SIMP 6.3+ are not required to support Puppet < 5.5 +# ^^^ = SIMP doesn't support 6 yet; tests are info-only and allowed to fail + --- language: ruby cache: bundler sudo: false +stages: + - check + - spec + - name: deploy + if: 'fork = false AND tag = true' + bundler_args: --without development system_tests --path .vendor notifications: @@ -31,36 +39,60 @@ addons: before_install: - rm -f Gemfile.lock +global: + - STRICT_VARIABLES=yes + jobs: + allow_failures: + - name: 'Latest Puppet 6.x (allowed to fail)' + include: - stage: check + name: 'Syntax, style, and validation checks' rvm: 2.4.4 - env: STRICT_VARIABLES=yes PUPPET_VERSION="~> 5.5" + env: PUPPET_VERSION="~> 5.5" script: - bundle exec rake check:dot_underscore - bundle exec rake check:test_file - - bundle exec rake lint - - bundle exec rake metadata_lint - bundle exec rake pkg:check_version + - bundle exec rake metadata_lint - bundle exec rake pkg:compare_latest_tag - bundle exec rake pkg:create_tag_changelog + - bundle exec rake lint - bundle exec puppet module build - stage: spec + name: 'Puppet 4.10 (SIMP 6.2, PE 2016.4)' + rvm: 2.1.9 + env: PUPPET_VERSION="~> 4.10.0" + script: + - bundle exec rake spec + + - stage: spec + name: 'Puppet 5.3 (PE 2017.3)' rvm: 2.4.4 - env: STRICT_VARIABLES=yes PUPPET_VERSION="~> 5.5.6" + env: PUPPET_VERSION="~> 5.3.0" script: - bundle exec rake spec - stage: spec rvm: 2.4.4 - env: STRICT_VARIABLES=yes PUPPET_VERSION="~> 5.5" + name: 'Puppet 5.5 (SIMP 6.3, PE 2018.1)' + env: PUPPET_VERSION="~> 5.5.0" script: - bundle exec rake spec - stage: spec - rvm: 2.1.9 - env: STRICT_VARIABLES=yes PUPPET_VERSION="~> 4.10.4" + name: 'Latest Puppet 5.x' + rvm: 2.4.4 + env: PUPPET_VERSION="~> 5.0" + script: + - bundle exec rake spec + + - stage: spec + name: 'Latest Puppet 6.x (allowed to fail)' + rvm: 2.5.1 + env: PUPPET_VERSION="~> 6.0" script: - bundle exec rake spec @@ -86,5 +118,4 @@ jobs: secure: "Os40yaNVVU3ypsLac11cu7PYfv0mdilx1qBA8euk12xoJxhYzrLz7n4Zlp/Bx+6knmMOeucUy6U0PKg3XCasTGFKKImw3h4X3kTOby0xcxGj4BAsxySv10JcB9x7MrIT5+Q9rx+vOef/kotNSMMWxNNVniV5VjrjuX+qOK4NtzhtyQLIpleZZ02geYSPLBCe+R5pPaf5D/zsWMu+v7oaqI9VM0XuvSGQAHNbSO97/trNgJP/nDeK/zWBzkGD/EP9wmJj9lfNSl9oa50uclqNkgHZ91SXmYv7f+YlqxpsbDKsoFs2HGPnGiipyIA0EEJXHTiknJ3v7XLveH3/ENE6hem3nJ+82WeQyMbsJTEmvb0vmTsiRTgls8GlpInG/ykBSGhqQdY21oYMS4PCvS2+CCZUw6qjaDokiTk5AeSugQNSiU1lqcRXUacYDwn0F8LR49ixDsPtoCsnvy/FRU87tr10ZyrnBtIGqgChJUsLhBA9s4FIzP9WmO6rUxZ0qufDq/wMHDRyPBPHNch5yTURGbOkGYzGkZ3u8cL5ezmGCteSKBOYsRNr45F9/ld1Rg+XfJ68UX8nysHs+GLMnaoD5l8vHHZu/nqcZbc2fEivQQ3OP2g2RzPF6WeBX8Fv20EZT9ZuAeGJEQkRySpp6jTjtSFUlhPUMbWXYwEbODESrHU=" on: tags: true - rvm: 2.4.4 condition: '($SKIP_FORGE_PUBLISH != true)' diff --git a/Gemfile b/Gemfile index dc17e44..43226f2 100644 --- a/Gemfile +++ b/Gemfile @@ -1,13 +1,10 @@ -# ------------------------------------------------------------------------------ -# NOTE: SIMP Puppet rake tasks support ruby 2.4.4 -# ------------------------------------------------------------------------------ gem_sources = ENV.fetch('GEM_SERVERS','https://rubygems.org').split(/[, ]+/) gem_sources.each { |gem_source| source gem_source } group :test do gem 'rake' - gem 'puppet', ENV.fetch('PUPPET_VERSION', '~> 5.5') + gem 'puppet', ENV.fetch('PUPPET_VERSION', '~> 5.5') gem 'rspec' gem 'rspec-puppet' gem 'hiera-puppet-helper'