From 502fa7b30c7a9b3f56d76fb7eac7844b9cc0a218 Mon Sep 17 00:00:00 2001 From: llhuii Date: Tue, 2 Mar 2021 17:41:31 +0800 Subject: [PATCH] Switch kubeedge to latest release version Signed-off-by: llhuii --- hack/local-up.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/hack/local-up.sh b/hack/local-up.sh index 3b7c688e..e8d922d7 100644 --- a/hack/local-up.sh +++ b/hack/local-up.sh @@ -53,7 +53,6 @@ MASTER_NODENAME=${CLUSTER_NAME}-control-plane EDGE_NODENAME=edge-node NAMESPACE=sedna -KUBEEDGE_VERSION=master TMP_DIR="$(realpath local-up-tmp)" GM_BIND_PORT=9000 @@ -68,13 +67,22 @@ arch() { echo "$arch" } +get_latest_version() { + # get the latest version of specified gh repo + local repo=${1} + # output of this latest page: + # ... + # "tag_name": "v1.0.0", + # ... + curl -s https://api.github.com/repos/$repo/releases/latest | awk '/"tag_name":/&&$0=$2' | sed 's/[",]//g' +} + download_and_extract_kubeedge() { [ -d kubeedge ] && return - local version=${1:-$KUBEEDGE_VERSION} + local version=${KUBEEDGE_VERSION:-$(get_latest_version kubeedge/kubeedge)} - # master branch can't works with git clone --depth 1 - git clone -b $version https://github.com/kubeedge/kubeedge + git clone -b $version --depth 1 https://github.com/kubeedge/kubeedge return # the archive file can't works since local-up-kubeedge.sh depends git tag