Skip to content

Commit

Permalink
cache containerd 1.6, add testing channel for apt, and switch to pack…
Browse files Browse the repository at this point in the history
…ages.microsoft.com again (Azure#1965)

* Revert "Revert PRs for containerd packages.microsoft.com installation switch (Azure#1930)"

This reverts commit 0fa4231.

* Revert "Revert "Revert PRs for containerd packages.microsoft.com installation switch (Azure#1930)""

This reverts commit 10b122d.

* update manifest.cue with containerd 1.6

* Revert "Revert "Revert "Revert PRs for containerd packages.microsoft.com installation switch (Azure#1930)"""

This reverts commit 7d732a2.

* Add testing channel for apt

* move updateAptPackage to vhd build - avoid repetition

* add updateAptWithMicrosoftPkg to cse_main.sh

* add 18.04 and 20.04 specific cases

* fix

* typo

* typo in check
  • Loading branch information
ganeshkumarashok authored Jul 18, 2022
1 parent 7a7c3ee commit 099a346
Show file tree
Hide file tree
Showing 207 changed files with 1,055 additions and 443 deletions.
4 changes: 3 additions & 1 deletion parts/linux/cloud-init/artifacts/cse_helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,9 @@ apt_get_download() {
local ret=0
pushd $APT_CACHE_DIR || return 1
for i in $(seq 1 $retries); do
wait_for_apt_locks; apt-get -o Dpkg::Options::=--force-confold download -y "${@}" && break
dpkg --configure -a --force-confdef
wait_for_apt_locks
apt-get -o Dpkg::Options::=--force-confold download -y "${@}" && break
if [ $i -eq $retries ]; then ret=1; else sleep $wait_sleep; fi
done
popd || return 1
Expand Down
2 changes: 2 additions & 0 deletions parts/linux/cloud-init/artifacts/cse_main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ else
echo "Golden image; skipping dependencies installation"
fi

updateAptWithMicrosoftPkg

installContainerRuntime
{{- if and NeedsContainerd TeleportEnabled}}
installTeleportdPlugin
Expand Down
3 changes: 2 additions & 1 deletion parts/linux/cloud-init/artifacts/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"downloadLocation": "/opt/containerd/downloads",
"downloadURL": "https://moby.blob.core.windows.net/moby/moby-containerd/${CONTAINERD_VERSION}+azure/bionic/linux_${CPU_ARCH}/moby-containerd_${CONTAINERD_VERSION}+azure-ubuntu18.04u${CONTAINERD_PATCH_VERSION}_${CPU_ARCH}.deb",
"versions": [
"1.4.13-3"
"1.4.13-3",
"1.6.4-4"
],
"edge": "1.6.4-4",
"latest": "1.5.11-2",
Expand Down
28 changes: 19 additions & 9 deletions parts/linux/cloud-init/artifacts/ubuntu/cse_install_ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,14 @@ updateAptWithMicrosoftPkg() {
fi

retrycmd_if_failure 10 5 10 cp /tmp/microsoft-prod.list /etc/apt/sources.list.d/ || exit $ERR_MOBY_APT_LIST_TIMEOUT
if [[ ${UBUNTU_RELEASE} == "18.04" ]]; then {
echo "deb [arch=amd64,arm64,armhf] https://packages.microsoft.com/ubuntu/18.04/multiarch/prod testing main" > /etc/apt/sources.list.d/microsoft-prod-testing.list
}
elif [[ ${UBUNTU_RELEASE} == "20.04" || ${UBUNTU_RELEASE} == "22.04" ]]; then {
echo "deb [arch=amd64,arm64,armhf] https://packages.microsoft.com/ubuntu/${UBUNTU_RELEASE}/prod testing main" > /etc/apt/sources.list.d/microsoft-prod-testing.list
}
fi

retrycmd_if_failure_no_stats 120 5 25 curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > /tmp/microsoft.gpg || exit $ERR_MS_GPG_KEY_DOWNLOAD_TIMEOUT
retrycmd_if_failure 10 5 10 cp /tmp/microsoft.gpg /etc/apt/trusted.gpg.d/ || exit $ERR_MS_GPG_KEY_DOWNLOAD_TIMEOUT
apt_get_update || exit $ERR_APT_UPDATE_TIMEOUT
Expand Down Expand Up @@ -162,26 +170,27 @@ installStandaloneContainerd() {
removeContainerd
# if containerd version has been overriden then there should exist a local .deb file for it on aks VHDs (best-effort)
# if no files found then try fetching from packages.microsoft repo
CONTAINERD_DEB_TMP="moby-containerd_${CONTAINERD_VERSION/-/\~}+azure-${CONTAINERD_PATCH_VERSION}_${CPU_ARCH}.deb"
CONTAINERD_DEB_FILE="$CONTAINERD_DOWNLOADS_DIR/${CONTAINERD_DEB_TMP}"
CONTAINERD_DEB_FILE="$(ls ${CONTAINERD_DOWNLOADS_DIR}/moby-containerd_${CONTAINERD_VERSION}*)"
if [[ -f "${CONTAINERD_DEB_FILE}" ]]; then
installDebPackageFromFile ${CONTAINERD_DEB_FILE} || exit $ERR_CONTAINERD_INSTALL_TIMEOUT
return 0
fi
fi
downloadContainerdFromVersion ${CONTAINERD_VERSION} ${CONTAINERD_PATCH_VERSION}
CONTAINERD_DEB_FILE="$(ls ${CONTAINERD_DOWNLOADS_DIR}/moby-containerd_${CONTAINERD_VERSION}*)"
if [[ -z "${CONTAINERD_DEB_FILE}" ]]; then
echo "Failed to locate cached containerd deb"
exit $ERR_CONTAINERD_INSTALL_TIMEOUT
fi
installDebPackageFromFile ${CONTAINERD_DEB_FILE} || exit $ERR_CONTAINERD_INSTALL_TIMEOUT
return 0
fi
}

downloadContainerdFromVersion() {
#containerd has arm64 binaries from 1.4.4 or later on moby.blob.core.windows.net
CPU_ARCH=$(getCPUArch) #amd64 or arm64
CONTAINERD_VERSION=$1
# currently upstream maintains the package on a storage endpoint rather than an actual apt repo
CONTAINERD_PATCH_VERSION="${2:-1}"
CONTAINERD_DOWNLOAD_URL="https://moby.blob.core.windows.net/moby/moby-containerd/${CONTAINERD_VERSION}+azure/bionic/linux_${CPU_ARCH}/moby-containerd_${CONTAINERD_VERSION}+azure-ubuntu18.04u${CONTAINERD_PATCH_VERSION}_${CPU_ARCH}.deb"
downloadContainerdFromURL $CONTAINERD_DOWNLOAD_URL
mkdir -p $CONTAINERD_DOWNLOADS_DIR
apt_get_download 20 30 moby-containerd=${CONTAINERD_VERSION}* || exit $ERR_CONTAINERD_INSTALL_TIMEOUT
cp -al ${APT_CACHE_DIR}moby-containerd_${CONTAINERD_VERSION}* $CONTAINERD_DOWNLOADS_DIR/ || exit $ERR_CONTAINERD_INSTALL_TIMEOUT
}

downloadContainerdFromURL() {
Expand Down Expand Up @@ -249,6 +258,7 @@ ensureRunc() {
CURRENT_VERSION=$(runc --version | head -n1 | sed 's/runc version //')
if [ "${CURRENT_VERSION}" == "${TARGET_VERSION}" ]; then
echo "target moby-runc version ${TARGET_VERSION} is already installed. skipping installRunc."
return
fi
# if on a vhd-built image, first check if we've cached the deb file
if [ -f $VHD_LOGS_FILEPATH ]; then
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ else
echo "Golden image; skipping dependencies installation"
fi

updateAptWithMicrosoftPkg

installContainerRuntime

setupCNIDirs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,14 @@ updateAptWithMicrosoftPkg() {
fi

retrycmd_if_failure 10 5 10 cp /tmp/microsoft-prod.list /etc/apt/sources.list.d/ || exit $ERR_MOBY_APT_LIST_TIMEOUT
if [[ ${UBUNTU_RELEASE} == "18.04" ]]; then {
echo "deb [arch=amd64,arm64,armhf] https://packages.microsoft.com/ubuntu/18.04/multiarch/prod testing main" > /etc/apt/sources.list.d/microsoft-prod-testing.list
}
elif [[ ${UBUNTU_RELEASE} == "20.04" || ${UBUNTU_RELEASE} == "22.04" ]]; then {
echo "deb [arch=amd64,arm64,armhf] https://packages.microsoft.com/ubuntu/${UBUNTU_RELEASE}/prod testing main" > /etc/apt/sources.list.d/microsoft-prod-testing.list
}
fi

retrycmd_if_failure_no_stats 120 5 25 curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > /tmp/microsoft.gpg || exit $ERR_MS_GPG_KEY_DOWNLOAD_TIMEOUT
retrycmd_if_failure 10 5 10 cp /tmp/microsoft.gpg /etc/apt/trusted.gpg.d/ || exit $ERR_MS_GPG_KEY_DOWNLOAD_TIMEOUT
apt_get_update || exit $ERR_APT_UPDATE_TIMEOUT
Expand Down Expand Up @@ -163,6 +171,7 @@ ensureRunc() {
CURRENT_VERSION=$(runc --version | head -n1 | sed 's/runc version //')
if [ "${CURRENT_VERSION}" == "${TARGET_VERSION}" ]; then
echo "target moby-runc version ${TARGET_VERSION} is already installed. skipping installRunc."
return
fi
# if on a vhd-built image, first check if we've cached the deb file
if [ -f $VHD_LOGS_FILEPATH ]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"downloadLocation": "/opt/containerd/downloads",
"downloadURL": "https://moby.blob.core.windows.net/moby/moby-containerd/${CONTAINERD_VERSION}+azure/bionic/linux_${CPU_ARCH}/moby-containerd_${CONTAINERD_VERSION}+azure-ubuntu18.04u${CONTAINERD_PATCH_VERSION}_${CPU_ARCH}.deb",
"versions": [
"1.4.13-3"
"1.4.13-3",
"1.6.4-4"
],
"edge": "1.6.4-4",
"latest": "1.5.11-2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,9 @@ apt_get_download() {
local ret=0
pushd $APT_CACHE_DIR || return 1
for i in $(seq 1 $retries); do
wait_for_apt_locks; apt-get -o Dpkg::Options::=--force-confold download -y "${@}" && break
dpkg --configure -a --force-confdef
wait_for_apt_locks
apt-get -o Dpkg::Options::=--force-confold download -y "${@}" && break
if [ $i -eq $retries ]; then ret=1; else sleep $wait_sleep; fi
done
popd || return 1
Expand Down
Loading

0 comments on commit 099a346

Please sign in to comment.