From 8b04e2209bfead588e38a90b36496b9b9336e9de Mon Sep 17 00:00:00 2001 From: ChengyuZhu6 Date: Mon, 11 Sep 2023 18:34:23 +0800 Subject: [PATCH] ci: install nydus snapshotter Install nydus-snapshotter dependencies. Signed-off-by: ChengyuZhu6 --- .ci/install_nydus_snapshotter.sh | 10 +++++----- .ci/lib.sh | 12 ++++++++++++ .ci/setup.sh | 6 ++++++ 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/.ci/install_nydus_snapshotter.sh b/.ci/install_nydus_snapshotter.sh index 5e2da6c6f..e6970e02e 100644 --- a/.ci/install_nydus_snapshotter.sh +++ b/.ci/install_nydus_snapshotter.sh @@ -13,7 +13,7 @@ set -o errtrace cidir=$(dirname "$0") source "${cidir}/lib.sh" -target_dir="/opt/confidential-containers" +target_dir="/opt/kata" nydus_snapshotter_repo=${nydus_snapshotter_repo:-"github.com/containerd/nydus-snapshotter"} nydus_snapshotter_repo_git="https://${nydus_snapshotter_repo}.git" @@ -32,9 +32,9 @@ clone_nydus_snapshotter_repo() { if [ ! -d "${nydus_snapshotter_repo_dir}" ]; then sudo mkdir -p "${nydus_snapshotter_repo_dir}" - git clone ${nydus_snapshotter_repo_git} "${nydus_snapshotter_repo_dir}" || true + sudo git clone ${nydus_snapshotter_repo_git} "${nydus_snapshotter_repo_dir}" || true pushd "${nydus_snapshotter_repo_dir}" - git checkout "${nydus_snapshotter_version}" + sudo git checkout "${nydus_snapshotter_version}" popd fi } @@ -47,7 +47,7 @@ build_nydus_snapshotter() { sudo -E PATH=$PATH make if [ ! -d "$nydus_snapshotter_binary_target_dir" ]; then - sudo mkdir -p $nydus_snapshotter_binary_target_dir + sudo mkdir -p "$nydus_snapshotter_binary_target_dir" fi sudo install -D -m 755 "bin/containerd-nydus-grpc" "$nydus_snapshotter_binary_target_dir/containerd-nydus-grpc" sudo install -D -m 755 "bin/nydus-overlayfs" "$nydus_snapshotter_binary_target_dir/nydus-overlayfs" @@ -79,7 +79,7 @@ download_nydus_from_tarball() { local tarball_url="${nydus_repo}/releases/download/${nydus_version}/nydus-static-${nydus_version}-linux-$goarch.tgz" echo "Download tarball from ${tarball_url}" tmp_dir=$(mktemp -d -t install-nydus-tmp.XXXXXXXXXX) - curl -Ls "$tarball_url" | sudo tar xfz - -C $tmp_dir --strip-components=1 + sudo curl -Ls "$tarball_url" | sudo tar xfz - -C $tmp_dir --strip-components=1 sudo install -D -m 755 "$tmp_dir/nydus-image" "/usr/local/bin/" } diff --git a/.ci/lib.sh b/.ci/lib.sh index 6de2dee64..cf386d4ed 100755 --- a/.ci/lib.sh +++ b/.ci/lib.sh @@ -391,6 +391,15 @@ cleanup_network_interface() { [ "$CNI" != "" ] && info "$CNI doesn't clean up" } +cleanup_nydus_snapshotter_dependencies(){ + if [ -f "/usr/local/bin/nydus-overlayfs" ]; then + rm -f "/usr/local/bin/nydus-overlayfs" + fi + if [ -f "/usr/local/bin/nydus-image" ]; then + rm -f "/usr/local/bin/nydus-image" + fi +} + gen_clean_arch() { # For metrics CI we are removing unnecessary steps like # removing packages, removing CRI-O, etc mainly because @@ -412,6 +421,9 @@ gen_clean_arch() { fi fi + info "remove nydus snapshotter dependencies" + cleanup_nydus_snapshotter_dependencies + info "remove containers started by ctr" clean_env_ctr diff --git a/.ci/setup.sh b/.ci/setup.sh index 71cb314db..8454ea42e 100755 --- a/.ci/setup.sh +++ b/.ci/setup.sh @@ -24,6 +24,7 @@ KATA_HYPERVISOR="${KATA_HYPERVISOR:-qemu}" KUBERNETES="${KUBERNETES:-yes}" TEST_CGROUPSV2="${TEST_CGROUPSV2:-false}" USE_DEVMAPPER="${USE_DEVMAPPER:-false}" +SNAPSHOTTER="${SNAPSHOTTER:-nydus}" setup_distro_env() { local setup_type="$1" @@ -135,6 +136,11 @@ install_extra_tools() { fi fi + if [ "${SNAPSHOTTER}" == "nydus" ]; then + info "Install nydus-snapshotter" + bash -f "${cidir}/install_nydus_snapshotter.sh" + fi + echo "Install CNI plugins" bash -f "${cidir}/install_cni_plugins.sh" }