Skip to content
This repository has been archived by the owner on Jun 28, 2024. It is now read-only.

Commit

Permalink
containerd: fix the issue of getting cri version
Browse files Browse the repository at this point in the history
Since 1.5.0, containerd had embedded cri and there's no
need to get the cri version.

Depends-on: github.com/kata-containers/kata-containers#2040

Fixes:#3630

Signed-off-by: fupan.lfp <fupan.lfp@antgroup.com>
  • Loading branch information
fupan.lfp committed Jun 18, 2021
1 parent 4ae77d8 commit ab6846e
Showing 1 changed file with 8 additions and 20 deletions.
28 changes: 8 additions & 20 deletions .ci/install_cri_containerd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ set -o errtrace
source /etc/os-release || source /usr/lib/os-release

script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cri_repository="github.com/containerd/cri"

# Flag to do tasks for CI
CI=${CI:-""}
Expand All @@ -29,9 +28,7 @@ CONTAIENRD_ARCH=$(go env GOARCH)
cri_containerd_tarball_version=$(get_version "externals.cri-containerd.version")
cri_containerd_repo=$(get_version "externals.cri-containerd.url")

echo "Get cri_containerd version"
cri_containerd_version_url="https://raw.githubusercontent.com/containerd/containerd/${cri_containerd_tarball_version}/vendor.conf"
cri_containerd_version=$(curl -sL $cri_containerd_version_url | grep "github.com/containerd/cri" | awk '{print $2}')
cri_containerd_version=${cri_containerd_tarball_version#v}

echo "Set up environment"
if [ "$ID" == centos ] || [ "$ID" == rhel ]; then
Expand All @@ -42,24 +39,21 @@ fi
install_from_source() {
echo "Trying to install containerd from source"
(
cd "${GOPATH}/src/${cri_repository}" >>/dev/null
cd "${GOPATH}/src/${cri_containerd_repo}" >>/dev/null
git fetch
git checkout "${cri_containerd_version}"
make BUILDTAGS="${BUILD_TAGS:-}" release
local commit
commit=$(git rev-parse --short HEAD)
tarball_name="cri-containerd-${commit}.${CONTAINERD_OS}-${CONTAIENRD_ARCH}.tar.gz"
sudo tar -xvf "./_output/${tarball_name}" -C /
git checkout "${cri_containerd_tarball_version}"
make BUILDTAGS="${BUILD_TAGS:-}" cri-cni-release
tarball_name="cri-containerd-cni-${cri_containerd_version}-${CONTAINERD_OS}-${CONTAIENRD_ARCH}.tar.gz"
sudo tar -xvf "./releases/${tarball_name}" -C /
)
}

install_from_static_tarball() {
echo "Trying to install containerd from static tarball"
local tarball_url=$(get_version "externals.cri-containerd.tarball_url")
cri_containerd_tarball_version="${cri_containerd_tarball_version/v/}"

local tarball_name="cri-containerd-${cri_containerd_tarball_version}.${CONTAINERD_OS}-${CONTAIENRD_ARCH}.tar.gz"
local url="${tarball_url}/${tarball_name}"
local tarball_name="cri-containerd-cni-${cri_containerd_version}-${CONTAINERD_OS}-${CONTAIENRD_ARCH}.tar.gz"
local url="${tarball_url}/${cri_containerd_tarball_version}/${tarball_name}"

echo "Download tarball from ${url}"
if ! curl -OL -f "${url}"; then
Expand All @@ -68,12 +62,6 @@ install_from_static_tarball() {
fi

sudo tar -xvf "${tarball_name}" -C /
echo "vendored cri version ${cri_containerd_version}"
(
cd "${GOPATH}/src/${cri_containerd_repo}" >>/dev/null
echo "checkout to cri version ${cri_containerd_version}"
git checkout "${cri_containerd_version}"
)
}

go get "${cri_containerd_repo}"
Expand Down

0 comments on commit ab6846e

Please sign in to comment.