-
Notifications
You must be signed in to change notification settings - Fork 5
/
.gitlab-ci.yml
341 lines (313 loc) · 8.54 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
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
---
variables:
SCAN_KUBERNETES_MANIFESTS: "true"
include:
template: Security/SAST.gitlab-ci.yml
stages:
- test
- build
- autopkgtest
- docker-pre
- docker
- docker-post
#- dockertest
- release
.build: &build
stage: test
services:
- postgres:11
- name: minio/minio:latest
command:
- server
- /data
variables:
POSTGRES_DB: sreview
POSTGRES_USER: sreview
POSTGRES_PASSWORD: ""
POSTGRES_HOST_AUTH_METHOD: trust
SREVIEWTEST_DB: sreview;host=postgres;user=sreview
SREVIEWTEST_S3_CONFIG: '{"default":{"aws_access_key_id":"minioadmin","aws_secret_access_key":"minioadmin","secure":0,"host":"minio-minio:9000"}}'
SREVIEWTEST_BUCKET: 'test'
SREVIEW_COMMAND_TUNE: '{"bs1770gain":"0.5","inkscape":"0.9"}'
JUNIT_OUTPUT_FILE: junit_output.xml
image: $CI_JOB_NAME
before_script:
- apt-get update; apt-get -y --no-install-recommends install inkscape ffmpeg bs1770gain
- cpanm --notest ExtUtils::Depends Devel::Cover TAP::Harness::JUnit Devel::Cover::Report::Cobertura
- cpanm --notest --installdeps .
- perl Makefile.PL
- perl .ci/setup-minio.pl
script:
- cover -delete
- HARNESS_PERL_SWITCHES='-MDevel::Cover' prove -v -l --harness TAP::Harness::JUnit
- cover
- cover -report cobertura
artifacts:
paths:
- cover_db
reports:
junit: junit_output.xml
coverage_report:
coverage_format: cobertura
path: cover_db/cobertura.xml
tags:
- docker
coverage: '/^Total.* (\d+.\d+)$/'
perl:latest:
<<: *build
perl:5.28:
<<: *build
test:committed:
stage: test
image: perl:latest
before_script:
- apt-get update; apt-get -y --no-install-recommends install git ffmpeg
- cpanm ExtUtils::Depends
- cpanm --notest --installdeps .
- perl Makefile.PL
script:
- make manifest
- git diff --exit-code
.deb: &deb
stage: build
image: $CI_JOB_NAME
before_script:
- apt-get update; apt-get -y --no-install-recommends install devscripts equivs git build-essential cpanminus
- if [ ! -z "$DEB_DEPENDS" ]; then apt-get -y --no-install-recommends install $DEB_DEPENDS; fi
- if [ ! -z "$CPAN_DEPENDS" ]; then cpanm $CPAN_DEPENDS; fi
- mk-build-deps -r -i -t "apt-get -y -o Debug::pkgProblemResolver=yes --no-install-recommends"
- DIST=${CI_JOB_NAME#*:}
- VERSION=$(git describe --match=v*.*.[0-9]|sed -e 's/^v//g')
- DEBEMAIL="gitlab-runner auto build <nowhere@nowhere>" dch --distribution $DIST -v $VERSION~$DIST-0 --no-auto-nmu "gitlab automatic snapshot build for $DIST of $VERSION-0"
script:
- dpkg-buildpackage -us -uc -i -I.git
after_script:
- mkdir products
- dcmd mv ../*ges products/
- echo "GIT_DESCRIBE=$(git describe --match=v*.*.[0-9])" > dot.env
artifacts:
paths:
- products
reports:
dotenv: dot.env
tags:
- docker
debian:stable:
<<: *deb
variables:
CPAN_DEPENDS: "Media::Convert"
DEB_DEPENDS: "ffmpeg libmoose-perl libjson-maybexs-perl libmoosex-singleton-perl libsemver-perl"
debian:testing:
<<: *deb
allow_failure: true
debian:unstable:
<<: *deb
.docker: &docker
stage: docker
dependencies:
- debian:stable
services:
- docker:dind
image: docker:latest
tags:
- docker
before_script:
- export IMAGE_TAG=$CI_REGISTRY_IMAGE/${CI_JOB_NAME#*:}:git-$CI_COMMIT_SHORT_SHA
- cp products/*deb dockerfiles/${CI_JOB_NAME#*:}
- docker info
- docker pull $IMAGE_TAG || true
script:
- cd dockerfiles/${CI_JOB_NAME#*:}
- sed -i -e "s/@git_describe@/$GIT_DESCRIBE/g" Dockerfile
- docker build --build-arg=ci_registry_image=$CI_REGISTRY_IMAGE --build-arg=ci_commit_ref_slug=git-$CI_COMMIT_SHORT_SHA --cache-from $CI_REGISTRY_IMAGE/master:git-$CI_COMMIT_SHORT_SHA --cache-from $IMAGE_TAG --pull -t $IMAGE_TAG .
after_script:
- export IMAGE_TAG=$CI_REGISTRY_IMAGE/${CI_JOB_NAME#*:}:git-$CI_COMMIT_SHORT_SHA
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker push $IMAGE_TAG
docker:common:
<<: *docker
stage: docker-pre
needs:
- debian:stable
docker:encoder:
<<: *docker
needs:
- debian:stable
- docker:common
docker:detect:
<<: *docker
needs:
- debian:stable
- docker:common
docker:master-kube:
<<: *docker
stage: docker-post
needs:
- debian:stable
- docker:master
- docker:common
docker:master:
<<: *docker
needs:
- debian:stable
- docker:common
docker:web:
<<: *docker
needs:
- debian:stable
- docker:common
helm:build:
stage: build
image:
name: alpine/helm
entrypoint: [""]
allow_failure: true
before_script:
- cd helm
- helm dependency update sreview
- cd ..
script:
- VERSION=$(grep ^version helm/sreview/Chart.yaml|cut -d ' ' -f 2)
- cd helm
- helm package sreview
- cd ..
- mkdir -p products/helm
- mv helm/sreview-$VERSION.tgz products/helm
- echo $VERSION > products/helm/version.txt
artifacts:
paths:
- products/helm
only:
changes:
- helm/**/*
- .gitlab-ci.yml
release:helm:
stage: release
image: debian:stable
allow_failure: true
needs:
- helm:build
dependencies:
- helm:build
before_script:
- apt-get update
- apt-get -y install curl
script:
- VERSION=$(cat products/helm/version.txt)
- curl --request POST --user gitlab-ci-token:$CI_JOB_TOKEN --form "chart=@products/helm/sreview-$VERSION.tgz" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/helm/api/dev/charts"
only:
changes:
- helm/**/*
- .gitlab-ci.yml
.drelease: &drelease
stage: release
when: manual
services:
- docker:dind
image: docker:latest
tags:
- docker
script:
- docker pull $CI_REGISTRY_IMAGE/${CI_JOB_NAME#*:}:git-$CI_COMMIT_SHORT_SHA
- if [ $CI_COMMIT_REF_SLUG eq "main" ]; then TARGET=latest; else TARGET=$CI_COMMIT_REF_SLUG; fi
- docker tag $CI_REGISTRY_IMAGE/${CI_JOB_NAME#*:}:git-$CI_COMMIT_SHORT_SHA $CI_REGISTRY_IMAGE/${CI_JOB_NAME#*:}:$TARGET
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker push $CI_REGISTRY_IMAGE/${CI_JOB_NAME#*:}:$TARGET
release:encoder:
<<: *drelease
release:master:
<<: *drelease
release:master-kube:
<<: *drelease
release:web:
<<: *drelease
release:detect:
<<: *drelease
pages:
stage: release
dependencies:
- debian:stable
script:
- mkdir public
- apt-get update; apt-get -y --no-install-recommends install devscripts
- dcmd cp products/*.changes public/
- for i in public/*.deb; do ln -s $(basename $i) ${i%_${i#*_}}.deb; done
artifacts:
paths:
- public
only:
- main
needs:
- debian:stable
.dput: &dput
stage: release
image: debian:stable
allow_failure: true
before_script:
- apt-get update
- apt-get -y install dput-ng
- echo -e "[gitlab]\nmethod=https\nfqdn=https://gitlab-runner:$CI_JOB_TOKEN@$CI_SERVER_HOST\nincoming=/api/v4/projects/$CI_PROJECT_ID/packages/debian\n" > dput.cf
script:
- dput --config=dput.cf --unchecked --no-upload-log gitlab products/*.changes
dput:stable:
<<: *dput
dependencies:
- debian:stable
dput:testing:
<<: *dput
dependencies:
- debian:testing
dput:unstable:
<<: *dput
dependencies:
- debian:unstable
validate:package:
image: debian:stable
dependencies:
- debian:stable
needs:
- debian:stable
stage: autopkgtest
services:
- postgres:latest
- name: minio/minio:latest
command:
- server
- /data
variables:
POSTGRES_DB: sreview
POSTGRES_USER: sreview
POSTGRES_PASSWORD: ""
POSTGRES_HOST_AUTH_METHOD: trust
SREVIEWTEST_DB: 'sreview;host=postgres;user=sreview'
SREVIEWTEST_INSTALLED: 1
SREVIEWTEST_S3_CONFIG: '{"default": {"aws_access_key_id": "minioadmin", "aws_secret_access_key":"minioadmin","secure":0,"host":"minio-minio:9000"}}'
SREVIEWTEST_BUCKET: 'test'
before_script:
- apt-get update; apt-get -y --no-install-recommends install libnet-amazon-s3-perl libmojolicious-perl
- perl .ci/setup-minio.pl
- apt-get --purge -y remove libnet-amazon-s3-perl libmojolicious-perl
- apt-get --purge -y autoremove
- apt-get -y install autopkgtest
script:
- autopkgtest products/*ges -- null
#validate:web:
# allow_failure: true
# stage: dockertest
# services:
# - name: postgres:latest
# alias: postgresql
# - name: $CI_REGISTRY_IMAGE/web:git-$CI_COMMIT_SHORT_SHA
# alias: web
# variables:
# POSTGRES_USER: sreview
# POSTGRES_DB: sreview
# POSTGRES_PASSWORD: ""
# POSTGRES_HOST_AUTH_METHOD: trust
# SREVIEW_DBISTRING: '"dbi:Pg:dbname=sreview;host=postgresql;user=sreview"'
# SREVIEW_ADMINUSER: '"[email protected]"'
# SREVIEW_ADMINPW: '"foo"'
# SREVIEW_URLBASE: '"http://web:8080/"'
# image: $CI_REGISTRY_IMAGE/encoder:git-$CI_COMMIT_SHORT_SHA
# script:
# - perl -I lib dockerfiles/tests/test.pl