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"} deploy_path=${CONTAINERD_DEPLOY_PATH:-"cri-containerd-release"}
# CONTAINERD_VERSION is the cri-containerd version to use. # CONTAINERD_VERSION is the cri-containerd version to use.
version=${CONTAINERD_VERSION:-""} version=${CONTAINERD_VERSION:-""}
if [ -z "${version}" ]; then
echo "CONTAINERD_VERSION is not set."
exit 1
fi
else else
deploy_path=${CONTAINERD_DEPLOY_PATH:-"cri-containerd-staging"} deploy_path=${CONTAINERD_DEPLOY_PATH:-"cri-containerd-staging"}
@ -118,15 +114,27 @@ TARBALL_GCS_NAME="${pkg_prefix}-${version}.linux-amd64.tar.gz"
TARBALL_GCS_PATH="https://storage.googleapis.com/${deploy_path}/${TARBALL_GCS_NAME}" TARBALL_GCS_PATH="https://storage.googleapis.com/${deploy_path}/${TARBALL_GCS_NAME}"
# TARBALL is the name of the tarball after being downloaded. # TARBALL is the name of the tarball after being downloaded.
TARBALL="cri-containerd.tar.gz" TARBALL="cri-containerd.tar.gz"
# CONTAINERD_TAR_SHA1 is the sha1sum of containerd tarball. # CONTAINERD_TAR_SHA1 is the sha1sum of containerd tarball.
if is_preloaded "${TARBALL_GCS_NAME}" "${CONTAINERD_TAR_SHA1:-""}"; then tar_sha1="${CONTAINERD_TAR_SHA1:-""}"
echo "${TARBALL_GCS_NAME} is preloaded"
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 else
# Download and untar the release tar ball. if is_preloaded "${TARBALL_GCS_NAME}" "${tar_sha1}"; then
curl -f --ipv4 -Lo "${TARBALL}" --connect-timeout 20 --max-time 300 --retry 6 --retry-delay 10 "${TARBALL_GCS_PATH}" echo "${TARBALL_GCS_NAME} is preloaded"
tar xvf "${TARBALL}" else
rm -f "${TARBALL}" # Download and untar the release tar ball.
curl -f --ipv4 -Lo "${TARBALL}" --connect-timeout 20 --max-time 300 --retry 6 --retry-delay 10 "${TARBALL_GCS_PATH}"
tar xvf "${TARBALL}"
rm -f "${TARBALL}"
fi
fi fi
# Configure containerd. # Configure containerd.