Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: the install scripts now picks the latest version and binary from… #1255

Merged
merged 2 commits into from
Jul 14, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion static/script/install-kubectl-vela.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
KUBECTL_VELA_HTTP_REQUEST_CLI=curl

# GitHub Organization and repo name to download release
GITHUB_ORG=oam-dev
GITHUB_ORG=kubevela
GITHUB_REPO=kubevela

# Kubectl-Vela CLI filename
Expand Down
22 changes: 18 additions & 4 deletions static/script/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ VELA_CLI_FILENAME=vela

VELA_CLI_FILE="${VELA_INSTALL_DIR}/${VELA_CLI_FILENAME}"

DOWNLOAD_BASE="https://static.kubevela.net/binary/vela"
VERSION_CHECK_BASE="https://api.github.com/repos/kubevela/kubevela"
DOWNLOAD_BASE="https://github.com/kubevela/kubevela/releases/download"

getSystemInfo() {
ARCH=$(uname -m)
Expand Down Expand Up @@ -83,13 +84,26 @@ checkExistingVela() {
}

getLatestRelease() {
local velaReleaseUrl="${DOWNLOAD_BASE}/latest_version"
local velaReleaseUrl="${VERSION_CHECK_BASE}/releases/latest"
local latest_release=""
local response=""

if [ "$VELA_HTTP_REQUEST_CLI" == "curl" ]; then
latest_release=$(curl -s $velaReleaseUrl)
response=$(curl -s $velaReleaseUrl)
else
latest_release=$(wget -q -O - $velaReleaseUrl)
response=$(wget -q -O - $velaReleaseUrl)
fi

if [[ "$response" == *"Not Found"* ]]; then
echo "Error: Repository or release not found."
return 1
fi

latest_release=$(echo "$response" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')

if [ -z "$latest_release" ]; then
echo "Error: Unable to retrieve the latest version."
return 1
fi

ret_val=$latest_release
Expand Down