Skip to content

Commit

Permalink
Merge pull request #2632 from ty-dc/e2e/install-dev-doctor
Browse files Browse the repository at this point in the history
e2e: Tips for installing development tools
  • Loading branch information
weizhoublue authored Nov 22, 2023
2 parents 0d291a6 + 630ec3d commit 1f524b6
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions test/scripts/install-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ export PATH=$PATH:$(go env GOPATH)/bin
OS=$(uname | tr 'A-Z' 'a-z')

MISS_FLAG=""
CURRENT_FILENAME=$( basename $0 )
CURRENT_DIR_PATH=$(cd $(dirname $0); pwd)

# kubectl
if ! kubectl help &>/dev/null ; then
Expand Down Expand Up @@ -35,9 +37,9 @@ if ! kind &> /dev/null ; then
if [ -z "$JUST_CLI_CHECK" ] ; then
echo "try to install it"
if [ -z $http_proxy ]; then
curl -Lo /usr/local/bin/kind https://github.com/kubernetes-sigs/kind/releases/download/v0.12.0/kind-$OS-amd64
curl -Lo /usr/local/bin/kind https://github.com/kubernetes-sigs/kind/releases/download/$(curl -s https://api.github.com/repos/kubernetes-sigs/kind/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')/kind-$OS-amd64
else
curl -x $http_proxy -Lo /usr/local/bin/kind https://github.com/kubernetes-sigs/kind/releases/download/v0.12.0/kind-$OS-amd64
curl -x $http_proxy -Lo -Lo /usr/local/bin/kind https://github.com/kubernetes-sigs/kind/releases/download/$(curl -s https://api.github.com/repos/kubernetes-sigs/kind/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')/kind-$OS-amd64
fi
chmod +x /usr/local/bin/kind
! kind -h &>/dev/null && echo "error, failed to install kind" && exit 1
Expand All @@ -64,9 +66,9 @@ if ! helm > /dev/null 2>&1 ; then
if [ -z "$JUST_CLI_CHECK" ] ; then
echo "try to install it"
if [ -z $http_proxy ]; then
curl -Lo /tmp/helm.tar.gz "https://get.helm.sh/helm-v3.8.1-$OS-amd64.tar.gz"
curl -Lo /tmp/helm.tar.gz https://get.helm.sh/helm-$(curl -s https://api.github.com/repos/helm/helm/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')-$OS-amd64.tar.gz
else
curl -x $http_proxy -Lo /tmp/helm.tar.gz "https://get.helm.sh/helm-v3.8.1-$OS-amd64.tar.gz"
curl -x $http_proxy -Lo /tmp/helm.tar.gz https://get.helm.sh/helm-$(curl -s https://api.github.com/repos/helm/helm/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')-$OS-amd64.tar.gz
fi
tar -xzvf /tmp/helm.tar.gz && mv $OS-amd64/helm /usr/local/bin
chmod +x /usr/local/bin/helm
Expand Down Expand Up @@ -106,9 +108,9 @@ if ! yq --version &>/dev/null ; then
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
curl -Lo /tmp/yq.tar.gz https://github.com/mikefarah/yq/releases/download/$(curl -s https://api.github.com/repos/mikefarah/yq/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\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
curl -x $http_proxy -Lo /tmp/yq.tar.gz https://github.com/mikefarah/yq/releases/download/$(curl -s https://api.github.com/repos/mikefarah/yq/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\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
Expand All @@ -121,5 +123,9 @@ else
fi

[ -n "$JUST_CLI_CHECK" ] && [ -n "$MISS_FLAG" ] && exit 1
if [ -n "$JUST_CLI_CHECK" ] && [ -n "$MISS_FLAG" ]; then
echo "fail, the required development tools are missing on localhost, please run $CURRENT_DIR_PATH/$CURRENT_FILENAME to install them."
exit 1
fi

exit 0

0 comments on commit 1f524b6

Please sign in to comment.