diff options
Diffstat (limited to '.github')
-rw-r--r-- | .github/CODEOWNERS | 66 | ||||
-rw-r--r-- | .github/ISSUE_TEMPLATE.md | 15 | ||||
-rw-r--r-- | .github/ISSUE_TEMPLATE/bug_report.md | 57 | ||||
-rw-r--r-- | .github/ISSUE_TEMPLATE/config.yml | 14 | ||||
-rw-r--r-- | .github/PULL_REQUEST_TEMPLATE.md | 28 | ||||
-rw-r--r-- | .github/dependabot.yml | 9 | ||||
-rw-r--r-- | .github/dockerfiles/Dockerfile.build_test | 11 | ||||
-rw-r--r-- | .github/dockerfiles/Dockerfile.clang | 18 | ||||
-rw-r--r-- | .github/labeler.yml | 101 | ||||
-rwxr-xr-x | .github/scripts/build-artifacts.sh | 81 | ||||
-rwxr-xr-x | .github/scripts/build-static-x86_64.sh | 58 | ||||
-rwxr-xr-x | .github/scripts/bump-packaging-version.sh | 6 | ||||
-rw-r--r-- | .github/scripts/functions.sh | 69 | ||||
-rwxr-xr-x | .github/scripts/run_install_with_dist_file.sh | 38 | ||||
-rw-r--r-- | .github/stale.yml | 18 | ||||
-rw-r--r-- | .github/workflows/build-and-install.yml | 201 | ||||
-rw-r--r-- | .github/workflows/checks.yml | 106 | ||||
-rw-r--r-- | .github/workflows/coverity.yml | 34 | ||||
-rw-r--r-- | .github/workflows/docker.yml | 59 | ||||
-rw-r--r-- | .github/workflows/docs.yml | 25 | ||||
-rw-r--r-- | .github/workflows/labeler.yml | 16 | ||||
-rw-r--r-- | .github/workflows/review.yml | 94 | ||||
-rw-r--r-- | .github/workflows/tests.yml | 88 |
23 files changed, 1212 insertions, 0 deletions
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..5d0484c --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,66 @@ +# Files which shouldn't be changed manually are owned by @netdatabot. +# This way we prevent modifications which will be overwriten by automation. + +# Global (default) code owner +* @ktsaou @Ferroin + +# Ownership by directory structure +.travis/ @Ferroin @knatsakis @kaskavel @vkalintiris +.github/ @Ferroin @knatsakis @kaskavel @vkalintiris +aclk/ @stelfrag @underhood +backends/ @thiagoftsm @vlvkobal +backends/graphite/ @thiagoftsm @vlvkobal +backends/json/ @thiagoftsm @vlvkobal +backends/opentsdb/ @thiagoftsm @vlvkobal +backends/prometheus/ @vlvkobal @thiagoftsm +build/ @Ferroin @knatsakis +contrib/debian @Ferroin @knatsakis @vkalintiris +collectors/ @vlvkobal @mfundul +collectors/charts.d.plugin/ @ilyam8 @Ferroin +collectors/freebsd.plugin/ @vlvkobal @thiagoftsm +collectors/ebpf.plugin/ @thiagoftsm @vlvkobal +collectors/macos.plugin/ @vlvkobal @thiagoftsm +collectors/node.d.plugin/ @jacekkolasa +collectors/node.d.plugin/fronius/ @ccremer +collectors/node.d.plugin/snmp/ @jacekkolasa +collectors/node.d.plugin/stiebeleltron/ @ccremer +collectors/python.d.plugin/ @ilyam8 +collectors/cups.plugin/ @simonnagl @vlvkobal @thiagoftsm +exporting/ @vlvkobal @thiagoftsm +daemon/ @thiagoftsm @mfundul +database/ @mfundul @thiagoftsm +docs/ @joelhans +health/ @thiagoftsm @vlvkobal +health/health.d/ @thiagoftsm @vlvkobal +health/notifications/ @Ferroin @thiagoftsm +libnetdata/ @thiagofsm @mfundul +packaging/ @Ferroin @knatsakis @vkalintiris +registry/ @jacekkolasa +streaming/ @thiagoftsm @vlvkobal +system/ @Ferroin @knatsakis @vkalintiris +tests/ @Ferroin @knatsakis @kaskavel +web/ @thiagoftsm @mfundul @vlvkobal +web/gui/ @jacekkolasa + +# Ownership by filetype (overwrites ownership by directory) +*.am @Ferroin +*.md @joelhans +Dockerfile* @Ferroin @knatsakis + +# Ownership of specific files +.gitignore @Ferroin @knatsakis +.travis.yml @Ferroin @knatsakis @kaskavel @vkalintiris +.lgtm.yml @Ferroin @knatsakis +.eslintrc @Ferroin @knatsakis +.eslintignore @Ferroin @knatsakis +.csslintrc @Ferroin @knatsakis +.codeclimate.yml @Ferroin @knatsakis +.codacy.yml @Ferroin @knatsakis +.yamllint.yml @Ferroin @knatsakis +netdata.spec.in @Ferroin @knatsakis @vkalintiris +netdata-installer.sh @Ferroin @knatsakis @vkalintiris +package.json @jacekkolasa @Ferroin @knatsakis +packaging/version @netdatabot @Ferroin @knatsakis + +LICENSE.md @joelhans @Ferroin +CHANGELOG.md @netdatabot @Ferroin diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..bd939ba --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,15 @@ +--- +about: General issue template +labels: "needs triage", "no changelog" +--- + +<!--- +This is a generic issue template. We usually prefer contributors to use one +of 3 other specific issue templates (bug report, feature request, question) +to allow our automation classify those so you can get response faster. +However if your issue doesn't fall into either one of those 3 categories +use this generic template. +---> + +#### Summary + diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..ecfd9fc --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,57 @@ +--- +name: "Bug report: Netdata Agent" +about: Submit a report and help us improve our free and open-source Netdata Agent +labels: bug, needs triage +--- + +<!-- +When creating a bug report please: +- Verify first that your issue is not already reported on GitHub. +- Test if the latest release and master branch are affected too. +--> + +##### Bug report summary +<!-- Provide a clear and concise description of the bug you're experiencing. --> + +##### OS / Environment +<!-- +Provide as much information about your environment (which operating system and distribution you're using, if Netdata is running in a container, etc.) +as possible to allow us reproduce this bug faster. + +To get this information, execute the following commands based on your operating system: +- uname -a; grep -Hv "^#" /etc/*release # Linux +- uname -a; uname -K # BSD +- uname -a; sw_vers # macOS + +Place the output from the command in the code section below. + --> +``` + +``` + +##### Netdata version +<!-- +Provide output of `netdata -V`. + +If Netdata is running, execute: $(ps aux | grep -E -o "[a-zA-Z/]+netdata ") -V + --> + + +##### Component Name +<!-- +Let us know which component is affected by the bug. Our code is structured according to its component, +so the component name is the same as the top level directory of the repository. +For example, a bug in the dashboard would be under the web component. +--> + +##### Steps To Reproduce +<!-- +Describe how you found this bug and how we can reproduce it, preferably with a minimal test-case scenario. +If you'd like to attach larger files, use gist.github.com and paste in links. +--> + +1. ... +2. ... + +##### Expected behavior +<!-- Provide a clear and concise description of what you expected to happen. --> diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..e6ea7d3 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,14 @@ +blank_issues_enabled: false +contact_links: + - name: "Bug report: Netdata Cloud" + url: https://github.com/netdata/netdata-cloud/issues/new/choose + about: Create a report to help us improve our web application + - name: Help + url: https://community.netdata.cloud/c/support/13 + about: We offer community-driven support on our community forums + - name: Feature request + url: https://community.netdata.cloud/c/feature-requests/7 + about: Make a feature request for Netdata Cloud or the Netdata Agent + - name: Community + url: https://netdata.cloud/community + about: If you don't know where to start, visit our community page! diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..33f7736 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,28 @@ +<!-- +Describe the change in summary section, including rationale and design decisions. +Include "Fixes #nnn" if you are fixing an existing issue. + +In "Component Name" section write which component is changed in this PR. This +will help us review your PR quicker. + +In "Test Plan" provide enough detail on how you plan to test this PR so that a reviewer can validate your tests. If our CI covers sufficient tests, then state which tests cover the change. + +If you have more information you want to add, write them in "Additional +Information" section. This is usually used to help others understand your +motivation behind this change. A step-by-step reproduction of the problem is +helpful if there is no related issue. +--> + +##### Summary + +##### Component Name + +##### Test Plan + +<!--- +Provide enough detail so that your reviewer can understand which test-cases you +have covered, and recreate them if necessary. If sufficient tests are covered +by our CI, then state which tests cover the change. +--> + +##### Additional Information diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..b02b155 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,9 @@ +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: weekly + labels: + - "no changelog" + - "area/ci" diff --git a/.github/dockerfiles/Dockerfile.build_test b/.github/dockerfiles/Dockerfile.build_test new file mode 100644 index 0000000..1dc3e30 --- /dev/null +++ b/.github/dockerfiles/Dockerfile.build_test @@ -0,0 +1,11 @@ +ARG BASE + +FROM ${BASE} + +ARG PRE +ENV PRE=${PRE} + +COPY . /netdata + +RUN /bin/sh /netdata/prep-cmd.sh +RUN /netdata/packaging/installer/install-required-packages.sh --dont-wait --non-interactive netdata-all diff --git a/.github/dockerfiles/Dockerfile.clang b/.github/dockerfiles/Dockerfile.clang new file mode 100644 index 0000000..62bb019 --- /dev/null +++ b/.github/dockerfiles/Dockerfile.clang @@ -0,0 +1,18 @@ +FROM debian:buster AS build + +# Disable apt/dpkg interactive mode +ENV DEBIAN_FRONTEND=noninteractive + +# Install all build dependencies +COPY packaging/installer/install-required-packages.sh /tmp/install-required-packages.sh +RUN /tmp/install-required-packages.sh --dont-wait --non-interactive netdata-all + +# Install Clang and set as default CC +RUN apt-get install -y clang && \ + update-alternatives --install /usr/bin/cc cc /usr/bin/clang 100 + +WORKDIR /netdata +COPY . . + +# Build Netdata +RUN ./netdata-installer.sh --dont-wait --dont-start-it --disable-go --require-cloud diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 0000000..544b420 --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,101 @@ +# This configures label matching for PR's. +# +# The keys are labels, and the values are lists of minimatch patterns +# to which those labels apply. +# +# NOTE: This can only add labels, not remove them. +# NOTE: Due to YAML syntax limitations, patterns or labels which start +# with a character that is part of the standard YAML syntax must be +# quoted. +# +# Please keep the labels sorted and deduplicated. + +ACLK: + - aclk/* + - aclk/**/* + +area/backends: + - backends/* + - backends/**/* + +area/exporting: + - exporting/* + - exporting/**/* + +area/build: + - build/* + - build/**/* + - build_external/* + - build_external/**/* + - CMakeLists.txt + - configure.ac + - Makefile.am + - "**/Makefile.am" + +area/ci: + - .travis/* + - .travis/**/* + - .github/* + - .github/**/* + +area/collectors: + - collectors/* + - collectors/**/* + +area/daemon: + - daemon/* + - daemon/**/* + +area/database: + - database/* + - database/**/* + +area/docs: + - "**/*.md" + - diagrams/* + - diagrams/**/* + +area/external/python: + - collectors/python.d.plugin/* + - collectors/python.d.plugin/**/* + +area/external: + - collectors/charts.d.plugin/* + - collectors/charts.d.plugin/**/* + - collectors/node.d.plugin/* + - collectors/node.d.plugin/**/* + +area/health: + - health/* + - health/**/* + +area/packaging: + - contrib/* + - contrib/**/* + - packaging/* + - packaging/**/* + - system/* + - system/**/* + - Dockerfile* + - netdata-installer.sh + - netdata.spec.in + +area/registry: + - registry/* + - registry/**/* + +area/streaming: + - streaming/* + - streaming/**/* + +area/tests: + - tests/* + - tests/**/* + - daemon/unit_test* + - coverity-scan.sh + - cppcheck.sh + - netdata.cppcheck + +area/web: + - web/* + - web/**/* diff --git a/.github/scripts/build-artifacts.sh b/.github/scripts/build-artifacts.sh new file mode 100755 index 0000000..e635765 --- /dev/null +++ b/.github/scripts/build-artifacts.sh @@ -0,0 +1,81 @@ +#!/bin/sh +# +# Builds the netdata-vX.y.Z-xxxx.tar.gz source tarball (dist) +# and netdata-vX.Y.Z-xxxx.gz.run (static x86_64) artifacts. + +set -e + +# shellcheck source=.github/scripts/functions.sh +. "$(dirname "$0")/functions.sh" + +NAME="${NAME:-netdata}" +VERSION="${VERSION:-"$(git describe)"}" +BASENAME="$NAME-$VERSION" + +prepare_build() { + progress "Preparing build" + ( + test -d artifacts || mkdir -p artifacts + echo "${VERSION}" > packaging/version + ) >&2 +} + +build_dist() { + progress "Building dist" + ( + command -v git > /dev/null && [ -d .git ] && git clean -d -f + autoreconf -ivf + ./configure \ + --prefix=/usr \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --libexecdir=/usr/libexec \ + --with-zlib \ + --with-math \ + --with-user=netdata \ + CFLAGS=-O2 + make dist + mv "${BASENAME}.tar.gz" artifacts/ + ) >&2 +} + +build_static_x86_64() { + progress "Building static x86_64" + ( + command -v git > /dev/null && [ -d .git ] && git clean -d -f + USER="" ./packaging/makeself/build-x86_64-static.sh + ) >&2 +} + +prepare_assets() { + progress "Preparing assets" + ( + cp packaging/version artifacts/latest-version.txt + + cd artifacts || exit 1 + ln -f "${BASENAME}.tar.gz" netdata-latest.tar.gz + ln -f "${BASENAME}.gz.run" netdata-latest.gz.run + sha256sum -b ./* > "sha256sums.txt" + ) >&2 +} + +steps="prepare_build build_dist build_static_x86_64" +steps="$steps prepare_assets" + +_main() { + for step in $steps; do + if ! run "$step"; then + if [ -t 1 ]; then + debug + else + fail "Build failed" + fi + fi + done + + echo "🎉 All Done!" +} + +if [ -n "$0" ] && [ x"$0" != x"-bash" ]; then + _main "$@" +fi diff --git a/.github/scripts/build-static-x86_64.sh b/.github/scripts/build-static-x86_64.sh new file mode 100755 index 0000000..2676b63 --- /dev/null +++ b/.github/scripts/build-static-x86_64.sh @@ -0,0 +1,58 @@ +#!/bin/sh +# +# Builds the netdata-vX.Y.Z-xxxx.gz.run (static x86_64) artifact. + +set -e + +# shellcheck source=.github/scripts/functions.sh +. "$(dirname "$0")/functions.sh" + +NAME="${NAME:-netdata}" +VERSION="${VERSION:-"$(git describe)"}" +BASENAME="$NAME-$VERSION" + +prepare_build() { + progress "Preparing build" + ( + test -d artifacts || mkdir -p artifacts + ) >&2 +} + +build_static_x86_64() { + progress "Building static x86_64" + ( + USER="" ./packaging/makeself/build-x86_64-static.sh + ) >&2 +} + +prepare_assets() { + progress "Preparing assets" + ( + cp packaging/version artifacts/latest-version.txt + + cd artifacts || exit 1 + ln -s "${BASENAME}.gz.run" netdata-latest.gz.run + sha256sum -b ./* > "sha256sums.txt" + ) >&2 +} + +steps="prepare_build build_static_x86_64" +steps="$steps prepare_assets" + +_main() { + for step in $steps; do + if ! run "$step"; then + if [ -t 1 ]; then + debug + else + fail "Build failed" + fi + fi + done + + echo "🎉 All Done!" +} + +if [ -n "$0" ] && [ x"$0" != x"-bash" ]; then + _main "$@" +fi diff --git a/.github/scripts/bump-packaging-version.sh b/.github/scripts/bump-packaging-version.sh new file mode 100755 index 0000000..bffcb0c --- /dev/null +++ b/.github/scripts/bump-packaging-version.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +VERSION="$(git describe)" +echo "$VERSION" > packaging/version +git add -A +git ci -m "[netdata nightly] $VERSION" diff --git a/.github/scripts/functions.sh b/.github/scripts/functions.sh new file mode 100644 index 0000000..7cd2e08 --- /dev/null +++ b/.github/scripts/functions.sh @@ -0,0 +1,69 @@ +#!/bin/sh + +# This file is included by download.sh & build.sh + +set -e + +color() { + fg="$1" + bg="${2}" + ft="${3:-0}" + + printf "\33[%s;%s;%s" "$ft" "$fg" "$bg" +} + +color_reset() { + printf "\033[0m" +} + +ok() { + if [ -t 1 ]; then + printf "%s[ OK ]%s\n" "$(color 37 42m 1)" "$(color_reset)" + else + printf "%s\n" "[ OK ]" + fi +} + +err() { + if [ -t 1 ]; then + printf "%s[ ERR ]%s\n" "$(color 37 41m 1)" "$(color_reset)" + else + printf "%s\n" "[ ERR ]" + fi +} + +run() { + retval=0 + logfile="$(mktemp -t "run-XXXXXX")" + if "$@" 2> "$logfile"; then + ok + else + retval=$? + err + tail -n 100 "$logfile" || true + fi + rm -rf "$logfile" + return $retval +} + +progress() { + printf "%-40s" "$(printf "%s ... " "$1")" +} + +log() { + printf "%s\n" "$1" +} + +error() { + log "ERROR: ${1}" +} + +fail() { + log "FATAL: ${1}" + exit 1 +} + +debug() { + log "Dropping into a shell for debugging ..." + exec /bin/sh +} diff --git a/.github/scripts/run_install_with_dist_file.sh b/.github/scripts/run_install_with_dist_file.sh new file mode 100755 index 0000000..9453dff --- /dev/null +++ b/.github/scripts/run_install_with_dist_file.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash +# +# This script is evaluating netdata installation with the source from make dist +# +# Copyright: SPDX-License-Identifier: GPL-3.0-or-later +# +# Author : Pavlos Emm. Katsoulakis <paul@netdata.cloud) + +set -e + +if [ $# -ne 1 ]; then + printf >&2 "Usage: %s <dist_file>\n" "$(basename "$0")" + exit 1 +fi + +distfile="${1}" +shift + +printf >&2 "Opening dist archive %s ... " "${distfile}" +tar -xovf "${distfile}" +distdir="$(echo "${distfile}" | cut -d. -f1,2,3)" +cp -a packaging/installer/install-required-packages.sh "${distdir}/install-required-packages.sh" +if [ ! -d "${distdir}" ]; then + printf >&2 "ERROR: %s is not a directory" "${distdir}" + exit 2 +fi + +printf >&2 "Entering %s and starting docker run ..." "${distdir}" + +pushd "${distdir}" || exit 1 +docker run \ + -v "${PWD}:/netdata" \ + -w /netdata \ + "ubuntu:latest" \ + /bin/bash -c "./install-required-packages.sh --dont-wait --non-interactive netdata && apt install wget && ./netdata-installer.sh --dont-wait --require-cloud --disable-telemetry --install /tmp && echo \"Validating netdata instance is running\" && wget -O - 'http://127.0.0.1:19999/api/v1/info' | grep version" +popd || exit 1 + +echo "All Done!" diff --git a/.github/stale.yml b/.github/stale.yml new file mode 100644 index 0000000..abf927a --- /dev/null +++ b/.github/stale.yml @@ -0,0 +1,18 @@ +--- +only: issues +limitPerRun: 30 +daysUntilStale: 30 +daysUntilClose: 7 +exemptLabels: + - bug + - help wanted + - feature request +exemptProjects: true +exemptMilestones: true +staleLabel: stale +markComment: > + This issue has been inactive for 30 days. + It will be closed in one week, unless it is updated. +closeComment: > + This issue has been automatically closed due to extended period of inactivity. + Please reopen if it is still valid. Thank you for your contributions. diff --git a/.github/workflows/build-and-install.yml b/.github/workflows/build-and-install.yml new file mode 100644 index 0000000..26a144a --- /dev/null +++ b/.github/workflows/build-and-install.yml @@ -0,0 +1,201 @@ +--- +name: Builder +on: + push: + branches: + - master + pull_request: +jobs: + static-build: + name: Build (x86_64) + runs-on: ubuntu-latest + steps: + - name: Git clone repository + uses: actions/checkout@v2 + - run: | + git fetch --prune --unshallow --tags + - name: Build + run: | + .github/scripts/build-static-x86_64.sh + source-build: + name: Build & Install + strategy: + fail-fast: false + matrix: + distro: + - 'alpine:edge' + - 'alpine:3.13' + - 'alpine:3.12' + - 'alpine:3.11' + - 'alpine:3.10' + - 'archlinux:latest' + - 'centos:8' + - 'centos:7' + - 'clearlinux:latest' + - 'debian:10' + - 'debian:9' + - 'fedora:33' + - 'fedora:32' + - 'opensuse/leap:15.2' + - 'opensuse/tumbleweed:latest' + - 'ubuntu:20.10' + - 'ubuntu:20.04' + - 'ubuntu:18.04' + - 'ubuntu:16.04' + include: + - distro: 'alpine:edge' + pre: 'apk add -U bash' + rmjsonc: 'apk del json-c-dev' + - distro: 'alpine:3.13' + pre: 'apk add -U bash' + rmjsonc: 'apk del json-c-dev' + - distro: 'alpine:3.12' + pre: 'apk add -U bash' + rmjsonc: 'apk del json-c-dev' + - distro: 'alpine:3.11' + pre: 'apk add -U bash' + rmjsonc: 'apk del json-c-dev' + - distro: 'alpine:3.10' + pre: 'apk add -U bash' + rmjsonc: 'apk del json-c-dev' + + - distro: 'archlinux:latest' + pre: 'pacman --noconfirm -Syu && pacman --noconfirm -Sy grep libffi' + + - distro: 'centos:8' + rmjsonc: 'dnf remove -y json-c-devel' + + - distro: 'debian:10' + pre: 'apt-get update' + rmjsonc: 'apt-get remove -y libjson-c-dev' + - distro: 'debian:9' + pre: 'apt-get update' + rmjsonc: 'apt-get remove -y libjson-c-dev' + + - distro: 'fedora:33' + rmjsonc: 'dnf remove -y json-c-devel' + - distro: 'fedora:32' + rmjsonc: 'dnf remove -y json-c-devel' + + - distro: 'opensuse/leap:15.2' + rmjsonc: 'zypper rm -y libjson-c-devel' + - distro: 'opensuse/tumbleweed:latest' + rmjsonc: 'zypper rm -y libjson-c-devel' + + - distro: 'ubuntu:20.10' + pre: 'apt-get update' + rmjsonc: 'apt-get remove -y libjson-c-dev' + - distro: 'ubuntu:20.04' + pre: 'apt-get update' + rmjsonc: 'apt-get remove -y libjson-c-dev' + - distro: 'ubuntu:18.04' + pre: 'apt-get update' + rmjsonc: 'apt-get remove -y libjson-c-dev' + - distro: 'ubuntu:16.04' + pre: 'apt-get update' + rmjsonc: 'apt-get remove -y libjson-c-dev' + runs-on: ubuntu-latest + steps: + - name: Git clone repository + uses: actions/checkout@v2 + - name: install-required-packages.sh on ${{ matrix.distro }} + env: + PRE: ${{ matrix.pre }} + RMJSONC: ${{ matrix.rmjsonc }} + run: | + echo $PRE > ./prep-cmd.sh + echo $RMJSONC > ./rmjsonc.sh && chmod +x ./rmjsonc.sh + docker build . -f .github/dockerfiles/Dockerfile.build_test -t test --build-arg BASE=${{ matrix.distro }} + - name: Regular build on ${{ matrix.distro }} + run: | + docker run -w /netdata test /bin/sh -c 'autoreconf -ivf && ./configure && make -j2' + - name: netdata-installer on ${{ matrix.distro }}, disable cloud + run: | + docker run -w /netdata test /bin/sh -c './netdata-installer.sh --dont-wait --dont-start-it --disable-cloud' + - name: netdata-installer on ${{ matrix.distro }}, require cloud + run: | + docker run -w /netdata test /bin/sh -c './netdata-installer.sh --dont-wait --dont-start-it --require-cloud' + - name: netdata-installer on ${{ matrix.distro }}, require cloud, no JSON-C + if: matrix.rmjsonc != '' + run: | + docker run -w /netdata test \ + /bin/sh -c '/netdata/rmjsonc.sh && ./netdata-installer.sh --dont-wait --dont-start-it --require-cloud' + aws-kinesis-build: + name: With AWS Kinesis SDK + strategy: + fail-fast: false + matrix: + distro: + - 'centos:8' + - 'debian:buster' + - 'fedora:32' + - 'ubuntu:20.04' + include: + - distro: 'centos:8' + pre: >- + yum -y update && + yum -y groupinstall 'Development Tools' && + yum -y install libcurl-devel openssl-devel libuuid-devel + build_kinesis: >- + git clone https://github.com/aws/aws-sdk-cpp.git && + cmake -DCMAKE_INSTALL_PREFIX=/usr + -DBUILD_ONLY=kinesis + ./aws-sdk-cpp && + make && + make install + - distro: 'debian:buster' + pre: >- + apt-get update && + DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential && + DEBIAN_FRONTEND=noninteractive apt-get install -y libcurl4-openssl-dev libssl-dev uuid-dev zlib1g-dev libpulse-dev + build_kinesis: >- + git clone https://github.com/aws/aws-sdk-cpp.git && + cmake -DCMAKE_INSTALL_PREFIX=/usr + -DBUILD_ONLY=kinesis + ./aws-sdk-cpp && + make && + make install + - distro: 'fedora:32' + pre: >- + dnf -y update && + dnf -y groupinstall 'Development Tools' && + dnf -y install libcurl-devel openssl-devel libuuid-devel + build_kinesis: >- + git clone https://github.com/aws/aws-sdk-cpp.git && + cmake -DCMAKE_INSTALL_PREFIX=/usr + -DBUILD_ONLY=kinesis + ./aws-sdk-cpp && + make && + make install + - distro: 'ubuntu:20.04' + pre: >- + apt-get update && + DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential && + DEBIAN_FRONTEND=noninteractive apt-get install -y libcurl4-openssl-dev libssl-dev uuid-dev zlib1g-dev libpulse-dev + build_kinesis: >- + git clone https://github.com/aws/aws-sdk-cpp.git && + cmake -DCMAKE_INSTALL_PREFIX=/usr + -DBUILD_ONLY=kinesis + ./aws-sdk-cpp && + make && + make install + runs-on: ubuntu-latest + steps: + - name: Git clone repository + uses: actions/checkout@v2 + - name: install-required-packages.sh on ${{ matrix.distro }} + env: + PRE: ${{ matrix.pre }} + BUILD_KINESIS: ${{ matrix.build_kinesis }} + run: | + echo $PRE > ./prep-cmd.sh + echo $BUILD_KINESIS > ./build-kinesis.sh && chmod +x ./build-kinesis.sh + docker build . -f .github/dockerfiles/Dockerfile.build_test -t test --build-arg BASE=${{ matrix.distro }} + - name: Build on ${{ matrix.distro }} + env: + RUNCMD: >- + ./build-kinesis.sh && + ./netdata-installer.sh --dont-wait --dont-start-it --enable-backend-kinesis + run: | + docker run -w /netdata test \ + /bin/sh -c "$RUNCMD" diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml new file mode 100644 index 0000000..cf494e9 --- /dev/null +++ b/.github/workflows/checks.yml @@ -0,0 +1,106 @@ +--- +name: Checks +on: + push: + branches: + - master + pull_request: +jobs: + checksum-checks: + name: Checksums + runs-on: ubuntu-latest + steps: + - name: Git clone repository + uses: actions/checkout@v2 + - name: Run checksum checks on kickstart files + env: + LOCAL_ONLY: "true" + run: | + ./tests/installer/checksums.sh + dashboard-checks: + name: Dashboard + runs-on: ubuntu-latest + steps: + - name: Git clone repository + uses: actions/checkout@v2 + - name: Install required packages + run: | + ./packaging/installer/install-required-packages.sh --dont-wait --non-interactive netdata + - name: Backup dashboard.js + run: | + cp web/gui/dashboard.js /tmp/dashboard.js + - name: Regenerate dashboard.js + run: | + autoreconf -ivf + ./configure --enable-maintainer-mode + make dist + - name: Compare generated Dashboard vs. Backed up Dashboard + run: | + diff -sNrdu /tmp/dashboard.js web/gui/dashboard.js + libressl-checks: + name: LibreSSL + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Build + run: > + docker run -v "$PWD":/netdata -w /netdata alpine:latest /bin/sh -c + 'apk add bash; + ./packaging/installer/install-required-packages.sh --dont-wait --non-interactive netdata; + apk del openssl openssl-dev; + apk add libressl libressl-dev; + autoreconf -ivf; + ./configure; + make;' + clang-checks: + name: Clang + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Build + run: | + docker build -f .github/dockerfiles/Dockerfile.clang . + dist-checks: + name: Dist + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Prepare environment + run: | + ./packaging/installer/install-required-packages.sh --dont-wait --non-interactive netdata + sudo apt-get install -y libjson-c-dev libipmimonitoring-dev libcups2-dev libsnappy-dev \ + libprotobuf-dev libprotoc-dev libssl-dev protobuf-compiler \ + libnetfilter-acct-dev + - name: Configure + run: | + autoreconf -ivf + ./configure \ + --with-zlib \ + --with-math \ + --with-user=netdata \ + CFLAGS=-O2 + - name: Make dist + run: | + make dist + - name: Verify & Set distfile + run: | + ls -lah netdata-*.tar.gz + echo "DISTFILE=$(ls netdata-*.tar.gz)" >> $GITHUB_ENV + - name: Run run_install_with_dist_file.sh + run: | + ./.github/scripts/run_install_with_dist_file.sh "${DISTFILE}" + gitignore-check: + name: .gitignore + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Prepare environment + run: ./packaging/installer/install-required-packages.sh --dont-wait --non-interactive netdata + - name: Build netdata + run: ./netdata-installer.sh --dont-start-it --disable-telemetry --dont-wait --install /tmp/install + - name: Check that repo is clean + run: if [ "$(git status --porcelain=v1 | wc -l)" -gt 0 ] ; then exit 1 ; fi diff --git a/.github/workflows/coverity.yml b/.github/workflows/coverity.yml new file mode 100644 index 0000000..926257d --- /dev/null +++ b/.github/workflows/coverity.yml @@ -0,0 +1,34 @@ +--- +# Runs coverity-scan.sh every 24h on `master` +name: Coverity Scan +on: + schedule: + - cron: '0 1 * * *' + pull_request: + paths: + - .github/workflows/coverity.yml + - coverity-scan.sh +jobs: + coverity: + if: github.repository == 'netdata/netdata' + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Prepare environment + env: + DEBIAN_FRONTEND: 'noninteractive' + run: | + ./packaging/installer/install-required-packages.sh \ + --dont-wait --non-interactive netdata + sudo apt-get install -y libjson-c-dev libipmimonitoring-dev \ + libcups2-dev libsnappy-dev libprotobuf-dev \ + libprotoc-dev libssl-dev protobuf-compiler \ + libnetfilter-acct-dev + - name: Run coverity-scan + env: + REPOSITORY: 'netdata/netdata' + COVERITY_SCAN_TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }} + COVERITY_SCAN_SUBMIT_MAIL: ${{ secrets.COVERITY_SCAN_SUBMIT_MAIL }} + run: | + ./coverity-scan.sh --with-install diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..04f91bf --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,59 @@ +--- +name: Docker +on: + push: + branches: + - master + paths: + - '.github/workflows/docker.yml' + - 'netdata-installer.sh' + - 'packaging/**' + pull_request: + paths: + - '.github/workflows/docker.yml' + - 'netdata-installer.sh' + - 'packaging/**' + workflow_dispatch: + inputs: + version: + name: Version Tag + default: nightly + required: true +jobs: + docker-build: + name: Docker Build + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Determine if we should push changes and which tags to use + if: github.event_name == 'workflow_dispatch' && github.event.inputs.version != 'nightly' + run: | + echo "publish=true" >> $GITHUB_ENV + echo "tags=netdata/netdata:latest,netdata/netdata:stable,netdata/netdata:${{ github.event.inputs.version }}" >> $GITHUB_ENV + - name: Determine if we should push changes and which tags to use + if: github.event_name == 'workflow_dispatch' && github.event.inputs.version == 'nightly' + run: | + echo "publish=true" >> $GITHUB_ENV + echo "tags=netdata/netdata:latest,netdata/netdata:edge" >> $GITHUB_ENV + - name: Determine if we should push changes and which tags to use + if: github.event_name != 'workflow_dispatch' + run: | + echo "publish=false" >> $GITHUB_ENV + echo "tags=netdata/netdata:test" >> $GITHUB_ENV + - name: Setup QEMU + uses: docker/setup-qemu-action@v1 + - name: Setup Buildx + uses: docker/setup-buildx-action@v1 + - name: Docker Hub Login + if: github.event_name == 'workflow_dispatch' + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_PASSWORD }} + - name: Docker Build + uses: docker/build-push-action@v2 + with: + platforms: linux/amd64,linux/i386,linux/arm/v7,linux/arm64 + push: ${{ env.publish }} + tags: ${{ env.tags }} diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..2a4fe87 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,25 @@ +--- +name: Docs +on: + push: + branches: + - master + paths: + - '**.md' + pull_request: + paths: + - '**.md' +jobs: + markdown-link-check: + name: Broken Links + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Run link check + uses: gaurav-nelson/github-action-markdown-link-check@v1 + with: + use-quiet-mode: 'no' + use-verbose-mode: 'yes' + check-modified-files-only: 'yes' + config-file: '.mlc_config.json' diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml new file mode 100644 index 0000000..24842e7 --- /dev/null +++ b/.github/workflows/labeler.yml @@ -0,0 +1,16 @@ +--- +# Handles labelling of PR's. +name: Pull Request Labeler +on: + schedule: + - cron: '*/5 * * * *' +jobs: + labeler: + runs-on: ubuntu-latest + steps: + - uses: docker://docker.io/ilyam8/periodic-pr-labeler:v0.1.0 + if: github.repository == 'netdata/netdata' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_REPOSITORY: ${{ github.repository }} + LABEL_MAPPINGS_FILE: .github/labeler.yml diff --git a/.github/workflows/review.yml b/.github/workflows/review.yml new file mode 100644 index 0000000..ca8f6de --- /dev/null +++ b/.github/workflows/review.yml @@ -0,0 +1,94 @@ +--- +# Runs various ReviewDog based checks against PR with suggested changes to improve quality +name: Review +on: + pull_request: +env: + run_eslint: 0 + run_hadolint: 0 + run_shellcheck: 0 + run_yamllint: 0 +jobs: + eslint: + name: eslint + runs-on: ubuntu-latest + steps: + - name: Git clone repository + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Check files + run: | + if git diff --name-only origin/${{ github.base_ref }} HEAD | grep -Eq '*\.js|node\.d\.plugin\.in' ; then + echo 'run_eslint=1' >> $GITHUB_ENV + fi + - name: Run eslint + if: env.run_eslint == 1 + uses: reviewdog/action-eslint@v1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + reporter: github-pr-check + eslint_flags: '.' + + hadolint: + name: hadolint + runs-on: ubuntu-latest + steps: + - name: Git clone repository + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Check files + run: | + if git diff --name-only origin/${{ github.base_ref }} HEAD | grep -Eq '*Dockerfile*' ; then + echo 'run_hadolint=1' >> $GITHUB_ENV + fi + - name: Run hadolint + if: env.run_hadolint == 1 + uses: reviewdog/action-hadolint@v1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + reporter: github-pr-check + + shellcheck: + name: shellcheck + runs-on: ubuntu-latest + steps: + - name: Git clone repository + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Check files + run: | + if git diff --name-only origin/${{ github.base_ref }} HEAD | grep -Eq '*\.sh.*' ; then + echo 'run_shellcheck=1' >> $GITHUB_ENV + fi + - name: Run shellcheck + if: env.run_shellcheck == 1 + uses: reviewdog/action-shellcheck@v1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + reporter: github-pr-check + path: "." + pattern: "*.sh*" + exclude: "./.git/*" + + yamllint: + name: yamllint + runs-on: ubuntu-latest + steps: + - name: Git clone repository + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Check files + run: | + if git diff --name-only origin/${{ github.base_ref }} HEAD | grep -Eq '*\.ya?ml|python\.d/.*\.conf' ; then + echo 'run_yamllint=1' >> $GITHUB_ENV + fi + - name: Run yamllint + if: env.run_yamllint == 1 + uses: reviewdog/action-yamllint@v1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + reporter: github-pr-check diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..ef6bfbc --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,88 @@ +--- +# Runs Tests on Pushes to `master` and Pull Requests +name: Tests +on: + push: + branches: + - master + paths: + - 'CMakeLists.txt' + - '**.c' + - '**.h' + pull_request: + paths: + - 'CMakeLists.txt' + - '**.c' + - '**.h' +jobs: + unit-tests-legacy: + name: Unit Tests (legacy) + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Prepare environment + run: | + ./packaging/installer/install-required-packages.sh --dont-wait --non-interactive netdata-all + sudo apt-get install -y libjson-c-dev libipmimonitoring-dev libcups2-dev libsnappy-dev \ + libprotobuf-dev libprotoc-dev libssl-dev protobuf-compiler \ + libnetfilter-acct-dev + - name: Run ./tests/run-unit-tests.sh + env: + CFLAGS: "-O1 -DNETDATA_INTERNAL_CHECKS=1 -DNETDATA_VERIFY_LOCKS=1" + run: | + ./tests/run-unit-tests.sh + + unit-tests-cmocka: + name: Unit Tests (cmocka) + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Prepare environment + run: | + ./packaging/installer/install-required-packages.sh --dont-wait --non-interactive netdata-all + sudo apt-get install -y libjson-c-dev libipmimonitoring-dev libcups2-dev libsnappy-dev \ + libprotobuf-dev libprotoc-dev libssl-dev protobuf-compiler \ + libnetfilter-acct-dev libmongoc-dev libcmocka-dev + - name: Configure + run: | + autoreconf -ivf + ./configure + # XXX: Work-around for bug with libbson-1.0 in Ubuntu 18.04 + # See: https://bugs.launchpad.net/ubuntu/+source/libmongoc/+bug/1790771 + # https://jira.mongodb.org/browse/CDRIVER-2818 + - name: Fix libbson + run: | + pushd /usr/lib || exit 1 + sudo ln -s /usr/include . + popd || exit 1 + - name: Build + run: | + mkdir build-tmp + cd build-tmp + cmake \ + -D UNIT_TESTING=1 \ + -D BUILD_TESTING=1 \ + -D CMAKE_BUILD_TYPE="Debug" \ + -D BSON_LIBRARY=/usr/lib/x86_64-linux-gnu/libbson-1.0.so \ + -D MONGOC_LIBRARY=/usr/lib/x86_64-linux-gnu/libmongoc-1.0.so \ + .. + make + - name: Run ctest + run: | + cd build-tmp + ctest + - name: Prepare Artifacts + if: always() + run: | + mkdir logs + pushd build-tmp || exit 1 + find . -type f -name '*.log' -exec cp {} ../logs/ \; + popd || exit 1 + - name: Upload Artifacts + uses: actions/upload-artifact@v2.2.2 + if: always() + with: + name: logs + path: logs |