mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-10-21 20:08:54 +00:00
install_yq() has no arch entry for ppc64le and hence installing yq fails on Power systems. Fixes: #124 Signed-off-by: Nitesh Konkar niteshkonkar@in.ibm.com
68 lines
1.4 KiB
Bash
68 lines
1.4 KiB
Bash
#!/bin/bash
|
|
#
|
|
# Copyright (c) 2018 Intel Corporation
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
# If we fail for any reason a message will be displayed
|
|
die(){
|
|
msg="$*"
|
|
echo "ERROR: $msg" >&2
|
|
exit 1
|
|
}
|
|
|
|
export tests_repo="${tests_repo:-github.com/kata-containers/tests}"
|
|
export tests_repo_dir="$GOPATH/src/$tests_repo"
|
|
|
|
clone_tests_repo()
|
|
{
|
|
# KATA_CI_NO_NETWORK is (has to be) ignored if there is
|
|
# no existing clone.
|
|
if [ -d "${tests_repo_dir}" ] && [ -n "${KATA_CI_NO_NETWORK:-}" ]
|
|
then
|
|
return
|
|
fi
|
|
|
|
go get -d -u "$tests_repo" || true
|
|
}
|
|
|
|
install_yq() {
|
|
path=$1
|
|
local yq_path=${path}/yq
|
|
local yq_pkg="github.com/mikefarah/yq"
|
|
[ -x "${yq_path}" ] && return
|
|
|
|
case "$(arch)" in
|
|
"aarch64")
|
|
goarch=arm64
|
|
;;
|
|
|
|
"x86_64")
|
|
goarch=amd64
|
|
;;
|
|
|
|
"ppc64le")
|
|
goarch=ppc64le
|
|
;;
|
|
|
|
"*")
|
|
echo "Arch $(arch) not supported"
|
|
exit
|
|
;;
|
|
esac
|
|
|
|
mkdir -p "${path}"
|
|
|
|
# Workaround to get latest release from github (to not use github token).
|
|
# Get the redirection to latest release on github.
|
|
yq_latest_url=$(curl -Ls -o /dev/null -w %{url_effective} "https://${yq_pkg}/releases/latest")
|
|
# The redirected url should include the latest release version
|
|
# https://github.com/mikefarah/yq/releases/tag/<VERSION-HERE>
|
|
yq_version=$(basename "${yq_latest_url}")
|
|
|
|
|
|
local yq_url="https://${yq_pkg}/releases/download/${yq_version}/yq_linux_${goarch}"
|
|
curl -o "${yq_path}" -L ${yq_url}
|
|
chmod +x ${yq_path}
|
|
}
|