forked from canonical/charmcraft
-
Notifications
You must be signed in to change notification settings - Fork 0
/
spread.yaml
131 lines (112 loc) · 3.44 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
project: charmcraft
path: /charmcraft
environment:
PROJECT_PATH: /charmcraft
PATH: /snap/bin:$PATH:$PROJECT_PATH/tools/external/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-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 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
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
if stat /charmcraft/charmcraft_*.snap 2>/dev/null; then
snap install --classic --dangerous /charmcraft/charmcraft_*.snap
else
echo "Expected a snap to exist in /charmcraft/"
exit 1
fi
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
kill-timeout: 30m