Merge pull request #745 from Random-Liu/use-preloaded-containerd

Try using preloaded containerd if no version is specified.
This commit is contained in:
Lantao Liu 2018-04-19 14:45:36 -07:00 committed by GitHub
commit b5906334fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -92,10 +92,6 @@ if [ "${CONTAINERD_TEST:-"false"}" != "true" ]; then
deploy_path=${CONTAINERD_DEPLOY_PATH:-"cri-containerd-release"}
# CONTAINERD_VERSION is the cri-containerd version to use.
version=${CONTAINERD_VERSION:-""}
if [ -z "${version}" ]; then
echo "CONTAINERD_VERSION is not set."
exit 1
fi
else
deploy_path=${CONTAINERD_DEPLOY_PATH:-"cri-containerd-staging"}
@ -118,9 +114,20 @@ TARBALL_GCS_NAME="${pkg_prefix}-${version}.linux-amd64.tar.gz"
TARBALL_GCS_PATH="https://storage.googleapis.com/${deploy_path}/${TARBALL_GCS_NAME}"
# TARBALL is the name of the tarball after being downloaded.
TARBALL="cri-containerd.tar.gz"
# CONTAINERD_TAR_SHA1 is the sha1sum of containerd tarball.
if is_preloaded "${TARBALL_GCS_NAME}" "${CONTAINERD_TAR_SHA1:-""}"; then
tar_sha1="${CONTAINERD_TAR_SHA1:-""}"
if [ -z "${version}" ]; then
# Try using preloaded containerd if version is not specified.
tarball_gcs_pattern="${pkg_prefix}-.*.linux-amd64.tar.gz"
if is_preloaded "${tarball_gcs_pattern}" "${tar_sha1}"; then
echo "CONTAINERD_VERSION is not set, use preloaded containerd"
else
echo "CONTAINERD_VERSION is not set, and containerd is not preloaded"
exit 1
fi
else
if is_preloaded "${TARBALL_GCS_NAME}" "${tar_sha1}"; then
echo "${TARBALL_GCS_NAME} is preloaded"
else
# Download and untar the release tar ball.
@ -128,6 +135,7 @@ else
tar xvf "${TARBALL}"
rm -f "${TARBALL}"
fi
fi
# Configure containerd.
# Copy crictl config.