summaryrefslogtreecommitdiffstats
path: root/.travis
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--.travis.yml96
-rwxr-xr-x.travis/create_artifacts.sh2
-rwxr-xr-x.travis/generate_changelog.sh51
-rwxr-xr-x.travis/generate_changelog_for_release.sh33
-rwxr-xr-x.travis/nightlies.sh74
-rwxr-xr-x.travis/releaser.sh4
6 files changed, 212 insertions, 48 deletions
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 000000000..5c61b8c0c
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,96 @@
+dist: trusty
+sudo: true
+language: c
+services:
+- docker
+
+stages:
+- test
+- build
+- name: packaging
+ if: branch = master AND type != pull_request AND type != cron
+- name: nightlies
+ if: branch = master AND type = cron
+- name: Integrity testing
+ if: branch = master AND type = cron
+
+jobs:
+ include:
+ - stage: test
+ name: C
+ install: sudo apt-get install -y libcap2-bin zlib1g-dev uuid-dev fakeroot libipmimonitoring-dev libmnl-dev libnetfilter-acct-dev
+ script: fakeroot ./netdata-installer.sh --install $HOME --dont-wait --dont-start-it --enable-plugin-nfacct --enable-plugin-freeipmi --disable-lto && $HOME/netdata/usr/sbin/netdata -W unittest
+ env: CFLAGS='-O1 -DNETDATA_INTERNAL_CHECKS=1 -DNETDATA_VERIFY_LOCKS=1'
+ - name: dashboard.js
+ script: cp web/gui/dashboard.js /tmp/dashboard.js && ./build/build.sh && diff /tmp/dashboard.js web/gui/dashboard.js
+ - name: lint .sh.in files
+ script: shellcheck --format=gcc $(find . -name '*.sh.in' -not -iwholename '*.git*')
+ - name: check checksums for kickstart files
+ script: ./tests/installer/checksums.sh
+ env: LOCAL_ONLY="true"
+ - name: coverity
+ install: sudo apt-get install -y zlib1g-dev uuid-dev libipmimonitoring-dev libmnl-dev libnetfilter-acct-dev
+ script: ./coverity-install.sh && ./coverity-scan.sh || echo "Coverity failed :("
+ if: type = cron
+
+ - stage: build
+# TODO: enable when travis OSX become stable. Probably after 12.01.2019
+# name: OSX
+# install: brew install fakeroot ossp-uuid
+# script: fakeroot ./netdata-installer.sh --install $HOME --dont-wait --dont-start-it
+# os: osx
+# - name: ubuntu 14.04 (not containerized)
+ name: ubuntu 14.04 (not containerized)
+ install: sudo apt-get install -y libcap2-bin zlib1g-dev uuid-dev fakeroot
+ script: fakeroot ./netdata-installer.sh --dont-wait --dont-start-it --install $HOME
+ - name: build container (alpine installation)
+ script: ./packaging/docker/build.sh
+ env: DEVEL="true"
+ - name: ubuntu 18.04 + lifecycle
+ script: docker run -it -v "${PWD}:/code:rw" -w /code "netdata/os-test:ubuntu1804" bats --tap tests/lifecycle.bats
+ - name: CentOS 7
+ script: docker run -it -v "${PWD}:/code:rw" -w /code "netdata/os-test:centos7" ./netdata-installer.sh --dont-wait --dont-start-it --install /tmp
+ - name: CentOS 6
+ script: docker run -it -v "${PWD}:/code:rw" -w /code "netdata/os-test:centos6" ./netdata-installer.sh --dont-wait --dont-start-it --install /tmp
+
+ - stage: packaging
+ name: Create release (only on special commit msg)
+ install:
+ - sudo apt-get install -y gnupg libcap2-bin zlib1g-dev uuid-dev fakeroot python-pip
+ - sudo apt install -y --only-upgrade docker-ce
+ - docker info
+ before_script: sudo pip install git-semver
+ script: ".travis/releaser.sh && .travis/labeler.sh" # labeler should be replaced with GitHub Actions when they hit GA
+ git:
+ depth: false
+
+ - stage: nightlies
+ name: Nightly build
+ before_install: openssl aes-256-cbc -K $encrypted_8daf19481253_key -iv $encrypted_8daf19481253_iv -in .travis/gcs-credentials.json.enc -out .travis/gcs-credentials.json -d
+ install:
+ - sudo apt-get install -y gnupg libcap2-bin zlib1g-dev uuid-dev fakeroot
+ - sudo apt install -y --only-upgrade docker-ce
+ - docker info
+ script: ".travis/nightlies.sh"
+ git:
+ depth: false
+ deploy:
+ provider: gcs
+ edge:
+ branch: gcs-ng
+ project_id: netdata-storage
+ credentials: .travis/gcs-credentials.json
+ bucket: "netdata-nightlies"
+ skip_cleanup: true
+ local_dir: "artifacts"
+ after_deploy: rm -f .travis/gcs-credentials.json
+
+ - stage: Integrity testing
+ name: Kickstart files integrity testing
+ script: ./tests/installer/checksums.sh
+
+notifications:
+ webhooks: https://app.fossa.io/hooks/travisci
+ slack:
+ rooms:
+ - secure: "NuW1p7s+WGLcyhEceeiLRSV1JgAc6N47zgdSsYoxrjSFRQHDfc8jensypDcEJwgs1K2Hcve9iKRaAddEHEw7AkS6rie9gFR5HmmbKXfW2GFMqOr6maYTFsvaECPqiWk1n9/XnRLsAi5kZ8HxH+a8ldb/eaVoFQesY1jPXgh11BM5DwvpXjEtwg0WGASsKiymvnXFS3KcC+sR7Lln2GX1a8vfCX2I3TEmOedKMlSHUy5JilGGC3AWA0SWS8tR8PUH0u3dHL5j0RNIr1RO3Yx24QgUpg/YpvKymnW/iIIEOq2vb2mBhhiKEQjJ1djUL4VSPzjIDpUzThVpKaHk3syOp6W9qZEHKhR/sqjc5Yk2XRjsw1cM0nS60gaCgxtKhEMKWcjtvWf04oJAVrmcUwcYXj0eA+jgRCZl5VhyufK/fUJavjOfsQGjwhdjxQfwDCw33W17ypJUt4GZngdb6jbIhEOcKHSLQDu1vuHTw82hJJkthkmR59PX30qJdl/MEGcfVLdN/fkCokjR/qwfmkNwQm+wYSKsK/Jq4RgBT0/oZwY3e8nkCq2ov7lBbDO3/0rzQKWZ9Uy//tnoCM3vGhDwGHQxsHshv7g6KwdhYTcmm7WWWIucfLupcjFUO1HbRuJ+7ZnvxRRwKiV+MGkFT2SNJkS8q1/jCu9KGbmktd0WUSE="
diff --git a/.travis/create_artifacts.sh b/.travis/create_artifacts.sh
index fe75f0f70..18c85287c 100755
--- a/.travis/create_artifacts.sh
+++ b/.travis/create_artifacts.sh
@@ -24,7 +24,7 @@ mv "${BASENAME}.tar.gz" artifacts/
echo "--- Create self-extractor ---"
./packaging/makeself/build-x86_64-static.sh
-# Needed fo GCS
+# Needed for GCS
echo "--- Copy artifacts to separate directory ---"
#shellcheck disable=SC2164
cp packaging/version artifacts/latest-version.txt
diff --git a/.travis/generate_changelog.sh b/.travis/generate_changelog.sh
index 4ae69f1c7..e48b42a66 100755
--- a/.travis/generate_changelog.sh
+++ b/.travis/generate_changelog.sh
@@ -1,29 +1,47 @@
#!/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"
+NEW_VERSION="${LAST_TAG}-$((COMMITS_SINCE_RELEASE + 1))-nightly"
+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 +49,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(${NEW_VERSION}) and CHANGELOG.md to the repository"
+echo "${NEW_VERSION}" > 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/generate_changelog_for_release.sh b/.travis/generate_changelog_for_release.sh
new file mode 100755
index 000000000..4ae69f1c7
--- /dev/null
+++ b/.travis/generate_changelog_for_release.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+set -e
+
+if [ ! -f .gitignore ]; then
+ echo "Run as ./travis/$(basename "$0") from top level directory of git repository"
+ exit 1
+fi
+
+ORGANIZATION=$(echo "$TRAVIS_REPO_SLUG" | awk -F '/' '{print $1}')
+PROJECT=$(echo "$TRAVIS_REPO_SLUG" | awk -F '/' '{print $2}')
+GIT_MAIL=${GIT_MAIL:-"bot@netdata.cloud"}
+GIT_USER=${GIT_USER:-"netdatabot"}
+
+if [ -z ${GIT_TAG+x} ]; then
+ OPTS=""
+else
+ OPTS="--future-release ${GIT_TAG}"
+fi
+
+echo "--- Creating changelog ---"
+git checkout master
+git pull
+#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}" \
+ --project "${PROJECT}" \
+ --token "${GITHUB_TOKEN}" \
+ --since-tag "v1.10.0" \
+ --unreleased-label "**Next release**" \
+ --exclude-labels "stale,duplicate,question,invalid,wontfix,discussion,no changelog" \
+ --no-compare-link ${OPTS}
+
diff --git a/.travis/nightlies.sh b/.travis/nightlies.sh
index 8e867416e..0d9fe036a 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 ---"
-export REPOSITORY="netdata/netdata"
-packaging/docker/build.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/.travis/releaser.sh b/.travis/releaser.sh
index c40f4c1bc..c82687dfb 100755
--- a/.travis/releaser.sh
+++ b/.travis/releaser.sh
@@ -48,7 +48,7 @@ echo "$GIT_TAG" >packaging/version
git add packaging/version
echo "---- GENERATE CHANGELOG -----"
-./.travis/generate_changelog.sh
+./.travis/generate_changelog_for_release.sh
git add CHANGELOG.md
echo "---- COMMIT AND PUSH CHANGES ----"
@@ -64,8 +64,8 @@ if [[ $(git describe) =~ -rc* ]]; then
fi
echo "---- CREATING TAGGED DOCKER CONTAINERS ----"
-export REPOSITORY="netdata/netdata"
./packaging/docker/build.sh
+./packaging/docker/publish.sh
echo "---- CREATING RELEASE ARTIFACTS -----"
# Artifacts are stored in `artifacts/` directory