algo/tests/pre-deploy.sh

44 lines
1.1 KiB
Bash
Raw Normal View History

#!/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
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
2021-10-31 10:21:04 +00:00
lxc profile set default raw.lxc 'lxc.apparmor.profile = unconfined'
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
ip addr
until dig A +short algo.lxd @10.0.8.1 | grep -vE '^$' > /dev/null; do
sleep 3
done
case ${UBUNTU_VERSION} in
20.04|22.04)
lxc exec algo -- apt remove snapd --purge -y || true
;;
18.04)
lxc exec algo -- apt install python3.8 -y
;;
esac
lxc list