Skip to content

Commit

Permalink
Merge pull request spidernet-io#2623 from ty-dc/e2e/install-tools
Browse files Browse the repository at this point in the history
Add a script to install yq
  • Loading branch information
weizhoublue committed Nov 21, 2023
2 parents 7411e40 + 43e508c commit 0d291a6
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion test/scripts/install-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ OS=$(uname | tr 'A-Z' 'a-z')
MISS_FLAG=""

# kubectl

if ! kubectl help &>/dev/null ; then
echo "fail 'kubectl' miss"
if [ -z "$JUST_CLI_CHECK" ] ; then
Expand Down Expand Up @@ -101,6 +100,26 @@ else
echo "pass 'p2ctl' installed: $( p2ctl --version 2>&1 ) "
fi

# Install yq
if ! yq --version &>/dev/null ; then
echo "fail 'yq' miss"
if [ -z "$JUST_CLI_CHECK" ] ; then
echo "try to install it"
if [ -z $http_proxy ]; then
curl -Lo /tmp/yq.tar.gz https://github.com/mikefarah/yq/releases/download/v4.35.1/yq_linux_amd64.tar.gz
else
curl -x $http_proxy -Lo /tmp/yq.tar.gz https://github.com/mikefarah/yq/releases/download/v4.35.1/yq_linux_amd64.tar.gz
fi
tar -C /usr/local/bin -xzf /tmp/yq.tar.gz
mv /usr/local/bin/yq_linux_amd64 /usr/local/bin/yq
chmod +x /usr/local/bin/yq
! yq -V &>/dev/null && echo "error, failed to install yq" && exit 1
fi
MISS_FLAG="true"
else
echo "pass 'yq' installed: $( yq -V 2>&1 ) "
fi

[ -n "$JUST_CLI_CHECK" ] && [ -n "$MISS_FLAG" ] && exit 1

exit 0

0 comments on commit 0d291a6

Please sign in to comment.