-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathspread.yaml
68 lines (58 loc) · 2.32 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
project: craft-store
path: /craft-store
environment:
PROJECT_PATH: /craft-store
PATH: /snap/bin:$PATH:$PROJECT_PATH/tools/spread
CRAFT_STORE_CHARMCRAFT_CREDENTIALS: '$(HOST: echo ${CRAFT_STORE_CHARMCRAFT_CREDENTIALS:-})'
SNAPCRAFT_STORE_CREDENTIALS: '$(HOST: echo ${SNAPCRAFT_STORE_CREDENTIALS:-})'
CRAFT_STORE_TEST_CHARM: '$(HOST: echo ${CRAFT_STORE_TEST_CHARM:-})'
backends:
google:
key: '$(HOST: echo "$SPREAD_GOOGLE_KEY")'
location: snapd-spread/us-east1-b
halt-timeout: 2h
systems:
- ubuntu-22.04-64:
workers: 2
storage: 40G
multipass:
type: adhoc
allocate: |
sleep 0.$RANDOM # Minimize chances of a race condition
if [[ ! -f $HOME/.spread/multipass-count ]]; then
mkdir -p $HOME/.spread
echo 0 > $HOME/.spread/multipass-count
fi
instance_num=$(< $HOME/.spread/multipass-count)
echo $(( $instance_num + 1 )) > $HOME/.spread/multipass-count
multipass_image=$(echo ${SPREAD_SYSTEM} | sed -e s/ubuntu-// -e s/-64//)
system=$(echo "${SPREAD_SYSTEM}" | tr . -)
instance_name="spread-${SPREAD_BACKEND}-${instance_num}-${system}"
multipass launch --cpus 2 --disk 20G --memory 2G --name "${instance_name}" "${multipass_image}"
# Enable PasswordAuthentication for root over SSH.
multipass exec "$instance_name" -- \
sudo sh -c "echo root:${SPREAD_PASSWORD} | 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
# Get the IP from the instance
ip=$(multipass info --format csv "$instance_name" | tail -1 | cut -d\, -f3)
ADDRESS "$ip"
discard: |
instance_name=$(multipass list --format csv | grep $SPREAD_SYSTEM_ADDRESS | cut -f1 -d\,)
multipass delete --purge "${instance_name}"
systems:
- ubuntu-22.04-64:
workers: 2
prepare: |
apt-get update
apt-get --yes install python3.10-venv
suites:
# docs/tutorials/code/:
# summary: tests basic tutorials from the docs
docs/howto/code/:
summary: tests how-to guides from the docs
# docs/reference/code/:
# summary: tests reference code from the docs