|
| 1 | +# The testing matrix considers ruby/puppet versions supported by SIMP and PE: |
| 2 | +# |
| 3 | +# https://puppet.com/docs/pe/2019.0/component_versions_in_recent_pe_releases.html |
| 4 | +# https://puppet.com/misc/puppet-enterprise-lifecycle |
| 5 | +# https://puppet.com/docs/pe/2018.1/overview/getting_support_for_pe.html |
| 6 | +# ------------------------------------------------------------------------------ |
| 7 | +# Release Puppet Ruby EOL |
| 8 | +# SIMP 6.3 5.5.10 2.4.5 TBD*** |
| 9 | +# PE 2018.1 5.5.8 2.4.5 2020-05 (LTS)*** |
| 10 | +# PE 2019.0 6.0 2.5.1 2019-08-31^^^ |
| 11 | +# |
| 12 | +# *** = Modules created for SIMP 6.3+ are not required to support Puppet < 5.5 |
| 13 | +--- |
| 14 | +stages: |
| 15 | + - 'sanity' |
| 16 | + - 'validation' |
| 17 | + - 'acceptance' |
| 18 | + - 'compliance' |
| 19 | + - 'deployment' |
| 20 | + |
| 21 | +variables: |
| 22 | + PUPPET_VERSION: 'UNDEFINED' # <- Matrixed jobs MUST override this (or fail) |
| 23 | + BUNDLER_VERSION: '1.17.1' |
| 24 | + |
| 25 | + # Force dependencies into a path the gitlab-runner user can write to. |
| 26 | + # (This avoids some failures on Runners with misconfigured ruby environments.) |
| 27 | + GEM_HOME: .vendor/gem_install |
| 28 | + BUNDLE_CACHE_PATH: .vendor/bundle |
| 29 | + BUNDLE_PATH: .vendor/bundle |
| 30 | + BUNDLE_BIN: .vendor/gem_install/bin |
| 31 | + BUNDLE_NO_PRUNE: 'true' |
| 32 | + |
| 33 | + |
| 34 | +# bundler dependencies and caching |
| 35 | +# |
| 36 | +# - Cache bundler gems between pipelines foreach Ruby version |
| 37 | +# - Try to use cached and local resources before downloading dependencies |
| 38 | +# -------------------------------------- |
| 39 | +.setup_bundler_env: &setup_bundler_env |
| 40 | + cache: |
| 41 | + untracked: true |
| 42 | + key: "${CI_PROJECT_NAMESPACE}_ruby-${MATRIX_RUBY_VERSION}_bundler" |
| 43 | + paths: |
| 44 | + - '.vendor' |
| 45 | + before_script: |
| 46 | + - '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)"' |
| 47 | + - 'declare GEM_BUNDLER_VER=(-v "~> ${BUNDLER_VERSION:-1.17.1}")' |
| 48 | + - 'declare GEM_INSTALL_CMD=(gem install --no-document)' |
| 49 | + - 'declare BUNDLER_INSTALL_CMD=(bundle install --no-binstubs --jobs $(nproc) "${FLAGS[@]}")' |
| 50 | + - 'mkdir -p ${GEM_HOME} ${BUNDLER_BIN}' |
| 51 | + - 'gem list -ie "${GEM_BUNDLER_VER[@]}" --silent bundler || "${GEM_INSTALL_CMD[@]}" --local "${GEM_BUNDLER_VER[@]}" bundler || "${GEM_INSTALL_CMD[@]}" "${GEM_BUNDLER_VER[@]}" bundler' |
| 52 | + - 'rm -rf pkg/ || :' |
| 53 | + - '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 ; }' |
| 54 | + |
| 55 | +# To avoid running a prohibitive number of tests every commit, |
| 56 | +# don't set this env var in your gitlab instance |
| 57 | +.only_with_SIMP_FULL_MATRIX: &only_with_SIMP_FULL_MATRIX |
| 58 | + only: |
| 59 | + variables: |
| 60 | + - $SIMP_FULL_MATRIX == "yes" |
| 61 | + |
| 62 | +# Puppet Versions |
| 63 | +#----------------------------------------------------------------------- |
| 64 | + |
| 65 | +.pup_5: &pup_5 |
| 66 | + image: 'ruby:2.4' |
| 67 | + variables: |
| 68 | + PUPPET_VERSION: '~> 5.0' |
| 69 | + BEAKER_PUPPET_COLLECTION: 'puppet5' |
| 70 | + MATRIX_RUBY_VERSION: '2.4' |
| 71 | + |
| 72 | +.pup_5_5_10: &pup_5_5_10 |
| 73 | + image: 'ruby:2.4' |
| 74 | + variables: |
| 75 | + PUPPET_VERSION: '5.5.10' |
| 76 | + BEAKER_PUPPET_COLLECTION: 'puppet5' |
| 77 | + MATRIX_RUBY_VERSION: '2.4' |
| 78 | + |
| 79 | +.pup_6: &pup_6 |
| 80 | + image: 'ruby:2.5' |
| 81 | + variables: |
| 82 | + PUPPET_VERSION: '~> 6.0' |
| 83 | + BEAKER_PUPPET_COLLECTION: 'puppet6' |
| 84 | + MATRIX_RUBY_VERSION: '2.5' |
| 85 | + |
| 86 | +# Testing Environments |
| 87 | +#----------------------------------------------------------------------- |
| 88 | + |
| 89 | +.lint_tests: &lint_tests |
| 90 | + stage: 'validation' |
| 91 | + tags: ['docker'] |
| 92 | + <<: *setup_bundler_env |
| 93 | + script: |
| 94 | + - 'bundle exec rake syntax' |
| 95 | + - 'bundle exec rake lint' |
| 96 | + - 'bundle exec rake metadata_lint' |
| 97 | + |
| 98 | +.unit_tests: &unit_tests |
| 99 | + stage: 'validation' |
| 100 | + tags: ['docker'] |
| 101 | + <<: *setup_bundler_env |
| 102 | + script: |
| 103 | + - 'bundle exec rake spec' |
| 104 | + |
| 105 | +.acceptance_base: &acceptance_base |
| 106 | + stage: 'acceptance' |
| 107 | + tags: ['beaker'] |
| 108 | + <<: *setup_bundler_env |
| 109 | + |
| 110 | +.compliance_base: &compliance_base |
| 111 | + stage: 'compliance' |
| 112 | + tags: ['beaker'] |
| 113 | + <<: *setup_bundler_env |
| 114 | + |
| 115 | + |
| 116 | +# Pipeline / testing matrix |
| 117 | +#======================================================================= |
| 118 | + |
| 119 | +sanity_checks: |
| 120 | + <<: *pup_5 |
| 121 | + <<: *setup_bundler_env |
| 122 | + stage: 'sanity' |
| 123 | + tags: ['docker'] |
| 124 | + script: |
| 125 | + - 'if `hash apt-get`; then apt-get update; fi' |
| 126 | + - 'if `hash apt-get`; then apt-get install -y rpm; fi' |
| 127 | + - 'bundle exec rake check:dot_underscore' |
| 128 | + - 'bundle exec rake check:test_file' |
| 129 | + - 'bundle exec rake pkg:check_version' |
| 130 | + - 'bundle exec rake pkg:compare_latest_tag' |
| 131 | + - 'bundle exec rake pkg:create_tag_changelog' |
| 132 | + - 'bundle exec puppet module build' |
| 133 | + |
| 134 | +# Linting |
| 135 | +#----------------------------------------------------------------------- |
| 136 | + |
| 137 | +pup5-lint: |
| 138 | + <<: *pup_5 |
| 139 | + <<: *lint_tests |
| 140 | + |
| 141 | +pup6-lint: |
| 142 | + <<: *pup_6 |
| 143 | + <<: *lint_tests |
| 144 | + |
| 145 | +# Unit Tests |
| 146 | +#----------------------------------------------------------------------- |
| 147 | + |
| 148 | +pup5-unit: |
| 149 | + <<: *pup_5 |
| 150 | + <<: *unit_tests |
| 151 | + |
| 152 | +pup5.5.10-unit: |
| 153 | + <<: *pup_5_5_10 |
| 154 | + <<: *unit_tests |
| 155 | + |
| 156 | +pup6-unit: |
| 157 | + <<: *pup_6 |
| 158 | + <<: *unit_tests |
| 159 | + |
| 160 | +# Acceptance tests |
| 161 | +# ============================================================================== |
| 162 | +pup5.5.10: |
| 163 | + <<: *pup_5_5_10 |
| 164 | + <<: *acceptance_base |
| 165 | + script: |
| 166 | + # ERROR: nodeset is a broken link |
| 167 | + - 'bundle exec rake beaker:suites[default,nodeset_broken_link]' |
0 commit comments