Add proposed to script, and fine tuning with arrays

This commit is contained in:
2024-07-05 12:20:41 +01:00
parent 451f985d57
commit 0afb518f0c
3 changed files with 55 additions and 19 deletions

View File

@@ -2,24 +2,29 @@
#set -ax
declare -A all_series
all_series=(
['focal']="ubuntu:focal"
['jammy']="ubuntu:jammy"
['noble']="ubuntu:noble"
['mantic']="ubuntu:mantic"
['oracular']="ubuntu-daily:devel"
)
latest_dev_series="oracular"
latest_sup_series="noble"
non_lts_releases="mantic"
all_series="focal jammy noble ${non_lts_releases} ${latest_dev_series}"
ppa_user="arif-ali"
ppa_name="sosreport-dev"
for distro in ${all_series}
for distro in "${!all_series[@]}"
do
inst_name=sos-avocado01-${distro}
inst_name=sos-avocado-${distro}
if [[ "${distro}" == "${latest_dev_series}" ]] ; then
image="ubuntu-daily:${distro}"
else
image="ubuntu:${distro}"
fi
image="${all_series[${distro}]}"
image_list="$(lxc image list --format json | jq -rc '.[] | select(.aliases[].name | contains("autopkgtest")) | .aliases[].name' | xargs)"

View File

@@ -4,10 +4,20 @@
script_cmd=${0##*/}
declare -A all_series
all_series=(
['bionic']="ubuntu:bionic"
['focal']="ubuntu:focal"
['jammy']="ubuntu:jammy"
['noble']="ubuntu:noble"
['mantic']="ubuntu:mantic"
['oracular']="ubuntu-daily:devel"
)
latest_dev_series="oracular"
latest_sup_series="noble"
non_lts_releases="mantic"
all_series="bionic focal jammy noble ${non_lts_releases} ${latest_dev_series}"
sos_type="deb"
sos_channel="latest/candidate"
@@ -15,6 +25,9 @@ sos_channel="latest/candidate"
ppa_user="arif-ali"
ppa_name="sosreport-dev"
# this can be "ppa" or "proposed"
deb_type="proposed"
project_name="sos-testing"
project="--project ${project_name}"
lxc="lxc ${project}"
@@ -26,18 +39,14 @@ lxc project create ${project_name}
${lxc} profile edit default < lxd_profile.yaml
for distro in ${all_series}
for distro in "${!all_series[@]}"
do
inst_name=sos-avocado-${distro}
${lxc} delete ${inst_name} --force
if [[ "${distro}" == "${latest_dev_series}" ]] ; then
image="ubuntu-daily:devel"
else
image="ubuntu:${distro}"
fi
image="${all_series[${distro}]}"
${lxc} launch ${image} ${inst_name} --vm -c limits.cpu=4 -c limits.memory=4GiB
@@ -78,10 +87,14 @@ do
echo done
if [[ "${script_cmd}" == "do_sos_testing.sh" ]] ; then
${lxc_exec} ${inst_name} -- sudo add-apt-repository -y ppa:${ppa_user}/${ppa_name}
if [[ "${distro}" == "${latest_dev_series}" ]] ; then
filename="$(echo ${ppa_name} | sed 's/\./_/g')"
${lxc_exec} ${inst_name} -- sed -i s/i${latest_sup_series}/${latest_dev_series}/g /etc/apt/sources.list.d/${ppa_user}-ubuntu-${filename}-${latest_sup_series}.list
if [[ "${deb_type}" == "ppa" ]] ; then
${lxc_exec} ${inst_name} -- sudo add-apt-repository -y ppa:${ppa_user}/${ppa_name}
if [[ "${distro}" == "${latest_dev_series}" ]] ; then
filename="$(echo ${ppa_name} | sed 's/\./_/g')"
${lxc_exec} ${inst_name} -- sed -i s/i${latest_sup_series}/${latest_dev_series}/g /etc/apt/sources.list.d/${ppa_user}-ubuntu-${filename}-${latest_sup_series}.list
fi
elif [[ "${deb_type}" == "proposed" ]] ; then
${lxc_exec} ${inst_name} -- bash /root/enable_proposed.sh
fi
cat > setup_sos.sh << EOF
#!/bin/bash

View File

@@ -10,6 +10,15 @@ devices:
config:
user.user-data: |
#cloud-config
apt:
disable_suites:
- $RELEASE-proposed
sources_list: |
deb $MIRROR $RELEASE main restricted multiverse universe
deb $MIRROR $RELEASE-updates main restricted multiverse universe
deb $MIRROR $RELEASE-backports main restricted multiverse universe
deb $MIRROR $RELEASE-security main restricted multiverse universe
deb $MIRROR $RELEASE-proposed main restricted multiverse universe
packages:
- python3-pip
- snapd
@@ -22,6 +31,15 @@ config:
#!bin/bash
sudo apt update --allow-releaseinfo-change
sudo apt -y purge sosreport
- path: /root/enable_proposed.sh
permissions: '0755'
owner: root:root
content: |
#!bin/bash
echo "Enabling proposed repo ..."
sudo sed -i 's/# suite disabled by cloud-init: //g' /etc/apt/sources.list
sudo apt update
- path: /root/run_avocado.sh
permissions: '0755'
owner: root:root