mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-30 17:22:33 +00:00
scripts: Foward port osbuilder scripts to update yq
This PR ports kata-containers/osbuilder#454 to kata 2.0 Fixes #576 Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
This commit is contained in:
parent
c14d44aba8
commit
f879acd6e7
@ -56,12 +56,14 @@ function install_yq() {
|
|||||||
die "Please install curl"
|
die "Please install curl"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local yq_version=2.3.0
|
local yq_version=3.1.0
|
||||||
|
|
||||||
local yq_url="https://${yq_pkg}/releases/download/${yq_version}/yq_${goos}_${goarch}"
|
## NOTE: ${var,,} => gives lowercase value of var
|
||||||
curl -o "${yq_path}" -LSsf ${yq_url}
|
local yq_url="https://${yq_pkg}/releases/download/${yq_version}/yq_${goos,,}_${goarch}"
|
||||||
|
curl -o "${yq_path}" -LSsf "${yq_url}"
|
||||||
[ $? -ne 0 ] && die "Download ${yq_url} failed"
|
[ $? -ne 0 ] && die "Download ${yq_url} failed"
|
||||||
chmod +x ${yq_path}
|
chmod +x "${yq_path}"
|
||||||
|
echo "Installed $(${yq_path} --version)"
|
||||||
|
|
||||||
if ! command -v "${yq_path}" >/dev/null; then
|
if ! command -v "${yq_path}" >/dev/null; then
|
||||||
die "Cannot not get ${yq_path} executable"
|
die "Cannot not get ${yq_path} executable"
|
||||||
|
@ -375,13 +375,13 @@ RUN ln -sf /usr/bin/g++ /bin/musl-g++
|
|||||||
detect_go_version()
|
detect_go_version()
|
||||||
{
|
{
|
||||||
info "Detecting go version"
|
info "Detecting go version"
|
||||||
typeset -r yq=$(command -v yq || command -v "${GOPATH}/bin/yq" || echo "${GOPATH}/bin/yq")
|
typeset yq=$(command -v yq || command -v ${GOPATH}/bin/yq || echo "${GOPATH}/bin/yq")
|
||||||
if [ ! -f "$yq" ]; then
|
if [ ! -f "$yq" ]; then
|
||||||
source "$yq_file"
|
source "$yq_file"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
info "Get Go version from ${kata_versions_file}"
|
info "Get Go version from ${kata_versions_file}"
|
||||||
GO_VERSION="$(cat "${kata_versions_file}" | $yq r - "languages.golang.meta.newest-version")"
|
GO_VERSION="$(cat "${kata_versions_file}" | $yq r -X - "languages.golang.meta.newest-version")"
|
||||||
|
|
||||||
[ "$?" == "0" ] && [ "$GO_VERSION" != "null" ]
|
[ "$?" == "0" ] && [ "$GO_VERSION" != "null" ]
|
||||||
}
|
}
|
||||||
@ -395,7 +395,7 @@ detect_rust_version()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
info "Get rust version from ${kata_versions_file}"
|
info "Get rust version from ${kata_versions_file}"
|
||||||
RUST_VERSION="$(cat "${kata_versions_file}" | $yq r - "languages.rust.meta.newest-version")"
|
RUST_VERSION="$(cat "${kata_versions_file}" | $yq r -X - "languages.rust.meta.newest-version")"
|
||||||
|
|
||||||
[ "$?" == "0" ] && [ "$RUST_VERSION" != "null" ]
|
[ "$?" == "0" ] && [ "$RUST_VERSION" != "null" ]
|
||||||
}
|
}
|
||||||
@ -409,7 +409,7 @@ detect_cmake_version()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
info "Get cmake version from ${kata_versions_file}"
|
info "Get cmake version from ${kata_versions_file}"
|
||||||
CMAKE_VERSION="$(cat "${kata_versions_file}" | $yq r - "externals.cmake.version")"
|
CMAKE_VERSION="$(cat "${kata_versions_file}" | $yq r -X - "externals.cmake.version")"
|
||||||
|
|
||||||
[ "$?" == "0" ] && [ "$CMAKE_VERSION" != "null" ]
|
[ "$?" == "0" ] && [ "$CMAKE_VERSION" != "null" ]
|
||||||
}
|
}
|
||||||
@ -423,7 +423,7 @@ detect_musl_version()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
info "Get musl version from ${kata_versions_file}"
|
info "Get musl version from ${kata_versions_file}"
|
||||||
MUSL_VERSION="$(cat "${kata_versions_file}" | $yq r - "externals.musl.version")"
|
MUSL_VERSION="$(cat "${kata_versions_file}" | $yq r -X - "externals.musl.version")"
|
||||||
|
|
||||||
[ "$?" == "0" ] && [ "$MUSL_VERSION" != "null" ]
|
[ "$?" == "0" ] && [ "$MUSL_VERSION" != "null" ]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user