diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-05-21 18:56:05 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-05-21 18:56:05 +0000 |
commit | 54deae27eed83a162ee438ef6bad4a23767757dd (patch) | |
tree | da5333377dfacf22177375aef822a8e696f007eb /.travis | |
parent | Releasing debian version 1.14.0-1. (diff) | |
download | netdata-54deae27eed83a162ee438ef6bad4a23767757dd.tar.xz netdata-54deae27eed83a162ee438ef6bad4a23767757dd.zip |
Merging upstream version 1.15.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | .travis.yml | 287 | ||||
-rw-r--r-- | .travis/README.md | 2 | ||||
-rwxr-xr-x | .travis/create_artifacts.sh | 28 | ||||
-rwxr-xr-x | .travis/draft_release.sh | 4 | ||||
-rwxr-xr-x | .travis/generate_changelog_and_tag_release.sh | 4 | ||||
-rwxr-xr-x | .travis/generate_changelog_for_nightlies.sh | 4 |
6 files changed, 309 insertions, 20 deletions
diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..e1b89dfa1 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,287 @@ +sudo: true +language: c +services: +- docker + +# This is a hook to help us introduce "soft" errors on our process +matrix: + allow_failures: + - env: ALLOW_SOFT_FAILURE_HERE=true + +# Install dependencies for all, once +# +install: +- sudo apt-get install -y libcap2-bin zlib1g-dev uuid-dev fakeroot libipmimonitoring-dev libmnl-dev libnetfilter-acct-dev gnupg python-pip +- sudo apt install -y --only-upgrade docker-ce +- sudo pip install git-semver +- docker info +- source tests/installer/slack.sh + +# Setup notification system +# +notifications: + webhooks: https://app.fossa.io/hooks/travisci + +# Define the stage sequence and conditionals +# +stages: +# Mandatory runs, we always want these executed +- name: Code quality, linting, syntax, code style +- name: Build process +- name: Artifacts validation + + # Nightly operations +- name: Nightly operations + if: branch = master AND type = cron +- name: Nightly release + if: branch = master AND type = cron + + # Scheduled releases +- name: Packaging for release + if: branch = master AND type != pull_request AND type != cron + +- name: Publish for release + if: branch = master AND type != pull_request AND type != cron AND commit_message =~ /(\[netdata release candidate\]|\[netdata major release\]|\[netdata minor release\]|\[netdata patch release\])/ + + + +# Define stage implementation details +# +jobs: + include: + # Do code quality, syntax checking and other pre-build activities + - stage: Code quality, linting, syntax, code style + + name: Run shellchecking on BASH + script: shellcheck --format=gcc $(find . -name '*.sh.in' -not -iwholename '*.git*') + + # This falls under same stage defined earlier + - name: Run checksum checks on kickstart files + script: ./tests/installer/checksums.sh + env: LOCAL_ONLY="true" + + # This falls under same stage defined earlier + - name: Web Dashboard pre-generated file consistency checks (dashboard.js) + script: cp web/gui/dashboard.js /tmp/dashboard.js && ./build/build.sh && diff /tmp/dashboard.js web/gui/dashboard.js + + + + # Ensure netdata code builds successfully + - stage: Build process + + name: Standard netdata build + script: fakeroot ./netdata-installer.sh --install $HOME --dont-wait --dont-start-it --enable-plugin-nfacct --enable-plugin-freeipmi --disable-lto + env: CFLAGS='-O1 -DNETDATA_INTERNAL_CHECKS=1 -DNETDATA_VERIFY_LOCKS=1' + after_failure: post_message "TRAVIS_MESSAGE" "<!here> standard netdata build is failing (Still dont know which one, will improve soon)" + + - name: Docker container build process (alpine installation) + script: packaging/docker/build.sh + env: DEVEL="true" + after_failure: post_message "TRAVIS_MESSAGE" "Docker build process failed" + + - name: Run 'make dist' validation + before_script: mkdir /tmp/netdata-makedist-test + script: + - echo "GIT Branch:" && git branch + - echo "Last commit:" && git log -1 + - echo "GIT Describe:" && git describe + - echo "packaging/version:" && cat packaging/version + - docker run -it -v "${PWD}:/netdata:rw" -v "/tmp/netdata-makedist-test:/netdata_install:rw" -w /netdata "netdata/os-test:ubuntu1804" make clean || echo "Nothing to clean" + - docker run -it -v "${PWD}:/netdata:rw" -v "/tmp/netdata-makedist-test:/netdata_install:rw" -w /netdata "netdata/os-test:ubuntu1804" make distclean || echo "Nothing to distclean" + - docker run -it -v "${PWD}:/netdata:rw" -v "/tmp/netdata-makedist-test:/netdata_install:rw" -w /netdata "netdata/os-test:ubuntu1804" autoreconf -ivf && ./configure --prefix=/netdata_install/usr --sysconfdir=/netdata_install/etc --localstatedir=/netdata_install/var --with-zlib --with-math --with-user=netdata CFLAGS=-O2 + - docker run -it -v "${PWD}:/netdata:rw" -v "/tmp/netdata-makedist-test:/netdata_install:rw" -w /netdata "netdata/os-test:ubuntu1804" make dist + - docker run -it -v "${PWD}:/netdata:rw" -v "/tmp/netdata-makedist-test:/netdata_install:rw" -w /netdata "netdata/os-test:ubuntu1804" ls -ltr ./netdata-$(git describe).tar.gz || ls -ltr ./netdata-$(cat packaging/version | tr -d '\n').tar.gz + - .travis/run_install_with_dist_file.sh + - docker run -it -v "${PWD}:/netdata:rw" -v "/tmp/netdata-makedist-test:/netdata_install:rw" -w /netdata "netdata/os-test:ubuntu1804" make distclean + git: + depth: false + after_script: rm -rf /tmp/netdata-makedist-test + after_failure: post_message "TRAVIS_MESSAGE" "'make dist' failed" + + + + - stage: Artifacts validation + + name: Unit Testing + 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' + after_failure: post_message "TRAVIS_MESSAGE" "Unit testing failed" + + - name: Build/install on ubuntu 14.04 (not containerized) + script: fakeroot ./netdata-installer.sh --dont-wait --dont-start-it --install $HOME + after_failure: post_message "TRAVIS_MESSAGE" "Build/Install failed on ubuntu 14.04" + + - name: Build/Install for ubuntu 18.04 (not containerized) + script: fakeroot ./netdata-installer.sh --dont-wait --dont-start-it --install $HOME + after_failure: post_message "TRAVIS_MESSAGE" "Build/Install failed on ubuntu 18.04" + + - name: Run netdata lifecycle, on ubuntu 18.04 (Containerized) + script: docker run -it -v "${PWD}:/netdata:rw" -w /netdata "netdata/os-test:ubuntu1804" bats --tap tests/lifecycle.bats + after_failure: post_message "TRAVIS_MESSAGE" "Netdata lifecycle test script failed on ubuntu 18.04" + + - name: Run netdata lifecycle from stable to current, on CentOS 7 (Containerized) + script: docker run -it -v "${PWD}:/netdata:rw" -w /netdata "netdata/os-test:centos7" tests/updater_checks.sh + after_failure: post_message "TRAVIS_MESSAGE" "Netdata updater process failed on CentOS 7" + + - name: Build/install for CentOS 6 (Containerized) + script: docker run -it -v "${PWD}:/netdata:rw" -w /netdata "netdata/os-test:centos6" ./netdata-installer.sh --dont-wait --dont-start-it --install /tmp + after_failure: post_message "TRAVIS_MESSAGE" "Build/Install failed on CentOS 6" + + - name: Build/install for CentOS 7 (Containerized) + script: docker run -it -v "${PWD}:/netdata:rw" -w /netdata "netdata/os-test:centos7" ./netdata-installer.sh --dont-wait --dont-start-it --install /tmp + after_failure: post_message "TRAVIS_MESSAGE" "Build/Install failed on CentOS 7" + + + + - stage: Packaging for release + + name: Generate changelog and TAG the release (only on special commit msg) + before_script: post_message "TRAVIS_MESSAGE" "Packaging step for release initiated" + script: + - echo "GIT Branch:" && git branch + - echo "Last commit:" && git log -1 + - echo "GIT Describe:" && git describe + - echo "packaging/version:" && cat packaging/version + - .travis/generate_changelog_and_tag_release.sh + after_failure: post_message "TRAVIS_MESSAGE" "<!here> Packaging for release failed" + git: + depth: false + + - name: Run labeler on github issues + script: .travis/labeler.sh # labeler should be replaced with GitHub Actions when they hit GA + + + + # We only publish if a TAG has been set during packaging + - stage: Publish for release + + name: Build & Publish docker images + before_script: post_message "TRAVIS_MESSAGE" "Publishing docker images" + script: + - echo "GIT Branch:" && git branch + - echo "Last commit:" && git log -1 + - echo "GIT Describe:" && git describe + - echo "packaging/version:" && cat packaging/version + - packaging/docker/check_login.sh + - packaging/docker/build.sh + - packaging/docker/publish.sh + after_failure: post_message "TRAVIS_MESSAGE" "<!here> Docker image publishing failed" + git: + depth: false + env: ALLOW_SOFT_FAILURE_HERE=true + # We don't run on release candidates + if: tag !~ /(-rc)/ + + - name: Create release draft + before_script: post_message "TRAVIS_MESSAGE" "Drafting release on github" + script: + - echo "GIT Branch:" && git branch + - echo "Last commit:" && git log -1 + - echo "GIT Describe:" && git describe + - echo "packaging/version:" && cat packaging/version + - echo "Generating release artifacts" && .travis/create_artifacts.sh # Could/should be a common storage to put this and share between jobs + - .travis/draft_release.sh + git: + depth: false + after_failure: post_message "TRAVIS_MESSAGE" "<!here> Draft release submission failed" + # We don't run on release candidates + if: tag !~ /(-rc)/ + + + + # This is the nightly pre-execution step (Jobs, preparatory steps for nightly, etc) + - stage: Nightly operations + + name: Run coverity scan + # Just notify people that Nightly ops triggered, use the first step as a hook to do that + before_script: post_message "TRAVIS_MESSAGE" "Starting nightly operations" + script: ./coverity-install.sh && ./coverity-scan.sh || echo "Coverity failed :(" + + - name: Kickstart files integrity testing (extended) + script: ./tests/installer/checksums.sh + + - name: Run labeler on github issues + script: .travis/labeler.sh # labeler should be replaced with GitHub Actions when they hit GA + + # This is generating the changelog for nightly release and publish it + - name: Generate nightly changelog + before_script: post_message "TRAVIS_MESSAGE" "Starting changelog generation for nightlies" + script: ".travis/nightlies.sh" + after_failure: post_message "TRAVIS_MESSAGE" "<!here> Nightly changelog generation failed" + git: + depth: false + + + + # This is the nightly execution step + # + - stage: Nightly release + + name: Build & Publish docker images + before_script: post_message "TRAVIS_MESSAGE" "Publishing docker images for nightlies" + script: + - echo "GIT Branch:" && git branch + - echo "Last commit:" && git log -1 + - echo "GIT Describe:" && git describe + - echo "packaging/version:" && cat packaging/version + - docker info + - packaging/docker/check_login.sh + - packaging/docker/build.sh + - packaging/docker/publish.sh + after_failure: post_message "TRAVIS_MESSAGE" "<!here> Nightly docker image publish failed" + git: + depth: false + env: ALLOW_SOFT_FAILURE_HERE=true + + - name: Create nightly release artifacts, publish to GCS + before_script: post_message "TRAVIS_MESSAGE" "Starting artifacts generation for nightlies" + script: + - echo "GIT Branch:" && git branch + - echo "Last commit:" && git log -1 + - echo "GIT Describe:" && git describe + - echo "packaging/version:" && cat packaging/version + - .travis/create_artifacts.sh + after_failure: post_message "TRAVIS_MESSAGE" "<!here> Nightly artifacts generation failed" + git: + depth: false + before_deploy: + echo "Preparing creds under ${TRAVIS_REPO_SLUG}"; + if [ "${TRAVIS_REPO_SLUG}" == "netdata/netdata" ]; then + openssl aes-256-cbc -K $encrypted_8daf19481253_key -iv $encrypted_8daf19481253_iv -in .travis/gcs-credentials.json.enc -out .travis/gcs-credentials.json -d; + else + echo "Beta deployment stage in progress"; + openssl aes-256-cbc -K $encrypted_8daf19481253_key -iv $encrypted_8daf19481253_iv -in .travis/gcs-credentials.json.enc -out .travis/gcs-credentials.json -d; + fi; + deploy: + # Beta storage, used for testing purposes + - provider: gcs + edge: + branch: gcs-ng + project_id: netdata-storage + credentials: .travis/gcs-credentials.json + bucket: "netdata-dev-nightlies" + skip_cleanup: true + local_dir: "artifacts" + on: + # Only deploy on netdata/netdata, master branch, when artifacts directory is created + repo: ${TRAVIS_REPO_SLUG} + branch: master + condition: -d "artifacts" && ${TRAVIS_REPO_SLUG} != "netdata/netdata" + + # Production storage + - provider: gcs + edge: + branch: gcs-ng + project_id: netdata-storage + credentials: .travis/gcs-credentials.json + bucket: "netdata-nightlies" + skip_cleanup: true + local_dir: "artifacts" + on: + # Only deploy on netdata/netdata, master branch, when artifacts directory is created + repo: netdata/netdata + branch: master + condition: -d "artifacts" && ${TRAVIS_REPO_SLUG} = "netdata/netdata" + after_deploy: rm -f .travis/gcs-credentials.json diff --git a/.travis/README.md b/.travis/README.md index 5f3d65105..03ac2edd6 100644 --- a/.travis/README.md +++ b/.travis/README.md @@ -4,7 +4,7 @@ - GITHUB_TOKEN - GitHub token with push access to repository - DOCKER_USERNAME - Username (netdatabot) with write access to docker hub repository -- DOCKER_PASS - Password to docker hub +- DOCKER_PWD - Password to docker hub - encrypted_8daf19481253_key - key needed by openssl to decrypt GCS credentials file - encrypted_8daf19481253_iv - IV needed by openssl to decrypt GCS credentials file - COVERITY_SCAN_TOKEN - Token to allow coverity test analysis uploads diff --git a/.travis/create_artifacts.sh b/.travis/create_artifacts.sh index 2c142e8d0..9670f229a 100755 --- a/.travis/create_artifacts.sh +++ b/.travis/create_artifacts.sh @@ -1,11 +1,24 @@ -#!/bin/bash +#!/usr/bin/env bash +# +# Artifacts creation script. +# This script generates two things: +# 1) The static binary that can run on all linux distros (built-in dependencies etc) +# 2) The distribution source tarbal +# +# Copyright: SPDX-License-Identifier: GPL-3.0-or-later +# +# Author: Paul Emm. Katsoulakis <paul@netdata.cloud> +# # shellcheck disable=SC2230 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" + exit 1 fi if [ ! "${TRAVIS_REPO_SLUG}" == "netdata/netdata" ]; then @@ -13,12 +26,9 @@ if [ ! "${TRAVIS_REPO_SLUG}" == "netdata/netdata" ]; then exit 0 fi; + echo "--- Initialize git configuration ---" -export GIT_MAIL="bot@netdata.cloud" -export GIT_USER="netdatabot" -git config user.email "${GIT_MAIL}" -git config user.name "${GIT_USER}" -git checkout master +git checkout "${1-master}" git pull # Everything from this directory will be uploaded to GCS diff --git a/.travis/draft_release.sh b/.travis/draft_release.sh index bfdfdfb0c..ddc0f9ad5 100755 --- a/.travis/draft_release.sh +++ b/.travis/draft_release.sh @@ -23,10 +23,6 @@ if [ ! -f .gitignore ]; then fi echo "--- Initialize git configuration ---" -export GIT_MAIL="bot@netdata.cloud" -export GIT_USER="netdatabot" -git config user.email "${GIT_MAIL}" -git config user.name "${GIT_USER}" git checkout master git pull diff --git a/.travis/generate_changelog_and_tag_release.sh b/.travis/generate_changelog_and_tag_release.sh index 0f3d1bb5d..fb155b264 100755 --- a/.travis/generate_changelog_and_tag_release.sh +++ b/.travis/generate_changelog_and_tag_release.sh @@ -48,8 +48,6 @@ fi echo "--- Initialize git configuration ---" export GIT_MAIL="bot@netdata.cloud" export GIT_USER="netdatabot" -git config user.email "${GIT_MAIL}" -git config user.name "${GIT_USER}" git checkout master git pull @@ -62,7 +60,7 @@ echo "---- GENERATE CHANGELOG -----" git add CHANGELOG.md echo "---- COMMIT AND PUSH CHANGES ----" -git commit -m "[ci skip] release $GIT_TAG" +git commit -m "[ci skip] release $GIT_TAG" --author "${GIT_USER} <${GIT_MAIL}>" git tag "$GIT_TAG" -a -m "Automatic tag generation for travis build no. $TRAVIS_BUILD_NUMBER" git push "https://${GITHUB_TOKEN}:@$(git config --get remote.origin.url | sed -e 's/^https:\/\///')" git push "https://${GITHUB_TOKEN}:@$(git config --get remote.origin.url | sed -e 's/^https:\/\///')" --tags diff --git a/.travis/generate_changelog_for_nightlies.sh b/.travis/generate_changelog_for_nightlies.sh index 763acc16b..68491fa9b 100755 --- a/.travis/generate_changelog_for_nightlies.sh +++ b/.travis/generate_changelog_for_nightlies.sh @@ -38,8 +38,6 @@ if [ ! "${TRAVIS_REPO_SLUG}" == "netdata/netdata" ]; then exit 0 fi -git config user.email "${GIT_MAIL}" -git config user.name "${GIT_USER}" git checkout master git pull @@ -58,7 +56,7 @@ echo "Changelog created! Adding packaging/version(${NEW_VERSION}) and CHANGELOG. 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 commit -m '[ci skip] create nightly packages and update changelog' --author "${GIT_USER} <${GIT_MAIL}>" && 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 |