Skip to content

Commit

Permalink
containerd: Install accordingly to FORKED_CONTAINERD
Browse files Browse the repository at this point in the history
The env var that was introduced in the previous commit, will allow us to
install the proper containerd version depending on what our tests will
need.

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

Signed-off-by: Fabiano Fidêncio <[email protected]>
  • Loading branch information
fidencio committed Sep 19, 2023
1 parent bf5395a commit 8146299
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 7 deletions.
18 changes: 15 additions & 3 deletions .ci/install_cri_containerd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ source "${script_dir}/lib.sh"
CONTAINERD_OS=$(go env GOOS)
CONTAINERD_ARCH=$(go env GOARCH)

containerd_tarball_version=$(get_version "externals.containerd.version")
if [ "${FORKED_CONTAINERD}" = "yes" ]; then
containerd_tarball_version=$(get_version "externals.containerd.forked.version")
else
containerd_tarball_version=$(get_version "externals.containerd.upstream.version")
fi

containerd_version=${containerd_tarball_version#v}

Expand All @@ -38,7 +42,11 @@ fi
install_from_source() {
echo "Trying to install containerd from source"
(
containerd_repo=$(get_version "externals.containerd.url")
if [ "${FORKED_CONTAINERD}" = "yes" ]; then
containerd_repo=$(get_version "externals.containerd.forked.url")
else
containerd_repo=$(get_version "externals.containerd.upstream.url")
fi
cd ${GOPATH}/src/
git clone "https://${containerd_repo}.git" "${GOPATH}/src/${containerd_repo}"

Expand All @@ -55,7 +63,11 @@ install_from_source() {

install_from_static_tarball() {
echo "Trying to install containerd from static tarball"
local tarball_url=$(get_version "externals.containerd.tarball_url")
if [ "${FORKED_CONTAINERD}" = "yes" ]; then
local tarball_url=$(get_version "externals.containerd.forked.tarball_url")
else
local tarball_url=$(get_version "externals.containerd.upstream.tarball_url")
fi

local tarball_name="cri-containerd-cni-${containerd_version}-${CONTAINERD_OS}-${CONTAINERD_ARCH}.tar.gz"
local url="${tarball_url}/${containerd_tarball_version}/${tarball_name}"
Expand Down
20 changes: 16 additions & 4 deletions integration/containerd/cri/integration-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ source "${SCRIPT_PATH}/../../../.ci/lib.sh"
# runc is installed in /usr/local/sbin/ add that path
export PATH="$PATH:/usr/local/sbin"

containerd_tarball_version=$(get_version "externals.containerd.version")
if [ "${FORKED_CONTAINERD}" = "yes" ]; then
containerd_tarball_version=$(get_version "externals.containerd.forked.version")
else
containerd_tarball_version=$(get_version "externals.containerd.upstream.version")
fi

# Runtime to be used for testing
RUNTIME=${RUNTIME:-containerd-shim-kata-v2}
Expand Down Expand Up @@ -48,7 +52,11 @@ SNAP_CI=${SNAP_CI:-""}
CI=${CI:-""}

containerd_shim_path="$(command -v containerd-shim)"
readonly cri_containerd_repo=$(get_version "externals.containerd.url")
if [ "${FORKED_CONTAINERD}" = "yes" ]; then
readonly cri_containerd_repo=$(get_version "externals.containerd.forked.url")
else
readonly cri_containerd_repo=$(get_version "externals.containerd.upstream.url")
fi
readonly cri_containerd_repo_git="https://${cri_containerd_repo}.git"

#containerd config file
Expand Down Expand Up @@ -464,7 +472,11 @@ main() {
git reset HEAD

# In CCv0 we are using a fork of containerd, so pull the matching branch of this
containerd_branch=$(get_version "externals.containerd.branch")
if [ "${FORKED_CONTAINERD}" = "yes" ]; then
containerd_branch=$(get_version "externals.containerd.forked.branch")
else
containerd_branch=$(get_version "externals.containerd.upstream.version")
fi
git checkout "${containerd_branch}"

# switch to the default pause image set by containerd:1.6.x
Expand Down Expand Up @@ -522,4 +534,4 @@ main() {
popd
}

main
main

0 comments on commit 8146299

Please sign in to comment.