netdata/packaging/ci: small improvements in logging (#5746)
* netdata/packaging/ci: calculate the version string earlier, so that we can have it in our logs for troubleshooting. Also a small comment nit * netdata/packaging/ci: always use curlies
Paul Katsoulakis committed
Mar 30, 2019 at 14:56 UTC
7bd1fe99f278291ffa8b5861f5e846d2fad7e2f2
3 files changed
+8
-7
.travis/create_artifacts.sh
+1
-1
@@ -24,7 +24,7 @@ mv "${BASENAME}.tar.gz" artifacts/
24
echo "--- Create self-extractor ---"
25
./packaging/makeself/build-x86_64-static.sh
26
27
-# Needed fo GCS
27
+# Needed for GCS
28
echo "--- Copy artifacts to separate directory ---"
29
#shellcheck disable=SC2164
30
cp packaging/version artifacts/latest-version.txt
.travis/generate_changelog.sh
+3
-2
@@ -19,6 +19,7 @@ fi
19
20
LAST_TAG="$1"
21
COMMITS_SINCE_RELEASE="$2"
22
+NEW_VERSION="${LAST_TAG}-$((COMMITS_SINCE_RELEASE + 1))-nightly"
23
ORG=$(echo "$TRAVIS_REPO_SLUG" | cut -d '/' -f1)
24
PROJECT=$(echo "$TRAVIS_REPO_SLUG" | cut -d '/' -f 2)
25
GIT_MAIL=${GIT_MAIL:-"bot@netdata.cloud"}
@@ -48,8 +49,8 @@ docker run -it -v "$(pwd)":/project markmandel/github-changelog-generator:latest
49
--exclude-labels "stale,duplicate,question,invalid,wontfix,discussion,no changelog" \
50
--no-compare-link ${OPTS}
51
51
-echo "Changelog created! Adding packaging/version and CHANGELOG.md to the repository"
52
-echo "$LAST_TAG-$((COMMITS_SINCE_RELEASE + 1))-nightly" > packaging/version
52
+echo "Changelog created! Adding packaging/version(${NEW_VERSION}) and CHANGELOG.md to the repository"
53
+echo "${NEW_VERSION}" > packaging/version
54
git add packaging/version && echo "1) Added packaging/version to repository" || FAIL=1
55
git add CHANGELOG.md && echo "2) Added changelog file to repository" || FAIL=1
56
git commit -m '[ci skip] create nightly packages and update changelog' && echo "3) Committed changes to repository" || FAIL=1
.travis/nightlies.sh
+4
-4
@@ -18,24 +18,24 @@ FAIL=0
18
# If we are not in netdata git repo, at the top level directory, fail
19
TOP_LEVEL=$(basename "$(git rev-parse --show-toplevel)")
20
CWD=$(git rev-parse --show-cdup || echo "")
21
-if [ -n "$CWD" ] || [ ! "${TOP_LEVEL}" == "netdata" ]; then
21
+if [ -n "${CWD}" ] || [ ! "${TOP_LEVEL}" == "netdata" ]; then
22
echo "Run as .travis/$(basename "$0") from top level directory of netdata git repository"
23
echo "Changelog generation process aborted"
24
exit 1
25
fi
26
27
LAST_TAG=$(git describe --abbrev=0 --tags)
28
-COMMITS_SINCE_RELEASE=$(git rev-list "$LAST_TAG"..HEAD --count)
28
+COMMITS_SINCE_RELEASE=$(git rev-list "${LAST_TAG}"..HEAD --count)
29
PREVIOUS_NIGHTLY_COUNT="$(rev <packaging/version | cut -d- -f 2 | rev)"
30
31
# If no commits since release, just stop
32
-if [ "$COMMITS_SINCE_RELEASE" == "${PREVIOUS_NIGHTLY_COUNT}" ]; then
32
+if [ "${COMMITS_SINCE_RELEASE}" == "${PREVIOUS_NIGHTLY_COUNT}" ]; then
33
echo "No changes since last nighthly release"
34
exit 0
35
fi
36
37
echo "--- Running Changelog generation ---"
38
-.travis/generate_changelog.sh "$LAST_TAG" "$COMMITS_SINCE_RELEASE" || echo "Changelog generation has failed, this is a soft error, process continues"
38
+.travis/generate_changelog.sh "${LAST_TAG}" "${COMMITS_SINCE_RELEASE}" || echo "Changelog generation has failed, this is a soft error, process continues"
39
40
echo "--- Build && publish docker images ---"
41
# Do not fail artifacts creation if docker fails. We will be restructuring this on a follow up PR