add Travis ctrl file for checking if changes happened (#11383)
* #10298 add Travis ctrl file for checking if changes happened since last nightly * missing comment subject * #10298 repair shellcheck warning - useless cat
rgiovanardi committed
Aug 26, 2021 at 13:31 UTC
5123aee6c99cdec5dbe6abca1763d0950b2a2ee7
3 files changed
+21
-2
.travis/create_artifacts.sh
+15
@@ -26,6 +26,21 @@ if [ ! "${TRAVIS_REPO_SLUG}" == "netdata/netdata" ]; then
26
exit 0
27
fi
28
29
+# if nightlies.sh has not written this TRAVIS_BUILD_NUMBER, there's no
30
+# changes from last nigthly
31
+if [ -f .travis/current_build_status ]; then
32
+ FILE_TRAVIS_BUILD_NUMBER=$(cut -d'#' -f2 < .travis/current_build_status)
33
+ FILE_TRAVIS_BUILD_STATUS=$(cut -d- -f1 < .travis/current_build_status)
34
+ if [[ ${FILE_TRAVIS_BUILD_NUMBER} -eq ${TRAVIS_BUILD_NUMBER} ]] && [[ ${FILE_TRAVIS_BUILD_STATUS} == "changes" ]]; then
35
+ echo "Changes happen since last nightly release, let's continue"
36
+ else
37
+ echo "No changes since last nightly release, nothing else to do"
38
+ exit 0
39
+ fi
40
+else
41
+ echo "File .travis/current_build_status doesn't exist, probably this is the very first build, let's continue"
42
+fi
43
+
44
echo "--- Initialize git configuration ---"
45
git checkout "${1-master}"
46
git pull
.travis/generate_changelog_for_nightlies.sh
+3
-2
@@ -37,8 +37,9 @@ echo "Changelog created! Adding packaging/version(${NEW_VERSION}) and CHANGELOG.
37
echo "${NEW_VERSION}" > packaging/version
38
git add packaging/version && echo "1) Added packaging/version to repository" || FAIL=1
39
git add CHANGELOG.md && echo "2) Added changelog file to repository" || FAIL=1
40
-git commit -m '[ci skip] create nightly packages and update changelog' --author "${GIT_USER} <${GIT_MAIL}>" && echo "3) Committed changes to repository" || FAIL=1
41
-git push "https://${GITHUB_TOKEN}:@${PUSH_URL}" && echo "4) Pushed changes to remote ${PUSH_URL}" || FAIL=1
40
+git add .travis/current_build_status && echo "3) Added travis current build status file to repository" || FAIL=1
41
+git commit -m '[ci skip] create nightly packages and update changelog' --author "${GIT_USER} <${GIT_MAIL}>" && echo "4) Committed changes to repository" || FAIL=1
42
+git push "https://${GITHUB_TOKEN}:@${PUSH_URL}" && echo "5) Pushed changes to remote ${PUSH_URL}" || FAIL=1
43
44
# In case of a failure, wrap it up and bail out cleanly
45
if [ $FAIL -eq 1 ]; then
.travis/nightlies.sh
+3
@@ -31,6 +31,9 @@ PREVIOUS_NIGHTLY_COUNT="$(rev <packaging/version | cut -d- -f 2 | rev)"
31
if [ "${COMMITS_SINCE_RELEASE}" == "${PREVIOUS_NIGHTLY_COUNT}" ]; then
32
echo "No changes since last nightly release, nothing else to do"
33
exit 0
34
+else
35
+ echo "Changes happen since last nightly release"
36
+ echo "changes-#${TRAVIS_BUILD_NUMBER}" > .travis/current_build_status
37
fi
38
39
if [ ! "${TRAVIS_REPO_SLUG}" == "netdata/netdata" ]; then