blob: a29a9dc80372da5f3bf43d0e1ded3cde30375042 (
plain)
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
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
|
# To preserve CI quota, pipelines won't run on push except for
# the upstream repo default branch. To force a run when pushing
# to a feature branch use
#
# git push -o ci.variable=RUN_PIPELINEI=1 ...
stages:
- containers
- sanity_checks
.job_rules_merge_request: &job_rules_merge_request
if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: on_success
.job_rules_push_upstream_default_branch: &job_rules_push_upstream_default_branch
if: '$CI_PIPELINE_SOURCE == "push" && $CI_PROJECT_NAMESPACE == "libvirt" && $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH'
when: on_success
.job_rules_opt_in: &job_rules_opt_in
if: '$RUN_PIPELINE == "1"'
when: on_success
.job_rules_container_changes: &job_rules_container_changes
changes:
- .gitlab-ci.yml
- containers/$NAME/*
.job_rules_test_container_changes: &job_rules_test_container_changes
changes:
- .gitlab-ci.yml
- lcitool/facts/mappings.yml
# If pushing to the default branch, then publish the container
# for future reuse, otherwise just discard it after testing build
.build_container_template:
image: docker:latest
stage: containers
interruptible: false
services:
- docker:dind
before_script:
- docker info
- docker login registry.gitlab.com -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD}
script:
- docker build --tag ${CI_REGISTRY_IMAGE}/${NAME}:latest containers/${NAME}
- if test "${CI_COMMIT_REF_NAME}" = "${CI_DEFAULT_BRANCH}" &&
( test "${CI_PIPELINE_SOURCE}" = "push" || test "${RUN_PIPELINE}" = "1" )
then
docker push ${CI_REGISTRY_IMAGE}/${NAME}:latest;
fi
after_script:
- docker logout
rules:
- <<: *job_rules_merge_request
<<: *job_rules_container_changes
- <<: *job_rules_push_upstream_default_branch
<<: *job_rules_container_changes
- <<: *job_rules_opt_in
<<: *job_rules_container_changes
- when: never
.test_template:
interruptible: true
rules:
- <<: *job_rules_merge_request
- <<: *job_rules_opt_in
- when: never
.check_container_template:
extends: .test_template
image: $IMAGE
stage: sanity_checks
interruptible: true
before_script:
- ci/gitlab/all_mappings_prep_env/$NAME-prep.sh
- mkdir -p /tmp/datadir/projects
- cp tests/data/packages/in/packages.yml /tmp/datadir/projects/all_mappings.yml
# We need to use Python virtual env because some platforms have an old
# version of pip that does not have the '--dry-run' option and because
# installing to system locations is broken on Debian
- python3 -m venv _venv_
- _venv_/bin/pip3 install --upgrade pip
- _venv_/bin/python3 -m pip install -r requirements.txt
script:
- source <(_venv_/bin/python3 bin/lcitool -d /tmp/datadir variables $NAME all_mappings | grep PKGS)
- set +e
- for pkg in $PKGS;
do
echo -n "Checking package '$pkg' ... ";
out=$($DRY_RUN_INSTALL_COMMAND $pkg 2>&1);
if [ $? -eq 0 ];
then
echo "OK";
else
echo "FAIL";
echo "LAST ERROR:";
echo "-----------";
echo -e "$out";
exit 1;
fi;
done
- for pkg in $PYPI_PKGS;
do
echo -n "Checking PyPI package '$pkg' ... ";
out=$(_venv_/bin/python3 -m pip install --dry-run $pkg 2>&1);
if [ $? -eq 0 ];
then
echo "OK";
else
echo "FAIL";
echo "LAST ERROR:";
echo "-----------";
echo -e "$out";
exit 1;
fi;
done
- for pkg in $CPAN_PKGS;
do
echo -n "Checking CPAN package '$pkg' ... ";
out=$($CPAN_DRY_RUN_COMMAND $pkg 2>&1);
if [ $? -eq 0 ];
then
echo "OK";
else
echo "FAIL";
echo "LAST ERROR:";
echo "-----------";
echo -e "$out";
exit 1;
fi;
done
variables:
CPAN_DRY_RUN_COMMAND: cpanm --scandeps
rules:
- if: '$LIBVIRT_CI_SKIP_TARGET && $NAME =~ $LIBVIRT_CI_SKIP_TARGET'
when: never
- <<: *job_rules_merge_request
<<: *job_rules_test_container_changes
- <<: *job_rules_opt_in
<<: *job_rules_test_container_changes
- when: never
check-dco-container:
extends: .build_container_template
variables:
NAME: check-dco
go-fmt-container:
extends: .build_container_template
variables:
NAME: go-fmt
cargo-fmt-container:
extends: .build_container_template
variables:
NAME: cargo-fmt
clang-format-container:
extends: .build_container_template
variables:
NAME: clang-format
black-container:
extends: .build_container_template
variables:
NAME: black
flake8-container:
extends: .build_container_template
variables:
NAME: flake8
cirrus-run-container:
extends: .build_container_template
variables:
NAME: cirrus-run
docker-dind-container:
extends: .build_container_template
variables:
NAME: docker-dind
check-dco:
extends: .test_template
stage: sanity_checks
image: python:3.8-alpine
needs: []
before_script:
- apk update
- apk add git
script:
- ./containers/check-dco/check-dco.py
flake8:
extends: .test_template
stage: sanity_checks
image: python:3.8-alpine
needs: []
before_script:
- apk update
- python3 -m pip install tox
script:
- tox -e lint
unittests:
extends: .test_template
stage: sanity_checks
image: python:3.8-alpine
needs: []
before_script:
- apk update
- apk add gcc linux-headers libffi-dev musl-dev
- python3 -m pip install tox
script:
- tox -e py38
# DNF returns 1 when 'install --assumeno' is used which is undistinguishable
# from genuine errors, let's install our DNF helper that checks whether the
# failure just means that the installation was aborted or whether the package
# actually doesn't exist
.dnf_dry_run_command: &dnf_dry_run_command
DRY_RUN_INSTALL_COMMAND: ci/gitlab/all_mappings_prep_env/dnf_install_wrapper install --assumeno
.apt_dry_run_command: &apt_dry_run_command
DRY_RUN_INSTALL_COMMAND: apt --dry-run install
.apk_dry_run_command: &apk_dry_run_command
DRY_RUN_INSTALL_COMMAND: apk add -s
.zypper_dry_run_command: &zypper_dry_run_command
DRY_RUN_INSTALL_COMMAND: zypper install -y --dry-run
x86_64-check-almalinux-8:
extends: .check_container_template
variables:
<<: *dnf_dry_run_command
IMAGE: docker.io/library/almalinux:8
NAME: almalinux-8
x86_64-check-almalinux-9:
extends: .check_container_template
variables:
<<: *dnf_dry_run_command
IMAGE: docker.io/library/almalinux:9
NAME: almalinux-9
x86_64-check-alpine-318:
extends: .check_container_template
variables:
<<: *apk_dry_run_command
IMAGE: docker.io/library/alpine:3.18
NAME: alpine-318
x86_64-check-alpine-319:
extends: .check_container_template
variables:
<<: *apk_dry_run_command
IMAGE: docker.io/library/alpine:3.19
NAME: alpine-319
x86_64-check-alpine-edge:
extends: .check_container_template
allow_failure: true
variables:
<<: *apk_dry_run_command
IMAGE: docker.io/library/alpine:edge
NAME: alpine-edge
x86_64-check-centos-stream-8:
extends: .check_container_template
variables:
<<: *dnf_dry_run_command
IMAGE: quay.io/centos/centos:stream8
NAME: centos-stream-8
x86_64-check-centos-stream-9:
extends: .check_container_template
allow_failure: true
variables:
<<: *dnf_dry_run_command
IMAGE: quay.io/centos/centos:stream9
NAME: centos-stream-9
x86_64-check-debian-11:
extends: .check_container_template
variables:
<<: *apt_dry_run_command
IMAGE: docker.io/library/debian:11-slim
NAME: debian-11
x86_64-check-debian-12:
extends: .check_container_template
variables:
<<: *apt_dry_run_command
IMAGE: docker.io/library/debian:12-slim
NAME: debian-12
x86_64-check-debian-sid:
extends: .check_container_template
allow_failure: true
variables:
<<: *apt_dry_run_command
IMAGE: docker.io/library/debian:sid-slim
NAME: debian-sid
x86_64-check-fedora-39:
extends: .check_container_template
variables:
<<: *dnf_dry_run_command
IMAGE: registry.fedoraproject.org/fedora:39
NAME: fedora-39
x86_64-check-fedora-40:
extends: .check_container_template
variables:
<<: *dnf_dry_run_command
IMAGE: registry.fedoraproject.org/fedora:40
NAME: fedora-40
x86_64-check-fedora-rawhide:
extends: .check_container_template
allow_failure: true
variables:
<<: *dnf_dry_run_command
IMAGE: registry.fedoraproject.org/fedora:rawhide
NAME: fedora-rawhide
x86_64-check-opensuse-leap-15:
extends: .check_container_template
variables:
<<: *zypper_dry_run_command
IMAGE: registry.opensuse.org/opensuse/leap:15.5
NAME: opensuse-leap-15
x86_64-check-opensuse-tumbleweed:
extends: .check_container_template
allow_failure: true
variables:
<<: *zypper_dry_run_command
IMAGE: registry.opensuse.org/opensuse/tumbleweed:latest
NAME: opensuse-tumbleweed
x86_64-check-ubuntu-2004:
extends: .check_container_template
variables:
<<: *apt_dry_run_command
IMAGE: docker.io/library/ubuntu:20.04
NAME: ubuntu-2004
x86_64-check-ubuntu-2204:
extends: .check_container_template
variables:
<<: *apt_dry_run_command
IMAGE: docker.io/library/ubuntu:22.04
NAME: ubuntu-2204
|