Skip to content

Commit 1efcba2

Browse files
Random-Liuestesp
authored andcommitted
Try using preloaded containerd if no version is specified.
Signed-off-by: Lantao Liu <[email protected]>
1 parent b3d92c5 commit 1efcba2

1 file changed

Lines changed: 19 additions & 11 deletions

File tree

contrib/gce/configure.sh

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,6 @@ if [ "${CONTAINERD_TEST:-"false"}" != "true" ]; then
9292
deploy_path=${CONTAINERD_DEPLOY_PATH:-"cri-containerd-release"}
9393
# CONTAINERD_VERSION is the cri-containerd version to use.
9494
version=${CONTAINERD_VERSION:-""}
95-
if [ -z "${version}" ]; then
96-
echo "CONTAINERD_VERSION is not set."
97-
exit 1
98-
fi
9995
else
10096
deploy_path=${CONTAINERD_DEPLOY_PATH:-"cri-containerd-staging"}
10197

@@ -118,15 +114,27 @@ TARBALL_GCS_NAME="${pkg_prefix}-${version}.linux-amd64.tar.gz"
118114
TARBALL_GCS_PATH="https://storage.googleapis.com/${deploy_path}/${TARBALL_GCS_NAME}"
119115
# TARBALL is the name of the tarball after being downloaded.
120116
TARBALL="cri-containerd.tar.gz"
121-
122117
# CONTAINERD_TAR_SHA1 is the sha1sum of containerd tarball.
123-
if is_preloaded "${TARBALL_GCS_NAME}" "${CONTAINERD_TAR_SHA1:-""}"; then
124-
echo "${TARBALL_GCS_NAME} is preloaded"
118+
tar_sha1="${CONTAINERD_TAR_SHA1:-""}"
119+
120+
if [ -z "${version}" ]; then
121+
# Try using preloaded containerd if version is not specified.
122+
tarball_gcs_pattern="${pkg_prefix}-.*.linux-amd64.tar.gz"
123+
if is_preloaded "${tarball_gcs_pattern}" "${tar_sha1}"; then
124+
echo "CONTAINERD_VERSION is not set, use preloaded containerd"
125+
else
126+
echo "CONTAINERD_VERSION is not set, and containerd is not preloaded"
127+
exit 1
128+
fi
125129
else
126-
# Download and untar the release tar ball.
127-
curl -f --ipv4 -Lo "${TARBALL}" --connect-timeout 20 --max-time 300 --retry 6 --retry-delay 10 "${TARBALL_GCS_PATH}"
128-
tar xvf "${TARBALL}"
129-
rm -f "${TARBALL}"
130+
if is_preloaded "${TARBALL_GCS_NAME}" "${tar_sha1}"; then
131+
echo "${TARBALL_GCS_NAME} is preloaded"
132+
else
133+
# Download and untar the release tar ball.
134+
curl -f --ipv4 -Lo "${TARBALL}" --connect-timeout 20 --max-time 300 --retry 6 --retry-delay 10 "${TARBALL_GCS_PATH}"
135+
tar xvf "${TARBALL}"
136+
rm -f "${TARBALL}"
137+
fi
130138
fi
131139

132140
# Configure containerd.

0 commit comments

Comments
 (0)