-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathspread.yaml
102 lines (83 loc) · 2.68 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
project: concierge
kill-timeout: 90m
workers: 1
environment:
CI: "$(HOST: echo $CI)"
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/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/:
summary: Spread tests
exclude:
- dist/
- .git
- .github
# 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
pushd "$SPREAD_PATH"
if [[ -f "$PWD/concierge" ]]; then
chown $(id -u):$(id -g) "$PWD/concierge"
chmod a+x "$PWD/concierge"
fi
if [[ ! -f "$PWD/concierge" ]]; then
sudo snap install go --classic
export CGO_ENABLED=0
go build -o concierge main.go
chmod 755 concierge
fi