summaryrefslogtreecommitdiffstats
path: root/tests/installer
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 11:08:07 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 11:08:07 +0000
commitc69cb8cc094cc916adbc516b09e944cd3d137c01 (patch)
treef2878ec41fb6d0e3613906c6722fc02b934eeb80 /tests/installer
parentInitial commit. (diff)
downloadnetdata-c69cb8cc094cc916adbc516b09e944cd3d137c01.tar.xz
netdata-c69cb8cc094cc916adbc516b09e944cd3d137c01.zip
Adding upstream version 1.29.3.upstream/1.29.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-xtests/installer/checksums.sh54
-rwxr-xr-xtests/installer/slack.sh65
2 files changed, 119 insertions, 0 deletions
diff --git a/tests/installer/checksums.sh b/tests/installer/checksums.sh
new file mode 100755
index 0000000..3fbbfa3
--- /dev/null
+++ b/tests/installer/checksums.sh
@@ -0,0 +1,54 @@
+#!/bin/sh
+
+#
+# Mechanism to validate kickstart files integrity status
+#
+# Copyright: SPDX-License-Identifier: GPL-3.0-or-later
+#
+# Author : Pawel Krupa (pawel@netdata.cloud)
+# Author : Pavlos Emm. Katsoulakis (paul@netdata.cloud)
+# Author : Austin S. Hemmelgarn (austin@netdata.cloud)
+set -e
+
+# If we are not in netdata git repo, at the top level directory, fail
+TOP_LEVEL=$(basename "$(git rev-parse --show-toplevel 2>/dev/null || echo "")")
+CWD="$(git rev-parse --show-cdup 2>/dev/null || echo "")"
+if [ -n "$CWD" ] || [ "${TOP_LEVEL}" != "netdata" ]; then
+ echo "Run as ./tests/installer/$(basename "$0") from top level directory of netdata git repository"
+ echo "Kickstart validation process aborted"
+ exit 1
+fi
+
+check_file() {
+ README_MD5=$(grep "$1" "$2" | grep md5sum | grep curl | cut -d '"' -f2)
+ KICKSTART_URL="https://my-netdata.io/$1"
+ KICKSTART="packaging/installer/$1"
+ KICKSTART_MD5="$(md5sum "${KICKSTART}" | cut -d' ' -f1)"
+ CALCULATED_MD5="$(curl -Ss "${KICKSTART_URL}" | md5sum | cut -d ' ' -f 1)"
+
+ # Conditionally run the website validation
+ if [ -z "${LOCAL_ONLY}" ]; then
+ echo "Validating ${KICKSTART_URL} against local file ${KICKSTART} with MD5 ${KICKSTART_MD5}.."
+ if [ "$KICKSTART_MD5" = "$CALCULATED_MD5" ]; then
+ echo "${KICKSTART_URL} looks fine"
+ else
+ echo "${KICKSTART_URL} md5sum does not match local file, it needs to be updated"
+ exit 2
+ fi
+ fi
+
+ echo "Validating documentation for $1"
+ if [ "$KICKSTART_MD5" != "$README_MD5" ]; then
+ echo "Invalid checksum for $1 in $2."
+ echo "checksum in docs: $README_MD5"
+ echo "current checksum: $KICKSTART_MD5"
+ exit 2
+ else
+ echo "$1 MD5Sum is well documented"
+ fi
+}
+
+check_file kickstart.sh packaging/installer/methods/kickstart.md
+check_file kickstart-static64.sh packaging/installer/methods/kickstart-64.md
+
+echo "No problems found, exiting succesfully!"
diff --git a/tests/installer/slack.sh b/tests/installer/slack.sh
new file mode 100755
index 0000000..3f3eff6
--- /dev/null
+++ b/tests/installer/slack.sh
@@ -0,0 +1,65 @@
+# #No shebang necessary
+# BASH Lib: Simple incoming webhook for slack integration.
+#
+# The script expects the following parameters to be defined by the upper layer:
+# SLACK_NOTIFY_WEBHOOK_URL
+# SLACK_BOT_NAME
+# SLACK_CHANNEL
+#
+# Copyright:
+#
+# Author: Pavlos Emm. Katsoulakis <paul@netdata.cloud
+
+post_message() {
+ TYPE="$1"
+ MESSAGE="$2"
+ CUSTOM_CHANNEL="$3"
+
+ case "$TYPE" in
+ "PLAIN_MESSAGE")
+ curl -X POST --data-urlencode "payload={\"channel\": \"${SLACK_CHANNEL}\", \"username\": \"${SLACK_BOT_NAME}\", \"text\": \"${MESSAGE}\", \"icon_emoji\": \":space_invader:\"}" "${SLACK_NOTIFY_WEBHOOK_URL}"
+ ;;
+ "TRAVIS_MESSAGE")
+ if [ "${TRAVIS_EVENT_TYPE}" == "pull_request" ] || [ "${TRAVIS_BRANCH}" != "master" ] ; then
+ echo "Skipping notification due to build type."
+ return 0
+ fi
+
+ if [ -n "${CUSTOM_CHANNEL}" ]; then
+ echo "Sending travis message to custom channel ${CUSTOM_CHANNEL}"
+ OPTIONAL_CHANNEL_INFO="\"channel\": \"${CUSTOM_CHANNEL}\","
+ fi
+
+ POST_MESSAGE="{
+ ${OPTIONAL_CHANNEL_INFO}
+ \"text\": \"${TRAVIS_REPO_SLUG}, ${MESSAGE}\",
+ \"attachments\": [{
+ \"text\": \"${TRAVIS_JOB_NUMBER}: Event type '${TRAVIS_EVENT_TYPE}', on '${TRAVIS_OS_NAME}' \",
+ \"fallback\": \"I could not determine the build\",
+ \"callback_id\": \"\",
+ \"color\": \"#3AA3E3\",
+ \"attachment_type\": \"default\",
+ \"actions\": [
+ {
+ \"name\": \"${TRAVIS_BUILD_NUMBER}\",
+ \"text\": \"Build #${TRAVIS_BUILD_NUMBER}\",
+ \"type\": \"button\",
+ \"url\": \"${TRAVIS_BUILD_WEB_URL}\"
+ },
+ {
+ \"name\": \"${TRAVIS_JOB_NUMBER}\",
+ \"text\": \"Job #${TRAVIS_JOB_NUMBER}\",
+ \"type\": \"button\",
+ \"url\": \"${TRAVIS_JOB_WEB_URL}\"
+ }]
+ }]
+ }"
+ echo "Sending ${POST_MESSAGE}"
+ curl -X POST --data-urlencode "payload=${POST_MESSAGE}" "${SLACK_NOTIFY_WEBHOOK_URL}"
+ ;;
+ *)
+ echo "Unrecognized message type \"$TYPE\" was given"
+ return 1
+ ;;
+ esac
+}