diff options
author | Ilya Mashchenko <ilya@netdata.cloud> | 2020-02-25 05:49:26 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-25 05:49:26 +0900 |
commit | c77542e61136238134d112b19d76136895f9242f (patch) | |
tree | 37e03fdb3102d85281b4256c8e07cf98cb5b3c47 /packaging/installer/netdata-updater.sh | |
parent | 412df53dd22bea876ff424df42490f4ee587bced (diff) |
packaging/installer: fix get_latest_version for nightly channel (#8172)
Diffstat (limited to 'packaging/installer/netdata-updater.sh')
-rwxr-xr-x | packaging/installer/netdata-updater.sh | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/packaging/installer/netdata-updater.sh b/packaging/installer/netdata-updater.sh index d4a4ca2113..46c49e572d 100755 --- a/packaging/installer/netdata-updater.sh +++ b/packaging/installer/netdata-updater.sh @@ -96,17 +96,13 @@ function parse_version() { } get_latest_version() { - shasums="${1}" - - tarball="$(grep -o 'netdata-v.*\.tar\.gz' "${shasums}")" - if [ -n "${tarball}" ]; then - # shellcheck disable=SC2001 - # XXX: Need to use regex group substitution here. - version="$(echo "${tarball}" | sed -e 's/^netdata-\(.*\)\.tar.gz/\1/')" - parse_version "${version}" + local latest + if [ "${RELEASE_CHANNEL}" == "stable" ]; then + latest="$(download "https://api.github.com/repos/netdata/netdata/releases/latest" /dev/stdout | grep tag_name | cut -d'"' -f4)" else - echo "000000000000" + latest="$(download "https://storage.googleapis.com/netdata-nightlies/latest-version.txt" /dev/stdout)" fi + parse_version "$latest" } set_tarball_urls() { @@ -139,7 +135,7 @@ update() { download "${NETDATA_TARBALL_CHECKSUM_URL}" "${tmpdir}/sha256sum.txt" >&3 2>&3 current_version="$(command -v netdata > /dev/null && parse_version "$(netdata -v | cut -f 2 -d ' ')")" - latest_version="$(get_latest_version "${tmpdir}/sha256sum.txt")" + latest_version="$(get_latest_version)" # If we can't get the current version for some reason assume `0` current_version="${current_version:-0}" |