From e22ebf420f62e965fb0ce07c574672d48b65e543 Mon Sep 17 00:00:00 2001 From: Lantao Liu Date: Tue, 24 Apr 2018 01:23:44 -0700 Subject: [PATCH] Down containerd binaries from official release. Signed-off-by: Lantao Liu --- docs/release.md | 4 ++-- hack/install/install-deps.sh | 17 ++--------------- hack/release.sh | 32 ++++++++++++++++++++++++++++++-- 3 files changed, 34 insertions(+), 19 deletions(-) diff --git a/docs/release.md b/docs/release.md index 24368e45c..1fc32264c 100644 --- a/docs/release.md +++ b/docs/release.md @@ -19,9 +19,9 @@ Publish the release tarball `cri-containerd-${CONTAINERD_VERSION}.${OS}-${ARCH}. git checkout ${RELEASE_VERSION} # Publish the release tarball without cni. -DEPLOY_BUCKET=cri-containerd-release make push TARBALL_PREFIX=cri-containerd VERSION=${CONTAINERD_VERSION} +DEPLOY_BUCKET=cri-containerd-release make push TARBALL_PREFIX=cri-containerd OFFICIAL_RELEASE=true VERSION=${CONTAINERD_VERSION} # Publish the release tarball with cni. -DEPLOY_BUCKET=cri-containerd-release make push TARBALL_PREFIX=cri-containerd-cni INCLUDE_CNI=true VERSION=${CONTAINERD_VERSION} +DEPLOY_BUCKET=cri-containerd-release make push TARBALL_PREFIX=cri-containerd-cni OFFICIAL_RELEASE=true INCLUDE_CNI=true VERSION=${CONTAINERD_VERSION} ``` ## Step 6: Update release note with release tarball information diff --git a/hack/install/install-deps.sh b/hack/install/install-deps.sh index f2a45f374..95074045b 100755 --- a/hack/install/install-deps.sh +++ b/hack/install/install-deps.sh @@ -28,27 +28,14 @@ set -o pipefail cd $(dirname "${BASH_SOURCE[0]}") -# INSTALL_CNI indicates whether to install CNI. CNI installation -# makes sense for local testing, but doesn't make sense for cluster -# setup, because CNI daemonset is usually used to deploy CNI binaries -# and configurations in cluster. -INSTALL_CNI=${INSTALL_CNI:-true} - -# INSTALL_CNI indicates whether to install CNI config. -INSTALL_CNI_CONFIG=${INSTALL_CNI_CONFIG:-true} - # Install runc ./install-runc.sh # Install cni -if ${INSTALL_CNI}; then - ./install-cni.sh -fi +./install-cni.sh # Install cni config -if ${INSTALL_CNI_CONFIG}; then - ./install-cni-config.sh -fi +./install-cni-config.sh # Install containerd ./install-containerd.sh diff --git a/hack/release.sh b/hack/release.sh index 0152521dc..79a4b600d 100755 --- a/hack/release.sh +++ b/hack/release.sh @@ -31,6 +31,8 @@ INCLUDE_CNI=${INCLUDE_CNI:-false} # CUSTOM_CONTAINERD indicates whether to install customized containerd # for CI test. CUSTOM_CONTAINERD=${CUSTOM_CONTAINERD:-false} +# OFFICIAL_RELEASE indicates whether to use official containerd release. +OFFICIAL_RELEASE=${OFFICIAL_RELEASE:-false} destdir=${BUILD_DIR}/release-stage @@ -42,9 +44,35 @@ fi # Remove release-stage directory to avoid including old files. rm -rf ${destdir} +# download_containerd downloads containerd from official release. +download_containerd() { + local -r tmppath="$(mktemp -d /tmp/download-containerd.XXXX)" + local -r tarball="${tmppath}/containerd.tar.gz" + local -r url="https://github.com/containerd/containerd/releases/download/v${VERSION}/containerd-${VERSION}.linux-amd64.tar.gz" + wget -O "${tarball}" "${url}" + tar -C "${destdir}/usr/local/bin" -xzf "${tarball}" + rm -rf "${tmppath}" +} + # Install dependencies into release stage. -NOSUDO=true INSTALL_CNI=${INCLUDE_CNI} INSTALL_CNI_CONFIG=false DESTDIR=${destdir} \ - ./hack/install/install-deps.sh +# Install runc +NOSUDO=true DESTDIR=${destdir} ./hack/install/install-runc.sh + +if ${INCLUDE_CNI}; then + # Install cni + NOSUDO=true DESTDIR=${destdir} ./hack/install/install-cni.sh +fi + +# Install critools +NOSUDO=true DESTDIR=${destdir} ./hack/install/install-critools.sh + +# Install containerd +if $OFFICIAL_RELEASE; then + download_containerd +else + # Build containerd from source + NOSUDO=true DESTDIR=${destdir} ./hack/install/install-containerd.sh +fi if ${CUSTOM_CONTAINERD}; then make install -e DESTDIR=${destdir}