summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-x.travis/generate_changelog.sh50
-rwxr-xr-x.travis/nightlies.sh74
-rwxr-xr-xpackaging/docker/build.sh7
-rwxr-xr-xpackaging/docker/publish.sh7
4 files changed, 91 insertions, 47 deletions
diff --git a/.travis/generate_changelog.sh b/.travis/generate_changelog.sh
index 4ae69f1c78..c348476114 100755
--- a/.travis/generate_changelog.sh
+++ b/.travis/generate_changelog.sh
@@ -1,29 +1,46 @@
#!/bin/bash
-
+#
+# Changelog generation scriptlet.
+#
+# Copyright: SPDX-License-Identifier: GPL-3.0-or-later
+#
+# Author : Pawel Krupa (paulfantom)
+# Author : Pavlos Emm. Katsoulakis (paul@netdata.cloud)
set -e
-if [ ! -f .gitignore ]; then
- echo "Run as ./travis/$(basename "$0") from top level directory of git repository"
- exit 1
+# If we are not in netdata git repo, at the top level directory, fail
+TOP_LEVEL=$(basename "$(git rev-parse --show-toplevel)")
+CWD=$(git rev-parse --show-cdup || echo "")
+if [ -n "$CWD" ] || [ ! "${TOP_LEVEL}" == "netdata" ]; then
+ echo "Run as .travis/$(basename "$0") from top level directory of netdata git repository"
+ echo "Changelog generation process aborted"
+ exit 1
fi
-ORGANIZATION=$(echo "$TRAVIS_REPO_SLUG" | awk -F '/' '{print $1}')
-PROJECT=$(echo "$TRAVIS_REPO_SLUG" | awk -F '/' '{print $2}')
+LAST_TAG="$1"
+COMMITS_SINCE_RELEASE="$2"
+ORG=$(echo "$TRAVIS_REPO_SLUG" | cut -d '/' -f1)
+PROJECT=$(echo "$TRAVIS_REPO_SLUG" | cut -d '/' -f 2)
GIT_MAIL=${GIT_MAIL:-"bot@netdata.cloud"}
GIT_USER=${GIT_USER:-"netdatabot"}
-
+PUSH_URL=$(git config --get remote.origin.url | sed -e 's/^https:\/\///')
+FAIL=0
if [ -z ${GIT_TAG+x} ]; then
OPTS=""
else
OPTS="--future-release ${GIT_TAG}"
fi
-echo "--- Creating changelog ---"
+echo "We got $COMMITS_SINCE_RELEASE changes since $LAST_TAG, re-generating changelog"
+git config user.email "${GIT_MAIL}"
+git config user.name "${GIT_USER}"
git checkout master
git pull
+
+echo "Running project markmandel for github changelog generation"
#docker run -it --rm -v "$(pwd)":/usr/local/src/your-app ferrarimarco/github-changelog-generator:1.14.3 \
docker run -it -v "$(pwd)":/project markmandel/github-changelog-generator:latest \
- --user "${ORGANIZATION}" \
+ --user "${ORG}" \
--project "${PROJECT}" \
--token "${GITHUB_TOKEN}" \
--since-tag "v1.10.0" \
@@ -31,3 +48,18 @@ docker run -it -v "$(pwd)":/project markmandel/github-changelog-generator:latest
--exclude-labels "stale,duplicate,question,invalid,wontfix,discussion,no changelog" \
--no-compare-link ${OPTS}
+echo "Changelog created! Adding packaging/version and CHANGELOG.md to the repository"
+echo "$LAST_TAG-$((COMMITS_SINCE_RELEASE + 1))-nightly" > packaging/version
+git add packaging/version && echo "1) Added packaging/version to repository" || FAIL=1
+git add CHANGELOG.md && echo "2) Added changelog file to repository" || FAIL=1
+git commit -m '[ci skip] create nightly packages and update changelog' && echo "3) Committed changes to repository" || FAIL=1
+git push "https://${GITHUB_TOKEN}:@${PUSH_URL}" && echo "4) Pushed changes to remote ${PUSH_URL}" || FAIL=1
+
+# In case of a failure, wrap it up and bail out cleanly
+if [ $FAIL -eq 1 ]; then
+ git clean -xfd
+ echo "Changelog generation failed during github UPDATE!"
+ exit 1
+fi
+
+echo "Changelog generation completed successfully!"
diff --git a/.travis/nightlies.sh b/.travis/nightlies.sh
index 740e569126..3791b21fce 100755
--- a/.travis/nightlies.sh
+++ b/.travis/nightlies.sh
@@ -1,45 +1,47 @@
#!/bin/bash
-
-BAD_THING_HAPPENED=0
-
-if [ ! -f .gitignore ]; then
- echo "Run as ./travis/$(basename "$0") from top level directory of git repository"
- exit 1
+#
+# This is the nightlies orchastration script
+# It runs the following activities in order:
+# 1) Generate changelog
+# 2) Build docker images
+# 3) Publish docker images
+# 4) Generate the rest of the artifacts (Source code .tar.gz file and makeself binary generation)
+#
+# Copyright: SPDX-License-Identifier: GPL-3.0-or-later
+#
+# Author : Pawel Krupa (paulfantom)
+# Author : Pavlos Emm. Katsoulakis (paul@netdata.cloud)
+set -e
+
+FAIL=0
+
+# If we are not in netdata git repo, at the top level directory, fail
+TOP_LEVEL=$(basename "$(git rev-parse --show-toplevel)")
+CWD=$(git rev-parse --show-cdup || echo "")
+if [ -n "$CWD" ] || [ ! "${TOP_LEVEL}" == "netdata" ]; then
+ echo "Run as .travis/$(basename "$0") from top level directory of netdata git repository"
+ echo "Changelog generation process aborted"
+ exit 1
fi
-export GIT_MAIL="bot@netdata.cloud"
-export GIT_USER="netdatabot"
-echo "--- Initialize git configuration ---"
-git config user.email "${GIT_MAIL}"
-git config user.name "${GIT_USER}"
-
-echo "--- UPDATE VERSION FILE ---"
LAST_TAG=$(git describe --abbrev=0 --tags)
-NO_COMMITS=$(git rev-list "$LAST_TAG"..HEAD --count)
-if [ "$NO_COMMITS" == "$(rev <packaging/version | cut -d- -f 2 | rev)" ]; then
- echo "Nothing changed since last nightly build"
+COMMITS_SINCE_RELEASE=$(git rev-list "$LAST_TAG"..HEAD --count)
+PREVIOUS_NIGHTLY_COUNT="$(rev <packaging/version | cut -d- -f 2 | rev)"
+
+# If no commits since release, just stop
+if [ "$COMMITS_SINCE_RELEASE" == "${PREVIOUS_NIGHTLY_COUNT}" ]; then
+ echo "No changes since last nighthly release"
exit 0
fi
-echo "$LAST_TAG-$((NO_COMMITS + 1))-nightly" >packaging/version
-git add packaging/version || exit 1
-
-echo "--- GENERATE CHANGELOG ---"
-if .travis/generate_changelog.sh; then
- git add CHANGELOG.md
-
- echo "--- UPLOAD FILE CHANGES ---"
- git commit -m '[ci skip] create nightly packages and update changelog'
- git push "https://${GITHUB_TOKEN}:@$(git config --get remote.origin.url | sed -e 's/^https:\/\///')"
-else
- git clean -xfd
- BAD_THING_HAPPENED=1
-fi
-echo "--- BUILD & PUBLISH DOCKER IMAGES ---"
-packaging/docker/build.sh || BAD_THING_HAPPENED=1
-packaging/docker/publish.sh || BAD_THING_HAPPENED=1
+echo "--- Running Changelog generation ---"
+.travis/generate_changelog.sh "$LAST_TAG" "$COMMITS_SINCE_RELEASE" || echo "Changelog generation has failed, this is a soft error, process continues"
+
+echo "--- Build && publish docker images ---"
+# Do not fail artifacts creation if docker fails. We will be restructuring this on a follow up PR
+packaging/docker/build.sh && packaging/docker/publish.sh || echo "Failed to build and publish docker images"
-echo "--- BUILD ARTIFACTS ---"
-.travis/create_artifacts.sh || BAD_THING_HAPPENED=1
+echo "--- Build artifacts ---"
+.travis/create_artifacts.sh
-exit "${BAD_THING_HAPPENED}"
+exit "${FAIL}"
diff --git a/packaging/docker/build.sh b/packaging/docker/build.sh
index 9901c8fddc..3a4bd57622 100755
--- a/packaging/docker/build.sh
+++ b/packaging/docker/build.sh
@@ -8,6 +8,11 @@
set -e
+if [ "${BASH_VERSINFO[0]}" -lt "4" ]; then
+ echo "This mechanism currently can only run on BASH version 4 and above"
+ exit 1
+fi
+
VERSION="$1"
REPOSITORY="${REPOSITORY:-netdata}"
declare -A ARCH_MAP
@@ -40,7 +45,7 @@ fi
echo "Docker image build in progress.."
echo "Version : ${VERSION}"
echo "Repository : ${REPOSITORY}"
-echo "Architectures : ${ARCHS}"
+echo "Architectures : ${ARCHS[*]}"
docker run --rm --privileged multiarch/qemu-user-static:register --reset
diff --git a/packaging/docker/publish.sh b/packaging/docker/publish.sh
index 3eba233f98..36a49283d6 100755
--- a/packaging/docker/publish.sh
+++ b/packaging/docker/publish.sh
@@ -8,6 +8,11 @@
set -e
+if [ "${BASH_VERSINFO[0]}" -lt "4" ]; then
+ echo "This mechanism currently can only run on BASH version 4 and above"
+ exit 1
+fi
+
WORKDIR="$(mktemp -d)" # Temporary folder, removed after script is done
VERSION="$1"
REPOSITORY="${REPOSITORY:-netdata}"
@@ -49,7 +54,7 @@ fi
echo "Docker image publishing in progress.."
echo "Version : ${VERSION}"
echo "Repository : ${REPOSITORY}"
-echo "Architectures : ${ARCHS}"
+echo "Architectures : ${ARCHS[*]}"
echo "Manifest list : ${MANIFEST_LIST}"
# Create temporary docker CLI config with experimental features enabled (manifests v2 need it)