forked from canonical/charmcraft
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspread.yaml
174 lines (151 loc) · 5.61 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
project: charmcraft
path: /charmcraft
environment:
PROJECT_PATH: /charmcraft
SNAPD_TESTING_TOOLS: $PROJECT_PATH/tools/external/tools
PATH: /snap/bin:$PATH:$SNAPD_TESTING_TOOLS
backends:
google:
key: '$(HOST: echo "$SPREAD_GOOGLE_KEY")'
location: snapd-spread/us-east1-b
halt-timeout: 2h
systems:
- ubuntu-18.04-64:
workers: 2
storage: 40G
- ubuntu-20.04-64:
workers: 4
storage: 40G
- ubuntu-22.04-64:
workers: 4
storage: 40G
# Fedora is disabled until it runs kernel 6.0.7 due to squashfs bug
# (https://forum.snapcraft.io/t/unsupported-version-0-of-verneed-record-linux-6-0/32160/14)
#- fedora-35-64:
# workers: 2
# storage: 40G
multipass:
type: adhoc
allocate: |
if [ "$SPREAD_SYSTEM" = "ubuntu-18.04-64" ]; then
image="18.04"
instance_name="spread-18-04"
elif [ "$SPREAD_SYSTEM" = "ubuntu-20.04-64" ]; then
image="20.04"
instance_name="spread-20-04"
elif [ "$SPREAD_SYSTEM" = "ubuntu-22.04-64" ]; then
image="22.04"
instance_name="spread-22-04"
else
FATAL "$SPREAD_SYSTEM is not supported!"
fi
multipass launch --disk 20G --mem 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-18.04-64" ]; then
instance_name="spread-18-04"
elif [ "$SPREAD_SYSTEM" = "ubuntu-20.04-64" ]; then
instance_name="spread-20-04"
elif [ "$SPREAD_SYSTEM" = "ubuntu-22.04-64" ]; then
instance_name="spread-22-04"
else
FATAL "$SPREAD_SYSTEM is not supported!"
fi
multipass delete --purge "$instance_name"
systems:
- ubuntu-18.04-64:
workers: 1
username: root
password: ubuntu
- ubuntu-20.04-64:
workers: 1
username: root
password: ubuntu
- ubuntu-22.04-64:
workers: 1
username: root
password: ubuntu
prepare: |
set -e
# if the 'tools' directory inside the submodule does not exist, then assume the submodule is empty
if [[ ! -d "$SNAPD_TESTING_TOOLS" ]]; then
echo "Cannot run spread because submodule 'snapd-testing-tools' is empty. Fetch with 'git submodule update --init' and rerun spread."
exit 1
fi
if os.query is-ubuntu; then
tempfile="$(mktemp)"
if ! apt-get update > "$tempfile" 2>&1; then
cat "$tempfile"
exit 1
fi
fi
tests.pkgs install snapd
snap wait system seed.loaded
# The /snap directory does not exist in some environments
[ ! -d /snap ] && ln -s /var/lib/snapd/snap /snap
# install lxd (previously removing the APT version, if there)
[ -e /usr/bin/lxd ] && apt-get remove --purge --yes lxd lxd-client lxcfs liblxc1
snap install 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
lxd waitready --timeout=30
lxd init --auto
#shellcheck source=tests/spread/tools/prepare.sh
. "/charmcraft/tests/spread/tools/prepare.sh"
install_charmcraft
suites:
tests/spread/commands/:
summary: simple charmcraft commands
tests/spread/charms/:
summary: real charm building tests
tests/spread/smoketests/:
summary: basic charm builds in different combinations
systems:
- ubuntu-20.04-64
- ubuntu-22.04-64
tests/spread/hooks/:
summary: snap hook tests
kill-timeout: 30m
tests/spread/store/:
prepare: |
snap install docker
# make sure docker is working
retry -n 10 --wait 2 sh -c 'docker run --rm hello-world'
# https://linuxcontainers.org/lxd/docs/master/howto/network_bridge_firewalld/#prevent-issues-with-lxd-and-docker
# https://github.com/canonical/lxd-cloud/blob/f20a64a8af42485440dcbfd370faf14137d2f349/test/includes/lxd.sh#L13-L23
iptables -P FORWARD ACCEPT
restore: |
snap remove docker --purge
summary: sequence of commands for different store-related functionalities
kill-timeout: 30m
manual: true
systems:
- ubuntu-22.04-64
environment:
# the content for this key is the content of FILE after running
# charmcraft login --export=FILE --ttl=5184000#
# (as the owner of CHARM_DEFAULT_NAME and BUNDLE_DEFAULT_NAME below), and it
# should be part of the environment (when running spread locally just define it,
# for GH actions set it in Settings -> Security -> Actions -> Repository secrets)
CHARMCRAFT_AUTH: "$(HOST: echo $CHARMCRAFT_AUTH)"
# to not flood Charmhub with names the same two are always used in the Store related
# tests (except in the names registration tests, of course); register them manually
# in staging Charmhub authenticating with the configured credentials
CHARM_DEFAULT_NAME: "$(HOST: echo ${CHARM_DEFAULT_NAME:-$USER-test-charm})"
BUNDLE_DEFAULT_NAME: "$(HOST: echo ${BUNDLE_DEFAULT_NAME:-$USER-test-bundle})"