-
Notifications
You must be signed in to change notification settings - Fork 545
/
.cirrus.yml
342 lines (319 loc) · 12.1 KB
/
.cirrus.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
342
---
# Main environment vars to set for all tasks
env:
FEDORA_NAME: "fedora-38"
FEDORA_PRIOR_NAME: "fedora-37"
DEBIAN_NAME: "debian-11"
UBUNTU_DEVEL_NAME: "ubuntu-25.04"
UBUNTU_LATEST_NAME: "ubuntu-24.10"
UBUNTU_NAME: "ubuntu-24.04"
UBUNTU_PRIOR_NAME: "ubuntu-22.04"
UBUNTU_PRIOR2_NAME: "ubuntu-20.04"
CENTOS_9_NAME: "centos-stream-9"
CENTOS_PROJECT: "centos-cloud"
DEBIAN_PROJECT: "debian-cloud"
FEDORA_PROJECT: "fedora-cloud"
SOS_PROJECT: "sos-devel-jobs"
UBUNTU_PROJECT: "ubuntu-os-cloud"
UBUNTU_DEVEL_PROJECT: "ubuntu-os-cloud-devel"
# Images exist on GCP already
CENTOS_9_FAMILY_NAME: "centos-stream-9"
DEBIAN_FAMILY_NAME: "debian-11"
FEDORA_FAMILY_NAME: "fedora-cloud-38"
FEDORA_PRIOR_FAMILY_NAME: "fedora-cloud-37"
UBUNTU_DEB_FAMILY_NAME: "ubuntu-minimal-2410-amd64"
UBUNTU_LATEST_FAMILY_NAME: "ubuntu-2410-amd64"
UBUNTU_FAMILY_NAME: "ubuntu-2404-lts-amd64"
UBUNTU_PRIOR_FAMILY_NAME: "ubuntu-2204-lts"
UBUNTU_PRIOR2_FAMILY_NAME: "ubuntu-2004-lts"
UBUNTU_SNAP_FAMILY_NAME: "ubuntu-2404-lts-amd64"
UBUNTU_DEVEL_FAMILY_NAME: "ubuntu-2504-amd64"
# Curl-command prefix for downloading task artifacts, simply add the
# the url-encoded task name, artifact name, and path as a suffix.
# This approach originally seen in the podman project.
ARTCURL: >-
curl --fail --location -O
--url https://api.cirrus-ci.com/v1/artifact/build/${CIRRUS_BUILD_ID}
# Default task timeout
timeout_in: 30m
# enable auto cancelling concurrent builds on main when multiple PRs are
# merged at once
auto_cancellation: true
gcp_credentials: ENCRYPTED[!77d4c8251094346c41db63cb05eba2ff98eaff04e58c5d0e2a8e2c6f159f7d601b3fe9a2a4fce1666297e371f2fc8752!]
# Run a simple lint on the community cluster
flake8_task:
skip: &man-changes-include "changesIncludeOnly('man/**')"
alias: "flake8_test"
name: "Flake8 linting test"
container:
image: "python:latest"
setup_script: &tox-lint-setup |
apt update
apt -y install tox
flake_script: tox -e flake8
pylint_task:
skip: *man-changes-include
alias: "pylint_test"
name: "pylint linting test"
container:
image: "python:latest"
setup_script: *tox-lint-setup
pylint_script: tox -e pylint
# Run a check on newer upstream python versions to check for possible
# breaks/changes in common modules. This is not meant to check any of the actual
# collections or archive integrity.
py_break_task:
skip: *man-changes-include
alias: "py_break"
name: "Breakage test python-$PY_VERSION"
container:
image: "python:${PY_VERSION}"
matrix:
- env:
PY_VERSION: "latest"
- env:
PY_VERSION: "3.9"
# This image has 2 py environments. Install to the one sos uses.
setup_script: pip3 install -t /usr/lib/python3/dist-packages -r requirements.txt
main_script: ./bin/sos report --batch
# Make sure a user can manually build an rpm from the checkout
rpm_build_task:
skip: *man-changes-include
alias: "rpm_build"
name: "rpm Build From Checkout - ${BUILD_NAME}"
gce_instance: &standardvm
image_project: "${PROJECT}"
image_family: "${VM_FAMILY_NAME}"
type: e2-medium
matrix:
- env: ¢os9
PROJECT: ${CENTOS_PROJECT}
BUILD_NAME: ${CENTOS_9_NAME}
VM_FAMILY_NAME: ${CENTOS_9_FAMILY_NAME}
- env: &fedora
PROJECT: ${FEDORA_PROJECT}
BUILD_NAME: ${FEDORA_NAME}
VM_FAMILY_NAME: ${FEDORA_FAMILY_NAME}
- env: &fedoraprior
PROJECT: ${FEDORA_PROJECT}
BUILD_NAME: ${FEDORA_PRIOR_NAME}
VM_FAMILY_NAME: ${FEDORA_PRIOR_FAMILY_NAME}
setup_script: |
dnf clean all
dnf -y install rpm-build rpmdevtools gettext python3-devel
main_script: |
mkdir -p /rpmbuild/{BUILD,BUILDROOT,RPMS,SRPMS,SOURCES}
python3 setup.py sdist
cp dist/sos*.tar.gz /rpmbuild/SOURCES/
rpmbuild -bs sos.spec
dnf -y builddep /rpmbuild/SRPMS/sos*src.rpm
rpmbuild -bb sos.spec
# Retrieving the built rpm in later tasks requires knowing the exact name
# of the file. To avoid having to juggle version numbers here, rename it
prep_artifacts_script: mv /rpmbuild/RPMS/noarch/sos-*.rpm ./sos_${BUILD_NAME}.rpm
packages_artifacts:
path: ./sos_${BUILD_NAME}.rpm
type: application/octet-stream
# Make sure a user can manually build a deb from the checkout
deb_build_task:
skip: *man-changes-include
alias: "deb_build"
name: "deb Build From Checkout"
gce_instance:
image_project: "${UBUNTU_PROJECT}"
image_family: "${UBUNTU_DEB_FAMILY_NAME}"
type: e2-medium
setup_script: |
apt update --allow-releaseinfo-change
apt -y install devscripts equivs python3-pip
mk-build-deps
apt -y install ./sosreport-build-deps*.deb
pip3 install -r test-requirements.txt --break-system-packages
main_script: |
dpkg-buildpackage -b -us -uc -rfakeroot -m --build-by="[email protected]"
prep_artifacts_script: mv ../*.deb ./sos_cirrus.deb
packages_artifacts:
path: ./sos_cirrus.deb
type: application/octet-stream
# Make sure a user can manually build a snap from the checkout
snap_build_task:
skip: *man-changes-include
alias: "snap_build"
name: "snap Build From Checkout"
gce_instance:
image_project: "${UBUNTU_PROJECT}"
image_family: "${UBUNTU_SNAP_FAMILY_NAME}"
type: e2-medium
setup_script: |
apt update
apt -y install snapd
systemctl start snapd
sed -i -e 's/adopt-info.*/version: test/g' -e '/set version/d' snap/snapcraft.yaml
snap install snapcraft --classic
main_script: |
snapcraft --destructive-mode
packages_artifacts:
path: "*.snap"
on_failure:
fail_script: |
ls -d /root/.cache/snapcraft/log 2> /dev/null | xargs tar cf snap-build-fail-logs.tar
log_artifacts:
path: "snap-build-fail-logs.tar"
# Run the stage one (no mocking) tests across all distros on GCP
report_stageone_task:
skip: *man-changes-include
alias: "stageone_report"
name: "Report Stage One - $BUILD_NAME"
depends_on:
- rpm_build
- snap_build
- deb_build
gce_instance: *standardvm
matrix:
- env: *centos9
- env: *fedora
- env: *fedoraprior
- env: &ubuntu
PKG: "snap"
PROJECT: ${UBUNTU_PROJECT}
BUILD_NAME: "${UBUNTU_NAME} - ${PKG}"
VM_FAMILY_NAME: ${UBUNTU_FAMILY_NAME}
- env: &ubuntuprior
PKG: "snap"
PROJECT: ${UBUNTU_PROJECT}
BUILD_NAME: "${UBUNTU_PRIOR_NAME} - ${PKG}"
VM_FAMILY_NAME: ${UBUNTU_PRIOR_FAMILY_NAME}
- env: &ubuntuprior2
PKG: "snap"
PROJECT: ${UBUNTU_PROJECT}
BUILD_NAME: "${UBUNTU_PRIOR2_NAME} - ${PKG}"
VM_FAMILY_NAME: ${UBUNTU_PRIOR2_FAMILY_NAME}
- env: &ubuntu-latest-snap
PKG: "snap"
PROJECT: ${UBUNTU_PROJECT}
BUILD_NAME: "${UBUNTU_LATEST_NAME} - ${PKG}"
VM_FAMILY_NAME: ${UBUNTU_LATEST_FAMILY_NAME}
- env: &ubuntu-latest-deb
PKG: "deb"
PROJECT: ${UBUNTU_PROJECT}
BUILD_NAME: "${UBUNTU_LATEST_NAME} - ${PKG}"
VM_FAMILY_NAME: ${UBUNTU_LATEST_FAMILY_NAME}
setup_script: &setup |
if [ $(command -v apt) ]; then
apt -y purge sosreport
apt update --allow-releaseinfo-change
apt -y install python3-pip snapd
if [ ${PKG} == "snap" ] ; then
echo "$ARTCURL/snap%20Build%20From%20Checkout/packages/sosreport_test_amd64.snap"
$ARTCURL/snap%20Build%20From%20Checkout/packages/sosreport_test_amd64.snap
systemctl start snapd
snap install ./sosreport_test_amd64.snap --classic --dangerous
snap alias sosreport.sos sos
elif [ ${PKG} == "deb" ]; then
echo "$ARTCURL/deb%20Build%20From%20Checkout/packages/sos_cirrus.deb"
$ARTCURL/deb%20Build%20From%20Checkout/packages/sos_cirrus.deb
apt -y install ./sos_cirrus.deb
fi
fi
if [ $(command -v dnf) ]; then
echo "$ARTCURL/rpm%20Build%20From%20Checkout%20-%20${BUILD_NAME}/packages/sos_${BUILD_NAME}.rpm"
$ARTCURL/rpm%20Build%20From%20Checkout%20-%20${BUILD_NAME}/packages/sos_${BUILD_NAME}.rpm
dnf -y remove sos
dnf -y install python3-pip ethtool
dnf -y install ./sos_${BUILD_NAME}.rpm
fi
PIP_EXTRA=""
[[ $(pip3 install --help | grep break-system) ]] && PIP_EXTRA="--break-system-packages"
pip3 install -r test-requirements.txt ${PIP_EXTRA}
# run the unittests separately as they require a different PYTHONPATH in
# order for the imports to work properly under avocado
unittest_script: &unit_test |
PYTHONPATH=. avocado run tests/unittests/
main_script: &stageone_test
PYTHONPATH=tests/ avocado run -p TESTLOCAL=true --max-parallel-tasks=1 -t stageone tests/{cleaner,collect,report,vendor}_tests
on_failure:
fail_script: &faillogs |
ls -d /var/tmp/avocado* /root/avocado* 2> /dev/null | xargs tar cf sos-fail-logs.tar
log_artifacts: &logs
path: "sos-fail-logs.tar"
report_stageone_daily_task:
skip: *man-changes-include
alias: "stageone_daily_report"
name: "Report Stage One - $BUILD_NAME"
allow_failures: true
depends_on:
- snap_build
gce_instance: *standardvm
environment: &ubuntudevel
PKG: "snap"
PROJECT: ${UBUNTU_DEVEL_PROJECT}
VM_FAMILY_NAME: ${UBUNTU_DEVEL_FAMILY_NAME}
BUILD_NAME: "${UBUNTU_DEVEL_NAME} - ${PKG}"
setup_script: *setup
unittest_script: *unit_test
main_script: *stageone_test
on_failure:
fail_script: *faillogs
log_artifacts: *logs
# IFF the stage one tests all pass, then run stage two for latest distros
report_stagetwo_task:
skip: *man-changes-include
alias: "stagetwo_report"
name: "Report Stage Two - $BUILD_NAME"
depends_on: stageone_report
timeout_in: 45m
gce_instance: *standardvm
matrix:
- env: *centos9
- env: *fedora
- env: *ubuntu
- env: *ubuntu-latest-snap
- env: *ubuntu-latest-deb
setup_script: *setup
install_pexpect_script: |
if [ $(command -v apt) ]; then
apt -y install python3-pexpect
fi
if [ $(command -v dnf) ]; then
dnf -y install python3-pexpect
fi
main_script: &stagetwo_test |
PYTHONPATH=tests/ avocado run -p TESTLOCAL=true --max-parallel-tasks=1 -t stagetwo tests/{cleaner,collect,report,vendor}_tests
on_failure:
fail_script: *faillogs
log_artifacts: *logs
report_stagetwo_daily_task:
skip: *man-changes-include
alias: "stagetwo_daily_report"
name: "Report Stage Two - $BUILD_NAME"
allow_failures: true
depends_on: stageone_daily_report
timeout_in: 45m
gce_instance: *standardvm
environment: *ubuntudevel
setup_script: *setup
main_script: *stagetwo_test
on_failure:
fail_script: *faillogs
log_artifacts: *logs
report_foreman_task:
skip: "!changesInclude('.cirrus.yml', '**/{__init__,apache,foreman,foreman_tests,candlepin,pulp,pulpcore}.py', '**/foreman_setup.sh')"
timeout_in: 45m
alias: "foreman_integration"
name: "Integration Test - Foreman ${FOREMAN_VER} - ${BUILD_NAME}"
depends_on: stageone_report
gce_instance: &bigvm
<<: *standardvm
type: e2-standard-2
matrix:
- env:
PROJECT: ${DEBIAN_PROJECT}
VM_FAMILY_NAME: ${DEBIAN_FAMILY_NAME}
BUILD_NAME: ${DEBIAN_NAME}
FOREMAN_VER: "3.7"
setup_script: *setup
foreman_setup_script: ./tests/test_data/foreman_setup.sh
main_script: PYTHONPATH=tests/ avocado run -p TESTLOCAL=true --max-parallel-tasks=1 -t foreman tests/product_tests/foreman/
on_failure:
fail_script: *faillogs
log_artifacts: *logs