2019-04-26 15:48:28 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -euxo pipefail
|
|
|
|
|
|
|
|
sysctl net.ipv6.conf.all.disable_ipv6=0
|
|
|
|
|
2020-01-16 12:06:11 +00:00
|
|
|
export REPOSITORY=${REPOSITORY:-${GITHUB_REPOSITORY}}
|
2020-01-16 12:24:23 +00:00
|
|
|
export _BRANCH=${BRANCH#refs/heads/}
|
|
|
|
export BRANCH=${_BRANCH:-${GITHUB_REF#refs/heads/}}
|
2020-01-13 16:20:40 +00:00
|
|
|
|
2019-04-26 15:48:28 +00:00
|
|
|
if [[ "$DEPLOY" == "cloud-init" ]]; then
|
|
|
|
bash tests/cloud-init.sh | lxc profile set default user.user-data -
|
|
|
|
else
|
|
|
|
echo -e "#cloud-config\nssh_authorized_keys:\n - $(cat ~/.ssh/id_rsa.pub)" | lxc profile set default user.user-data -
|
|
|
|
fi
|
|
|
|
|
2021-10-31 10:21:04 +00:00
|
|
|
lxc network set lxdbr0 ipv4.address 10.0.8.1/24
|
2019-04-26 15:48:28 +00:00
|
|
|
|
2021-10-31 10:21:04 +00:00
|
|
|
lxc profile set default raw.lxc 'lxc.apparmor.profile = unconfined'
|
2019-04-26 15:48:28 +00:00
|
|
|
lxc profile set default security.privileged true
|
|
|
|
lxc profile show default
|
2021-10-31 10:21:04 +00:00
|
|
|
|
|
|
|
lxc init ubuntu:${UBUNTU_VERSION} algo
|
|
|
|
lxc network attach lxdbr0 algo eth0 eth0
|
|
|
|
lxc config device set algo eth0 ipv4.address 10.0.8.100
|
|
|
|
lxc start algo
|
2019-04-26 15:48:28 +00:00
|
|
|
|
|
|
|
ip addr
|
|
|
|
|
|
|
|
until dig A +short algo.lxd @10.0.8.1 | grep -vE '^$' > /dev/null; do
|
|
|
|
sleep 3
|
|
|
|
done
|
|
|
|
|
2021-12-14 20:52:34 +00:00
|
|
|
case ${UBUNTU_VERSION} in
|
2023-05-17 00:04:23 +00:00
|
|
|
20.04|22.04)
|
2021-12-14 20:52:34 +00:00
|
|
|
lxc exec algo -- apt remove snapd --purge -y || true
|
|
|
|
;;
|
|
|
|
18.04)
|
|
|
|
lxc exec algo -- apt install python3.8 -y
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2019-04-26 15:48:28 +00:00
|
|
|
lxc list
|