@cryptotaxi247 / netdata-1 / commits / ea4516620

Improve handling of release channel selection in kickstart.sh. (#12635)

- Added a new option named `--nightly-channel` for symmetry with `--stable-channel`. - Added a new option named `--release-channel` for a future-proof way to explicitly specify a particular release channel. - Added a third release channel value named `default` to indicate that the user has indicated no preference for a specific release channel. - Decoupled the selected release channel from the one indicated in telemetry events, allowing us to differentiate between the default channel being selected because the user explicitly asked for it, and it being selected because the user indicated no preference.

Austin S. Hemmelgarn committed May 3, 2022 at 11:41 UTC ea451662055227545550d8f09deecb1427b7c672
2 files changed +35 -10
packaging/installer/kickstart.sh
+29 -8
@@ -7,6 +7,7 @@
7
8 AGENT_BUG_REPORT_URL="https://github.com/netdata/netdata/issues/new/choose"
9 CLOUD_BUG_REPORT_URL="https://github.com/netdata/netdata-cloud/issues/new/choose"
10 +DEFAULT_RELEASE_CHANNEL="nightly"
11 DISCUSSIONS_URL="https://github.com/netdata/netdata/discussions"
12 DISCORD_INVITE="https://discord.gg/5ygS846fR6"
13 DOCS_URL="https://learn.netdata.cloud/docs/"
@@ -36,7 +37,7 @@ NETDATA_ONLY_NATIVE=0
37 NETDATA_ONLY_STATIC=0
38 NETDATA_REQUIRE_CLOUD=1
39 NETDATA_WARNINGS=""
39 -RELEASE_CHANNEL="nightly"
40 +RELEASE_CHANNEL="default"
41
42 if [ -n "$DISABLE_TELEMETRY" ]; then
43 NETDATA_DISABLE_TELEMETRY="${DISABLE_TELEMETRY}"
@@ -122,8 +123,9 @@ USAGE: kickstart.sh [options]
123 --interactive Prompt for user input even if there is no controlling terminal.
124 --dont-start-it Do not start the agent by default (only for static installs or local builds)
125 --dry-run Report what we would do with the given options on this system, but don’t actually do anything.
125 - --stable-channel Install a stable version instead of a nightly build (default: install a nightly build)
126 - --nightly-channel Install a nightly build instead of a stable version
126 + --release-channel Specify the release channel to use for the install (default: ${DEFAULT_RELEASE_CHANNEL})
127 + --stable-channel Equivalent to "--release-channel stable"
128 + --nightly-channel Equivalent to "--release-channel nightly"
129 --no-updates Do not enable automatic updates (default: enable automatic updates using the best supported scheduling method)
130 --auto-update Enable automatic updates.
131 --auto-update-type Specify a particular scheduling type for auto-updates (valid types: systemd, interval, crontab)
@@ -1183,7 +1185,7 @@ try_package_install() {
1185 progress "Attempting to install using native packages..."
1186 fi
1187
1186 - if [ "${RELEASE_CHANNEL}" = "nightly" ]; then
1188 + if [ "${SELECTED_RELEASE_CHANNEL}" = "nightly" ]; then
1189 release="-edge"
1190 else
1191 release=""
@@ -1370,7 +1372,7 @@ try_package_install() {
1372 # Static build install code
1373
1374 set_static_archive_urls() {
1373 - if [ "${RELEASE_CHANNEL}" = "stable" ]; then
1375 + if [ "$1" = "stable" ]; then
1376 latest="$(get_redirect "https://github.com/netdata/netdata/releases/latest")"
1377 export NETDATA_STATIC_ARCHIVE_URL="https://github.com/netdata/netdata/releases/download/${latest}/netdata-${SYSARCH}-latest.gz.run"
1378 export NETDATA_STATIC_ARCHIVE_CHECKSUM_URL="https://github.com/netdata/netdata/releases/download/${latest}/sha256sums.txt"
@@ -1381,7 +1383,7 @@ set_static_archive_urls() {
1383 }
1384
1385 try_static_install() {
1384 - set_static_archive_urls "${RELEASE_CHANNEL}"
1386 + set_static_archive_urls "${SELECTED_RELEASE_CHANNEL}"
1387 if [ "${DRY_RUN}" -eq 1 ]; then
1388 progress "Would attempt to install using static build..."
1389 else
@@ -1502,7 +1504,7 @@ build_and_install() {
1504 opts="${opts} --dont-wait"
1505 fi
1506
1505 - if [ "${RELEASE_CHANNEL}" = "stable" ]; then
1507 + if [ "${SELECTED_RELEASE_CHANNEL}" = "stable" ]; then
1508 opts="${opts} --stable-channel"
1509 fi
1510
@@ -1544,7 +1546,7 @@ try_build_install() {
1546 return 1
1547 fi
1548
1547 - set_source_archive_urls "${RELEASE_CHANNEL}"
1549 + set_source_archive_urls "${SELECTED_RELEASE_CHANNEL}"
1550
1551 if ! download "${NETDATA_SOURCE_ARCHIVE_URL}" "${tmpdir}/netdata-latest.tar.gz"; then
1552 fatal "Failed to download source tarball for local build." F000B
@@ -1708,7 +1710,20 @@ while [ -n "${1}" ]; do
1710 "--dont-wait"|"--non-interactive") INTERACTIVE=0 ;;
1711 "--interactive") INTERACTIVE=1 ;;
1712 "--dry-run") DRY_RUN=1 ;;
1713 + "--release-channel")
1714 + RELEASE_CHANNEL="$(echo "${2}" | tr '[:upper:]' '[:lower:]')"
1715 + case "${RELEASE_CHANNEL}" in
1716 + nightly|stable|default)
1717 + shift 1
1718 + ;;
1719 + *)
1720 + echo "Unrecognized value for --release-channel. Valid release channels are: stable, nightly, default"
1721 + exit 1
1722 + ;;
1723 + esac
1724 + ;;
1725 "--stable-channel") RELEASE_CHANNEL="stable" ;;
1726 + "--nightly-channel") RELEASE_CHANNEL="nightly" ;;
1727 "--no-updates") NETDATA_AUTO_UPDATES=0 ;;
1728 "--auto-update") NETDATA_AUTO_UPDATES="1" ;;
1729 "--auto-update-method")
@@ -1844,6 +1859,12 @@ else
1859 AUTO_UPDATE=0
1860 fi
1861
1862 +if [ "${RELEASE_CHANNEL}" = "default" ]; then
1863 + SELECTED_RELEASE_CHANNEL="${DEFAULT_RELEASE_CHANNEL}"
1864 +else
1865 + SELECTED_RELEASE_CHANNEL="${RELEASE_CHANNEL}"
1866 +fi
1867 +
1868 check_claim_opts
1869 confirm_root_support
1870 get_system_info
packaging/installer/methods/kickstart.md
+6 -2
@@ -50,8 +50,12 @@ The `kickstart.sh` script accepts a number of optional parameters to control how
50 - `--dont-wait`: Synonym for `--non-interactive`
51 - `--dry-run`: Show what the installer would do, but don’t actually do any of it.
52 - `--dont-start-it`: Don’t auto-start the daemon after installing. This parameter is not guaranteed to work.
53 -- `--nightly-channel`: Use a nightly build instead of a stable release (this is the default).
54 -- `--stable-channel`: Use a stable release instead of a nightly build.
53 +- `--release-channel`: Specify a particular release channel to install from. Currently supported release channels are:
54 + - `nightly`: Installs a nightly build (this is currently the default).
55 + - `stable`: Installs a stable release.
56 + - `default`: Explicitly request whatever the current default is.
57 +- `--nightly-channel`: Synonym for `--release-channel nightly`.
58 +- `--stable-channel`: Synonym for `--release-channel stable`.
59 - `--auto-update`: Enable automatic updates (this is the default).
60 - `--no-updates`: Disable automatic updates.
61 - `--disable-telemetry`: Disable anonymous statistics.