summaryrefslogtreecommitdiffstats
path: root/netdata-installer.sh
diff options
context:
space:
mode:
authorAustin S. Hemmelgarn <austin@netdata.cloud>2020-11-06 07:07:08 -0500
committerGitHub <noreply@github.com>2020-11-06 07:07:08 -0500
commitb873b655ce2adb75cac07decfb8e2687e8fa8c6c (patch)
tree00b33eb6d2a5d704f5e1373f58f5aee174c46e80 /netdata-installer.sh
parentfddc8510887eadec5fdfd744f80677874f0d313d (diff)
Fixed two bugs related to version handling in install and update code. (#10162)
* Try to update local tags during build to ensure consistent version. By default, `git` does not update the list of tags for a repository after it is first cloned unless you explicitly tell it to do so. Because we use the most recent tag as the first part of our version number, this can lead to strange ancient-looking version numbers that are actually far more recent (for example, `v1.11.1-2915-g6106dd7`, which is actually from v1.21.1 sources), potentially causing confusion with respect to support. This adds code to `netdata-installer.sh` to try to update the local repo with the remote tags to ensure that we actually have sane version numbers. * Use 5 digits for commit count in version number comparison. The original code in `netdata-updater.sh` includes a hard-coded assumption that a version number will never have more than 3 digits for the commit count. This is of course wrong in a handful of cases, which will then get stuck on the older version because of the effects of digit counts on comparisons. This updates from our current 999 commit limit to a limit of 99999 commits, which is a reasonable expectation that we should never get _that_ far.
Diffstat (limited to 'netdata-installer.sh')
-rwxr-xr-xnetdata-installer.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/netdata-installer.sh b/netdata-installer.sh
index fefd6111a1..2752c7ca66 100755
--- a/netdata-installer.sh
+++ b/netdata-installer.sh
@@ -920,6 +920,18 @@ if [ -x "${NETDATA_PREFIX}/usr/libexec/netdata-switch-dashboard.sh" ]; then
fi
# -----------------------------------------------------------------------------
+# By default, `git` does not update local tags based on remotes. Because
+# we use the most recent tag as part of our version determination in
+# our build, this can lead to strange versions that look ancient but are
+# actually really recent. To avoid this, try and fetch tags if we're
+# working in a git checkout.
+if [ -d ./.git ] ; then
+ echo >&2
+ progress "Updating tags in git to ensure a consistent version number"
+ run git fetch <remote> 'refs/tags/*:refs/tags/*' || true
+fi
+
+# -----------------------------------------------------------------------------
echo >&2
progress "Run autotools to configure the build environment"