From 4bdac2b43b2f0e9c35baf24cc4aba37783a68cce Mon Sep 17 00:00:00 2001 From: Nobel Barakat Date: Thu, 31 Mar 2022 22:38:07 +0000 Subject: [PATCH] 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 --- contrib/gce/configure.sh | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/contrib/gce/configure.sh b/contrib/gce/configure.sh index 3ac717e4a..dac8eb006 100755 --- a/contrib/gce/configure.sh +++ b/contrib/gce/configure.sh @@ -126,8 +126,16 @@ else # TODO(random-liu): Put version into the metadata instead of # deciding it in cloud init. This may cause issue to reboot test. - version=$(curl -f --ipv4 --retry 6 --retry-delay 3 --silent --show-error \ - https://storage.googleapis.com/${deploy_path}/latest) + 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 \ + https://storage.googleapis.com/${deploy_path}/latest) + fi fi TARBALL_GCS_NAME="${pkg_prefix}-${version}.linux-amd64.tar.gz" @@ -148,7 +156,12 @@ if [ -z "${version}" ]; then exit 1 fi 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" else # Download and untar the release tar ball.