@cryptotaxi247 / netdata-1 / commits / c77542e61

packaging/installer: fix get_latest_version for nightly channel (#8172)

Ilya Mashchenko committed Feb 25, 2020 at 05:49 UTC c77542e61136238134d112b19d76136895f9242f
1 file changed +6 -10
packaging/installer/netdata-updater.sh
+6 -10
@@ -96,17 +96,13 @@ function parse_version() {
96 }
97
98 get_latest_version() {
99 - shasums="${1}"
100 -
101 - tarball="$(grep -o 'netdata-v.*\.tar\.gz' "${shasums}")"
102 - if [ -n "${tarball}" ]; then
103 - # shellcheck disable=SC2001
104 - # XXX: Need to use regex group substitution here.
105 - version="$(echo "${tarball}" | sed -e 's/^netdata-\(.*\)\.tar.gz/\1/')"
106 - parse_version "${version}"
99 + local latest
100 + if [ "${RELEASE_CHANNEL}" == "stable" ]; then
101 + latest="$(download "https://api.github.com/repos/netdata/netdata/releases/latest" /dev/stdout | grep tag_name | cut -d'"' -f4)"
102 else
108 - echo "000000000000"
103 + latest="$(download "https://storage.googleapis.com/netdata-nightlies/latest-version.txt" /dev/stdout)"
104 fi
105 + parse_version "$latest"
106 }
107
108 set_tarball_urls() {
@@ -139,7 +135,7 @@ update() {
135 download "${NETDATA_TARBALL_CHECKSUM_URL}" "${tmpdir}/sha256sum.txt" >&3 2>&3
136
137 current_version="$(command -v netdata > /dev/null && parse_version "$(netdata -v | cut -f 2 -d ' ')")"
142 - latest_version="$(get_latest_version "${tmpdir}/sha256sum.txt")"
138 + latest_version="$(get_latest_version)"
139
140 # If we can't get the current version for some reason assume `0`
141 current_version="${current_version:-0}"