generated from canonical/template-operator
-
Notifications
You must be signed in to change notification settings - Fork 11
/
spread.yaml
112 lines (91 loc) · 2.95 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
project: zinc-charm-tests
kill-timeout: 90m
workers: 1
environment:
CI: "$(HOST: echo $CI)"
CONCIERGE_JUJU_CHANNEL/juju_3_5: 3.5/stable
CONCIERGE_JUJU_CHANNEL/juju_3_6: 3.6/stable
backends:
lxd:
type: adhoc
allocate: |
BASE="${BASE:-noble}"
VM_NAME="${VM_NAME:-ubuntu-${BASE}-${RANDOM}}"
DISK="${DISK:-20}"
CPU="${CPU:-4}"
MEM="${MEM:-8}"
cloud_config="$(mktemp)"
sed "s|SPREAD_PASSWORD|$SPREAD_PASSWORD|g" tests/spread/cloud-config.yaml > "$cloud_config"
lxc launch --vm \
"ubuntu:${BASE}" \
"${VM_NAME}" \
-c user.user-data="$(cat "$cloud_config")" \
-c limits.cpu="${CPU}" \
-c limits.memory="${MEM}GiB" \
-d root,size="${DISK}GiB"
# Wait for the spread user
while ! lxc exec "${VM_NAME}" -- id -u spread &>/dev/null; do sleep 0.5; done
rm "$cloud_config"
# Set the instance address for spread
ADDRESS "$(lxc ls -f csv | grep "${VM_NAME}" | cut -d"," -f3 | cut -d" " -f1)"
discard: |
instance_name="$(lxc ls -f csv | grep $SPREAD_SYSTEM_ADDRESS | cut -f1 -d",")"
lxc delete -f $instance_name
systems:
- ubuntu-24.04:
username: spread
workers: 1
github-ci:
type: adhoc
manual: true
allocate: |
sudo sed -i "s|#PasswordAuthentication yes|PasswordAuthentication yes|g" /etc/ssh/sshd_config
sudo sed -i "s|KbdInteractiveAuthentication no|KbdInteractiveAuthentication yes|g" /etc/ssh/sshd_config
sudo rm -f /etc/ssh/sshd_config.d/60-cloudimg-settings.conf
sudo systemctl daemon-reload
sudo systemctl restart ssh
sudo useradd spread -s /bin/bash -m || true
echo "spread:$SPREAD_PASSWORD" | sudo chpasswd || true
echo 'spread ALL=(ALL) NOPASSWD:ALL ' | sudo tee /etc/sudoers.d/99-spread-user || true
ADDRESS "127.0.0.1"
discard: |
sudo userdel -f -r spread || true
sudo rm -f /etc/sudoers.d/99-spread-user
systems:
- ubuntu-24.04:
username: spread
workers: 1
suites:
tests/spread/:
summary: Spread tests
exclude:
- .coverage
- .git
- .github
- .pytest_cache
- .ruff_cache
- .tox
- .venv
# this needs to be under /root because spread executes the test scripts
# as root, which means that juju can only see files in root's
# home directory due to snap confinement.
path: /root/proj
prepare: |
snap refresh --hold
if systemctl is-enabled unattended-upgrades.service; then
systemctl stop unattended-upgrades.service
systemctl mask unattended-upgrades.service
fi
snap install --classic concierge
concierge prepare --trace -p microk8s --extra-snaps astral-uv --extra-debs make
pushd "$SPREAD_PATH"
if [[ -f "$PWD/zinc-k8s_amd64.charm" ]]; then
chown $(id -u):$(id -g) $PWD/zinc-k8s_amd64.charm
fi
restore: |
if [[ -z "${CI:-}" ]]; then
concierge restore --trace
apt autoremove -y --purge
rm -Rf "$SPREAD_PATH"
mkdir -p "$SPREAD_PATH"
fi