diff --git a/hack/install_kubespider.sh b/hack/install_kubespider.sh index 4cc785bd..8bfff5fe 100755 --- a/hack/install_kubespider.sh +++ b/hack/install_kubespider.sh @@ -50,10 +50,7 @@ if [[ $(docker ps | grep aria2-pro) == "" ]]; then fi # 7.Deploy kubespider -export KUBESPIDER_DEFAULT_VERSION="latest" -if [[ -z "${KUBESPIDER_VERSION}" ]]; then - export KUBESPIDER_VERSION=${KUBESPIDER_DEFAULT_VERSION} -fi +export KUBESPIDER_VERSION=${KUBESPIDER_VERSION:-$(util::get_latest_release_version)} docker run -itd --name kubespider \ --log-opt max-size=5m \ -v ${KUBESPIDER_HOME}/kubespider/.config:/app/.config \ diff --git a/hack/test/deploy_test.sh b/hack/test/deploy_test.sh index 8ea24d5f..03fba2d5 100755 --- a/hack/test/deploy_test.sh +++ b/hack/test/deploy_test.sh @@ -18,6 +18,7 @@ function handle_trap() { trap handle_trap ERR EXIT #1. Test deploy Kubespider +export KUBESPIDER_VERSION=latest ./hack/install_kubespider.sh sleep 10 docker ps | grep -e kubespider -e aria2-pro diff --git a/hack/util.sh b/hack/util.sh index 43ef3c1c..d5e493e1 100755 --- a/hack/util.sh +++ b/hack/util.sh @@ -9,3 +9,7 @@ function util::set_registry_for_image() { export image_registry=index.docker.io/cesign fi } + +function util::get_latest_release_version() { + curl --silent https://api.github.com/repos/opennaslab/kubespider/tags | grep -o '"name": "[^"]*' | cut -d'"' -f4 | head -n1 +}