This is an automated email from the ASF dual-hosted git repository.

zhongxjian pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo-kubernetes.git


The following commit(s) were added to refs/heads/master by this push:
     new 066df845 Update release dubbo script (#650)
066df845 is described below

commit 066df8450ed6bcfd401211789152d334e0cf089c
Author: Jian Zhong <[email protected]>
AuthorDate: Thu Mar 20 15:06:17 2025 +0800

    Update release dubbo script (#650)
---
 release/README.md                                  |  1 -
 .../dubbo.sh => downloadDubboCandidate.sh}         | 48 +++++++++++-----------
 .../{download/dubboctl.sh => downloadDubboctl.sh}  | 39 ++++++++++++------
 3 files changed, 50 insertions(+), 38 deletions(-)

diff --git a/release/README.md b/release/README.md
deleted file mode 100644
index 3be8ffab..00000000
--- a/release/README.md
+++ /dev/null
@@ -1 +0,0 @@
-# Download
\ No newline at end of file
diff --git a/release/download/dubbo.sh b/release/downloadDubboCandidate.sh
similarity index 73%
rename from release/download/dubbo.sh
rename to release/downloadDubboCandidate.sh
index da64b9dc..7f553008 100644
--- a/release/download/dubbo.sh
+++ b/release/downloadDubboCandidate.sh
@@ -15,10 +15,12 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+set -e
+
 # Determines the operating system.
 OS="${TARGET_OS:-$(uname)}"
 if [ "${OS}" = "Darwin" ] ; then
-  OSEXT="darwin"
+  OSEXT="osx"
 else
   OSEXT="linux"
 fi
@@ -32,7 +34,7 @@ if [ "${DUBBO_VERSION}" = "" ] ; then
 fi
 
 if [ "${DUBBO_VERSION}" = "" ] ; then
-  printf "Unable to get latest Dubbo version. Set DUBBO_VERSION env var and 
re-run. For example: export DUBBO_VERSION=0.0.1\n"
+  printf "Unable to get latest Dubbo version. Set DUBBO_VERSION env var and 
re-run. For example: export DUBBO_VERSION=0.1.0\n"
   exit 1;
 fi
 
@@ -57,16 +59,10 @@ case "${LOCAL_ARCH}" in
     ;;
 esac
 
-download_failed () {
-  printf "Download failed, please make sure your DUBBO_VERSION is correct and 
verify the download URL exists!"
-  exit 1
-}
-
-# Downloads the dubbo binary archive.
-tmp=$(mktemp -d /tmp/dubbo.XXXXXX)
-NAME="dubboctl-${DUBBO_VERSION}"
+NAME="dubbo-$DUBBO_VERSION"
+URL=" 
https://github.com/apache/dubbo-kubernetes/releases/download/${DUBBO_VERSION}/dubbo-${DUBBO_VERSION}-${OSEXT}.tar.gz";
+ARCH_URL=" 
https://github.com/apache/dubbo-kubernetes/releases/download/${DUBBO_VERSION}/dubbo-${DUBBO_VERSION}-${OSEXT}-${DUBBO_ARCH}.tar.gz";
 
-ARCH_URL=" 
https://github.com/apache/dubbo-kubernetes/releases/download/dubbo%2F${DUBBO_VERSION}/dubbo-${DUBBO_VERSION}-${OSEXT}-${DUBBO_ARCH}.tar.gz";
 
 with_arch() {
   printf "\nDownloading %s from %s ...\n" "${NAME}" "$ARCH_URL"
@@ -75,27 +71,31 @@ with_arch() {
     exit 1
   fi
   filename="dubbo-${DUBBO_VERSION}-${OSEXT}-${DUBBO_ARCH}.tar.gz"
-  curl -fsL -o "${tmp}/${filename}" "$ARCH_URL"
-  tar -xzf "${tmp}/${filename}" -C "${tmp}"
+  tar -xzf "${filename}"
+  rm "${filename}"
+}
+
+without_arch() {
+  printf "\nDownloading %s from %s ..." "$NAME" "$URL"
+  if ! curl -o /dev/null -sIf "$URL"; then
+    printf "\n%s is not found, please specify a valid DUBBO_VERSION\n" "$URL"
+    exit 1
+  fi
+  curl -fsLO "$URL"
+  filename="dubbo-${DUBBO_VERSION}-${OSEXT}.tar.gz"
+  tar -xzf "${filename}"
+  rm "${filename}"
 }
 
 with_arch
+without_arch
 
 printf "%s download complete!\n" "${filename}"
 
-# setup dubboctl
-mkdir -p "$HOME/.dubbo/bin"
-mv "${tmp}/dubbo" "$HOME/.dubbo/bin/dubbo"
-chmod +x "$HOME/.dubbo/bin/dubbo"
-rm -r "${tmp}"
-
-# Print message
+# Print message.
 printf "\n"
-printf "Add the dubboctl to your path with:"
+printf "Add the dubbo to your path with:"
 printf "\n"
 printf "  export PATH=\$HOME/.dubbo/bin:\$PATH \n"
 printf "\n"
-printf "Begin the Dubbo pre-installation check by running:\n"
-printf "\t dubboctl x precheck \n"
-printf "\n"
 
diff --git a/release/download/dubboctl.sh b/release/downloadDubboctl.sh
similarity index 76%
rename from release/download/dubboctl.sh
rename to release/downloadDubboctl.sh
index 27f5e6c0..306581d5 100644
--- a/release/download/dubboctl.sh
+++ b/release/downloadDubboctl.sh
@@ -15,20 +15,22 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+set -e
+
 # Determines the operating system.
 OS="${TARGET_OS:-$(uname)}"
 if [ "${OS}" = "Darwin" ] ; then
-  OSEXT="darwin"
+  OSEXT="osx"
 else
   OSEXT="linux"
 fi
 
 # Determine the latest Dubboctl version by version number ignoring alpha, 
beta, and rc versions.
-if [ "${DUBBOCTL_VERSION}" = "" ] ; then
-  DUBBOCTL_VERSION="$(curl -sL 
https://github.com/apache/dubbo-kubernetes/releases | \
+if [ "${DUBBO_VERSION}" = "" ] ; then
+  DUBBO_VERSION="$(curl -sL 
https://github.com/apache/dubbo-kubernetes/releases | \
                   grep -E -o 'dubboctl/([v,V]?)[0-9]*.[0-9]*.[0-9]*' | sort -V 
| \
                   tail -1 | awk -F'/' '{ print $2}')"
-  DUBBOCTL_VERSION="${DUBBOCTL_VERSION##*/}"
+  DUBBO_VERSION="${DUBBOCTL_VERSION##*/}"
 fi
 
 if [ "${DUBBOCTL_VERSION}" = "" ] ; then
@@ -62,11 +64,13 @@ download_failed () {
   exit 1
 }
 
+download_failed
+
 # Downloads the dubboctl binary archive.
 tmp=$(mktemp -d /tmp/dubboctl.XXXXXX)
-NAME="dubboctl-${DUBBOCTL_VERSION}"
-
-ARCH_URL="https://github.com/apache/dubbo-kubernetes/releases/download/dubboctl%2F${DUBBOCTL_VERSION}/dubboctl-${DUBBOCTL_VERSION}-${OSEXT}-${DUBBOCTL_ARCH}.tar.gz";
+NAME="dubboctl-${DUBBO_VERSION}"
+URL="https://github.com/apache/dubbo-kubernetes/releases/download/${DUBBOCTL_VERSION}/dubboctl-${DUBBOCTL_VERSION}-${OSEXT}-${DUBBOCTL_ARCH}.tar.gz";
+ARCH_URL="https://github.com/apache/dubbo-kubernetes/releases/download/${DUBBOCTL_VERSION}/dubboctl-${DUBBOCTL_VERSION}-${OSEXT}-${DUBBOCTL_ARCH}.tar.gz";
 
 with_arch() {
   printf "\nDownloading %s from %s ...\n" "${NAME}" "$ARCH_URL"
@@ -79,9 +83,20 @@ with_arch() {
   tar -xzf "${tmp}/${filename}" -C "${tmp}"
 }
 
-with_arch
+without_arch() {
+  printf "\nDownloading %s from %s ..." "$NAME" "$URL"
+  if ! curl -o /dev/null -sIf "$URL"; then
+    printf "\n%s is not found, please specify a valid DUBBO_VERSION\n" "$URL"
+    exit 1
+  fi
+  curl -fsLO "$URL"
+  filename="dubboctl-${DUBBO_VERSION}-${OSEXT}.tar.gz"
+  curl -fsL -o "${tmp}/${filename}" "$URL"
+  tar -xzf "${tmp}/${filename}" -C "${tmp}"
+}
 
-printf "%s download complete!\n" "${filename}"
+with_arch
+without_arch
 
 # setup dubboctl
 mkdir -p "$HOME/.dubboctl/bin"
@@ -89,13 +104,11 @@ mv "${tmp}/dubboctl" "$HOME/.dubboctl/bin/dubboctl"
 chmod +x "$HOME/.dubboctl/bin/dubboctl"
 rm -r "${tmp}"
 
+printf "%s download complete!\n" "${filename}"
+
 # Print message
 printf "\n"
 printf "Add the dubboctl to your path with:"
 printf "\n"
 printf "  export PATH=\$HOME/.dubboctl/bin:\$PATH \n"
 printf "\n"
-printf "Begin the Dubbo pre-installation check by running:\n"
-printf "\t dubboctl x precheck \n"
-printf "\n"
-

Reply via email to