Skip to content

Commit

Permalink
Add a script to install yq
Browse files Browse the repository at this point in the history
Signed-off-by: tao.yang <[email protected]>
  • Loading branch information
ty-dc committed Nov 17, 2023
1 parent 078a3c7 commit 43e508c
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 43e508c

Please sign in to comment.