From a4b3ca39bf745439c47d5ab75277bf1255a5d846 Mon Sep 17 00:00:00 2001 From: basefas Date: Wed, 13 Oct 2021 19:22:25 +0800 Subject: [PATCH] check latest_release (#339) --- static/script/install-kubectl-vela.sh | 5 +++++ static/script/install.sh | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/static/script/install-kubectl-vela.sh b/static/script/install-kubectl-vela.sh index 423216f4..1a068f1a 100644 --- a/static/script/install-kubectl-vela.sh +++ b/static/script/install-kubectl-vela.sh @@ -92,6 +92,11 @@ getLatestRelease() { latest_release=$(wget -q --header="Accept: application/json" -O - $velaReleaseUrl | grep \"tag_name\" | grep -v rc | awk 'NR==1{print $2}' | sed -n 's/\"\(.*\)\",/\1/p') fi + if [[ ! "$latest_release" =~ ^v[\.0-9]+$ ]]; then + echo "Failed to get latest release tag." + exit 1 + fi + ret_val=$latest_release } diff --git a/static/script/install.sh b/static/script/install.sh index a7fec950..eed59a89 100644 --- a/static/script/install.sh +++ b/static/script/install.sh @@ -92,6 +92,11 @@ getLatestRelease() { latest_release=$(wget -q --header="Accept: application/json" -O - $velaReleaseUrl | grep \"tag_name\" | grep -v rc | awk 'NR==1{print $2}' | sed -n 's/\"\(.*\)\",/\1/p') fi + if [[ ! "$latest_release" =~ ^v[\.0-9]+$ ]]; then + echo "Failed to get latest release tag." + exit 1 + fi + ret_val=$latest_release }