diff options
-rw-r--r-- | .travis.yml | 334 | ||||
-rw-r--r-- | .travis/README.md | 168 | ||||
-rwxr-xr-x | .travis/create_artifacts.sh | 5 | ||||
-rwxr-xr-x | .travis/draft_release.sh | 60 | ||||
-rwxr-xr-x | .travis/generate_changelog_and_tag_release.sh | 69 | ||||
-rwxr-xr-x | .travis/generate_changelog_for_nightlies.sh (renamed from .travis/generate_changelog.sh) | 7 | ||||
-rwxr-xr-x | .travis/generate_changelog_for_release.sh | 7 | ||||
-rwxr-xr-x | .travis/nightlies.sh | 24 | ||||
-rwxr-xr-x | .travis/releaser.sh | 96 | ||||
-rwxr-xr-x | .travis/run_install_with_dist_file.sh | 48 | ||||
-rwxr-xr-x | .travis/tagger.sh | 42 | ||||
-rwxr-xr-x | tests/installer/slack.sh | 44 |
12 files changed, 609 insertions, 295 deletions
diff --git a/.travis.yml b/.travis.yml index 35e33602c5..9d15a6d85c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,113 +1,275 @@ -dist: trusty 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: -- test -- build -- name: packaging - if: branch = master AND type != pull_request AND type != cron -- name: nightlies +# 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: Integrity testing +- 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: - - 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 + # 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*') - - name: check checksums for kickstart files + + # This falls under same stage defined earlier + - name: Run checksum checks on kickstart files script: ./tests/installer/checksums.sh env: LOCAL_ONLY="true" - - name: Kickstart Script execution integrity - script: docker run -it -v "${PWD}:/code:rw" -w /code "netdata/os-test:centos7" packaging/installer/kickstart.sh --dont-wait --dont-start-it --install /tmp - - name: Kickstart-static64 Script execution integrity - before_script: rm -rf /tmp/kickstart-static64-temp && mkdir -p /tmp/kickstart-static64-temp - script: docker run -it -v "${PWD}:/code:rw" -v "/tmp/kickstart-static64-temp:/opt" -w /code "netdata/os-test:centos7" packaging/installer/kickstart-static64.sh --dont-wait --dont-start-it - after_script: rm -rf /tmp/kickstart-static64-temp - - 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 + + # 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" - - name: ubuntu 18.04 + lifecycle + 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}:/code:rw" -v "/tmp/netdata-makedist-test:/netdata_install:rw" -w /code "netdata/os-test:ubuntu1804" make clean || echo "Nothing to clean" + - docker run -it -v "${PWD}:/code:rw" -v "/tmp/netdata-makedist-test:/netdata_install:rw" -w /code "netdata/os-test:ubuntu1804" make distclean || echo "Nothing to distclean" + - docker run -it -v "${PWD}:/code:rw" -v "/tmp/netdata-makedist-test:/netdata_install:rw" -w /code "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}:/code:rw" -v "/tmp/netdata-makedist-test:/netdata_install:rw" -w /code "netdata/os-test:ubuntu1804" make dist + - docker run -it -v "${PWD}:/code:rw" -v "/tmp/netdata-makedist-test:/netdata_install:rw" -w /code "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}:/code:rw" -v "/tmp/netdata-makedist-test:/netdata_install:rw" -w /code "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}:/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 + after_failure: post_message "TRAVIS_MESSAGE" "Netdata lifecycle test script failed on ubuntu 18.04" + + - name: Build/install for CentOS 6 (Containerized) script: docker run -it -v "${PWD}:/code:rw" -w /code "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" - - 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 + - name: Build/install for CentOS 7 (Containerized) + script: docker run -it -v "${PWD}:/code:rw" -w /code "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: .travis/generate_changelog_and_tag_release.sh + after_failure: post_message "TRAVIS_MESSAGE" "<!here> Packaging for release failed" 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" + - 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/build.sh + - packaging/docker/publish.sh + after_failure: post_message "TRAVIS_MESSAGE" "<!here> Docker image publishing failed" 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" - on: - # Only deploy on netdata/netdata, master branch, when artifacts directory is created - repo: netdata/netdata - branch: master - condition: -d "artifacts" - after_deploy: rm -f .travis/gcs-credentials.json + env: ALLOW_SOFT_FAILURE_HERE=true + # We don't run on release candidates + if: tag !~ /(-rc)/ + + - name: Generate release artifacts + before_script: post_message "TRAVIS_MESSAGE" "Starting artifacts generation for release" + script: .travis/create_artifacts.sh + after_failure: post_message "TRAVIS_MESSAGE" "<!here> Release artifacts generation failed" + git: + depth: false + # 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 + - .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 :(" - - stage: Integrity testing - name: Kickstart Files integrity testing + - name: Kickstart files integrity testing (extended) script: ./tests/installer/checksums.sh - - name: Kickstart Execution integrity - before_script: rm -rf /tmp/kickstart-static64-temp && mkdir -p /tmp/kickstart-static64-temp + + - 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: - - docker run -it -v "${PWD}:/code:rw" -w /code "netdata/os-test:centos7" packaging/installer/kickstart.sh --dont-wait --dont-start-it --install /tmp - - docker run -it -v "${PWD}:/code:rw" -v "/tmp/kickstart-static64-temp:/opt" -w /code "netdata/os-test:centos7" packaging/installer/kickstart-static64.sh --dont-wait --dont-start-it - after_script: rm -rf /tmp/kickstart-static64-temp + - docker info + - packaging/docker/build.sh + - packaging/docker/publish.sh + after_failure: post_message "TRAVIS_MESSAGE" "<!here> Nightly docker image publish failed" + env: ALLOW_SOFT_FAILURE_HERE=true -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=" + - 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" + 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" + # 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" + after_deploy: rm -f .travis/gcs-credentials.json diff --git a/.travis/README.md b/.travis/README.md index 3c1a99527b..5f3d651053 100644 --- a/.travis/README.md +++ b/.travis/README.md @@ -8,84 +8,90 @@ - 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 - -## Stages - -### Test - -Unit tests and coverage tests are executed here. Stage consists of 2 parallel jobs: - - C tests - executed every time - - dashboard.js - test if source files create the same file as it is in current repo - - coverity test - executed only when pipeline was triggered from cron - -### Build - -Stage is executed every time and consists of 5 parallel jobs which execute containerized and non-containerized -installations of netdata. Jobs are run on following operating systems: - - OSX - - ubuntu 14.04 - - ubuntu 16.04 (containerized) - - CentOS 6 (containerized) - - CentOS 7 (containerized) - - alpine (containerized) - -Images for system containers are stored on dockerhub and are created from Dockerfiles located in -[netdata/helper-images](https://github.com/netdata/helper-images) repository. - -### Packaging - -This stage is executed only on "master" brach and allows us to create a new tag just looking at git commit message. -It executes one script called `releaser.sh` which is responsible for creating a release on GitHub by using -[hub](https://github.com/github/hub). This script is also executing other scripts which can also be used in other -CI jobs: - - `.travis/tagger.sh` - - `.travis/generate_changelog.sh` - - `packaging/docker/build.sh` - - `.travis/create_artifacts.sh` - -Alternatively new release can be also created by pushing new tag to master branch. -Additionally this step is also executing `.travis/labeler.sh` which is a temporary workaround to automatically label -issues and PR. This script should be replaced with GitHub Actions when they are available to public. - -##### tagger.sh - -Script responsible to find out what will be the next tag based on a keyword in last commit message. Keywords are: - - `[netdata patch release]` to bump patch number - - `[netdata minor release]` to bump minor number - - `[netdata major release]` to bump major number - - `[netdata release candidate]` to create a new release candidate (appends or modifies suffix `-rcX` of previous tag) -All keywords MUST be surrounded with square brackets. -Tag is then stored in `GIT_TAG` variable. - -##### generate_changelog.sh - -Automatic changelog generator which updates our CHANGELOG.md file based on GitHub features (mostly labels and pull -requests). Internally it uses -[github-changelog-generator](https://github.com/github-changelog-generator/github-changelog-generator) and more -information can be found on that project site. - -##### build.sh and create_artifacts.sh - -Scripts used to build new container images and provide release artifacts (tar.gz and makeself archives) - -### Nightlies - -##### Tarball and self-extractor build AND Nightly docker images - -As names might suggest those two jobs are responsible for nightly netdata package creation and are run every day (in -cron). Combined they produce: - - docker images - - tar.gz archive (soon to be removed) - - self-extracting package - -This is achieved by running 2 scripts described earlier: - - `create_artifacts.sh` - - `build.sh` - -Artifacts are pushed to GCS and container images are stored in docker hub. - -##### Changelog generation - -This job is responsible for regenerating changelog every day by executing `generate_changelog.sh` script. This is done -only once a day due to github rate limiter. - +- SLACK_USERNAME - This is required for the slack notifications triggered by travis pipeline +- SLACK_CHANNEL - This is the channel that Travis will be posting messages +- SLACK_NOTIFY_WEBHOOK_URL - This is the incoming URL webhook as provided by slack integration. Visit Apps integration in slack to generate the required hook +- SLACK_BOT_NAME - This is the name your bot will appear with on slack + +## CI workflow details +Our CI pipeline is designed to help us identify and mitigate risks at all stages of implementation. +To accommodate this need, we used [Travis CI](http://www.travis-ci.com) as our CI/CD tool. +Our main areas of concern are: +1) Only push code that is working. That means fail fast so that we can improve before we reach the public + +2) Reduce the time to market to minimum, by streamlining the release process. + That means a lot of testing, a lot of consistency checks, a lot of validations + +3) Generated artifacts consistency. We should not allow broken software to reach the public. + When this happens, it's embarassing and we struggle to eliminate it. + +4) We are an innovative company, so we love to automate :) + + +Having said that, here's a brief introduction to Netdata's improved CI/CD pipeline with Travis. +Our CI/CD lifecycle contains three different execution entry points: +1) A user opens a pull request to netdata/master: Travis will run a pipeline on the branch under that PR +2) A merge or commit happens on netdata/master. This will trigger travis to run, but we have two distinct cases in this scenario: + a) A user merges a pull request to netdata/master: Travis will run on master, after the merge. + b) A user runs a commit/merge with a special keyword (mentioned later). + This triggers a release for either minor, major or release candidate versions, depending the keyword +3) A scheduled job runs on master once per day: Travis will run on master at the scheduled interval + +To accommodate all three entry points our CI/CD workflow has a set of steps that run on all three entry points. +Once all these steps are successfull, then our pipeline executes another subset of steps for entry points 2 and 3. +In travis terms the "steps" are "Stages" and within each stage we execute a set of activities called "jobs" in travis. + +### Always run: Stages that running on all three execution entry points + +## Code quality, linting, syntax, code style +At this early stage we iterate through a set of basic quality control checks: +- Shell checking: Run linters for our various BASH scripts +- Checksum validators: Run validators to ensure our installers and documentation are in sync +- Dashboard validator: We provide a pre-generated dashboard.js script file that we need to make sure its up to date. We validate that. + +## Build process +At this stage, basically, we build :-) +We do a baseline check of our build artifacts to guarantee they are not broken +Briefly our activities include: +- Verify docker builds successfully +- Run the standard netdata installer, to make sure we build & run properly +- Do the same through 'make dist', as this is our stable channel for our kickstart files + +## Artifacts validation +At this point we know our software is building, we need to go through the a set of checks, to guarantee +that our product meets certain epxectations. At the current stage, we are focusing on basic capabilities +like installing in different distributions, running the full lifecycle of install-run-update-install and so on. +We are still working on enriching this with more and more use cases, to get us closer to achieving full stability of our software. +Briefly we currently evaluate the following activities: +- Basic software unit testing +- Non containerized build and install on ubuntu 14.04 +- Non containerized build and install on ubuntu 18.04 +- Running the full netdata lifecycle (install, update, uninstall) on ubuntu 18.04 +- Build and install on CentOS 6 +- Build and install on CentOS 7 +(More to come) + +### Nightly operations: Stages that run daily under cronjob +The nightly stages are related to the daily nightly activities, that produce our daily latest releases. +We also maintain a couple of cronjobs that run during the night to provide us with deeper insights, +like for example coverity scanning or extended kickstart checksum checks + +## Nightly operations +At this stage we run scheduled jobs and execute the nightly changelog generator, coverity scans, +labeler for our issues and extended kickstart files checksum validations. + +## Nightly release +During this stage we are building and publishing latest docker images, prepare the nightly artifacts +and deploy them (the artifacts) to our google cloud service provider. + + +### Publishing +Publishing is responsible for executing the major/minor/patch releases and is separated +in two stages: packaging preparation process and publishing. + +## Packaging for release +During packaging we are preparing the release changelog information and run the labeler. + +## Publish for release +The publishing stage is the most complex part in publishing. This is the stage were we generate and publish docker images, +prepare the release artifacts and get ready with the release draft. diff --git a/.travis/create_artifacts.sh b/.travis/create_artifacts.sh index 18c85287c0..d851390285 100755 --- a/.travis/create_artifacts.sh +++ b/.travis/create_artifacts.sh @@ -8,6 +8,11 @@ if [ ! -f .gitignore ]; then exit 1 fi +if [ ! "${TRAVIS_REPO_SLUG}" == "netdata/netdata" ]; then + echo "Beta mode on ${TRAVIS_REPO_SLUG}, not running anything here" + exit 0 +fi; + # Everything from this directory will be uploaded to GCS mkdir -p artifacts BASENAME="netdata-$(git describe)" diff --git a/.travis/draft_release.sh b/.travis/draft_release.sh new file mode 100755 index 0000000000..5631997128 --- /dev/null +++ b/.travis/draft_release.sh @@ -0,0 +1,60 @@ +#!/bin/bash +# +# Draft release generator. +# This utility is responsible for submitting a draft release to github repo +# It is agnostic of other processes, when executed it will draft a release, +# based on the most recent reachable tag. +# +# Requirements: +# - GITHUB_TOKEN variable set with GitHub token. Access level: repo.public_repo +# - artifacts directory in place +# - The directory is created by create_artifacts.sh mechanism +# - The artifacts need to be created with the same tag, obviously +# +# Copyright: SPDX-License-Identifier: GPL-3.0-or-later +# +# 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 +fi + +if [[ $(git describe) =~ -rc* ]]; then + echo "This is a release candidate tag, we do not generate a release draft" + exit 0 +fi + +# Load the tag, if any +GIT_TAG=$(git describe) + +if [ ! "${TRAVIS_REPO_SLUG}" == "netdata/netdata" ]; then + echo "Beta mode on ${TRAVIS_REPO_SLUG}, i was about to run for release (${GIT_TAG}), but i am emulating, so bye" + exit 0 +fi; + +echo "---- CREATING RELEASE DRAFT WITH ASSETS -----" +# Download hub +HUB_VERSION=${HUB_VERSION:-"2.5.1"} +wget "https://github.com/github/hub/releases/download/v${HUB_VERSION}/hub-linux-amd64-${HUB_VERSION}.tgz" -O "/tmp/hub-linux-amd64-${HUB_VERSION}.tgz" +tar -C /tmp -xvf "/tmp/hub-linux-amd64-${HUB_VERSION}.tgz" +export PATH=$PATH:"/tmp/hub-linux-amd64-${HUB_VERSION}/bin" + +# Create a release draft +if [ -z ${GIT_TAG+x} ]; then + echo "Variable GIT_TAG is not set. Something went terribly wrong! Exiting." + exit 1 +fi +if [ "${GIT_TAG}" != "$(git tag --points-at)" ]; then + echo "ERROR! Current commit is not tagged. Stopping release creation." + exit 1 +fi +until hub release create --draft \ + -a "artifacts/netdata-${GIT_TAG}.tar.gz" \ + -a "artifacts/netdata-${GIT_TAG}.gz.run" \ + -a "artifacts/sha256sums.txt" \ + -m "${GIT_TAG}" "${GIT_TAG}"; do + sleep 5 +done diff --git a/.travis/generate_changelog_and_tag_release.sh b/.travis/generate_changelog_and_tag_release.sh new file mode 100755 index 0000000000..6280a68172 --- /dev/null +++ b/.travis/generate_changelog_and_tag_release.sh @@ -0,0 +1,69 @@ +#!/bin/bash +# +# Script to automatically do a couple of things: +# - generate a new tag according to semver (https://semver.org/) +# - generate CHANGELOG.md by using https://github.com/skywinder/github-changelog-generator +# +# Tags are generated by searching for a keyword in last commit message. Keywords are: +# - [patch] or [fix] to bump patch number +# - [minor], [feature] or [feat] to bump minor number +# - [major] or [breaking change] to bump major number +# All keywords MUST be surrounded with square braces. +# +# Script uses git mechanisms for locking, so it can be used in parallel builds +# +# Requirements: +# - GITHUB_TOKEN variable set with GitHub token. Access level: repo.public_repo +# - docker +# +# This is a modified version of: +# https://github.com/paulfantom/travis-helper/blob/master/releasing/releaser.sh +# +# Copyright: SPDX-License-Identifier: GPL-3.0-or-later +# +# Author: Pavlos Emm. Katsoulakis <paul@netdata.cloud> +# Author: Pawel Krupa (@paulfantom) +set -e + +if [ ! -f .gitignore ]; then + echo "Run as ./travis/$(basename "$0") from top level directory of git repository" + exit 1 +fi + +echo "--- Executing Tagging facility to determine TAG ---" +.travis/tagger.sh + +echo "--- Changelog generator and tagger script starting ---" +# If tagger script hasn't produced a TAG, there is nothing to do so bail out happy +if [ -z "${GIT_TAG}" ]; then + echo "GIT_TAG is empty, nothing to do for now (Value: $GIT_TAG)" + exit 0 +fi + +if [ ! "${TRAVIS_REPO_SLUG}" == "netdata/netdata" ]; then + echo "Beta mode on ${TRAVIS_REPO_SLUG}, nothing to do on the changelog generator and tagging script for (${GIT_TAG}), bye" + 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 pull + +echo "---- UPDATE VERSION FILE ----" +echo "$GIT_TAG" >packaging/version +git add packaging/version + +echo "---- GENERATE CHANGELOG -----" +./.travis/generate_changelog_for_release.sh +git add CHANGELOG.md + +echo "---- COMMIT AND PUSH CHANGES ----" +git commit -m "[ci skip] release $GIT_TAG" +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 +# After those operations output of command `git describe` should be identical with a value of GIT_TAG diff --git a/.travis/generate_changelog.sh b/.travis/generate_changelog_for_nightlies.sh index e48b42a666..763acc16bb 100755 --- a/.travis/generate_changelog.sh +++ b/.travis/generate_changelog_for_nightlies.sh @@ -31,8 +31,13 @@ if [ -z ${GIT_TAG+x} ]; then else OPTS="--future-release ${GIT_TAG}" fi - echo "We got $COMMITS_SINCE_RELEASE changes since $LAST_TAG, re-generating changelog" + +if [ ! "${TRAVIS_REPO_SLUG}" == "netdata/netdata" ]; then + echo "Beta mode on ${TRAVIS_REPO_SLUG}, nothing else to do here" + exit 0 +fi + git config user.email "${GIT_MAIL}" git config user.name "${GIT_USER}" git checkout master diff --git a/.travis/generate_changelog_for_release.sh b/.travis/generate_changelog_for_release.sh index 4ae69f1c78..de5d3e7022 100755 --- a/.travis/generate_changelog_for_release.sh +++ b/.travis/generate_changelog_for_release.sh @@ -11,13 +11,17 @@ 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 +if [ ! "${TRAVIS_REPO_SLUG}" == "netdata/netdata" ]; then + echo "Beta mode on ${TRAVIS_REPO_SLUG}, nothing else to do" + exit 0 +fi + echo "--- Creating changelog ---" git checkout master git pull @@ -30,4 +34,3 @@ docker run -it -v "$(pwd)":/project markmandel/github-changelog-generator:latest --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 0d9fe036a9..188b37da02 100755 --- a/.travis/nightlies.sh +++ b/.travis/nightlies.sh @@ -1,11 +1,9 @@ #!/bin/bash # -# 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) +# This is the nightly changelog generation script +# It is responsible for two major activities: +# 1) Update packaging/version with the current nightly version +# 2) Generate the changelog for the mentioned version # # Copyright: SPDX-License-Identifier: GPL-3.0-or-later # @@ -34,14 +32,12 @@ if [ "${COMMITS_SINCE_RELEASE}" == "${PREVIOUS_NIGHTLY_COUNT}" ]; then exit 0 fi -echo "--- Running Changelog generation ---" -.travis/generate_changelog.sh "${LAST_TAG}" "${COMMITS_SINCE_RELEASE}" || echo "Changelog generation has failed, |