summaryrefslogtreecommitdiffstats
path: root/.github/scripts
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2021-12-01 06:15:04 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2021-12-01 06:15:04 +0000
commite970e0b37b8bd7f246feb3f70c4136418225e434 (patch)
tree0b67c0ca45f56f2f9d9c5c2e725279ecdf52d2eb /.github/scripts
parentAdding upstream version 1.31.0. (diff)
downloadnetdata-e970e0b37b8bd7f246feb3f70c4136418225e434.tar.xz
netdata-e970e0b37b8bd7f246feb3f70c4136418225e434.zip
Adding upstream version 1.32.0.upstream/1.32.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '.github/scripts')
-rwxr-xr-x.github/scripts/build-static.sh (renamed from .github/scripts/build-static-x86_64.sh)17
-rwxr-xr-x.github/scripts/check-updater.sh6
-rwxr-xr-x.github/scripts/docker-test.sh58
-rwxr-xr-x.github/scripts/pkg-test.sh128
-rwxr-xr-x.github/scripts/run-updater-check.sh9
-rwxr-xr-x.github/scripts/run_install_with_dist_file.sh3
6 files changed, 210 insertions, 11 deletions
diff --git a/.github/scripts/build-static-x86_64.sh b/.github/scripts/build-static.sh
index 2676b6321..e81051438 100755
--- a/.github/scripts/build-static-x86_64.sh
+++ b/.github/scripts/build-static.sh
@@ -7,9 +7,10 @@ set -e
# shellcheck source=.github/scripts/functions.sh
. "$(dirname "$0")/functions.sh"
+BUILDARCH="${1}"
NAME="${NAME:-netdata}"
VERSION="${VERSION:-"$(git describe)"}"
-BASENAME="$NAME-$VERSION"
+BASENAME="$NAME-$BUILDARCH-$VERSION"
prepare_build() {
progress "Preparing build"
@@ -18,10 +19,10 @@ prepare_build() {
) >&2
}
-build_static_x86_64() {
- progress "Building static x86_64"
+build_static() {
+ progress "Building static ${BUILDARCH}"
(
- USER="" ./packaging/makeself/build-x86_64-static.sh
+ USER="" ./packaging/makeself/build-static.sh "${BUILDARCH}"
) >&2
}
@@ -31,12 +32,14 @@ prepare_assets() {
cp packaging/version artifacts/latest-version.txt
cd artifacts || exit 1
- ln -s "${BASENAME}.gz.run" netdata-latest.gz.run
- sha256sum -b ./* > "sha256sums.txt"
+ ln -s "${BASENAME}.gz.run" "netdata-${BUILDARCH}-latest.gz.run"
+ if [ "${BUILDARCH}" = "x86_64" ]; then
+ ln -s "${BASENAME}.gz.run" netdata-latest.gz.run
+ fi
) >&2
}
-steps="prepare_build build_static_x86_64"
+steps="prepare_build build_static"
steps="$steps prepare_assets"
_main() {
diff --git a/.github/scripts/check-updater.sh b/.github/scripts/check-updater.sh
index 3ef4857f9..1051f1eee 100755
--- a/.github/scripts/check-updater.sh
+++ b/.github/scripts/check-updater.sh
@@ -4,20 +4,20 @@ set -e
# shellcheck source=.github/scripts/functions.sh
. "$(dirname "$0")/functions.sh"
-check_successfull_update() {
+check_successful_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!"
+ echo "Update successful!"
else
exit 1
fi
) >&2
}
-steps="check_successfull_update"
+steps="check_successful_update"
_main() {
for step in $steps; do
diff --git a/.github/scripts/docker-test.sh b/.github/scripts/docker-test.sh
new file mode 100755
index 000000000..795711b1a
--- /dev/null
+++ b/.github/scripts/docker-test.sh
@@ -0,0 +1,58 @@
+#!/bin/sh
+
+export DEBIAN_FRONTEND=noninteractive
+
+wait_for() {
+ host="${1}"
+ port="${2}"
+ name="${3}"
+ timeout="30"
+
+ if command -v nc > /dev/null ; then
+ netcat="nc"
+ elif command -v netcat > /dev/null ; then
+ netcat="netcat"
+ else
+ printf "Unable to find a usable netcat command.\n"
+ return 1
+ fi
+
+ printf "Waiting for %s on %s:%s ... " "${name}" "${host}" "${port}"
+
+ sleep 30
+
+ i=0
+ while ! ${netcat} -z "${host}" "${port}"; do
+ sleep 1
+ if [ "$i" -gt "$timeout" ]; then
+ printf "Timed out!\n"
+ return 1
+ fi
+ i="$((i + 1))"
+ done
+ printf "OK\n"
+}
+
+apt-get update && apt-get upgrade -y && apt get install -y netcat
+
+docker run -d --name=netdata \
+ -p 19999:19999 \
+ -v netdataconfig:/etc/netdata \
+ -v netdatalib:/var/lib/netdata \
+ -v netdatacache:/var/cache/netdata \
+ -v /etc/passwd:/host/etc/passwd:ro \
+ -v /etc/group:/host/etc/group:ro \
+ -v /proc:/host/proc:ro \
+ -v /sys:/host/sys:ro \
+ -v /etc/os-release:/host/etc/os-release:ro \
+ --cap-add SYS_PTRACE \
+ --security-opt apparmor=unconfined \
+ netdata/netdata:test
+
+wait_for localhost 19999 netdata || exit 1
+
+curl -sS http://127.0.0.1:19999/api/v1/info > ./response || exit 1
+
+cat ./response
+
+jq '.version' ./response || exit 1
diff --git a/.github/scripts/pkg-test.sh b/.github/scripts/pkg-test.sh
new file mode 100755
index 000000000..196fefa99
--- /dev/null
+++ b/.github/scripts/pkg-test.sh
@@ -0,0 +1,128 @@
+#!/bin/sh
+
+install_debian_like() {
+ # This is needed to ensure package installs don't prompt for any user input.
+ export DEBIAN_FRONTEND=noninteractive
+
+ apt-get update
+
+ # Install Netdata
+ apt-get install -y /netdata/artifacts/netdata_"${VERSION}"_*.deb || exit 1
+
+ # Install testing tools
+ apt-get install -y --no-install-recommends curl netcat jq || exit 1
+}
+
+install_fedora_like() {
+ # Using a glob pattern here because I can't reliably determine what the
+ # resulting package name will be (TODO: There must be a better way!)
+
+ PKGMGR="$( (command -v dnf > /dev/null && echo "dnf") || echo "yum")"
+
+ pkg_version="$(echo "${VERSION}" | tr - .)"
+
+ # Install Netdata
+ "$PKGMGR" install -y /netdata/artifacts/netdata-"${pkg_version}"-*.rpm
+
+ # Install testing tools
+ "$PKGMGR" install -y curl nc jq || exit 1
+}
+
+install_centos() {
+ # Using a glob pattern here because I can't reliably determine what the
+ # resulting package name will be (TODO: There must be a better way!)
+
+ PKGMGR="$( (command -v dnf > /dev/null && echo "dnf") || echo "yum")"
+
+ pkg_version="$(echo "${VERSION}" | tr - .)"
+
+ # Install EPEL (needed for `jq`
+ "$PKGMGR" install -y epel-release || exit 1
+
+ # Install Netdata
+ "$PKGMGR" install -y /netdata/artifacts/netdata-"${pkg_version}"-*.rpm
+
+ # Install testing tools
+ "$PKGMGR" install -y curl nc jq || exit 1
+}
+
+install_suse_like() {
+ # Using a glob pattern here because I can't reliably determine what the
+ # resulting package name will be (TODO: There must be a better way!)
+
+ pkg_version="$(echo "${VERSION}" | tr - .)"
+
+ # Install Netdata
+ zypper install -y --allow-unsigned-rpm /netdata/artifacts/netdata-"${pkg_version}"-*.rpm
+
+ # Install testing tools
+ zypper install -y --no-recommends curl netcat-openbsd jq || exit 1
+}
+
+dump_log() {
+ cat ./netdata.log
+}
+
+wait_for() {
+ host="${1}"
+ port="${2}"
+ name="${3}"
+ timeout="30"
+
+ if command -v nc > /dev/null ; then
+ netcat="nc"
+ elif command -v netcat > /dev/null ; then
+ netcat="netcat"
+ else
+ printf "Unable to find a usable netcat command.\n"
+ return 1
+ fi
+
+ printf "Waiting for %s on %s:%s ... " "${name}" "${host}" "${port}"
+
+ sleep 30
+
+ i=0
+ while ! ${netcat} -z "${host}" "${port}"; do
+ sleep 1
+ if [ "$i" -gt "$timeout" ]; then
+ printf "Timed out!\n"
+ return 1
+ fi
+ i="$((i + 1))"
+ done
+ printf "OK\n"
+}
+
+case "${DISTRO}" in
+ debian | ubuntu)
+ install_debian_like
+ ;;
+ fedora | oraclelinux)
+ install_fedora_like
+ ;;
+ centos)
+ install_centos
+ ;;
+ opensuse)
+ install_suse_like
+ ;;
+ *)
+ printf "ERROR: unsupported distro: %s_%s\n" "${DISTRO}" "${DISTRO_VERSION}"
+ exit 1
+ ;;
+esac
+
+trap dump_log EXIT
+
+/usr/sbin/netdata -D > ./netdata.log 2>&1 &
+
+wait_for localhost 19999 netdata || exit 1
+
+curl -sS http://127.0.0.1:19999/api/v1/info > ./response || exit 1
+
+cat ./response
+
+jq '.version' ./response || exit 1
+
+trap - EXIT
diff --git a/.github/scripts/run-updater-check.sh b/.github/scripts/run-updater-check.sh
new file mode 100755
index 000000000..e6969a2d1
--- /dev/null
+++ b/.github/scripts/run-updater-check.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+echo ">>> Installing Netdata..."
+/netdata/packaging/installer/kickstart.sh --dont-wait --disable-telemetry || exit 1
+echo ">>> Updating Netdata..."
+export NETDATA_NIGHTLIES_BASEURL="http://localhost:8080/artifacts/" # Pull the tarball from the local web server.
+/netdata/packaging/installer/netdata-updater.sh --not-running-from-cron --no-updater-self-update || exit 1
+echo ">>> Checking if update was successful..."
+/netdata/.github/scripts/check-updater.sh || exit 1
diff --git a/.github/scripts/run_install_with_dist_file.sh b/.github/scripts/run_install_with_dist_file.sh
index 9453dff35..18cf80927 100755
--- a/.github/scripts/run_install_with_dist_file.sh
+++ b/.github/scripts/run_install_with_dist_file.sh
@@ -18,7 +18,7 @@ shift
printf >&2 "Opening dist archive %s ... " "${distfile}"
tar -xovf "${distfile}"
-distdir="$(echo "${distfile}" | cut -d. -f1,2,3)"
+distdir="$(echo "${distfile}" | rev | cut -d. -f3- | rev)"
cp -a packaging/installer/install-required-packages.sh "${distdir}/install-required-packages.sh"
if [ ! -d "${distdir}" ]; then
printf >&2 "ERROR: %s is not a directory" "${distdir}"
@@ -29,6 +29,7 @@ printf >&2 "Entering %s and starting docker run ..." "${distdir}"
pushd "${distdir}" || exit 1
docker run \
+ -e DO_NOT_TRACK=1 \
-v "${PWD}:/netdata" \
-w /netdata \
"ubuntu:latest" \