summaryrefslogtreecommitdiffstats
path: root/.github/scripts
diff options
context:
space:
mode:
authorkaskavel <31739664+kaskavel@users.noreply.github.com>2021-03-03 21:36:53 +0200
committerGitHub <noreply@github.com>2021-03-03 21:36:53 +0200
commitcadbb5056d839e3bd72805e4f7ccdc76d2c4dbd3 (patch)
tree4791e8d7a8bdbc651d296b9a0e43a164c4bb09ee /.github/scripts
parent1d003fa0d5111066e1459997c18bb115a036eb94 (diff)
Add a new workflow to test that updater works as expected (#10599)
* Add workflow for installing latest version of netdata, building from source of this branch & running the updater. Add script build-dist to create the artifacts used for the update. * Add more distributions, arguments in updater script & accomodate review comment * Run updater within docker for 6 distributions * Remove unecessary change in updater * Correct netdata_version --> updater_version in check-updater script * Review comments: remove unused vars & replace == with =
Diffstat (limited to '.github/scripts')
-rwxr-xr-x.github/scripts/build-dist.sh70
-rwxr-xr-x.github/scripts/check-updater.sh38
2 files changed, 108 insertions, 0 deletions
diff --git a/.github/scripts/build-dist.sh b/.github/scripts/build-dist.sh
new file mode 100755
index 0000000000..f7e27324cb
--- /dev/null
+++ b/.github/scripts/build-dist.sh
@@ -0,0 +1,70 @@
+#!/bin/sh
+#
+# Builds the netdata-vX.y.Z-xxxx.tar.gz source tarball (dist)
+
+set -e
+
+# shellcheck source=.github/scripts/functions.sh
+. "$(dirname "$0")/functions.sh"
+
+NAME="${NAME:-netdata}"
+VERSION="${VERSION:-"$(git describe --always)"}"
+BASENAME="$NAME-$VERSION"
+
+prepare_build() {
+ progress "Preparing build"
+ (
+ test -d artifacts || mkdir -p artifacts
+ echo "${VERSION}" > packaging/version
+ ) >&2
+}
+
+build_dist() {
+ progress "Building dist"
+ (
+ command -v git > /dev/null && [ -d .git ] && git clean -d -f
+ autoreconf -ivf
+ ./configure \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --localstatedir=/var \
+ --libexecdir=/usr/libexec \
+ --with-zlib \
+ --with-math \
+ --with-user=netdata \
+ CFLAGS=-O2
+ make dist
+ mv "${BASENAME}.tar.gz" artifacts/
+ ) >&2
+}
+
+prepare_assets() {
+ progress "Preparing assets"
+ (
+ cp packaging/version artifacts/latest-version.txt
+ cd artifacts || exit 1
+ ln -f "${BASENAME}.tar.gz" netdata-latest.tar.gz
+ ln -f "${BASENAME}.gz.run" netdata-latest.gz.run
+ sha256sum -b ./* > "sha256sums.txt"
+ ) >&2
+}
+
+steps="prepare_build build_dist prepare_assets"
+
+_main() {
+ for step in $steps; do
+ if ! run "$step"; then
+ if [ -t 1 ]; then
+ debug
+ else
+ fail "Build failed"
+ fi
+ fi
+ done
+
+ echo "🎉 All Done!"
+}
+
+if [ -n "$0" ] && [ x"$0" != x"-bash" ]; then
+ _main "$@"
+fi
diff --git a/.github/scripts/check-updater.sh b/.github/scripts/check-updater.sh
new file mode 100755
index 0000000000..3ef4857f9e
--- /dev/null
+++ b/.github/scripts/check-updater.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+#
+set -e
+# shellcheck source=.github/scripts/functions.sh
+. "$(dirname "$0")/functions.sh"
+
+check_successfull_update() {
+ progress "Check netdata version after update"
+ (
+ netdata_version=$(netdata -v | awk '{print $2}')
+ updater_version=$(cat packaging/version)
+ if [ "$netdata_version" = "$updater_version" ]; then
+ echo "Update successfull!"
+ else
+ exit 1
+ fi
+ ) >&2
+}
+
+steps="check_successfull_update"
+
+_main() {
+ for step in $steps; do
+ if ! run "$step"; then
+ if [ -t 1 ]; then
+ debug
+ else
+ fail "Build failed"
+ fi
+ fi
+ done
+
+ echo "🎉 All Done!"
+}
+
+if [ -n "$0" ] && [ x"$0" != x"-bash" ]; then
+ _main "$@"
+fi