Skip to content

Commit

Permalink
ci: install docker 19.03 for arm64 to let build image go
Browse files Browse the repository at this point in the history
"make proto" will fail on arm64 using docker 18.06. This bug will be
gone if using docker 19.03. so upgrade docker before "make proto"
for arm64.

Depends-on: github.com/kata-containers/runtime#3057
Fixes: kata-containers#861
Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
  • Loading branch information
jongwu committed Nov 11, 2020
1 parent 5cfb8ec commit 15516c3
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions .ci/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

export tests_repo="${tests_repo:-github.com/kata-containers/tests}"
export tests_repo_dir="$GOPATH/src/$tests_repo"
source "${tests_repo_dir}/.ci/lib.sh"

clone_tests_repo()
{
Expand Down
29 changes: 29 additions & 0 deletions .ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,39 @@ set -e
cidir=$(dirname "$0")
source "${cidir}/lib.sh"

install_docker_ubuntu() {
pkg_name="docker-ce"
repo_url="https://download.docker.com/linux/ubuntu"
curl -fsSL "${repo_url}/gpg" | sudo apt-key add -
sudo -E add-apt-repository "deb [arch=${arch}] ${repo_url} $(lsb_release -cs) stable"
sudo -E apt-get update
docker_version_full=$(apt-cache madison $pkg_name | grep "$docker_version" | awk '{print $3}' | head -1)
sudo -E apt-get -y install "${pkg_name}=${docker_version_full}"
}

pushd "${tests_repo_dir}"
.ci/run.sh
testcidir=$(dirname "$0")

# make proto will fail on arm64 when use docker 18.06 and using docker 19.03 can avoid this failure
arch=$(go env GOARCH)
if [ "$arch" == "arm64" ]; then
ID=$(cat /etc/os-release | grep "^ID=" | cut -f 2 -d "=")
if [ "$ID" != "ubuntu" ]; then
exit 0
fi
current_docker_version=$(docker version | awk '/Engine/{getline; print $2 }')
current_docker_version=${current_docker_version%.*}
docker_version=$(get_version "externals.docker.architecture.aarch64.agent.version")
docker_version=${docker_version/v}
docker_version=${docker_version/-*}
if [[ `echo "$current_docker_version < $docker_version" | bc` -eq 1 ]]; then
command -v docker >/dev/null 2>&1 && "${testcidir}/../cmd/container-manager/manage_ctr_mgr.sh" docker remove
echo "reinstall docker $docker_version for arm64"
install_docker_ubuntu $docker_version
fi
fi

echo "Starting docker service before making proto"
sudo systemctl start docker

Expand Down

0 comments on commit 15516c3

Please sign in to comment.