diff options
author | Austin S. Hemmelgarn <austin@netdata.cloud> | 2023-01-16 08:17:51 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-16 08:17:51 -0500 |
commit | e5be62dcbcb4729d87c0a68c58b31a220b98b1c1 (patch) | |
tree | a3f8ada302285e085a3d6eab53c2cdb17f2be277 /packaging/installer/netdata-updater.sh | |
parent | a14a21f90f7f38ff2b71eb3bc0b442d240c09fd6 (diff) |
Switch nightlies to GitHub releases. (#14020)
* Switch nightlies to GitHub releases.
Instead of using GCS.
* Fix CI handling.
* Fix handling of download URLs for nightly builds.
* Fix handling of redirects for consolidated artifact checks.
* Avoid redirect issues with the test environment.
* Add more info to logs for updater checks.
* Ignore redirect issues for updater checks.
* Fix base URL handling in updater.
* Dump post-update info in CI before checking if the update worked.
* Special-case a version of `latest` in updater.
This is to allow CI to work correctly.
* Update nightly release badge in README.md.
* Fix updater check variable name.
* Add a comment documenting the magic number in parse_version.
Diffstat (limited to 'packaging/installer/netdata-updater.sh')
-rwxr-xr-x | packaging/installer/netdata-updater.sh | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/packaging/installer/netdata-updater.sh b/packaging/installer/netdata-updater.sh index 8740e7db2a..5e6a786eb3 100755 --- a/packaging/installer/netdata-updater.sh +++ b/packaging/installer/netdata-updater.sh @@ -34,6 +34,9 @@ set -e PACKAGES_SCRIPT="https://raw.githubusercontent.com/netdata/netdata/master/packaging/installer/install-required-packages.sh" +NETDATA_STABLE_BASE_URL="${NETDATA_BASE_URL:-https://github.com/netdata/netdata/releases}" +NETDATA_NIGHTLY_BASE_URL="${NETDATA_BASE_URL:-https://github.com/netdata/netdata-nightlies/releases}" + script_dir="$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd -P)" if [ -x "${script_dir}/netdata-updater" ]; then @@ -369,8 +372,8 @@ download() { } get_netdata_latest_tag() { - dest="${1}" - url="https://github.com/netdata/netdata/releases/latest" + url="${1}/latest" + dest="${2}" if command -v curl >/dev/null 2>&1; then tag=$(curl "${url}" -s -L -I -o /dev/null -w '%{url_effective}' | grep -m 1 -o '[^/]*$') @@ -439,7 +442,12 @@ self_update() { parse_version() { r="${1}" - if echo "${r}" | grep -q '^v.*'; then + if [ "${r}" = "latest" ]; then + # If we get ‘latest’ as a version, return the largest possible + # version value. + printf "99999999999999" + return 0 + elif echo "${r}" | grep -q '^v.*'; then # shellcheck disable=SC2001 # XXX: Need a regex group substitution here. r="$(echo "${r}" | sed -e 's/^v\(.*\)/\1/')" @@ -463,9 +471,9 @@ parse_version() { get_latest_version() { if [ "${RELEASE_CHANNEL}" = "stable" ]; then - get_netdata_latest_tag /dev/stdout + get_netdata_latest_tag "${NETDATA_STABLE_BASE_URL}" /dev/stdout else - download "$NETDATA_NIGHTLIES_BASEURL/latest-version.txt" /dev/stdout + get_netdata_latest_tag "${NETDATA_NIGHTLY_BASE_URL}" /dev/stdout fi } @@ -529,12 +537,13 @@ set_tarball_urls() { fi if [ "$1" = "stable" ]; then - latest="$(get_netdata_latest_tag /dev/stdout)" - export NETDATA_TARBALL_URL="https://github.com/netdata/netdata/releases/download/$latest/${filename}" - export NETDATA_TARBALL_CHECKSUM_URL="https://github.com/netdata/netdata/releases/download/$latest/sha256sums.txt" + latest="$(get_netdata_latest_tag "${NETDATA_STABLE_BASE_URL}" /dev/stdout)" + export NETDATA_TARBALL_URL="${NETDATA_STABLE_BASE_URL}/download/$latest/${filename}" + export NETDATA_TARBALL_CHECKSUM_URL="${NETDATA_STABLE_BASE_URL}/download/$latest/sha256sums.txt" else - export NETDATA_TARBALL_URL="$NETDATA_NIGHTLIES_BASEURL/${filename}" - export NETDATA_TARBALL_CHECKSUM_URL="$NETDATA_NIGHTLIES_BASEURL/sha256sums.txt" + tag="$(get_netdata_latest_tag "${NETDATA_NIGHTLY_BASE_URL}" /dev/stdout)" + export NETDATA_TARBALL_URL="${NETDATA_NIGHTLY_BASE_URL}/download/${tag}/${filename}" + export NETDATA_TARBALL_CHECKSUM_URL="${NETDATA_NIGHTLY_BASE_URL}/download/${tag}/sha256sums.txt" fi } @@ -907,9 +916,6 @@ export NETDATA_LIB_DIR="${NETDATA_LIB_DIR:-${NETDATA_PREFIX}/var/lib/netdata}" # Source the tarball checksum, if not already available from environment (for existing installations with the old logic) [ -z "${NETDATA_TARBALL_CHECKSUM}" ] && [ -f "${NETDATA_LIB_DIR}/netdata.tarball.checksum" ] && NETDATA_TARBALL_CHECKSUM="$(cat "${NETDATA_LIB_DIR}/netdata.tarball.checksum")" -# Grab the nightlies baseurl (defaulting to our Google Storage bucket) -export NETDATA_NIGHTLIES_BASEURL="${NETDATA_NIGHTLIES_BASEURL:-https://storage.googleapis.com/netdata-nightlies}" - if echo "$INSTALL_TYPE" | grep -qv ^binpkg && [ "${INSTALL_UID}" != "$(id -u)" ]; then fatal "You are running this script as user with uid $(id -u). We recommend to run this script as root (user with uid 0)" U0011 fi |