From 2e85f9325a797977eea9dfea0a925775ddd211d9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Feb 2021 12:49:00 +0100 Subject: Merging upstream version 1.29.0. Signed-off-by: Daniel Baumann --- .github/workflows/build-and-install.yml | 201 ++++++++++++++++++++++++++++++++ .github/workflows/checks.yml | 106 +++++++++++++++++ .github/workflows/coverity.yml | 34 ++++++ .github/workflows/docker.yml | 59 ++++++++++ .github/workflows/docs.yml | 25 ++++ .github/workflows/labeler.yml | 16 +++ .github/workflows/review.yml | 94 +++++++++++++++ .github/workflows/tests.yml | 88 ++++++++++++++ 8 files changed, 623 insertions(+) create mode 100644 .github/workflows/build-and-install.yml create mode 100644 .github/workflows/checks.yml create mode 100644 .github/workflows/coverity.yml create mode 100644 .github/workflows/docker.yml create mode 100644 .github/workflows/docs.yml create mode 100644 .github/workflows/labeler.yml create mode 100644 .github/workflows/review.yml create mode 100644 .github/workflows/tests.yml (limited to '.github/workflows') diff --git a/.github/workflows/build-and-install.yml b/.github/workflows/build-and-install.yml new file mode 100644 index 000000000..26a144acd --- /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 000000000..cf494e95c --- /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 000000000..926257dc0 --- /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 000000000..8f0795d1c --- /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: latest + 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 000000000..2a4fe87e4 --- /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 000000000..24842e73d --- /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 000000000..ca8f6de13 --- /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 000000000..ef6bfbc2a --- /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 -- cgit v1.2.3