-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitlab-ci.yml
249 lines (227 loc) · 6.01 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
---
stages:
- source test
- build
- vendor upload
- upload
variables:
CLOUD_IMAGE_BUILD_ID: ${CI_PROJECT_NAMESPACE}-${CI_COMMIT_REF_SLUG}
GIT_DEPTH: "1"
before_script:
- apt-get update
- apt-get install --no-install-recommends -y python3-libcloud python3-marshmallow python3-yaml qemu-utils
- |
if [ "$CI_DISPOSABLE_ENVIRONMENT" ]; then
# Workaround unsupported SEEK_HOLE in overlayfs (Docker default)
mount -t tmpfs none /tmp
fi
test flake8:
stage: source test
image: debian:bullseye
script:
- >
apt-get install --no-install-recommends -y
python3-flake8
- python3 -m flake8
test mypy:
stage: source test
image: debian:bullseye
script:
- apt-get build-dep -y ./
- >
apt-get install --no-install-recommends -y
mypy
- mypy --namespace-packages src
allow_failure: true
test package:
stage: source test
image: debian:bullseye
script:
- apt-get build-dep -y ./
- >
apt-get install --no-install-recommends -y
lintian
- DEB_BUILD_OPTIONS=nocheck dpkg-buildpackage -us -uc
- lintian ../*.changes
.test pytest:
stage: source test
script:
- >
apt-get install --no-install-recommends -y
python3-pytest python3-pytest-cov
- >
PYTHONPATH=src
py.test-3
-vrxXs
--color=yes
--cov=src --cov-report=term --cov-report=html:coverage
--junit-xml=junit.xml
tests
artifacts:
paths:
- coverage/
reports:
junit: junit.xml
test pytest buster:
extends: .test pytest
image: debian:buster
test pytest bullseye:
extends: .test pytest
image: debian:bullseye
test pytest latest:
stage: source test
image: python:slim
before_script:
- pip install -e .
script:
- python3 ./setup.py pytest
.build:
stage: build
image: debian:bullseye
script:
- |
if [ "$CI_DISPOSABLE_ENVIRONMENT" ]; then
# Some of our build environments run with SELinux enabled, make sure it is detected by all the tools
if [ -d /sys/fs/selinux ]; then mount -t selinuxfs none /sys/fs/selinux; mkdir -p /etc/selinux; touch /etc/selinux/config; fi
# Setup binfmt_misc for foreign binaries via qemu-user
if [ ! -e /proc/sys/fs/binfmt_misc/status ]; then
mount -t binfmt_misc binfmt_misc /proc/sys/fs/binfmt_misc
fi
fi
- >
apt-get install --no-install-recommends -y
binfmt-support ca-certificates debsums dosfstools fai-server fai-setup-storage fdisk make python3-pytest qemu-user-static qemu-utils sudo udev
- >
echo
debian-cloud-images build
--build-id ${CLOUD_IMAGE_BUILD_ID}
--build-type dev
--version ${CI_PIPELINE_IID}
${CLOUD_RELEASE} ${CLOUD_VENDOR} ${CLOUD_ARCH}
- >
./bin/debian-cloud-images build
--build-id ${CLOUD_IMAGE_BUILD_ID}
--build-type dev
${CLOUD_RELEASE} ${CLOUD_VENDOR} ${CLOUD_ARCH}
- 'xz -vk5T0 *.tar'
artifacts:
name: debian-${CLOUD_RELEASE}-${CLOUD_VENDOR}-${CLOUD_ARCH}
expire_in: 7 days
paths:
- '*.build.json'
- '*.info'
- '*.tar.xz'
reports:
junit: '*.build.junit.xml'
allow_failure: true
####
# Builds for developer uploads pushes
#
# Builds are run if
# - it is requested by setting $BUILD_AZURE, $BUILD_EC2, $BUILD_GCE, $BUILD_GENERIC or $BUILD_NOCLOUD or
# - the manual jobs are started.
####
.azure build:
extends: .build
rules:
- if: '$CI_MERGE_REQUEST_ID == null && $BUILD_AZURE'
when: on_success
- if: '$CI_MERGE_REQUEST_ID == null'
when: manual
.ec2 build:
extends: .build
rules:
- if: '$CI_MERGE_REQUEST_ID == null && $BUILD_EC2'
when: on_success
- if: '$CI_MERGE_REQUEST_ID == null'
when: manual
.gce build:
extends: .build
rules:
- if: '$CI_MERGE_REQUEST_ID == null && $BUILD_GCE'
when: on_success
- if: '$CI_MERGE_REQUEST_ID == null'
when: manual
.generic build:
extends: .build
rules:
- if: '$CI_MERGE_REQUEST_ID == null && $BUILD_GENERIC'
when: on_success
- if: '$CI_MERGE_REQUEST_ID == null'
when: manual
.genericcloud build:
extends: .build
rules:
- if: '$CI_MERGE_REQUEST_ID == null && $BUILD_GENERIC'
when: on_success
- if: '$CI_MERGE_REQUEST_ID == null'
when: manual
.nocloud build:
extends: .build
rules:
- if: '$CI_MERGE_REQUEST_ID == null && $BUILD_NOCLOUD'
when: on_success
- if: '$CI_MERGE_REQUEST_ID == null'
when: manual
####
# Provider uploads for developer pushs
####
.azure upload:
stage: vendor upload
image: debian:bullseye
script:
- >
./bin/debian-cloud-images upload-azure
--config-file "${CLOUD_UPLOAD_DEV_CONFIG}"
*.build.json
artifacts:
name: upload-azure
expire_in: 7 days
paths:
- '*.upload-azure.json'
rules:
- if: '$CI_MERGE_REQUEST_ID == null && $CLOUD_UPLOAD_AZURE_DEV_ENABLED == "1" && $BUILD_AZURE'
when: on_success
- if: '$CI_MERGE_REQUEST_ID == null && $CLOUD_UPLOAD_AZURE_DEV_ENABLED == "1"'
when: manual
allow_failure: true
.ec2 upload:
stage: vendor upload
image: debian:bullseye
script:
- >
./bin/debian-cloud-images upload-ec2
--config-file "${CLOUD_UPLOAD_DEV_CONFIG}"
*.build.json
artifacts:
name: upload-ec2
expire_in: 7 days
paths:
- '*.upload-ec2.json'
rules:
- if: '$CI_MERGE_REQUEST_ID == null && $CLOUD_UPLOAD_EC2_DEV_ENABLED == "1" && $BUILD_EC2'
when: on_success
- if: '$CI_MERGE_REQUEST_ID == null && $CLOUD_UPLOAD_EC2_DEV_ENABLED == "1"'
when: manual
allow_failure: true
.gce upload:
stage: vendor upload
image: debian:bullseye
script:
- >
./bin/debian-cloud-images upload-gce
--config-file "${CLOUD_UPLOAD_DEV_CONFIG}"
*.build.json
artifacts:
name: upload-gce
expire_in: 7 days
paths:
- '*.upload-gce.json'
rules:
- if: '$CI_MERGE_REQUEST_ID == null && $CLOUD_UPLOAD_GCE_DEV_ENABLED == "1" && $BUILD_GCE'
when: on_success
- if: '$CI_MERGE_REQUEST_ID == null && $CLOUD_UPLOAD_GCE_DEV_ENABLED == "1"'
when: manual
allow_failure: true
include:
local: .gitlab/ci/generated.yml