From f66c68a2bf53b210a06029e0b35f171554e84940 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Thu, 13 Jul 2023 13:43:22 +0200 Subject: [PATCH] ci: Add install_cri_tools() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This function will install cri-tools in the host, and soon enough (as part of this PR) we'll be using it to install cri-tools as part of the cri-containerd tests. I've decided to have this as part of the `common.bash` as other tests that will be added in the future will require cri-tools to be installed as well. Signed-off-by: Fabiano FidĂȘncio --- tests/common.bash | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/common.bash b/tests/common.bash index 83051d33b8..5f7fdb8460 100644 --- a/tests/common.bash +++ b/tests/common.bash @@ -388,3 +388,17 @@ function install_cri_containerd() { sudo mkdir -p /etc/containerd containerd config default | sudo tee /etc/containerd/config.toml } + +# base_version: The version to be intalled in the ${major}.${minor} format +function install_cri_tools() { + base_version="${1}" + + project="kubernetes-sigs/cri-tools" + version=$(get_latest_patch_release_from_a_github_project "${project}" "${base_version}") + + tarball_name="crictl-${version}-linux-$(${repo_root_dir}/tests/kata-arch.sh -g).tar.gz" + + download_github_project_tarball "${project}" "${version}" "${tarball_name}" + sudo tar -xvf "${tarball_name}" -C /usr/local/bin + rm -f "${tarball_name}" +}