Adding multi-arch support for the configure.sh script

This script is used by various tests to install and configure
containerd. However, right now it's hardcoded to only support x86
and not other architectures like arm. This change will now check the
architecture of the machine the script is running on and will pull
the correct artifacts accordingly from the correct artifact store
(GCS vs Github).

Signed-off-by: Nobel Barakat <nobelbarakat@google.com>
This commit is contained in:
Nobel Barakat 2022-03-31 22:38:07 +00:00
parent 887615c7d0
commit 4bdac2b43b

View File

@ -126,8 +126,16 @@ else
# TODO(random-liu): Put version into the metadata instead of # TODO(random-liu): Put version into the metadata instead of
# deciding it in cloud init. This may cause issue to reboot test. # deciding it in cloud init. This may cause issue to reboot test.
if [ $(uname -m) == "aarch64" ]; then
version=$(curl -f --ipv4 --retry 6 --retry-delay 3 --silent --show-error \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/containerd/containerd/releases/latest" \
| jq -r .tag_name \
| sed "s:v::g")
else
version=$(curl -f --ipv4 --retry 6 --retry-delay 3 --silent --show-error \ version=$(curl -f --ipv4 --retry 6 --retry-delay 3 --silent --show-error \
https://storage.googleapis.com/${deploy_path}/latest) https://storage.googleapis.com/${deploy_path}/latest)
fi
fi fi
TARBALL_GCS_NAME="${pkg_prefix}-${version}.linux-amd64.tar.gz" TARBALL_GCS_NAME="${pkg_prefix}-${version}.linux-amd64.tar.gz"
@ -148,7 +156,12 @@ if [ -z "${version}" ]; then
exit 1 exit 1
fi fi
else else
if is_preloaded "${TARBALL_GCS_NAME}" "${tar_sha1}"; then if [ $(uname -m) == "aarch64" ]; then
curl -f --ipv4 -Lo "${TARBALL}" --connect-timeout 20 --max-time 300 --retry 6 --retry-delay 10 \
"https://github.com/containerd/containerd/releases/download/v${version}/cri-containerd-${version}-linux-arm64.tar.gz"
tar xvf "${TARBALL}"
rm -f "${TARBALL}"
elif is_preloaded "${TARBALL_GCS_NAME}" "${tar_sha1}"; then
echo "${TARBALL_GCS_NAME} is preloaded" echo "${TARBALL_GCS_NAME} is preloaded"
else else
# Download and untar the release tar ball. # Download and untar the release tar ball.