-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
300 lines (233 loc) · 5.95 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
---
# This file is templated, please edit it in the templates folder
stages:
- lint
- contain
- scan
.env_entrypoint:
image:
name: _ # Placeholder to keep YAML schemea happy
entrypoint: &env_entrypoint
- "/usr/bin/env"
- "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
lint:templates:
stage: lint
image: alpine
variables:
faq_version: 0.0.6
gomplate_version: 3.6.0
before_script:
- >
wget
"https://github.com/jzelinskie/faq/releases/download/${faq_version}/faq-linux-amd64"
-O /bin/faq
- >
wget
"https://github.com/hairyhenderson/gomplate/releases/download/v${gomplate_version}/gomplate_linux-amd64"
-O /bin/gomplate
- chmod +x /bin/faq /bin/gomplate
script:
- echo "Checking for differences in templates"
- ./scripts/build_templates.sh --diff
- echo "Checking for differences in Dockerfile templates"
- ./scripts/build_dockerfile_templates.sh --diff
lint:shell:
stage: lint
image: docker
services:
- docker:dind
before_script:
- docker --version
script:
- LIST_OF_SHELL=$(find -path '.git' -prune -o -print | egrep "\.sh$")
- docker run -v "$PWD:/mnt" koalaman/shellcheck $LIST_OF_SHELL
lint:yaml:
stage: lint
image: pipelinecomponents/yamllint
before_script:
- yamllint --version
script:
- yamllint --strict .
# Common markdown config
.markdown:
stage: lint
image:
name: registry.gitlab.com/06kellyjac/docker_markdownlint-cli
entrypoint: *env_entrypoint
# Don't prevent fixing own image
allow_failure: true
before_script:
- markdownlint --version
script:
- markdownlint .
lint:markdown:docker_hub:
extends: .markdown
image:
name: 06kellyjac/markdownlint-cli
lint:markdown:gitlab:
extends: .markdown
lint:docker:
stage: lint
image:
name: hadolint/hadolint:latest-debian
entrypoint: *env_entrypoint
before_script:
- hadolint --version
script:
- LIST_OF_DOCKERFILES="$(find -type f -name "Dockerfile*" ! -path "./.git/*" ! -path "./templates/*")"
- hadolint $LIST_OF_DOCKERFILES
.contain:
stage: contain
only:
- master
image: docker
services:
- docker:dind
before_script:
- docker --version
script:
- ./scripts/ci_contain.sh
contain:docker:latest:
extends: .contain
contain:docker:latest-slim:
extends: .contain
contain:docker:0.29.0:
extends: .contain
contain:docker:0.29.0-slim:
extends: .contain
contain:docker:0.28.1:
extends: .contain
contain:docker:0.28.1-slim:
extends: .contain
contain:docker:0.28.0:
extends: .contain
contain:docker:0.28.0-slim:
extends: .contain
contain:docker:0.27.1:
extends: .contain
contain:docker:0.27.1-slim:
extends: .contain
contain:docker:0.27.0:
extends: .contain
contain:docker:0.27.0-slim:
extends: .contain
contain:docker:0.26.0:
extends: .contain
contain:docker:0.26.0-slim:
extends: .contain
contain:docker:0.25.0:
extends: .contain
contain:docker:0.25.0-slim:
extends: .contain
contain:docker:0.24.0:
extends: .contain
contain:docker:0.24.0-slim:
extends: .contain
contain:docker:0.23.2:
extends: .contain
contain:docker:0.23.2-slim:
extends: .contain
contain:docker:0.23.1:
extends: .contain
contain:docker:0.23.1-slim:
extends: .contain
contain:docker:0.23.0:
extends: .contain
contain:docker:0.23.0-slim:
extends: .contain
contain:docker:0.22.0:
extends: .contain
contain:docker:0.22.0-slim:
extends: .contain
contain:docker:0.21.0:
extends: .contain
contain:docker:0.21.0-slim:
extends: .contain
contain:docker:0.20.0:
extends: .contain
contain:docker:0.20.0-slim:
extends: .contain
contain:docker:0.19.0:
extends: .contain
contain:docker:0.19.0-slim:
extends: .contain
contain:docker:0.18.0:
extends: .contain
contain:docker:0.18.0-slim:
extends: .contain
contain:docker:0.17.0:
extends: .contain
contain:docker:0.17.0-slim:
extends: .contain
contain:docker:0.16.0:
extends: .contain
contain:docker:0.16.0-slim:
extends: .contain
contain:docker:0.15.0:
extends: .contain
contain:docker:0.15.0-slim:
extends: .contain
contain:docker:0.14.1:
extends: .contain
contain:docker:0.14.1-slim:
extends: .contain
contain:docker:0.14.0:
extends: .contain
contain:docker:0.14.0-slim:
extends: .contain
contain:docker:0.13.0:
extends: .contain
contain:docker:0.13.0-slim:
extends: .contain
contain:docker:0.12.0:
extends: .contain
contain:docker:0.12.0-slim:
extends: .contain
contain:docker:0.11.0:
extends: .contain
contain:docker:0.11.0-slim:
extends: .contain
contain:docker:0.10.0:
extends: .contain
contain:docker:0.10.0-slim:
extends: .contain
container_scanning:
stage: scan
only:
- master
image: docker:stable
variables:
DOCKER_DRIVER: overlay2
DOCKER_IMAGE: $CI_REGISTRY_IMAGE
allow_failure: true
services:
- docker:stable-dind
artifacts:
paths:
- gl-container-scanning-report.json
script:
- docker run -d --name db arminc/clair-db:latest
- >
docker run -p 6060:6060 --link db:postgres -d --name clair --restart on-failure
arminc/clair-local-scan:v2.1.0_8cb406fdb7ae7dc6fed05032b036a365391aaf42
- apk add -U wget ca-certificates
- docker pull ${DOCKER_IMAGE}
- wget -O clair-scanner https://github.com/arminc/clair-scanner/releases/download/v12/clair-scanner_linux_amd64
- chmod +x clair-scanner
- touch clair-whitelist.yml
- while( ! wget -q -O /dev/null http://docker:6060/v1/namespaces ) ; do sleep 1 ; done
- retries=0
- echo "Waiting for clair daemon to start"
- |
while( ! wget -timeout=10 -q -O /dev/null http://docker:6060/v1/namespaces ); do
sleep 1
echo -n "."
if [ $retries -eq 10 ]; then
echo " Timeout, aborting."
exit 1
fi
retries=$(($retries+1))
done
- >
./clair-scanner -c http://docker:6060 --ip $(hostname -i) -r gl-container-scanning-report.json
-l clair.log -w clair-whitelist.yml ${DOCKER_IMAGE} || true