2023-10-30 19:52:44 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2024-04-16 14:35:04 +00:00
|
|
|
#set -ax
|
2023-10-30 19:52:44 +00:00
|
|
|
|
2024-02-20 12:39:50 +00:00
|
|
|
latest_dev_series="noble"
|
|
|
|
latest_sup_series="mantic"
|
2024-04-16 14:35:04 +00:00
|
|
|
all_series="bionic focal jammy ${latest_sup_series} ${latest_dev_series}"
|
2024-02-20 12:39:50 +00:00
|
|
|
|
2023-10-30 19:52:44 +00:00
|
|
|
project_name="sos-testing"
|
|
|
|
project="--project ${project_name}"
|
|
|
|
lxc="lxc ${project}"
|
|
|
|
lxc_exec="${lxc} exec"
|
|
|
|
|
2024-04-16 14:35:04 +00:00
|
|
|
sos_location="$HOME/gitRepos/sos"
|
2023-10-30 19:52:44 +00:00
|
|
|
|
|
|
|
lxc project create ${project_name}
|
|
|
|
|
|
|
|
${lxc} profile edit default < lxd_profile.yaml
|
|
|
|
|
2024-02-20 12:39:50 +00:00
|
|
|
for distro in ${all_series}
|
2023-10-30 19:52:44 +00:00
|
|
|
do
|
|
|
|
|
2024-04-16 14:35:04 +00:00
|
|
|
inst_name=sos-avocado01-${distro}
|
|
|
|
|
|
|
|
${lxc} delete ${inst_name} --force
|
2023-10-30 19:52:44 +00:00
|
|
|
|
2024-02-20 12:39:50 +00:00
|
|
|
if [[ "${distro}" == "${latest_dev_series}" ]] ; then
|
|
|
|
image="ubuntu-daily:devel"
|
|
|
|
else
|
|
|
|
image="ubuntu:${distro}"
|
|
|
|
fi
|
2023-10-30 19:52:44 +00:00
|
|
|
|
2024-04-16 14:35:04 +00:00
|
|
|
${lxc} launch ${image} ${inst_name} --vm -c limits.cpu=4 -c limits.memory=4GiB
|
2023-10-30 19:52:44 +00:00
|
|
|
|
2024-04-16 14:35:04 +00:00
|
|
|
cd ${sos_location}
|
|
|
|
find . -type f -name "*.pyc" -exec sudo rm -f {} \;
|
|
|
|
rm -rf .tox *.snap *.deb
|
2024-02-20 12:39:50 +00:00
|
|
|
tar cfz /tmp/sos.tgz .
|
|
|
|
cd -
|
|
|
|
|
2024-04-16 14:35:04 +00:00
|
|
|
echo -n "Checking VM status of ${inst_name} "
|
|
|
|
|
|
|
|
while true ; do
|
|
|
|
num_of_procs=$(${lxc} info ${inst_name} | yq .Resources.Processes)
|
|
|
|
[[ ${num_of_procs} -gt 0 ]] && break
|
|
|
|
sleep 3
|
|
|
|
echo -n "."
|
|
|
|
done
|
|
|
|
|
|
|
|
echo done
|
|
|
|
|
|
|
|
${lxc} file push /tmp/sos.tgz ${inst_name}/root/sos.tgz
|
|
|
|
|
|
|
|
echo -n "Checking cloud-init status of ${inst_name} "
|
2024-02-20 12:39:50 +00:00
|
|
|
|
|
|
|
while true ; do
|
2024-04-16 14:35:04 +00:00
|
|
|
status=$(${lxc_exec} ${inst_name} -- cloud-init status | grep status | awk '{print $2}')
|
2024-02-20 12:39:50 +00:00
|
|
|
[[ "${status}" == "done" ]] && break
|
|
|
|
[[ "${status}" == "error" ]] && break
|
|
|
|
sleep 3
|
2024-04-16 14:35:04 +00:00
|
|
|
echo -n "."
|
2024-02-20 12:39:50 +00:00
|
|
|
done
|
2023-10-30 19:52:44 +00:00
|
|
|
|
2024-04-16 14:35:04 +00:00
|
|
|
echo done
|
|
|
|
|
|
|
|
${lxc_exec} ${inst_name} -- bash /root/run_avocado.sh
|
|
|
|
${lxc} stop ${inst_name}
|
2023-10-30 19:52:44 +00:00
|
|
|
|
|
|
|
done
|