nightlies.sh 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/usr/bin/env bash
  2. #
  3. # This is the nightly changelog generation script
  4. # It is responsible for two major activities:
  5. # 1) Update packaging/version with the current nightly version
  6. # 2) Generate the changelog for the mentioned version
  7. #
  8. # Copyright: SPDX-License-Identifier: GPL-3.0-or-later
  9. #
  10. # Author : Pawel Krupa (paulfantom)
  11. # Author : Pavlos Emm. Katsoulakis (paul@netdata.cloud)
  12. set -e
  13. FAIL=0
  14. source tests/installer/slack.sh || echo "Could not load slack library"
  15. # If we are not in netdata git repo, at the top level directory, fail
  16. TOP_LEVEL=$(basename "$(git rev-parse --show-toplevel)")
  17. CWD=$(git rev-parse --show-cdup || echo "")
  18. if [ -n "${CWD}" ] || [ ! "${TOP_LEVEL}" == "netdata" ]; then
  19. echo "Run as .travis/$(basename "$0") from top level directory of netdata git repository"
  20. echo "Changelog generation process aborted"
  21. exit 1
  22. fi
  23. LAST_TAG=$(git describe --abbrev=0 --tags)
  24. COMMITS_SINCE_RELEASE=$(git rev-list "${LAST_TAG}"..HEAD --count)
  25. PREVIOUS_NIGHTLY_COUNT="$(rev <packaging/version | cut -d- -f 2 | rev)"
  26. # If no commits since release, just stop
  27. if [ "${COMMITS_SINCE_RELEASE}" == "${PREVIOUS_NIGHTLY_COUNT}" ]; then
  28. echo "No changes since last nightly release, nothing else to do"
  29. exit 0
  30. fi
  31. if [ ! "${TRAVIS_REPO_SLUG}" == "netdata/netdata" ]; then
  32. echo "Beta mode -- nothing to do for ${TRAVIS_REPO_SLUG} on the nightlies script, bye"
  33. exit 0
  34. fi
  35. echo "--- Running Changelog generation ---"
  36. echo "We got $COMMITS_SINCE_RELEASE changes since $LAST_TAG, re-generating changelog"
  37. NIGHTLIES_CHANGELOG_FAILED=0
  38. .travis/generate_changelog_for_nightlies.sh "${LAST_TAG}" "${COMMITS_SINCE_RELEASE}" || NIGHTLIES_CHANGELOG_FAILED=1
  39. if [ ${NIGHTLIES_CHANGELOG_FAILED} -eq 1 ]; then
  40. echo "Changelog generation has failed, this is a soft error, process continues"
  41. post_message "TRAVIS_MESSAGE" "Changelog generation job for nightlies failed, possibly due to github issues" "${NOTIF_CHANNEL}" || echo "Slack notification failed"
  42. fi
  43. exit "${FAIL}"