Skip to content

Commit 4d64a8b

Browse files
authored
Merge pull request #66 from voxpupuli/update_ci_example
feat: Update gitlab-ci example
2 parents 1a26131 + df9c378 commit 4d64a8b

File tree

1 file changed

+106
-40
lines changed

1 file changed

+106
-40
lines changed

.gitlab-ci.yml

Lines changed: 106 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,155 @@
11
---
22
# Example of a CI/CD pipeline for a Puppet module
3+
# Pipeline runs on main and merge_requests, but not on tags.
4+
#
35
stages:
4-
- QA🚦
5-
- Test🚥
6+
- 🚦 QA
7+
- 🚥 Test
68

79
variables:
10+
# Use internal default Rakefile, to make sure we have a working version
811
RAKE: rake -f /Rakefile
912

1013
default:
1114
image:
12-
name: ghcr.io/voxpupuli/vobox:7.29.1-main
15+
name: ghcr.io/voxpupuli/voxbox:7.34.0-main
1316
entrypoint: [""]
1417

15-
### QA🚦
18+
### Templates #################################################################
19+
.default_rules:
20+
rules:
21+
- &puppetfile
22+
if: '$CI_COMMIT_TAG == null'
23+
exists:
24+
- 'Puppetfile'
25+
changes:
26+
- 'Puppetfile'
27+
28+
### 🚦 QA ######################################################################
1629
.qa:
17-
stage: QA🚦
30+
stage: 🚦 QA
1831

1932
qa-check:
2033
extends: .qa
2134
script:
2235
- $RAKE check
36+
rules:
37+
- if: '$CI_COMMIT_TAG == null'
2338

2439
qa-lint:
2540
extends: .qa
2641
script:
27-
- $RAKE lint
42+
- $RAKE voxpupuli:custom:lint_all
43+
rules:
44+
- if: '$CI_COMMIT_TAG == null'
45+
changes:
46+
- '**/*.pp'
2847

29-
qa-metadata_lint:
48+
qa-yamllint:
3049
extends: .qa
3150
script:
32-
- $RAKE metadata_lint
51+
- yamllint data/
52+
rules:
53+
- if: '$CI_COMMIT_TAG == null'
54+
changes:
55+
- 'data/**/*.yaml'
3356

34-
qa-puppet-strings:
57+
qa-metadata_lint:
3558
extends: .qa
3659
script:
37-
- $RAKE strings:validate:reference
60+
- $RAKE metadata_lint
61+
rules:
62+
- if: '$CI_COMMIT_TAG == null'
63+
changes:
64+
- metadata.json
3865

3966
qa-rubocop:
4067
extends: .qa
4168
script:
4269
- $RAKE rubocop
70+
rules:
71+
- if: '$CI_COMMIT_TAG == null'
72+
changes:
73+
- '**/*.rb'
74+
75+
qa-strings:
76+
extends: .qa
77+
script:
78+
- $RAKE strings:validate:reference
79+
rules:
80+
- if: '$CI_COMMIT_TAG == null'
81+
exists:
82+
- REFERENCE.md
4383

4484
qa-syntax:
4585
extends: .qa
4686
script:
4787
- $RAKE syntax
88+
rules:
89+
- if: '$CI_COMMIT_TAG == null'
90+
changes:
91+
- 'data/**/*.yaml'
92+
- 'manifests/**/*.pp'
93+
- 'plans/**/*.pp'
94+
- 'templates/**/*.epp'
95+
- 'templates/**/*.erb'
4896

49-
qa-gateway:
50-
stage: QA🚦
51-
image: alpine:latest
97+
qa-r10k-syntax:
98+
extends: .qa
5299
script:
53-
- echo "QA Gateway"
54-
variables:
55-
GIT_STRATEGY: none
56-
needs:
57-
- qa-check
58-
- qa-lint
59-
- qa-metadata_lint
60-
- qa-puppet-strings
61-
- qa-rubocop
62-
- qa-syntax
63-
64-
### Test🚥
100+
- $RAKE r10k:syntax
101+
rules:
102+
- *puppetfile
103+
104+
qa-r10k-duplicates:
105+
extends: .qa
106+
script:
107+
- $RAKE r10k:duplicates
108+
rules:
109+
- *puppetfile
110+
111+
qa-r10k-validate:
112+
extends: .qa
113+
script:
114+
- $RAKE r10k:validate
115+
rules:
116+
- *puppetfile
117+
118+
### 🚥 Test ####################################################################
65119
.test:
66-
stage: Test🚥
67-
needs:
68-
- qa-gateway
120+
stage: 🚥 Test
69121

70122
test-unit:
71123
extends: .test
72124
script:
73-
- $RAKE spec
125+
- $RAKE spec
126+
rules:
127+
- if: '$CI_COMMIT_TAG == null'
128+
changes:
129+
- 'data/**/*.yaml'
130+
- 'manifests/**/*.pp'
131+
- 'plans/**/*.pp'
132+
- 'spec/**/*_spec.rb'
133+
- 'templates/**/*.epp'
134+
- 'templates/**/*.erb'
74135

75-
test-acceptance:
136+
test-r10k-install:
76137
extends: .test
77138
script:
78-
- $RAKE beaker
139+
- $RAKE r10k:install
140+
rules:
141+
- *puppetfile
79142

80-
test-gateway:
81-
stage: Test🚥
82-
image: alpine:latest
143+
test-acceptance:
144+
extends: .test
83145
script:
84-
- echo "Test Gateway"
85-
variables:
86-
GIT_STRATEGY: none
87-
needs:
88-
- test-unit
89-
- test-acceptance
146+
- $RAKE beaker
147+
rules:
148+
- if: '$CI_COMMIT_TAG == null'
149+
changes:
150+
- 'data/**/*.yaml'
151+
- 'manifests/**/*.pp'
152+
- 'plans/**/*.pp'
153+
- 'spec/**/*_spec.rb'
154+
- 'templates/**/*.epp'
155+
- 'templates/**/*.erb'

0 commit comments

Comments
 (0)