From de1eeee334a58d2c49c0b095004fd9ead820e367 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Tue, 26 Sep 2023 22:52:14 +0200 Subject: [PATCH] ci: Create a generic install_crio function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This will serve us quite will in the upcoming tests addition, which will also have to be executed using CRi-O. Signed-off-by: Fabiano FidĂȘncio --- tests/common.bash | 46 +++++++++++++++++++++++++++++++++++++ tests/gha-run-k8s-common.sh | 41 +-------------------------------- 2 files changed, 47 insertions(+), 40 deletions(-) diff --git a/tests/common.bash b/tests/common.bash index 19f57ab0c..e114a2121 100644 --- a/tests/common.bash +++ b/tests/common.bash @@ -469,6 +469,52 @@ function install_nydus_snapshotter() { rm -f "${tarball_name}" } +function _get_os_for_crio() { + source /etc/os-release + + if [ "${NAME}" != "Ubuntu" ]; then + echo "Only Ubuntu is supported for now" + exit 2 + fi + + echo "x${NAME}_${VERSION_ID}" +} + +# version: the CRI-O version to be installe +function install_crio() { + local version=${1} + + os=$(_get_os_for_crio) + + echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/${os}/ /"|sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list + echo "deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable:/cri-o:/${version}/${os}/ /"|sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable:cri-o:${version}.list + curl -L https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable:cri-o:${version}/${os}/Release.key | sudo apt-key add - + curl -L https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/${os}/Release.key | sudo apt-key add - + sudo apt update + sudo apt install -y cri-o cri-o-runc + + # We need to set the default capabilities to ensure our tests will pass + # See: https://github.com/kata-containers/kata-containers/issues/8034 + sudo mkdir -p /etc/crio/crio.conf.d/ + cat <