summaryrefslogtreecommitdiffstats
path: root/tests/installer
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2019-05-21 18:56:05 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2019-05-21 18:56:05 +0000
commit54deae27eed83a162ee438ef6bad4a23767757dd (patch)
treeda5333377dfacf22177375aef822a8e696f007eb /tests/installer
parentReleasing debian version 1.14.0-1. (diff)
downloadnetdata-54deae27eed83a162ee438ef6bad4a23767757dd.tar.xz
netdata-54deae27eed83a162ee438ef6bad4a23767757dd.zip
Merging upstream version 1.15.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/installer')
-rwxr-xr-xtests/installer/checksums.sh51
-rwxr-xr-xtests/installer/slack.sh58
2 files changed, 109 insertions, 0 deletions
diff --git a/tests/installer/checksums.sh b/tests/installer/checksums.sh
new file mode 100755
index 00000000..b2b0b2a2
--- /dev/null
+++ b/tests/installer/checksums.sh
@@ -0,0 +1,51 @@
+#!/bin/bash
+#
+# 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)
+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
+
+README_DOC="packaging/installer/README.md"
+source ./tests/installer/slack.sh
+
+for file in kickstart.sh kickstart-static64.sh; do
+ README_MD5=$(grep "$file" $README_DOC | grep md5sum | cut -d '"' -f2)
+ KICKSTART_URL="https://my-netdata.io/$file"
+ KICKSTART="packaging/installer/$file"
+ 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
+ post_message "TRAVIS_MESSAGE" "Attention <!here> , ${KICKSTART_URL} md5sum does not match local file, it needs to be updated"
+ fi
+ fi
+
+ echo "Validating documentation for $file"
+ if [ "$KICKSTART_MD5" != "$README_MD5" ]; then
+ echo "Invalid checksum for $file in $README_DOC."
+ echo "checksum in docs: $README_MD5"
+ echo "current checksum: $KICKSTART_MD5"
+ exit 2
+ else
+ echo "$file MD5Sum is well documented"
+ fi
+
+done
+echo "No problems found, exiting succesfully!"
diff --git a/tests/installer/slack.sh b/tests/installer/slack.sh
new file mode 100755
index 00000000..3c5f94a4
--- /dev/null
+++ b/tests/installer/slack.sh
@@ -0,0 +1,58 @@
+# #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"
+
+ 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")
+ EVENT_LINE="${TRAVIS_JOB_NUMBER}: Event type '${TRAVIS_EVENT_TYPE}', on '${TRAVIS_OS_NAME}'"
+ if [ "$TRAVIS_EVENT_TYPE}" == "pull_request" ]; then
+ EVENT_LINE="${TRAVIS_JOB_NUMBER}: Event type '${TRAVIS_EVENT_TYPE}' #${TRAVIS_PULL_REQUEST}, on '${TRAVIS_OS_NAME}' "
+ fi
+
+ POST_MESSAGE="{
+ \"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
+}