forked from simp/rubygem-simp-rake-helpers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
139 lines (116 loc) · 4.26 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# The testing matrix considers ruby/puppet versions supported by SIMP:
# --------------------------------------------------------------------
# Release Puppet Ruby EOL
# SIMP 6.4 5.5 2.4.10 TBD
# SIMP 6.5 6.18 2.5.7 TBD
---
stages:
- validation
- acceptance
- deploy
image: 'ruby:2.5'
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
key: "${CI_PROJECT_NAMESPACE}_ruby-${MATRIX_RUBY_VERSION}_bundler"
paths:
- '.vendor'
before_script:
- '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.16.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_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
.with_SIMP_ACCEPTANCE_MATRIX_LEVEL_3: &with_SIMP_ACCEPTANCE_MATRIX_LEVEL_3
only:
variables:
- $SIMP_FULL_MATRIX == "yes"
# Puppet Versions
#-----------------------------------------------------------------------
.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_18: &pup_6_18
image: 'ruby:2.5'
variables:
PUPPET_VERSION: '~> 6.18.0'
BEAKER_PUPPET_COLLECTION: 'puppet6'
MATRIX_RUBY_VERSION: '2.5'
.pup_6_18: &pup_6_x
image: 'ruby:2.5'
variables:
PUPPET_VERSION: '~> 6.18'
BEAKER_PUPPET_COLLECTION: 'puppet6'
MATRIX_RUBY_VERSION: '2.5'
.validation_checks: &validation_checks
stage: validation
tags: ['docker']
<<: *setup_bundler_env
script:
- bundle exec rake clean
- bundle exec rake pkg:gem
.spec_tests: &spec_tests
stage: validation
tags: ['docker']
<<: *setup_bundler_env
script:
- 'command -v rpmbuild || if command -v apt-get; then apt-get update; apt-get install -y rpm; fi ||:'
- 'command -v rpmbuild || if command -v yum; then yum install -y rpm-build; fi ||:'
- 'command -v rpmbuild || { >&2 echo "FATAL: Cannot find executable: ''rpmbuild''"; exit 1 ;}'
- 'bundle exec rake spec'
.acceptance_base: &acceptance_base
stage: 'acceptance'
tags: ['beaker']
<<: *setup_bundler_env
# Puppet 5.5 for PE 2018.1 support
# See: https://puppet.com/misc/puppet-enterprise-lifecycle
# --------------------------------------
pup6.18-validation:
<<: *pup_6_18
<<: *validation_checks
pup6.18-unit:
<<: *pup_6_18
<<: *spec_tests
pup6.latest-validation:
<<: *pup_6_x
<<: *validation_checks
pup6.latest-unit:
<<: *pup_6_x
<<: *spec_tests
# Acceptance tests
# ==============================================================================
acceptance:
<<: *acceptance_base
<<: *pup_6_18
script:
- 'bundle exec rake acceptance'
allow_failure: true # FIXME: add docker to GLCI beaker runners
fips-acceptance:
<<: *acceptance_base
<<: *pup_6_18
script:
- 'BEAKER_fips=yes bundle exec rake acceptance'
allow_failure: true