netdata/packaging: Notify us when CHANGELOG.md gets too old (#6556)
* netdata/packaging: [ci skip] Make sure you notify us when nightlies changelog generation fails. It is a soft error, but we do want to know about it
Paul Emm. Katsoulakis committed
Jul 28, 2019 at 10:54 UTC
864d25d07e784e2154e5580d0edd10b357f4dd34
2 files changed
+24
-1
.travis.yml
+3
-1
@@ -557,7 +557,9 @@ jobs:
557
# This is generating the changelog for nightly release and publish it
558
- name: Generate nightly changelog
559
before_script: post_message "TRAVIS_MESSAGE" "Starting changelog generation for nightlies" "${NOTIF_CHANNEL}"
560
- script: ".travis/nightlies.sh"
560
+ script:
561
+ - ".travis/nightlies.sh"
562
+ - ".travis/check_changelog_last_modification.sh"
563
after_failure: post_message "TRAVIS_MESSAGE" "<!here> Nightly changelog generation failed"
564
git:
565
depth: false
.travis/check_changelog_last_modification.sh
new
+21
@@ -0,0 +1,21 @@
1
+#!/usr/bin/env bash
2
+
3
+set -e
4
+
5
+LAST_MODIFICATION="$(git log -1 --pretty="format:%at" CHANGELOG.md)"
6
+CURRENT_TIME="$(date +"%s")"
7
+TWO_DAYS_IN_SECONDS=172800
8
+
9
+DIFF=$((CURRENT_TIME - LAST_MODIFICATION))
10
+
11
+echo "Checking CHANGELOG.md last modification time on GIT.."
12
+echo "CHANGELOG.md timestamp: ${LAST_MODIFICATION}"
13
+echo "Current timestamp: ${CURRENT_TIME}"
14
+echo "Diff: ${DIFF}"
15
+
16
+if [ ${DIFF} -gt ${TWO_DAYS_IN_SECONDS} ]; then
17
+ echo "CHANGELOG.md is more than two days old!"
18
+ post_message "TRAVIS_MESSAGE" "Hi <!here>, CHANGELOG.md was found more than two days old (Diff: ${DIFF} seconds)" "${NOTIF_CHANNEL}"
19
+else
20
+ echo "CHANGELOG.md is less than two days old, fine"
21
+fi