Skip to content

Commit e289cfb

Browse files
authored
update test helpers for amazon 2023 and ubuntu 2404 (#661)
* update test helpers for amazon 2023 and ubuntu 2404 * f
1 parent b91115b commit e289cfb

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

tgrun/pkg/runner/vmi/embed/testhelpers.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,26 @@ function is_rhel_9_variant() {
596596
return 1
597597
}
598598

599+
# is_amazon_2023 returns 0 if the current distro is Amazon 2023.
600+
function is_amazon_2023() {
601+
if grep '^ID=' /etc/os-release | grep -qE '(amzn)' ; then
602+
if grep '^VERSION_ID=' /etc/os-release | grep -q '=*"2023' ; then
603+
return 0
604+
fi
605+
fi
606+
return 1
607+
}
608+
609+
# is_ubuntu_2404 returns 0 if the current distro is Ubuntu 24.04.
610+
function is_ubuntu_2404() {
611+
if grep '^ID=' /etc/os-release | grep -qE '(ubuntu)' ; then
612+
if grep '^VERSION_ID=' /etc/os-release | grep -q '=*"24.04' ; then
613+
return 0
614+
fi
615+
fi
616+
return 1
617+
}
618+
599619
function rhel_9_install_host_packages() {
600620
local packages=("$@")
601621
if is_rhel_9_variant ; then
@@ -604,6 +624,23 @@ function rhel_9_install_host_packages() {
604624
fi
605625
}
606626

627+
function amazon_2023_install_host_packages() {
628+
local packages=("$@")
629+
if is_amazon_2023 ; then
630+
# install required host packages
631+
yum install -y "${packages[@]}"
632+
fi
633+
}
634+
635+
function ubuntu_2024_install_host_packages() {
636+
local packages=("$@")
637+
if is_ubuntu_2404 ; then
638+
# install required host packages
639+
apt update
640+
apt install -y "${packages[@]}"
641+
fi
642+
}
643+
607644
function installer_host() {
608645
if echo "$1" | grep -q "staging" ; then
609646
echo "staging.kurl.sh"

0 commit comments

Comments
 (0)