mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-29 16:57:18 +00:00
lib.sh: Fix curl error when using curl+yq
When you curl versions.yaml file and pipe into yq, sometimes the piped program closes the read pipe before the previous program is finished leading to "curl: (23) Failed writing body (1337 != 1371)". As a workaround we pipe the stream through double "tac", an intermediary program that always reads the whole page before feeding it to the next program. Fixes: #363 Signed-off-by: Nitesh Konkar <niteshkonkar@in.ibm.com>
This commit is contained in:
parent
05428a6424
commit
5982e48774
@ -289,7 +289,7 @@ detect_go_version()
|
||||
typeset -r runtimeVersionsURL="https://raw.githubusercontent.com/kata-containers/runtime/${runtimeRevision}/versions.yaml"
|
||||
info "Getting golang version from ${runtimeVersionsURL}"
|
||||
# This may fail if we are a kata bump.
|
||||
if GO_VERSION="$(curl -fsSL "$runtimeVersionsURL" | $yq r - "languages.golang.version")"; then
|
||||
if GO_VERSION="$(curl -fsSL "$runtimeVersionsURL" | tac | tac | $yq r - "languages.golang.version")"; then
|
||||
[ "$GO_VERSION" != "null" ]
|
||||
return 0
|
||||
fi
|
||||
@ -301,7 +301,7 @@ detect_go_version()
|
||||
info "There is not runtime repository in filesystem (${kata_runtime_pkg_dir})"
|
||||
local runtime_versions_url="https://raw.githubusercontent.com/kata-containers/runtime/${KATA_BRANCH}/versions.yaml"
|
||||
info "Get versions file from ${runtime_versions_url}"
|
||||
GO_VERSION="$(curl -fsSL "${runtime_versions_url}" | $yq r - "languages.golang.version")"
|
||||
GO_VERSION="$(curl -fsSL "${runtime_versions_url}" | tac | tac | $yq r - "languages.golang.version")"
|
||||
if [ "$?" == "0" ] && [ "$GO_VERSION" != "null" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user