forked from canonical/snapcraft
-
Notifications
You must be signed in to change notification settings - Fork 0
/
spread.yaml
372 lines (321 loc) · 10 KB
/
spread.yaml
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
359
360
361
362
363
364
365
366
367
368
369
370
371
372
project: snapcraft
environment:
# Tell snapcraft to use the current host to build
SNAPCRAFT_BUILD_ENVIRONMENT: "host"
# Generate manifest when building snaps.
SNAPCRAFT_BUILD_INFO: "1"
# If SNAPCRAFT_PACKAGE_TYPE is "snap" and this variable is defined, spread
# will install snapcraft from that channel. Otherwise, it'll look for a snap
# in the source tree. If SNAPCRAFT_PACKAGE_TYPE is "deb" this variable does
# nothing.
SNAPCRAFT_CHANNEL: "$(HOST: echo ${SNAPCRAFT_CHANNEL})"
# Show error tracebacks
SNAPCRAFT_MANAGED_HOST: "yes"
# Disable all Sentry error reporting
SNAPCRAFT_ENABLE_ERROR_REPORTING: "no"
# Print potentially useful debugging info
SNAPCRAFT_ENABLE_DEVELOPER_DEBUG: "yes"
# Ensure that we have the right debian configuration for legacy
DEBIAN_FRONTEND: noninteractive
DEBIAN_PRIORITY: critical
TOOLS_DIR: /snapcraft/tests/spread/tools
PATH: $PATH:$TOOLS_DIR/snapd-testing-tools/tools/
# Git environment for commits
GIT_AUTHOR_NAME: "Test User"
GIT_AUTHOR_EMAIL: "test-user@email.com"
backends:
lxd:
systems:
# -native is added for clarity and for ubuntu-20.04* to match.
- ubuntu-20.04
- ubuntu-22.04
google:
key: '$(HOST: echo "$SPREAD_GOOGLE_KEY")'
location: snapd-spread/us-east1-b
halt-timeout: 2h
systems:
- ubuntu-20.04-64:
workers: 6
image: ubuntu-2004-64
storage: 40G
- ubuntu-22.04-64:
workers: 6
storage: 20G
image: ubuntu-2204-64
- ubuntu-24.04-64:
image: ubuntu-23.04-64
storage: 12G
workers: 6
multipass:
type: adhoc
allocate: |
if [ "$SPREAD_SYSTEM" = "ubuntu-24.04-64" ]; then
image="daily:devel"
instance_name=spread-devel
else
# SPREAD_SYSTEM has the following format here 'ubuntu-XX.YY-64' and gets
# translated to an image XX.YY.
image=$(echo $SPREAD_SYSTEM | sed -e 's/ubuntu-\(.*\)-64/\1/')
spread_name=$(echo ${image} | sed -e 's/\.//g')
instance_name="spread-${spread_name}"
fi
if [ -z "${image}" ]; then
FATAL "$SPREAD_SYSTEM is not supported!"
fi
multipass launch --disk 20G --memory 2G --name "$instance_name" "$image"
# Get the IP from the instance
ip=$(multipass info --format csv "$instance_name" | tail -1 | cut -d\, -f3)
# Enable PasswordAuthertication for root over SSH.
multipass exec "$instance_name" -- \
sudo sh -c "echo root:ubuntu | sudo chpasswd"
multipass exec "$instance_name" -- \
sudo sh -c \
"sed -i /etc/ssh/sshd_config -e 's/^PasswordAuthentication.*/PasswordAuthentication yes/' -e 's/^#PermitRootLogin.*/PermitRootLogin yes/'"
multipass exec "$instance_name" -- \
sudo systemctl restart ssh
ADDRESS "$ip:22"
discard: |
if [ "$SPREAD_SYSTEM" = "ubuntu-24.04-64" ]; then
image="daily:devel"
instance_name=spread-devel
else
# SPREAD_SYSTEM has the following format here 'ubuntu-XX.YY-64' and gets
# translated to an image XX.YY.
image=$(echo $SPREAD_SYSTEM | sed -e 's/ubuntu-\(.*\)-64/\1/')
spread_name=$(echo ${image} | sed -e 's/\.//g')
instance_name="spread-${spread_name}"
fi
if [ -z "${image}" ]; then
FATAL "$SPREAD_SYSTEM is not supported!"
fi
multipass delete --purge "$instance_name"
systems:
- ubuntu-20.04-64:
workers: 1
username: root
password: ubuntu
- ubuntu-22.04-64:
workers: 1
username: root
password: ubuntu
autopkgtest:
type: adhoc
allocate: |
echo "Allocating ad-hoc $SPREAD_SYSTEM"
if [ -z "${ADT_ARTIFACTS:-}" ]; then
FATAL "adhoc only works inside autopkgtest"
exit 1
fi
echo 'ubuntu ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/99-spread-users
ADDRESS localhost:22
discard: echo "Discarding ad-hoc $SPREAD_SYSTEM"
systems:
# Focal
- ubuntu-20.04-amd64:
username: ubuntu
password: ubuntu
- ubuntu-20.04-ppc64el:
username: ubuntu
password: ubuntu
- ubuntu-20.04-armhf:
username: ubuntu
password: ubuntu
- ubuntu-20.04-s390x:
username: ubuntu
password: ubuntu
- ubuntu-20.04-arm64:
username: ubuntu
password: ubuntu
# Jammy
- ubuntu-22.04-amd64:
username: ubuntu
password: ubuntu
- ubuntu-22.04-ppc64el:
username: ubuntu
password: ubuntu
- ubuntu-22.04-armhf:
username: ubuntu
password: ubuntu
- ubuntu-22.04-s390x:
username: ubuntu
password: ubuntu
- ubuntu-22.04-arm64:
username: ubuntu
password: ubuntu
exclude: [snaps-cache/]
prepare: |
#shellcheck source=tests/spread/tools/prepare.sh
. "$TOOLS_DIR/prepare.sh"
if [[ -z $(ls -A "$TOOLS_DIR/snapd-testing-tools") ]]; then
echo "Cannot run spread because submodule 'snapd-testing-tools' does not exist. Fetch with 'git submodule update --init' and rerun spread."
exit 1
fi
# This unfortunately cannot be extracted into a standalone script since this
# portion of of YAML runs before the source code has been fetched.
# 'apt-get update' is hanging on security.ubuntu.com with IPv6. Prefer IPv4 over
# IPv6
cat <<EOF > gai.conf
precedence ::1/128 50
precedence ::/0 40
precedence 2002::/16 30
precedence ::/96 20
precedence ::ffff:0:0/96 100
EOF
if ! mv gai.conf /etc/gai.conf; then
echo "/etc/gai.conf is not writable, ubuntu-core system? apt-get update won't"
echo "be affected in that case"
rm -f gai.conf
fi
# Now run 'apt-get update', but don't show output unless it fails. The logs are
# long enough as it is.
tempfile="$(mktemp)"
if ! apt-get update > "$tempfile" 2>&1; then
cat "$tempfile"
exit 1
fi
apt-get install -y snapd
snap install snapd
snap wait system seed.loaded
if [ "$SPREAD_SYSTEM" = "ubuntu-20.04-64" ]; then
# Remove lxd and lxd-client deb packages as our implementation (pylxd) does not
# nicely handle the snap and deb being installed at the same time.
apt-get remove --purge --yes lxd lxd-client
fi
install_lxd
# Add the ubuntu user to the lxd group.
adduser ubuntu lxd
# Hold snap refreshes for 24h.
snap set system refresh.hold="$(date --date=tomorrow +%Y-%m-%dT%H:%M:%S%:z)"
if ! snap watch --last=auto-refresh?; then
journalctl -xe
fi
if ! snap watch --last=install?; then
journalctl -xe
fi
if [ "$SPREAD_SYSTEM" = "ubuntu-20.04-64" ]; then
/snap/bin/lxd waitready --timeout=30
/snap/bin/lxd init --auto
fi
install_snapcraft
pushd /snapcraft
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
git init
git add .
git commit -m "Testing Commit"
popd
restore-each: |
"$TOOLS_DIR"/restore.sh
suites:
tests/spread/core22/:
summary: core22 specific tests
systems:
- ubuntu-22.04
- ubuntu-22.04-64
- ubuntu-22.04-amd64
- ubuntu-22.04-arm64
- ubuntu-22.04-armhf
- ubuntu-22.04-s390x
- ubuntu-22.04-ppc64el
tests/spread/core22/environment/:
summary: core22 environment tests
systems:
- ubuntu-22.04*
tests/spread/core22/scriptlets/:
summary: core22 scriptlet tests
systems:
- ubuntu-22.04*
tests/spread/core22/manifest/:
summary: core22 manifest tests
systems:
- ubuntu-22.04*
tests/spread/core22/architectures/:
summary: core22 architecture tests
systems:
- ubuntu-22.04
- ubuntu-22.04-64
- ubuntu-22.04-amd64
tests/spread/core22/linters/:
summary: core22 linter tests
environment:
SNAPCRAFT_ENABLE_DEVELOPER_DEBUG: "n"
systems:
- ubuntu-22.04*
tests/spread/core22/patchelf/:
summary: core22 patchelf tests
systems:
- ubuntu-22.04*
tests/spread/core24/:
summary: core24 tests
systems:
- ubuntu-22.04*
# General, core suite
tests/spread/general/:
summary: tests of snapcraft core functionality
tests/spread/general/grammar/:
summary: grammar tests
# run grammar tests on amd64 platforms
systems:
- ubuntu-20.04
- ubuntu-20.04-64
- ubuntu-20.04-amd64
- ubuntu-22.04
- ubuntu-22.04-64
- ubuntu-22.04-amd64
tests/spread/general/hooks/:
summary: tests of snapcraft hook functionality
tests/spread/core-devel/:
summary: tests of devel base snaps
environment:
SNAPCRAFT_BUILD_ENVIRONMENT: ""
# General, core suite
tests/spread/cross-compile/:
summary: tests of supported cross-compile functionality
systems:
- ubuntu-20.04
- ubuntu-20.04-64
- ubuntu-20.04-amd64
# Use of multipass and lxd build providers
tests/spread/providers/:
summary: tests of snapcraft using build providers
systems:
- ubuntu-20.04-64
- ubuntu-22.04-64
kill-timeout: 180m
warn-timeout: 9m # Keep less than 10 minutes so Travis can't timeout
priority: 90 # Run this test relatively early since fetching images can take time
tests/spread/providers/legacy/:
summary: tests of snapcraft using build providers
systems:
- ubuntu-20.04-64
kill-timeout: 180m
warn-timeout: 9m # Keep less than 10 minutes so Travis can't timeout
priority: 90 # Run this test relatively early since fetching images can take time
# Plugin-specific suites
tests/spread/plugins/v2/:
summary: tests of snapcraft's v2 plugins
systems:
- ubuntu-20.04*
tests/spread/plugins/craft-parts/:
summary: tests of snapcraft's craft-part's based plugins
systems:
- ubuntu-22.04*
# Extensions tests
tests/spread/extensions/:
summary: tests of snapcraft's extensions
kill-timeout: 20m
# External snap tests
tests/spread/snaps/:
environment:
SNAPCRAFT_BUILD_ENVIRONMENT: ""
manual: true
summary: external snaps
prepare: |
sudo apt-get install git
sudo apt-mark auto git
path: /snapcraft/
include:
- tests/
- requirements.txt
- requirements-devel.txt
- runtests.sh