summaryrefslogtreecommitdiffstats
path: root/.github/workflows
diff options
context:
space:
mode:
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/add-to-project.yml26
-rw-r--r--.github/workflows/build.yml861
-rw-r--r--.github/workflows/checks.yml61
-rw-r--r--.github/workflows/cloud_regression.yml54
-rw-r--r--.github/workflows/codeql.yml117
-rw-r--r--.github/workflows/coverity.yml63
-rw-r--r--.github/workflows/dashboard-pr.yml54
-rw-r--r--.github/workflows/docker.yml298
-rw-r--r--.github/workflows/docs.yml29
-rw-r--r--.github/workflows/labeler.yml18
-rw-r--r--.github/workflows/packagecloud.yml36
-rw-r--r--.github/workflows/packaging.yml279
-rw-r--r--.github/workflows/release.yml214
-rw-r--r--.github/workflows/repoconfig-packages.yml183
-rw-r--r--.github/workflows/review.yml172
-rw-r--r--.github/workflows/tests.yml41
-rw-r--r--.github/workflows/trigger-learn-update.yml37
17 files changed, 2543 insertions, 0 deletions
diff --git a/.github/workflows/add-to-project.yml b/.github/workflows/add-to-project.yml
new file mode 100644
index 0000000..a80d8b4
--- /dev/null
+++ b/.github/workflows/add-to-project.yml
@@ -0,0 +1,26 @@
+name: Add issues to Agent Board
+
+on:
+ issues:
+ types:
+ - opened
+ - transferred
+
+jobs:
+ add-to-project:
+ name: Add issue to project
+ if: github.repository == 'netdata/netdata'
+ runs-on: ubuntu-latest
+ steps:
+ - name: Add issues to Agent project board
+ uses: actions/add-to-project@v0.4.0
+ with:
+ project-url: https://github.com/orgs/netdata/projects/32
+ github-token: ${{ secrets.NETDATABOT_ORG_GITHUB_TOKEN }}
+
+ - name: Add issues to Product Bug project board
+ uses: actions/add-to-project@v0.4.0
+ with:
+ project-url: https://github.com/orgs/netdata/projects/45
+ github-token: ${{ secrets.NETDATABOT_ORG_GITHUB_TOKEN }}
+ labeled: bug
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 0000000..53f1590
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,861 @@
+---
+# Ci code for building release artifacts.
+name: Build
+on:
+ push: # Master branch checks only validate the build and generate artifacts for testing.
+ branches:
+ - master
+ pull_request: null # PR checks only validate the build and generate artifacts for testing.
+ workflow_dispatch: # Dispatch runs build and validate, then push to the appropriate storage location.
+ inputs:
+ type:
+ description: Build Type
+ default: nightly
+ required: true
+ version:
+ description: Version Tag
+ default: nightly
+ required: true
+concurrency: # This keeps multiple instances of the job from running concurrently for the same ref and event type.
+ group: build-${{ github.ref }}-${{ github.event_name }}
+ cancel-in-progress: true
+jobs:
+ build-dist: # Build the distribution tarball and store it as an artifact.
+ name: Build Distribution Tarball
+ runs-on: ubuntu-latest
+ outputs:
+ distfile: ${{ steps.build.outputs.distfile }}
+ steps:
+ - name: Checkout
+ id: checkout
+ uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+ submodules: recursive
+ - name: Fix tags
+ id: fix-tags
+ if: github.event_name != 'push'
+ run: |
+ git fetch --tags --force
+ - name: Mark Stable
+ id: channel
+ if: github.event_name == 'workflow_dispatch' && github.event.inputs.type != 'nightly'
+ run: |
+ sed -i 's/^RELEASE_CHANNEL="nightly" *#/RELEASE_CHANNEL="stable" #/' netdata-installer.sh
+ - name: Build
+ id: build
+ run: |
+ git describe
+ mkdir -p artifacts
+ ./packaging/installer/install-required-packages.sh --dont-wait --non-interactive netdata
+ autoreconf -ivf
+ ./configure --prefix=/usr \
+ --sysconfdir=/etc \
+ --localstatedir=/var \
+ --libexecdir=/usr/libexec \
+ --with-zlib \
+ --with-math \
+ --with-user=netdata
+ make dist
+ echo "::set-output name=distfile::$(find . -name 'netdata-*.tar.gz')"
+ cp netdata-*.tar.gz artifacts/
+ - name: Store
+ id: store
+ uses: actions/upload-artifact@v3
+ with:
+ name: dist-tarball
+ path: artifacts/*.tar.gz
+ retention-days: 30
+ - name: Failure Notification
+ uses: rtCamp/action-slack-notify@v2
+ env:
+ SLACK_COLOR: 'danger'
+ SLACK_FOOTER: ''
+ SLACK_ICON_EMOJI: ':github-actions:'
+ SLACK_TITLE: 'Distribution tarball creation failed:'
+ SLACK_USERNAME: 'GitHub Actions'
+ SLACK_MESSAGE: |-
+ ${{ github.repository }}: Failed to create source tarball for distribution.
+ Checkout: ${{ steps.checkout.outcome }}
+ Fix Tags: ${{ steps.fix-tags.outcome }}
+ Mark stable: ${{ steps.channel.outcome }}
+ Build: ${{ steps.build.outcome }}
+ Store: ${{ steps.store.outcome }}
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
+ if: >-
+ ${{
+ failure()
+ && startsWith(github.ref, 'refs/heads/master')
+ && github.event_name != 'pull_request'
+ && github.repository == 'netdata/netdata'
+ }}
+
+ build-static: # Build the static binary archives, and store them as artifacts.
+ name: Build Static
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ arch:
+ - x86_64
+ - armv7l
+ - aarch64
+ - ppc64le
+ steps:
+ - name: Checkout
+ id: checkout
+ uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+ submodules: recursive
+ - name: Fix tags
+ id: fix-tags
+ if: github.event_name != 'push'
+ run: |
+ git fetch --tags --force
+ - name: Mark Stable
+ id: channel
+ if: github.event_name == 'workflow_dispatch' && github.event.inputs.type != 'nightly'
+ run: |
+ sed -i 's/^RELEASE_CHANNEL="nightly" *#/RELEASE_CHANNEL="stable" #/' netdata-installer.sh packaging/makeself/install-or-update.sh
+ - name: Get Cache Key
+ id: cache-key
+ run: .github/scripts/get-static-cache-key.sh ${{ matrix.arch }}
+ - name: Cache
+ id: cache
+ uses: actions/cache@v3
+ with:
+ path: artifacts/cache
+ key: ${{ steps.cache-key.outputs.key }}
+ - name: Build
+ if: github.event_name != 'workflow_dispatch' # Don’t use retries on PRs.
+ run: .github/scripts/build-static.sh ${{ matrix.arch }}
+ - name: Build
+ if: github.event_name == 'workflow_dispatch'
+ id: build
+ uses: nick-fields/retry@v2
+ with:
+ timeout_minutes: 180
+ retries: 3
+ command: .github/scripts/build-static.sh ${{ matrix.arch }}
+ - name: Store
+ id: store
+ uses: actions/upload-artifact@v3
+ with:
+ name: static-archive
+ path: artifacts/*.gz.run
+ retention-days: 30
+ - name: Failure Notification
+ uses: rtCamp/action-slack-notify@v2
+ env:
+ SLACK_COLOR: 'danger'
+ SLACK_FOOTER: ''
+ SLACK_ICON_EMOJI: ':github-actions:'
+ SLACK_TITLE: 'Static build failed:'
+ SLACK_USERNAME: 'GitHub Actions'
+ SLACK_MESSAGE: |-
+ ${{ github.repository }}: Failed to create static installer archive for ${{ matrix.arch }}.
+ Checkout: ${{ steps.checkout.outcome }}
+ Fix Tags: ${{ steps.fix-tags.outcome }}
+ Mark stable: ${{ steps.channel.outcome }}
+ Build: ${{ steps.build.outcome }}
+ Store: ${{ steps.store.outcome }}
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
+ if: >-
+ ${{
+ failure()
+ && startsWith(github.ref, 'refs/heads/master')
+ && github.event_name != 'pull_request'
+ && github.repository == 'netdata/netdata'
+ }}
+
+ matrix: # Generate the shared build matrix for our build tests.
+ name: Prepare Build Matrix
+ runs-on: ubuntu-latest
+ outputs:
+ matrix: ${{ steps.set-matrix.outputs.matrix }}
+ steps:
+ - name: Checkout
+ id: checkout
+ uses: actions/checkout@v3
+ - name: Prepare tools
+ id: prepare
+ run: |
+ sudo apt-get update && sudo apt-get install -y python3-ruamel.yaml
+ - name: Read build matrix
+ id: set-matrix
+ shell: python3 {0}
+ run: |
+ from ruamel.yaml import YAML
+ import json
+ yaml = YAML(typ='safe')
+ entries = list()
+
+ with open('.github/data/distros.yml') as f:
+ data = yaml.load(f)
+
+ for i, v in enumerate(data['include']):
+ e = {
+ 'artifact_key': v['distro'] + str(v['version']).replace('.', ''),
+ 'version': v['version'],
+ }
+
+ if 'base_image' in v:
+ e['distro'] = ':'.join([v['base_image'], str(v['version'])])
+ else:
+ e['distro'] = ':'.join([v['distro'], str(v['version'])])
+
+ if 'env_prep' in v:
+ e['env_prep'] = v['env_prep']
+
+ if 'jsonc_removal' in v:
+ e['jsonc_removal'] = v['jsonc_removal']
+
+ entries.append(e)
+
+ entries.sort(key=lambda k: k['distro'])
+ matrix = json.dumps({'include': entries}, sort_keys=True)
+ print('Generated Matrix: ' + matrix)
+ print('::set-output name=matrix::' + matrix)
+ - name: Failure Notification
+ uses: rtCamp/action-slack-notify@v2
+ env:
+ SLACK_COLOR: 'danger'
+ SLACK_FOOTER: ''
+ SLACK_ICON_EMOJI: ':github-actions:'
+ SLACK_TITLE: 'Build matrix preparation failed:'
+ SLACK_USERNAME: 'GitHub Actions'
+ SLACK_MESSAGE: |-
+ ${{ github.repository }}: Failed to prepare build matrix for build checks.
+ Checkout: ${{ steps.checkout.outcome }}
+ Prepare tools: ${{ steps.prepare.outcome }}
+ Read build matrix: ${{ steps.set-matrix.outcome }}
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
+ if: >-
+ ${{
+ failure()
+ && startsWith(github.ref, 'refs/heads/master')
+ && github.event_name != 'pull_request'
+ && github.repository == 'netdata/netdata'
+ }}
+
+ prepare-test-images: # Prepare the test environments for our build checks. This also checks dependency handling code for each tested environment.
+ name: Prepare Test Environments
+ runs-on: ubuntu-latest
+ needs:
+ - matrix
+ env:
+ RETRY_DELAY: 300
+ strategy:
+ # Unlike the actal build tests, this completes _very_ fast (average of about 3 minutes for each job), so we
+ # just run everything in parallel instead lof limiting job concurrency.
+ fail-fast: false
+ matrix: ${{ fromJson(needs.matrix.outputs.matrix) }}
+ steps:
+ - name: Checkout
+ id: checkout
+ uses: actions/checkout@v3
+ - name: Setup Buildx
+ id: buildx
+ uses: docker/setup-buildx-action@v2
+ - name: Build test environment
+ id: build1
+ uses: docker/build-push-action@v3
+ continue-on-error: true # We retry 3 times at 5 minute intervals if there is a failure here.
+ with:
+ push: false
+ load: false
+ file: .github/dockerfiles/Dockerfile.build_test
+ build-args: |
+ BASE=${{ matrix.distro }}
+ PRE=${{ matrix.env_prep }}
+ RMJSONC=${{ matrix.jsonc_removal }}
+ outputs: type=oci,dest=/tmp/image.tar
+ tags: test:${{ matrix.artifact_key }}
+ - name: Retry delay
+ if: ${{ steps.build1.outcome == 'failure' }}
+ run: sleep "${RETRY_DELAY}"
+ - name: Build test environment (attempt 2)
+ if: ${{ steps.build1.outcome == 'failure' }}
+ id: build2
+ uses: docker/build-push-action@v3
+ continue-on-error: true # We retry 3 times at 5 minute intervals if there is a failure here.
+ with:
+ push: false
+ load: false
+ file: .github/dockerfiles/Dockerfile.build_test
+ build-args: |
+ BASE=${{ matrix.distro }}
+ PRE=${{ matrix.env_prep }}
+ RMJSONC=${{ matrix.jsonc_removal }}
+ outputs: type=oci,dest=/tmp/image.tar
+ tags: test:${{ matrix.artifact_key }}
+ - name: Retry delay
+ if: ${{ steps.build1.outcome == 'failure' && steps.build2.outcome == 'failure' }}
+ run: sleep "${RETRY_DELAY}"
+ - name: Build test environment (attempt 3)
+ if: ${{ steps.build1.outcome == 'failure' && steps.build2.outcome == 'failure' }}
+ id: build3
+ uses: docker/build-push-action@v3
+ with:
+ push: false
+ load: false
+ file: .github/dockerfiles/Dockerfile.build_test
+ build-args: |
+ BASE=${{ matrix.distro }}
+ PRE=${{ matrix.env_prep }}
+ RMJSONC=${{ matrix.jsonc_removal }}
+ outputs: type=oci,dest=/tmp/image.tar
+ tags: test:${{ matrix.artifact_key }}
+ - name: Upload image artifact
+ id: upload
+ uses: actions/upload-artifact@v3
+ with:
+ name: ${{ matrix.artifact_key }}-test-env
+ path: /tmp/image.tar
+ retention-days: 30
+ - name: Failure Notification
+ uses: rtCamp/action-slack-notify@v2
+ env:
+ SLACK_COLOR: 'danger'
+ SLACK_FOOTER: ''
+ SLACK_ICON_EMOJI: ':github-actions:'
+ SLACK_TITLE: 'Test environment preparation for ${{ matrix.distro }} failed:'
+ SLACK_USERNAME: 'GitHub Actions'
+ SLACK_MESSAGE: |-
+ ${{ github.repository }}: Test environment preparation for ${{ matrix.distro }} failed.
+ Checkout: ${{ steps.checkout.outcome }}
+ Set up Buildx: ${{ steps.buildx.outcome }}
+ Build test environment: ${{ steps.build1.outcome }}
+ Build test environment (attempt 2): ${{ steps.build2.outcome }}
+ Build test environment (attempt 3): ${{ steps.build3.outcome }}
+ Upload: ${{ steps.upload.outcome }}
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
+ if: >-
+ ${{
+ failure()
+ && startsWith(github.ref, 'refs/heads/master')
+ && github.event_name != 'pull_request'
+ && github.repository == 'netdata/netdata'
+ }}
+
+ source-build: # Test various source build arrangements.
+ name: Test Source Build
+ runs-on: ubuntu-latest
+ needs:
+ - matrix
+ - prepare-test-images
+ strategy:
+ fail-fast: false
+ max-parallel: 8
+ matrix: ${{ fromJson(needs.matrix.outputs.matrix) }}
+ steps:
+ - name: Checkout
+ id: checkout
+ uses: actions/checkout@v3
+ with:
+ submodules: recursive
+ - name: Fetch test environment
+ id: fetch
+ uses: actions/download-artifact@v3
+ with:
+ name: ${{ matrix.artifact_key }}-test-env
+ - name: Load test environment
+ id: load
+ run: |
+ docker load --input image.tar | tee image-info.txt
+ echo "::set-output name=image::$(cut -d ':' -f 3 image-info.txt)"
+ - name: Regular build on ${{ matrix.distro }}
+ id: build-basic
+ run: |
+ docker run --security-opt seccomp=unconfined -w /netdata sha256:${{ steps.load.outputs.image }} \
+ /bin/sh -c 'autoreconf -ivf && ./configure --disable-dependency-tracking && make -j2'
+ - name: netdata-installer on ${{ matrix.distro }}, disable cloud
+ id: build-no-cloud
+ run: |
+ docker run --security-opt seccomp=unconfined -w /netdata sha256:${{ steps.load.outputs.image }} \
+ /bin/sh -c './netdata-installer.sh --dont-wait --dont-start-it --disable-cloud --one-time-build'
+ - name: netdata-installer on ${{ matrix.distro }}, require cloud
+ id: build-cloud
+ run: |
+ docker run --security-opt seccomp=unconfined -w /netdata sha256:${{ steps.load.outputs.image }} \
+ /bin/sh -c './netdata-installer.sh --dont-wait --dont-start-it --require-cloud --one-time-build'
+ - name: netdata-installer on ${{ matrix.distro }}, require cloud, no JSON-C
+ id: build-no-jsonc
+ if: matrix.jsonc_removal != ''
+ run: |
+ docker run --security-opt seccomp=unconfined -w /netdata sha256:${{ steps.load.outputs.image }} \
+ /bin/sh -c '/rmjsonc.sh && ./netdata-installer.sh --dont-wait --dont-start-it --require-cloud --one-time-build'
+ - name: Failure Notification
+ uses: rtCamp/action-slack-notify@v2
+ env:
+ SLACK_COLOR: 'danger'
+ SLACK_FOOTER: ''
+ SLACK_ICON_EMOJI: ':github-actions:'
+ SLACK_TITLE: 'Build tests for ${{ matrix.distro }} failed:'
+ SLACK_USERNAME: 'GitHub Actions'
+ SLACK_MESSAGE: |-
+ ${{ github.repository }}: Build tests for ${{ matrix.distro }} failed.
+ Checkout: ${{ steps.checkout.outcome }}
+ Fetch test environment: ${{ steps.fetch.outcome }}
+ Load test environment: ${{ steps.load.outcome }}
+ Regular build: ${{ steps.build-basic.outcome }}
+ netdata-installer, disable cloud: ${{ steps.build-no-cloud.outcome }}
+ netdata-installer, require cloud: ${{ steps.build-cloud.outcome }}
+ netdata-installer, no JSON-C: ${{ steps.build-no-jsonc.outcome }}
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
+ if: >-
+ ${{
+ failure()
+ && startsWith(github.ref, 'refs/heads/master')
+ && github.event_name != 'pull_request'
+ && github.repository == 'netdata/netdata'
+ }}
+
+ updater-check: # Test the generated dist archive using the updater code.
+ name: Test Generated Distfile and Updater Code
+ runs-on: ubuntu-latest
+ needs:
+ - build-dist
+ - matrix
+ - prepare-test-images
+ strategy:
+ fail-fast: false
+ max-parallel: 8
+ matrix: ${{ fromJson(needs.matrix.outputs.matrix) }}
+ services:
+ apache: # This gets used to serve the dist tarball for the updater script.
+ image: httpd:2.4
+ ports:
+ - 8080:80
+ volumes:
+ - ${{ github.workspace }}:/usr/local/apache2/htdocs/
+ steps:
+ - name: Checkout
+ id: checkout
+ uses: actions/checkout@v3
+ - name: Fetch dist tarball artifacts
+ id: fetch-tarball
+ uses: actions/download-artifact@v3
+ with:
+ name: dist-tarball
+ path: dist-tarball
+ - name: Prepare artifact directory
+ id: prepare
+ run: |
+ mkdir -p artifacts || exit 1
+ echo "9999.0.0-0" > artifacts/latest-version.txt || exit 1
+ cp dist-tarball/* artifacts || exit 1
+ cd artifacts || exit 1
+ ln -s ${{ needs.build-dist.outputs.distfile }} netdata-latest.tar.gz || exit 1
+ sha256sum -b ./* > "sha256sums.txt" || exit 1
+ cat sha256sums.txt
+ - name: Fetch test environment
+ id: fetch-test-environment
+ uses: actions/download-artifact@v3
+ with:
+ name: ${{ matrix.artifact_key }}-test-env
+ - name: Load test environment
+ id: load
+ run: |
+ docker load --input image.tar | tee image-info.txt
+ echo "::set-output name=image::$(cut -d ':' -f 3 image-info.txt)"
+ - name: Install netdata and run the updater on ${{ matrix.distro }}
+ id: updater-check
+ run: |
+ docker run --security-opt seccomp=unconfined -e DISABLE_TELEMETRY=1 --network host -w /netdata sha256:${{ steps.load.outputs.image }} \
+ /netdata/.github/scripts/run-updater-check.sh
+ - name: Failure Notification
+ uses: rtCamp/action-slack-notify@v2
+ env:
+ SLACK_COLOR: 'danger'
+ SLACK_FOOTER: ''
+ SLACK_ICON_EMOJI: ':github-actions:'
+ SLACK_TITLE: 'Updater checks for ${{ matrix.distro }} failed:'
+ SLACK_USERNAME: 'GitHub Actions'
+ SLACK_MESSAGE: |-
+ ${{ github.repository }}: Updater checks for ${{ matrix.distro }} failed.
+ Checkout: ${{ steps.checkout.outcome }}
+ Fetch dist tarball: ${{ steps.fetch-tarball.outcome }}
+ Prepare artifact directory: ${{ steps.prepare.outcome }}
+ Fetch test environment: ${{ steps.fetch-test-environment.outcome }}
+ Load test environment: ${{ steps.load.outcome }}
+ Updater check: ${{ steps.updater-check.outcome }}
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
+ if: >-
+ ${{
+ failure()
+ && startsWith(github.ref, 'refs/heads/master')
+ && github.event_name != 'pull_request'
+ && github.repository == 'netdata/netdata'
+ }}
+
+ prepare-upload: # Consolidate the artifacts for uploading or releasing.
+ name: Prepare Artifacts
+ runs-on: ubuntu-latest
+ needs:
+ - build-dist
+ - build-static
+ steps:
+ - name: Checkout
+ id: checkout
+ uses: actions/checkout@v3
+ - name: Prepare Environment
+ id: prepare
+ run: mkdir -p artifacts
+ - name: Retrieve Dist Tarball
+ id: fetch-dist
+ uses: actions/download-artifact@v3
+ with:
+ name: dist-tarball
+ path: dist-tarball
+ - name: Retrieve Static Build Artifacts
+ id: fetch-static
+ uses: actions/download-artifact@v3
+ with:
+ name: static-archive
+ path: static-archive
+ - name: Prepare Artifacts
+ id: consolidate
+ working-directory: ./artifacts/
+ run: |
+ mv ../dist-tarball/* . || exit 1
+ mv ../static-archive/* . || exit 1
+ ln -s ${{ needs.build-dist.outputs.distfile }} netdata-latest.tar.gz || exit 1
+ cp ../packaging/version ./latest-version.txt || exit 1
+ sha256sum -b ./* > sha256sums.txt || exit 1
+ cat sha256sums.txt
+ - name: Store Artifacts
+ id: store
+ uses: actions/upload-artifact@v3
+ with:
+ name: final-artifacts
+ path: artifacts/*
+ retention-days: 30
+ - name: Failure Notification
+ uses: rtCamp/action-slack-notify@v2
+ env:
+ SLACK_COLOR: 'danger'
+ SLACK_FOOTER: ''
+ SLACK_ICON_EMOJI: ':github-actions:'
+ SLACK_TITLE: 'Failed to prepare release artifacts for upload:'
+ SLACK_USERNAME: 'GitHub Actions'
+ SLACK_MESSAGE: |-
+ ${{ github.repository }}: Failed to prepare release artifacts for upload.
+ CHeckout: ${{ steps.checkout.outcome }}
+ Prepare environment: ${{ steps.prepare.outcome }}
+ Fetch dist tarball: ${{ steps.fetch-dist.outcome }}
+ Fetch static builds: ${{ steps.fetch-static.outcome }}
+ Consolidate artifacts: ${{ steps.consolidate.outcome }}
+ Store: ${{ steps.store.outcome }}
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
+ if: >-
+ ${{
+ failure()
+ && startsWith(github.ref, 'refs/heads/master')
+ && github.event_name != 'pull_request'
+ && github.repository == 'netdata/netdata'
+ }}
+
+ artifact-verification-dist: # Verify the regular installer works with the consolidated artifacts.
+ name: Test Consolidated Artifacts (Source)
+ runs-on: ubuntu-latest
+ needs:
+ - prepare-upload
+ services:
+ apache: # This gets used to serve the dist tarball for the updater script.
+ image: httpd:2.4
+ ports:
+ - 8080:80
+ volumes:
+ - ${{ github.workspace }}:/usr/local/apache2/htdocs/
+ steps:
+ - name: Checkout
+ id: checkout
+ uses: actions/checkout@v3
+ - name: Fetch artifacts
+ id: fetch
+ uses: actions/download-artifact@v3
+ with:
+ name: final-artifacts
+ path: artifacts
+ - name: Verify that artifacts work with installer
+ id: verify
+ env:
+ NETDATA_TARBALL_BASEURL: http://localhost:8080/artifacts
+ run: packaging/installer/kickstart.sh --build-only --dont-start-it --disable-telemetry --dont-wait
+ - name: Failure Notification
+ uses: rtCamp/action-slack-notify@v2
+ env:
+ SLACK_COLOR: 'danger'
+ SLACK_FOOTER: ''
+ SLACK_ICON_EMOJI: ':github-actions:'
+ SLACK_TITLE: 'Artifact verification for source tarball failed.'
+ SLACK_USERNAME: 'GitHub Actions'
+ SLACK_MESSAGE: |-
+ ${{ github.repository }}: Artifact verification for source tarball failed.
+ Checkout: ${{ steps.checkout.outcome }}
+ Fetch artifacts: ${{ steps.fetch.outcome }}
+ Verify artifacts: ${{ steps.verify.outcome }}
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
+ if: >-
+ ${{
+ failure()
+ && startsWith(github.ref, 'refs/heads/master')
+ && github.event_name != 'pull_request'
+ && github.repository == 'netdata/netdata'
+ }}
+
+ artifact-verification-static: # Verify the static installer works with the consolidated artifacts.
+ name: Test Consolidated Artifacts (Static)
+ runs-on: ubuntu-latest
+ needs:
+ - prepare-upload
+ services:
+ apache: # This gets used to serve the static archives.
+ image: httpd:2.4
+ ports:
+ - 8080:80
+ volumes:
+ - ${{ github.workspace }}:/usr/local/apache2/htdocs/
+ steps:
+ - name: Checkout
+ id: checkout
+ uses: actions/checkout@v3
+ - name: Fetch artifacts
+ id: fetch-artifacts
+ uses: actions/download-artifact@v3
+ with:
+ name: final-artifacts
+ path: artifacts
+ - name: Verify that artifacts work with installer
+ id: verify
+ env:
+ NETDATA_TARBALL_BASEURL: http://localhost:8080/artifacts
+ run: packaging/installer/kickstart.sh --static-only --dont-start-it --disable-telemetry
+ - name: Failure Notification
+ uses: rtCamp/action-slack-notify@v2
+ env:
+ SLACK_COLOR: 'danger'
+ SLACK_FOOTER: ''
+ SLACK_ICON_EMOJI: ':github-actions:'
+ SLACK_TITLE: 'Artifact verification for static build failed.'
+ SLACK_USERNAME: 'GitHub Actions'
+ SLACK_MESSAGE: |-
+ ${{ github.repository }}: Artifact verification for static build failed.
+ Checkout: ${{ steps.checkout.outcome }}
+ Fetch artifacts: ${{ steps.fetch-artifacts.outcome }}
+ Verify artifacts: ${{ steps.verify.outcome }}
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
+ if: >-
+ ${{
+ failure()
+ && startsWith(github.ref, 'refs/heads/master')
+ && github.event_name != 'pull_request'
+ && github.repository == 'netdata/netdata'
+ }}
+
+ upload-nightly: # Upload the nightly build artifacts to GCS.
+ name: Upload Nightly Artifacts
+ runs-on: ubuntu-latest
+ if: github.event_name == 'workflow_dispatch' && github.event.inputs.type == 'nightly' && github.repository == 'netdata/netdata'
+ needs:
+ - updater-check
+ - source-build
+ - artifact-verification-dist
+ - artifact-verification-static
+ steps:
+ - name: Retrieve Artifacts
+ id: fetch
+ uses: actions/download-artifact@v3
+ with:
+ name: final-artifacts
+ path: final-artifacts
+ - name: Authenticate to GCS
+ id: gcs-auth
+ uses: google-github-actions/auth@v1
+ with:
+ project_id: ${{ secrets.GCP_NIGHTLY_STORAGE_PROJECT }}
+ credentials_json: ${{ secrets.GCS_STORAGE_SERVICE_KEY_JSON }}
+ - name: Setup GCS
+ id: gcs-setup
+ uses: google-github-actions/setup-gcloud@v1.0.1
+ - name: Upload Artifacts
+ id: upload
+ uses: google-github-actions/upload-cloud-storage@v1.0.0
+ with:
+ destination: ${{ secrets.GCP_NIGHTLY_STORAGE_BUCKET }}
+ gzip: false
+ path: ./final-artifacts
+ parent: false
+ - name: Failure Notification
+ uses: rtCamp/action-slack-notify@v2
+ env:
+ SLACK_COLOR: 'danger'
+ SLACK_FOOTER: ''
+ SLACK_ICON_EMOJI: ':github-actions:'
+ SLACK_TITLE: 'Failed to upload nightly release artifacts:'
+ SLACK_USERNAME: 'GitHub Actions'
+ SLACK_MESSAGE: |-
+ ${{ github.repository }}: Failed to upload nightly release artifacts.
+ Fetch artifacts: ${{ steps.fetch.outcome }}
+ Authenticatie GCS: ${{ steps.gcs-auth.outcome }}
+ Setup GCS: ${{ steps.gcs-setup.outcome }}
+ Upload artifacts: ${{ steps.upload.outcome }}
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
+ if: >-
+ ${{
+ failure()
+ && startsWith(github.ref, 'refs/heads/master')
+ && github.event_name != 'pull_request'
+ }}
+
+ create-nightly: # Create a nightly build release in netdata/netdata-nightlies
+ name: Create Nightly Release
+ runs-on: ubuntu-latest
+ if: github.event_name == 'workflow_dispatch' && github.event.inputs.type == 'nightly' && github.repository == 'netdata/netdata'
+ needs:
+ - updater-check
+ - source-build
+ - artifact-verification-dist
+ - artifact-verification-static
+ steps:
+ - name: Checkout Main Repo
+ id: checkout-main
+ uses: actions/checkout@v3
+ with:
+ path: main
+ - name: Checkout Nightly Repo
+ id: checkout-nightly
+ uses: actions/checkout@v3
+ with:
+ repository: netdata/netdata-nightlies
+ path: nightlies
+ token: ${{ secrets.NETDATABOT_GITHUB_TOKEN }}
+ - name: Retrieve Artifacts
+ id: fetch
+ uses: actions/download-artifact@v3
+ with:
+ name: final-artifacts
+ path: final-artifacts
+ - name: Prepare version info
+ id: version
+ run: |
+ # shellcheck disable=SC2129
+ echo "version=$(cat main/packaging/version)" >> "${GITHUB_OUTPUT}"
+ echo "commit=$(cd nightlies && git rev-parse HEAD)" >> "${GITHUB_OUTPUT}"
+ echo "date=$(date +%F)" >> "${GITHUB_OUTPUT}"
+ - name: Create Release
+ id: create-release
+ uses: ncipollo/release-action@v1
+ with:
+ allowUpdates: false
+ artifactErrorsFailBuild: true
+ artifacts: 'final-artifacts/sha256sums.txt,final-artifacts/netdata-*.tar.gz,final-artifacts/netdata-*.gz.run'
+ owner: netdata
+ repo: netdata-nightlies
+ body: Netdata nightly build for ${{ steps.version.outputs.date }}.
+ commit: ${{ steps.version.outputs.commit }}
+ tag: ${{ steps.version.outputs.version }}
+ token: ${{ secrets.NETDATABOT_GITHUB_TOKEN }}
+ - name: Failure Notification
+ uses: rtCamp/action-slack-notify@v2
+ env:
+ SLACK_COLOR: 'danger'
+ SLACK_FOOTER: ''
+ SLACK_ICON_EMOJI: ':github-actions:'
+ SLACK_TITLE: 'Failed to draft release:'
+ SLACK_USERNAME: 'GitHub Actions'
+ SLACK_MESSAGE: |-
+ ${{ github.repository }}: Failed to create nightly release or attach artifacts.
+ Checkout netdata/netdata: ${{ steps.checkout-main.outcome }}
+ Checkout netdata/netdata-nightlies: ${{ steps.checkout-nightly.outcome }}
+ Fetch artifacts: ${{ steps.fetch.outcome }}
+ Prepare version info: ${{ steps.version.outcome }}
+ Create release: ${{ steps.create-release.outcome }}
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
+ if: >-
+ ${{
+ failure()
+ && github.event_name == 'workflow_dispatch'
+ }}
+
+ normalize-tag: # Fix the release tag if needed
+ name: Normalize Release Tag
+ runs-on: ubuntu-latest
+ if: github.event_name == 'workflow_dispatch' && github.event.inputs.type == 'release'
+ outputs:
+ tag: ${{ steps.tag.outputs.tag }}
+ steps:
+ - name: Normalize Tag
+ id: tag
+ run: |
+ if echo ${{ github.event.inputs.version }} | grep -qE '^[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+$'; then
+ echo "::set-output name=tag::v${{ github.event.inputs.version }}"
+ else
+ echo "::set-output name=tag::${{ github.event.inputs.version }}"
+ fi
+
+ upload-release: # Create the draft release and upload the build artifacts.
+ name: Create Release Draft
+ runs-on: ubuntu-latest
+ if: github.event_name == 'workflow_dispatch' && github.event.inputs.type == 'release' && github.repository == 'netdata/netdata'
+ needs:
+ - updater-check
+ - source-build
+ - artifact-verification-dist
+ - artifact-verification-static
+ - normalize-tag
+ steps:
+ - name: Checkout
+ id: checkout
+ uses: actions/checkout@v3
+ - name: Retrieve Artifacts
+ id: fetch
+ uses: actions/download-artifact@v3
+ with:
+ name: final-artifacts
+ path: final-artifacts
+ - name: Create Release
+ id: create-release
+ uses: ncipollo/release-action@v1
+ with:
+ allowUpdates: false
+ artifactErrorsFailBuild: true
+ artifacts: 'final-artifacts/sha256sums.txt,final-artifacts/netdata-*.tar.gz,final-artifacts/netdata-*.gz.run'
+ draft: true
+ tag: ${{ needs.normalize-tag.outputs.tag }}
+ token: ${{ secrets.NETDATABOT_GITHUB_TOKEN }}
+ - name: Failure Notification
+ uses: rtCamp/action-slack-notify@v2
+ env:
+ SLACK_COLOR: 'danger'
+ SLACK_FOOTER: ''
+ SLACK_ICON_EMOJI: ':github-actions:'
+ SLACK_TITLE: 'Failed to draft release:'
+ SLACK_USERNAME: 'GitHub Actions'
+ SLACK_MESSAGE: |-
+ ${{ github.repository }}: Failed to create draft release or attach artifacts.
+ Checkout: ${{ steps.checkout.outcome }}
+ Fetch artifacts: ${{ steps.fetch.outcome }}
+ Create draft release: ${{ steps.create-release.outcome }}
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
+ if: >-
+ ${{
+ failure()
+ && github.event_name == 'workflow_dispatch'
+ }}
+ - name: Success Notification
+ uses: rtCamp/action-slack-notify@v2
+ env:
+ SLACK_COLOR: 'good'
+ SLACK_FOOTER: ''
+ SLACK_ICON_EMOJI: ':github-actions:'
+ SLACK_TITLE: 'Created agent draft release:'
+ SLACK_USERNAME: 'GitHub Actions'
+ SLACK_MESSAGE: "${{ github.repository }}: ${{ steps.create-release.outputs.html_url }}"
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
+ if: >-
+ ${{
+ success()
+ && github.event_name == 'workflow_dispatch'
+ }}
diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml
new file mode 100644
index 0000000..65ad6ac
--- /dev/null
+++ b/.github/workflows/checks.yml
@@ -0,0 +1,61 @@
+---
+name: Checks
+on:
+ push:
+ branches:
+ - master
+ pull_request: null
+env:
+ DISABLE_TELEMETRY: 1
+concurrency:
+ group: checks-${{ github.ref }}
+ cancel-in-progress: true
+jobs:
+ libressl-checks:
+ name: LibreSSL
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v3
+ with:
+ submodules: recursive
+ - 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 --disable-dependency-tracking;
+ make;'
+ clang-checks:
+ name: Clang
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v3
+ with:
+ submodules: recursive
+ - name: Build
+ run: |
+ docker build -f .github/dockerfiles/Dockerfile.clang .
+ gitignore-check:
+ name: .gitignore
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v3
+ with:
+ submodules: recursive
+ - 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 --one-time-build
+ - name: Check that repo is clean
+ run: |
+ git status --porcelain=v1 > /tmp/porcelain
+ if [ -s /tmp/porcelain ]; then
+ cat /tmp/porcelain
+ exit 1
+ fi
diff --git a/.github/workflows/cloud_regression.yml b/.github/workflows/cloud_regression.yml
new file mode 100644
index 0000000..b6e321f
--- /dev/null
+++ b/.github/workflows/cloud_regression.yml
@@ -0,0 +1,54 @@
+name: Trigger Cloud Regression E2E Tests
+on:
+ push:
+ branches: [master]
+ paths:
+ - 'CMakeLists.txt'
+ - '**.c'
+ - '**.cc'
+ - '**.cpp'
+ - '**.h'
+ - 'mqtt_websockets/**'
+ - 'aclk/aclk-schemas/**'
+jobs:
+ trigger_cloud_regression_tests:
+ runs-on: ubuntu-latest
+ if: github.repository == 'netdata/netdata'
+ steps:
+ - name: Evaluate workflow dispatch parameters
+ env:
+ PR_REPO_NAME: ${{ github.event.pull_request.head.repo.full_name }}
+ PR_BRANCH_NAME: ${{ github.event.pull_request.head.ref }}
+ PR_COMMIT_HASH: ${{ github.event.pull_request.head.sha }}
+ id: output-workflow-dispatch-params
+ run: |
+ if [ ${{ github.event_name }} == 'pull_request_target' ]; then
+ NETDATA_CUSTOM_REPO="$PR_REPO_NAME"
+ NETDATA_CUSTOM_BRANCH="$PR_BRANCH_NAME"
+ NETDATA_CUSTOM_PR_NUMBER="${{ github.event.number }}"
+ NETDATA_CUSTOM_COMMIT_HASH="$PR_COMMIT_HASH"
+ elif [ ${{ github.event_name }} == 'push' ]; then
+ NETDATA_CUSTOM_REPO="netdata/netdata"
+ NETDATA_CUSTOM_BRANCH="master"
+ NETDATA_CUSTOM_PR_NUMBER=""
+ NETDATA_CUSTOM_COMMIT_HASH="${{ github.sha }}"
+ fi
+ echo "::set-output name=netdata_repo::${NETDATA_CUSTOM_REPO}"
+ echo "::set-output name=netdata_branch::${NETDATA_CUSTOM_BRANCH}"
+ echo "::set-output name=netdata_pr_number::${NETDATA_CUSTOM_PR_NUMBER}"
+ echo "::set-output name=netdata_commit_hash::${NETDATA_CUSTOM_COMMIT_HASH}"
+
+ - name: Trigger Cloud Regression
+ uses: aurelien-baudet/workflow-dispatch@v2
+ with:
+ repo: netdata/test-automation
+ ref: refs/heads/master
+ workflow: regression.yml
+ token: ${{ secrets.NETDATABOT_GITHUB_TOKEN }}
+ inputs: '{ "netdata_branch": "${{ steps.output-workflow-dispatch-params.outputs.netdata_branch }}",
+ "netdata_repo": "${{ steps.output-workflow-dispatch-params.outputs.netdata_repo }}",
+ "netdata_pr_number": "${{ steps.output-workflow-dispatch-params.outputs.netdata_pr_number }}",
+ "netdata_branch_commit_hash": "${{ steps.output-workflow-dispatch-params.outputs.netdata_commit_hash }}",
+ "custom_netdata_image": "true"
+ }'
+ wait-for-completion: false
diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml
new file mode 100644
index 0000000..021376a
--- /dev/null
+++ b/.github/workflows/codeql.yml
@@ -0,0 +1,117 @@
+---
+# Run CodeQL to analyze C/C++ and Python code.
+name: CodeQL
+on:
+ pull_request:
+ types: [opened, reopened, labeled, synchronize]
+ branches: [master]
+ push:
+ branches: [master]
+ schedule:
+ - cron: "27 2 * * 1"
+env:
+ DISABLE_TELEMETRY: 1
+concurrency:
+ group: codeql-${{ github.ref }}
+ cancel-in-progress: true
+jobs:
+ prepare:
+ name: Prepare Jobs
+ runs-on: ubuntu-latest
+ outputs:
+ cpp: ${{ steps.cpp.outputs.run }}
+ python: ${{ steps.python.outputs.run }}
+ steps:
+ - name: Clone repository
+ uses: actions/checkout@v3
+ with:
+ submodules: recursive
+ fetch-depth: 0
+ - name: Check if we should always run
+ id: always
+ run: |
+ if [ "${{ github.event_name }}" = "pull_request" ]; then
+ if [ "${{ contains(github.event.pull_request.labels.*.name, 'run-ci/codeql') }}" = "true" ]; then
+ echo '::set-output name=run::true'
+ echo '::notice::Found ci/codeql label, unconditionally running all CodeQL checks.'
+ else
+ echo '::set-output name=run::false'
+ fi
+ else
+ echo '::set-output name=run::true'
+ fi
+ - name: Check for C/C++ changes
+ id: cpp
+ run: |
+ if [ "${{ steps.always.outputs.run }}" = "false" ]; then
+ if git diff --name-only origin/${{ github.base_ref }} HEAD | grep -Eq '.*\.[ch](xx|\+\+)?' ; then
+ echo '::set-output name=run::true'
+ echo '::notice::C/C++ code has changed, need to run CodeQL.'
+ else
+ echo '::set-output name=run::false'
+ fi
+ else
+ echo '::set-output name=run::true'
+ fi
+ - name: Check for python changes
+ id: python
+ run: |
+ if [ "${{ steps.always.outputs.run }}" = "false" ]; then
+ if git diff --name-only origin/${{ github.base_ref }} HEAD | grep -Eq 'collectors/python.d.plugin/.*\.py' ; then
+ echo '::set-output name=run::true'
+ echo '::notice::Python code has changed, need to run CodeQL.'
+ else
+ echo '::set-output name=run::false'
+ fi
+ else
+ echo '::set-output name=run::true'
+ fi
+
+ analyze-cpp:
+ name: Analyze C/C++
+ runs-on: ubuntu-latest
+ needs: prepare
+ if: needs.prepare.outputs.cpp == 'true'
+ permissions:
+ security-events: write
+ steps:
+ - name: Git clone repository
+ uses: actions/checkout@v3
+ with:
+ submodules: recursive
+ fetch-depth: 0
+ - name: Initialize CodeQL
+ uses: github/codeql-action/init@v2
+ with:
+ languages: cpp
+ - 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 --one-time-build
+ - name: Run CodeQL
+ uses: github/codeql-action/analyze@v2
+ with:
+ category: "/language:cpp"
+
+ analyze-python:
+ name: Analyze Python
+ runs-on: ubuntu-latest
+ needs: prepare
+ if: needs.prepare.outputs.python == 'true'
+ permissions:
+ security-events: write
+ steps:
+ - name: Git clone repository
+ uses: actions/checkout@v3
+ with:
+ submodules: recursive
+ fetch-depth: 0
+ - name: Initialize CodeQL
+ uses: github/codeql-action/init@v2
+ with:
+ config-file: ./.github/codeql/python-config.yml
+ languages: python
+ - name: Run CodeQL
+ uses: github/codeql-action/analyze@v2
+ with:
+ category: "/language:python"
diff --git a/.github/workflows/coverity.yml b/.github/workflows/coverity.yml
new file mode 100644
index 0000000..9d1119a
--- /dev/null
+++ b/.github/workflows/coverity.yml
@@ -0,0 +1,63 @@
+---
+# 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
+env:
+ DISABLE_TELEMETRY: 1
+concurrency:
+ group: coverity-${{ github.ref }}
+ cancel-in-progress: true
+jobs:
+ coverity:
+ if: github.repository == 'netdata/netdata'
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v3
+ id: checkout
+ with:
+ submodules: recursive
+ - name: Prepare environment
+ id: prepare
+ 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
+ id: run
+ env:
+ REPOSITORY: 'netdata/netdata'
+ COVERITY_SCAN_TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
+ COVERITY_SCAN_SUBMIT_MAIL: ${{ secrets.COVERITY_SCAN_SUBMIT_MAIL }}
+ run: |
+ bash -x ./coverity-scan.sh --with-install
+ - name: Failure Notification
+ uses: rtCamp/action-slack-notify@v2
+ env:
+ SLACK_COLOR: 'danger'
+ SLACK_FOOTER: ''
+ SLACK_ICON_EMOJI: ':github-actions:'
+ SLACK_TITLE: 'Coverity run failed:'
+ SLACK_USERNAME: 'GitHub Actions'
+ SLACK_MESSAGE: |-
+ ${{ github.repository }}: Coverity failed to run correctly.
+ Checkout: ${{ steps.checkout.outcome }}
+ Environment preparation: ${{ steps.prepare.outcome }}
+ Coverity run: ${{ steps.run.outcome }}
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
+ if: ${{
+ failure()
+ && github.event_name != 'pull_request'
+ && startsWith(github.ref, 'refs/heads/master')
+ }}
diff --git a/.github/workflows/dashboard-pr.yml b/.github/workflows/dashboard-pr.yml
new file mode 100644
index 0000000..c99f989
--- /dev/null
+++ b/.github/workflows/dashboard-pr.yml
@@ -0,0 +1,54 @@
+---
+# Create a PR to update the react dashboard code.
+name: Dashboard Version PR
+
+on:
+ workflow_dispatch:
+ inputs:
+ dashboard_version:
+ # This must be specified, and must _exactly_ match the version
+ # tag for the release to be used for the update.
+ description: Dashboard Version
+ required: true
+
+env:
+ DISABLE_TELEMETRY: 1
+
+jobs:
+ dashboard-pr:
+ name: Generate Dashboard Version Bump PR
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ id: checkout
+ uses: actions/checkout@v3
+ - name: Update Files
+ id: update
+ run: |
+ web/gui/bundle_dashboard.py ${{ github.event.inputs.dashboard_version }}
+ - name: Create Pull Request
+ id: pr
+ uses: peter-evans/create-pull-request@v4
+ with:
+ title: 'Update dashboard to version ${{ github.event.inputs.dashboard_version }}.'
+ body: 'See https://github.com/netdata/dashboard/releases/tag/${{ github.event.inputs.dashboard_version }} for changes.'
+ branch: dashboard-${{ github.event.inputs.dashboard_version }}
+ branch-suffix: timestamp
+ delete-branch: true
+ commit-message: 'Update dashboard to version ${{ github.event.inputs.dashboard_version }}.'
+ token: ${{ secrets.NETDATABOT_GITHUB_TOKEN }}
+ - name: Failure Notification
+ uses: rtCamp/action-slack-notify@v2
+ env:
+ SLACK_COLOR: 'danger'
+ SLACK_FOOTER: ''
+ SLACK_ICON_EMOJI: ':github-actions:'
+ SLACK_TITLE: 'Dashboard update PR creation failed:'
+ SLACK_USERNAME: 'GitHub Actions'
+ SLACK_MESSAGE: |-
+ ${{ github.repository }}: Failed to create PR to update dashboard code to newest release.
+ Checkout: ${{ steps.checkout.outcome }}
+ Update files: ${{ steps.update.outcome }}
+ Create PR: ${{ steps.pr.outcome }}
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
+ if: failure()
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml
new file mode 100644
index 0000000..b7eb53c
--- /dev/null
+++ b/.github/workflows/docker.yml
@@ -0,0 +1,298 @@
+---
+name: Docker
+on:
+ push:
+ branches:
+ - master
+ pull_request: null
+ workflow_dispatch:
+ inputs:
+ version:
+ description: Version Tag
+ default: nightly
+ required: true
+env:
+ DISABLE_TELEMETRY: 1
+concurrency:
+ group: docker-${{ github.ref }}-${{ github.event_name }}
+ cancel-in-progress: true
+jobs:
+ docker-test:
+ name: Docker Runtime Test
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ id: checkout
+ uses: actions/checkout@v3
+ with:
+ submodules: recursive
+ - name: Setup Buildx
+ id: prepare
+ uses: docker/setup-buildx-action@v2
+ - name: Test Build
+ id: build
+ uses: docker/build-push-action@v3
+ with:
+ load: true
+ push: false
+ tags: netdata/netdata:test
+ - name: Test Image
+ id: test
+ run: .github/scripts/docker-test.sh
+ - name: Failure Notification
+ uses: rtCamp/action-slack-notify@v2
+ env:
+ SLACK_COLOR: 'danger'
+ SLACK_FOOTER: ''
+ SLACK_ICON_EMOJI: ':github-actions:'
+ SLACK_TITLE: 'Docker runtime testing failed:'
+ SLACK_USERNAME: 'GitHub Actions'
+ SLACK_MESSAGE: |-
+ ${{ github.repository }}: Building or testing Docker image for linux/amd64 failed.
+ CHeckout: ${{ steps.checkout.outcome }}
+ Setup buildx: ${{ steps.prepare.outcome }}
+ Build image: ${{ steps.build.outcome }}
+ Test image: ${{ steps.test.outcome }}
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
+ if: >-
+ ${{
+ failure()
+ && github.event_name != 'pull_request'
+ && startsWith(github.ref, 'refs/heads/master')
+ && github.repository == 'netdata/netdata'
+ }}
+
+ docker-ci:
+ if: github.event_name != 'workflow_dispatch'
+ name: Docker Alt Arch Builds
+ needs: docker-test
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ platforms:
+ - linux/i386
+ - linux/arm/v7
+ - linux/arm64
+ - linux/ppc64le
+ steps:
+ - name: Checkout
+ id: checkout
+ uses: actions/checkout@v3
+ with:
+ submodules: recursive
+ - name: Setup QEMU
+ id: qemu
+ if: matrix.platforms != 'linux/i386'
+ uses: docker/setup-qemu-action@v2
+ - name: Setup Buildx
+ id: buildx
+ uses: docker/setup-buildx-action@v2
+ - name: Build
+ id: build
+ uses: docker/build-push-action@v3
+ with:
+ platforms: ${{ matrix.platforms }}
+ load: false
+ push: false
+ tags: netdata/netdata:test
+ - name: Failure Notification
+ uses: rtCamp/action-slack-notify@v2
+ env:
+ SLACK_COLOR: 'danger'
+ SLACK_FOOTER: ''
+ SLACK_ICON_EMOJI: ':github-actions:'
+ SLACK_TITLE: 'Docker build testing failed:'
+ SLACK_USERNAME: 'GitHub Actions'
+ SLACK_MESSAGE: |-
+ ${{ github.repository }}: Building Docker image for ${{ matrix.platforms }} failed.
+ CHeckout: ${{ steps.checkout.outcome }}
+ Setup QEMU: ${{ steps.qemu.outcome }}
+ Setup buildx: ${{ steps.buildx.outcome }}
+ Build image: ${{ steps.build.outcome }}
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
+ if: >-
+ ${{
+ failure()
+ && github.event_name != 'pull_request'
+ && startsWith(github.ref, 'refs/heads/master')
+ && github.repository == 'netdata/netdata'
+ }}
+
+ normalize-tag: # Fix the release tag if needed
+ name: Normalize Release Tag
+ runs-on: ubuntu-latest
+ if: github.event_name == 'workflow_dispatch'
+ outputs:
+ tag: ${{ steps.tag.outputs.tag }}
+ steps:
+ - name: Normalize Tag
+ id: tag
+ run: |
+ if echo ${{ github.event.inputs.version }} | grep -qE '^[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+$'; then
+ echo "::set-output name=tag::v${{ github.event.inputs.version }}"
+ else
+ echo "::set-output name=tag::${{ github.event.inputs.version }}"
+ fi
+
+ docker-publish:
+ if: github.event_name == 'workflow_dispatch'
+ name: Docker Build and Publish
+ needs:
+ - docker-test
+ - normalize-tag
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ id: checkout
+ uses: actions/checkout@v3
+ with:
+ submodules: recursive
+ - name: Determine which tags to use
+ id: release-tags
+ if: github.event.inputs.version != 'nightly'
+ run: |
+ echo "tags=netdata/netdata:latest,netdata/netdata:stable,$(.github/scripts/gen-docker-tags.py ${{ needs.normalize-tag.outputs.tag }} '')" \
+ >> "${GITHUB_ENV}"
+ - name: Determine which tags to use
+ id: nightly-tags
+ if: github.event.inputs.version == 'nightly'
+ run: |
+ echo "tags=netdata/netdata:latest,netdata/netdata:edge" >> "${GITHUB_ENV}"
+ - name: Mark image as official
+ id: env
+ if: github.repository == 'netdata/netdata'
+ run: echo "OFFICIAL_IMAGE=true" >> "${GITHUB_ENV}"
+ - name: Setup QEMU
+ id: qemu
+ uses: docker/setup-qemu-action@v2
+ - name: Setup Buildx
+ id: buildx
+ uses: docker/setup-buildx-action@v2
+ - name: Docker Hub Login
+ id: login
+ if: github.repository == 'netdata/netdata'
+ uses: docker/login-action@v2
+ with:
+ username: ${{ secrets.DOCKER_HUB_USERNAME }}
+ password: ${{ secrets.DOCKER_HUB_PASSWORD }}
+ - name: Docker Build
+ id: build
+ uses: docker/build-push-action@v3
+ with:
+ platforms: linux/amd64,linux/i386,linux/arm/v7,linux/arm64,linux/ppc64le
+ push: ${{ github.repository == 'netdata/netdata' }}
+ tags: ${{ env.tags }}
+ build-args: OFFICIAL_IMAGE=${{ env.OFFICIAL_IMAGE }}
+ - name: Failure Notification
+ uses: rtCamp/action-slack-notify@v2
+ env:
+ SLACK_COLOR: 'danger'
+ SLACK_FOOTER: ''
+ SLACK_ICON_EMOJI: ':github-actions:'
+ SLACK_TITLE: 'Docker Build failed:'
+ SLACK_USERNAME: 'GitHub Actions'
+ SLACK_MESSAGE: |-
+ ${{ github.repository }}: Failed to build or publish Docker images.
+ CHeckout: ${{ steps.checkout.outcome }}
+ Generate release tags: ${{ steps.release-tags.outcome }}
+ Generate nightly tags: ${{ steps.nightly-tags.outcome }}
+ Setup environment: ${{ steps.env.outcome }}
+ Setup QEMU: ${{ steps.qemu.outcome }}
+ Setup buildx: ${{ steps.buildx.outcome }}
+ Authenticate against DockerHub: ${{ steps.login.outcome }}
+ Build and publish images: ${{ steps.build.outcome }}
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
+ if: >-
+ ${{
+ failure()
+ && github.event_name != 'pull_request'
+ && startsWith(github.ref, 'refs/heads/master')
+ && github.repository == 'netdata/netdata'
+ }}
+ - name: Trigger Helmchart PR
+ if: github.event_name == 'workflow_dispatch' && github.event.inputs.version != 'nightly' && github.repository == 'netdata/netdata'
+ uses: benc-uk/workflow-dispatch@v1
+ with:
+ token: ${{ secrets.NETDATABOT_GITHUB_TOKEN }}
+ repo: netdata/helmchart
+ workflow: Agent Version PR
+ ref: refs/heads/master
+ inputs: '{"agent_version": "${{ needs.normalize-tag.outputs.tag }}"}'
+
+ docker-dbg-publish:
+ if: github.event_name == 'workflow_dispatch'
+ name: Docker Build and Publish (Debuging Image)
+ needs:
+ - docker-test
+ - normalize-tag
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ id: checkout
+ uses: actions/checkout@v3
+ with:
+ submodules: recursive
+ - name: Determine which tags to use
+ id: release-tags
+ if: github.event.inputs.version != 'nightly'
+ run: |
+ echo "tags=netdata/netdata-debug:latest,netdata/netdata-debug:stable,$(.github/scripts/gen-docker-tags.py ${{ needs.normalize-tag.outputs.tag }} '-debug')" \
+ >> "${GITHUB_ENV}"
+ - name: Determine which tags to use
+ id: nightly-tags
+ if: github.event.inputs.version == 'nightly'
+ run: |
+ echo "tags=netdata/netdata-debug:latest,netdata/netdata-debug:edge" >> "${GITHUB_ENV}"
+ - name: Mark image as official
+ id: env
+ if: github.repository == 'netdata/netdata'
+ run: echo "OFFICIAL_IMAGE=true" >> "${GITHUB_ENV}"
+ - name: Setup QEMU
+ id: qemu
+ uses: docker/setup-qemu-action@v2
+ - name: Setup Buildx
+ id: buildx
+ uses: docker/setup-buildx-action@v2
+ - name: Docker Hub Login
+ id: login
+ if: github.repository == 'netdata/netdata'
+ uses: docker/login-action@v2
+ with:
+ username: ${{ secrets.DOCKER_HUB_USERNAME }}
+ password: ${{ secrets.DOCKER_HUB_PASSWORD }}
+ - name: Docker Build
+ id: build
+ uses: docker/build-push-action@v3
+ with:
+ platforms: linux/amd64,linux/i386,linux/arm/v7,linux/arm64,linux/ppc64le
+ push: ${{ github.repository == 'netdata/netdata' }}
+ tags: ${{ env.tags }}
+ build-args: |
+ OFFICIAL_IMAGE=${{ env.OFFICIAL_IMAGE }}
+ DEBUG_BUILD=1
+ - name: Failure Notification
+ uses: rtCamp/action-slack-notify@v2
+ env:
+ SLACK_COLOR: 'danger'
+ SLACK_FOOTER: ''
+ SLACK_ICON_EMOJI: ':github-actions:'
+ SLACK_TITLE: 'Docker Debug Build failed:'
+ SLACK_USERNAME: 'GitHub Actions'
+ SLACK_MESSAGE: |-
+ ${{ github.repository }}: Failed to build or publish Docker debug images.
+ CHeckout: ${{ steps.checkout.outcome }}
+ Generate release tags: ${{ steps.release-tags.outcome }}
+ Generate nightly tags: ${{ steps.nightly-tags.outcome }}
+ Setup environment: ${{ steps.env.outcome }}
+ Setup QEMU: ${{ steps.qemu.outcome }}
+ Setup buildx: ${{ steps.buildx.outcome }}
+ Authenticate against DockerHub: ${{ steps.login.outcome }}
+ Build and publish images: ${{ steps.build.outcome }}
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
+ if: >-
+ ${{
+ failure()
+ && github.event_name != 'pull_request'
+ && startsWith(github.ref, 'refs/heads/master')
+ && github.repository == 'netdata/netdata'
+ }}
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
new file mode 100644
index 0000000..69fda40
--- /dev/null
+++ b/.github/workflows/docs.yml
@@ -0,0 +1,29 @@
+---
+name: Docs
+on:
+ push:
+ branches:
+ - master
+ paths:
+ - '**.md'
+ pull_request:
+ paths:
+ - '**.md'
+env:
+ DISABLE_TELEMETRY: 1
+jobs:
+ markdown-link-check:
+ name: Broken Links
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v3
+ with:
+ submodules: recursive
+ - 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..0854080
--- /dev/null
+++ b/.github/workflows/labeler.yml
@@ -0,0 +1,18 @@
+---
+# Handles labelling of PR's.
+name: Pull Request Labeler
+on:
+ schedule:
+ - cron: '*/10 * * * *'
+env:
+ DISABLE_TELEMETRY: 1
+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/packagecloud.yml b/.github/workflows/packagecloud.yml
new file mode 100644
index 0000000..ba70c17
--- /dev/null
+++ b/.github/workflows/packagecloud.yml
@@ -0,0 +1,36 @@
+---
+# Runs PackageCloud cleanup every day at 9pm
+name: PackageCloud Cleanup
+on:
+ schedule:
+ - cron: '0 21 * * *'
+ workflow_dispatch: null
+
+jobs:
+ cleanup:
+ name: PackageCloud Cleanup
+ runs-on: ubuntu-latest
+ if: github.repository == 'netdata/netdata'
+ strategy:
+ fail-fast: false
+ matrix:
+ repos:
+ - stable
+ - edge
+ - devel
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v3
+ id: checkout
+ with:
+ submodules: recursive
+ - name: Prepare environment
+ id: prepare
+ run: |
+ pip3 install requests python-dateutil
+ - name: Run PackageCloud Cleanup
+ id: cleanup
+ env:
+ PKGCLOUD_TOKEN: ${{ secrets.PACKAGE_CLOUD_API_KEY }}
+ run: |
+ python3 .github/scripts/netdata-pkgcloud-cleanup.py -r ${{ matrix.repos }}
diff --git a/.github/workflows/packaging.yml b/.github/workflows/packaging.yml
new file mode 100644
index 0000000..ddd8356
--- /dev/null
+++ b/.github/workflows/packaging.yml
@@ -0,0 +1,279 @@
+---
+# Handles building of binary packages for the agent.
+name: Packages
+on:
+ pull_request:
+ types:
+ - opened
+ - reopened
+ - labeled
+ - synchronize
+ branches:
+ - master
+ push:
+ branches:
+ - master
+ workflow_dispatch:
+ inputs:
+ type:
+ description: Package build type
+ default: devel
+ required: true
+ version:
+ description: Package version
+ required: false
+env:
+ DISABLE_TELEMETRY: 1
+ REPO_PREFIX: netdata/netdata
+concurrency:
+ group: packages-${{ github.ref }}-${{ github.event_name }}
+ cancel-in-progress: true
+jobs:
+ matrix:
+ name: Prepare Build Matrix
+ runs-on: ubuntu-latest
+ outputs:
+ matrix: ${{ steps.set-matrix.outputs.matrix }}
+ steps:
+ - name: Checkout
+ id: checkout
+ uses: actions/checkout@v3
+ - name: Prepare tools
+ id: prepare
+ run: |
+ sudo apt-get update && sudo apt-get install -y python3-ruamel.yaml
+ - name: Read build matrix
+ id: set-matrix
+ shell: python3 {0}
+ run: |
+ from ruamel.yaml import YAML
+ import json
+ import re
+ import os
+ ALWAYS_RUN_ARCHES = ["amd64", "x86_64"]
+ yaml = YAML(typ='safe')
+ entries = list()
+ run_limited = False
+
+ with open('.github/data/distros.yml') as f:
+ data = yaml.load(f)
+
+ if "${{ github.event_name }}" == "pull_request" and "${{ !contains(github.event.pull_request.labels.*.name, 'run-ci/packaging') }}":
+ run_limited = True
+
+ for i, v in enumerate(data['include']):
+ if 'packages' in data['include'][i]:
+ for arch in data['include'][i]['packages']['arches']:
+ if arch in ALWAYS_RUN_ARCHES or not run_limited:
+ entries.append({
+ 'distro': data['include'][i]['distro'],
+ 'version': data['include'][i]['version'],
+ 'repo_distro': data['include'][i]['packages']['repo_distro'],
+ 'format': data['include'][i]['packages']['type'],
+ 'base_image': data['include'][i]['base_image'] if 'base_image' in data['include'][i] else data['include'][i]['distro'],
+ 'platform': data['platform_map'][arch],
+ 'arch': arch
+ })
+
+ entries.sort(key=lambda k: (data['arch_order'].index(k['arch']), k['distro'], k['version']))
+ matrix = json.dumps({'include': entries}, sort_keys=True)
+ print('Generated Matrix: ' + matrix)
+ print('::set-output name=matrix::' + matrix)
+ - name: Failure Notification
+ uses: rtCamp/action-slack-notify@v2
+ env:
+ SLACK_COLOR: 'danger'
+ SLACK_ICON_EMOJI: ':github-actions:'
+ SLACK_TITLE: 'Package Build matrix generation failed:'
+ SLACK_USERNAME: 'GitHub Actions'
+ SLACK_MESSAGE: |-
+ ${{ github.repository }}: Failed to generate build matrix for package build.
+ Checkout: ${{ steps.checkout.outcome }}
+ Prepare Tools: ${{ steps.prepare.outcome }}
+ Read Build Matrix: ${{ steps.set-matrix.outcome }}
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
+ if: >-
+ ${{
+ failure()
+ && github.event_name != 'pull_request'
+ && startsWith(github.ref, 'refs/heads/master')
+ && github.repository == 'netdata/netdata'
+ }}
+
+ version-check:
+ name: Version check
+ runs-on: ubuntu-latest
+ outputs:
+ repo: ${{ steps.check-version.outputs.repo }}
+ version: ${{ steps.check-version.outputs.version }}
+ retention: ${{ steps.check-version.outputs.retention }}
+ steps:
+ - name: Checkout
+ id: checkout
+ uses: actions/checkout@v3
+ - name: Check Version
+ id: check-version
+ run: |
+ if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
+ case "${{ github.event.inputs.type }}" in
+ "release")
+ echo "::set-output name=repo::${REPO_PREFIX}"
+ echo "::set-output name=version::${{ github.event.inputs.version }}"
+ echo "::set-output name=retention::365"
+ ;;
+ "nightly")
+ echo "::set-output name=repo::${REPO_PREFIX}-edge"
+ echo "::set-output name=version::$(tr -d 'v' < packaging/version)"
+ echo "::set-output name=retention::30"
+ ;;
+ *)
+ echo "::set-output name=repo::${REPO_PREFIX}-devel"
+ echo "::set-output name=version::0.${GITHUB_SHA}"
+ echo "::set-output name=retention::30"
+ ;;
+ esac
+ else
+ echo "::set-output name=version::$(cut -d'-' -f 1 packaging/version | tr -d 'v')"
+ echo "::set-output name=retention::0"
+ fi
+ - name: Failure Notification
+ uses: rtCamp/action-slack-notify@v2
+ env:
+ SLACK_COLOR: 'danger'
+ SLACK_ICON_EMOJI: ':github-actions:'
+ SLACK_TITLE: 'Package Build version check failed:'
+ SLACK_USERNAME: 'GitHub Actions'
+ SLACK_MESSAGE: |-
+ ${{ github.repository }}: Failed to generate version information for package build.
+ Checkout: ${{ steps.checkout.outcome }}
+ Check Version: ${{ steps.check-version.outcome }}
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
+ if: >-
+ ${{
+ failure()
+ && github.event_name != 'pull_request'
+ && startsWith(github.ref, 'refs/heads/master')
+ && github.repository == 'netdata/netdata'
+ }}
+
+ build:
+ name: Build
+ runs-on: ubuntu-latest
+ env:
+ DOCKER_CLI_EXPERIMENTAL: enabled
+ needs:
+ - matrix
+ - version-check
+ strategy:
+ matrix: ${{ fromJson(needs.matrix.outputs.matrix) }}
+ # We intentiaonally disable the fail-fast behavior so that a
+ # build failure for one version doesn't prevent us from publishing
+ # successfully built and tested packages for another version.
+ fail-fast: false
+ max-parallel: 8
+ steps:
+ - name: Checkout
+ id: checkout
+ uses: actions/checkout@v3
+ with:
+ fetch-depth: 0 # We need full history for versioning
+ submodules: recursive
+ - name: Setup QEMU
+ id: qemu
+ if: matrix.platform != 'linux/amd64' && matrix.platform != 'linux/i386'
+ uses: docker/setup-qemu-action@v2
+ - name: Prepare Docker Environment
+ id: docker-config
+ shell: bash
+ run: |
+ echo '{"cgroup-parent": "/actions_job", "experimental": true}' | sudo tee /etc/docker/daemon.json 2>/dev/null
+ sudo service docker restart
+ - name: Fetch images
+ id: fetch-images
+ uses: nick-invision/retry@v2
+ with:
+ max_attempts: 3
+ retry_wait_seconds: 30
+ timeout_seconds: 900
+ command: |
+ docker pull --platform ${{ matrix.platform }} ${{ matrix.base_image }}:${{ matrix.version }}
+ docker pull --platform ${{ matrix.platform }} netdata/package-builders:${{ matrix.distro }}${{ matrix.version }}
+ - name: Build Packages
+ id: build
+ shell: bash
+ run: |
+ docker run --security-opt seccomp=unconfined -e DISABLE_TELEMETRY=1 -e VERSION=${{ needs.version-check.outputs.version }} \
+ --platform=${{ matrix.platform }} -v "$PWD":/netdata netdata/package-builders:${{ matrix.distro }}${{ matrix.version }}
+ - name: Save Packages
+ id: artifacts
+ continue-on-error: true
+ uses: actions/upload-artifact@v3
+ with:
+ name: ${{ matrix.distro }}-${{ matrix.version }}-${{ matrix.arch }}-packages
+ path: ${{ github.workspace }}/artifacts/*
+ - name: Test Packages
+ id: test
+ shell: bash
+ run: |
+ docker run --security-opt seccomp=unconfined -e DISABLE_TELEMETRY=1 -e DISTRO=${{ matrix.distro }} \
+ -e VERSION=${{ needs.version-check.outputs.version }} -e DISTRO_VERSION=${{ matrix.version }} \
+ --platform=${{ matrix.platform }} -v "$PWD":/netdata ${{ matrix.base_image }}:${{ matrix.version }} \
+ /netdata/.github/scripts/pkg-test.sh
+ - name: SSH setup
+ id: ssh-setup
+ if: github.event_name == 'workflow_dispatch' && github.repository == 'netdata/netdata'
+ continue-on-error: true
+ uses: shimataro/ssh-key-action@v2
+ with:
+ key: ${{ secrets.NETDATABOT_PACKAGES_SSH_KEY }}
+ name: id_ecdsa
+ known_hosts: ${{ secrets.PACKAGES_KNOWN_HOSTS }}
+ - name: Upload to packages.netdata.cloud
+ id: package-upload
+ continue-on-error: true
+ if: github.event_name == 'workflow_dispatch' && github.repository == 'netdata/netdata'
+ run: |
+ .github/scripts/package-upload.sh \
+ ${{ matrix.repo_distro }} \
+ ${{ matrix.arch }} \
+ ${{ matrix.format }} \
+ ${{ needs.version-check.outputs.repo }}
+ - name: Upload to PackageCloud
+ id: upload
+ if: github.event_name == 'workflow_dispatch' && github.repository == 'netdata/netdata'
+ shell: bash
+ env:
+ PKG_CLOUD_TOKEN: ${{ secrets.PACKAGE_CLOUD_API_KEY }}
+ run: |
+ printf "Packages to upload:\n%s" "$(ls artifacts/*.${{ matrix.format }})"
+ for pkgfile in artifacts/*.${{ matrix.format }} ; do
+ .github/scripts/package_cloud_wrapper.sh yank ${{ needs.version-check.outputs.repo }}/${{ matrix.repo_distro }} \
+ "$(basename "${pkgfile}")" || true
+ .github/scripts/package_cloud_wrapper.sh push ${{ needs.version-check.outputs.repo }}/${{ matrix.repo_distro }} "${pkgfile}"
+ done
+ - name: Failure Notification
+ uses: rtCamp/action-slack-notify@v2
+ env:
+ SLACK_COLOR: 'danger'
+ SLACK_ICON_EMOJI: ':github-actions:'
+ SLACK_TITLE: 'Package Build failed:'
+ SLACK_USERNAME: 'GitHub Actions'
+ SLACK_MESSAGE: |-
+ ${{ github.repository }}: ${{ matrix.repo_distro }} ${{ matrix.version }} package build for ${{ matrix.arch }} failed.
+ Checkout: ${{ steps.checkout.outcome }}
+ Setup QEMU: ${{ steps.qemu.outcome }}
+ Setup Docker: ${{ steps.docker-config.outcome }}
+ Fetch images: ${{ steps.fetch-images.outcome }}
+ Build: ${{ steps.build.outcome }}
+ Test: ${{ steps.test.outcome }}
+ Import SSH Key: ${{ steps.ssh-setup.outcome }}
+ Publish to packages.netdata.cloud: ${{ steps.package-upload.outcome }}
+ Publish to PackageCloud: ${{ steps.upload.outcome }}
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
+ if: >-
+ ${{
+ failure()
+ && github.event_name != 'pull_request'
+ && startsWith(github.ref, 'refs/heads/master')
+ && github.repository == 'netdata/netdata'
+ }}
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 0000000..e16ecab
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,214 @@
+---
+# Workflow for triggering a release.
+name: Release
+on:
+ schedule:
+ - cron: '0 0 * * *'
+ workflow_dispatch: # Dispatch runs build and validate, then push to the appropriate storage location.
+ inputs:
+ type:
+ description: Build Type
+ default: nightly
+ required: true
+ version:
+ description: Version Tag
+ default: nightly
+ required: true
+concurrency: # This keeps multiple instances of the job from running concurrently for the same ref and event type.
+ group: release-${{ github.ref }}-${{ github.event_name }}
+ cancel-in-progress: true
+jobs:
+ update-changelogs:
+ name: Update changelog
+ runs-on: ubuntu-latest
+ outputs:
+ ref: ${{ steps.target.outputs.ref }}
+ version: ${{ steps.target.outputs.version }}
+ type: ${{ steps.target.outputs.type }}
+ run: ${{ steps.target.outputs.run }}
+ steps:
+ - name: Checkout
+ id: checkout
+ uses: actions/checkout@v2
+ with:
+ fetch-depth: 0
+ submodules: recursive
+ token: ${{ secrets.NETDATABOT_GITHUB_TOKEN }}
+ - name: Prepare base ref
+ id: target
+ run: >-
+ .github/scripts/prepare-release-base.sh \
+ ${{ github.repository }} \
+ ${{ github.event_name }} \
+ ${{ github.event.inputs.type }} \
+ ${{ github.event.inputs.version }} \
+ ${{ secrets.NETDATA_RELEASE_TEST }}
+ - name: Generate Nightly Changleog
+ id: nightly-changelog
+ if: steps.target.outputs.run == 'true' && steps.target.outputs.type == 'nightly'
+ uses: heinrichreimer/github-changelog-generator-action@v2.3
+ with:
+ bugLabels: IGNOREBUGS
+ excludeLabels: "stale,duplicate,question,invalid,wontfix,discussion,no changelog"
+ issues: false
+ sinceTag: v1.10.0
+ token: ${{ secrets.NETDATABOT_GITHUB_TOKEN }}
+ unreleasedLabel: "**Next release**"
+ verbose: true
+ maxIssues: 500
+ - name: Generate Release Changelog
+ id: release-changelog
+ if: steps.target.outputs.run == 'true' && steps.target.outputs.type != 'nightly'
+ uses: heinrichreimer/github-changelog-generator-action@v2.3
+ with:
+ bugLabels: IGNOREBUGS
+ excludeLabels: "stale,duplicate,question,invalid,wontfix,discussion,no changelog"
+ futureRelease: ${{ github.event.inputs.version }}
+ issues: false
+ sinceTag: v1.10.0
+ token: ${{ secrets.NETDATABOT_GITHUB_TOKEN }}
+ unreleasedLabel: "**Next release**"
+ verbose: true
+ maxIssues: 500
+ - name: Commit Changes
+ id: commit
+ if: steps.target.outputs.run == 'true'
+ env:
+ GITHUB_TOKEN: ${{ secrets.NETDATABOT_GITHUB_TOKEN }}
+ run: |
+ git config user.name "netdatabot"
+ git config user.email "bot@netdata.cloud"
+ git add packaging/version CHANGELOG.md
+ git commit -m "[ci skip] ${{ steps.target.outputs.message }}"
+ if [ "${{ steps.target.outputs.type }}" != "nightly" ]; then
+ git tag -a "${{ github.event.inputs.version }}" -m "${{ steps.target.outputs.message }}"
+ fi
+ if [ -n "${{ steps.target.outputs.new-branch }}" ]; then
+ git branch "${{ steps.target.outputs.new-branch }}"
+ fi
+ git push --tags origin "${{ steps.target.outputs.branch }}"
+ if [ -n "${{ steps.target.outputs.new-branch }}" ]; then
+ git push origin "${{ steps.target.outputs.new-branch }}"
+ fi
+ - name: Failure Notification
+ uses: rtCamp/action-slack-notify@v2
+ env:
+ SLACK_COLOR: 'danger'
+ SLACK_FOOTER: ''
+ SLACK_ICON_EMOJI: ':github-actions:'
+ SLACK_TITLE: 'Failed to prepare changelog:'
+ SLACK_USERNAME: 'GitHub Actions'
+ SLACK_MESSAGE: |-
+ ${{ github.repository }}: Failed to prepare changelog.
+ Checkout: ${{ steps.checkout.outcome }}
+ Prepare base ref: ${{ steps.target.outcome }}
+ Generate nightly changelog: ${{ steps.nightly-changelog.outcome }}
+ Generate release changelog: ${{ steps.release-changelog.outcome }}
+ Commit changes: ${{ steps.commit.outcome }}
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
+ if: failure()
+
+ trigger-artifacts:
+ name: Trigger artifact builds
+ runs-on: ubuntu-latest
+ needs: update-changelogs
+ if: needs.update-changelogs.outputs.run == 'true'
+ steps:
+ - name: Checkout
+ id: checkout
+ uses: actions/checkout@v2
+ with:
+ ref: ${{ needs.update-changelogs.outputs.ref }}
+ - name: Trigger build
+ id: trigger
+ uses: benc-uk/workflow-dispatch@v1
+ with:
+ token: ${{ secrets.NETDATABOT_GITHUB_TOKEN }}
+ repo: ${{ github.repository }}
+ workflow: Build
+ ref: ${{ needs.update-changelogs.outputs.ref }}
+ inputs: '{"version": "${{ needs.update-changelogs.outputs.version }}", "type": "${{ needs.update-changelogs.outputs.type }}"}'
+ - name: Failure Notification
+ uses: rtCamp/action-slack-notify@v2
+ env:
+ SLACK_COLOR: 'danger'
+ SLACK_FOOTER: ''
+ SLACK_ICON_EMOJI: ':github-actions:'
+ SLACK_TITLE: 'Failed to trigger ${{ needs.update-changelogs.outputs.type }} artifact builds:'
+ SLACK_USERNAME: 'GitHub Actions'
+ SLACK_MESSAGE: |-
+ ${{ github.repository }}: Failed to trigger ${{ needs.update-changelogs.outputs.type }} artifact builds.
+ Checkout: ${{ steps.checkout.outcome }}
+ Trigger build: ${{ steps.trigger.outcome }}
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
+ if: failure()
+
+ trigger-docker:
+ name: Trigger docker builds
+ runs-on: ubuntu-latest
+ needs: update-changelogs
+ if: needs.update-changelogs.outputs.run == 'true'
+ steps:
+ - name: Checkout
+ id: checkout
+ uses: actions/checkout@v2
+ with:
+ ref: ${{ needs.update-changelogs.outputs.ref }}
+ - name: Trigger build
+ id: trigger
+ uses: benc-uk/workflow-dispatch@v1
+ with:
+ token: ${{ secrets.NETDATABOT_GITHUB_TOKEN }}
+ repo: ${{ github.repository }}
+ workflow: Docker
+ ref: ${{ needs.update-changelogs.outputs.ref }}
+ inputs: '{"version": "${{ needs.update-changelogs.outputs.version }}"}'
+ - name: Failure Notification
+ uses: rtCamp/action-slack-notify@v2
+ env:
+ SLACK_COLOR: 'danger'
+ SLACK_FOOTER: ''
+ SLACK_ICON_EMOJI: ':github-actions:'
+ SLACK_TITLE: 'Failed to trigger ${{ needs.update-changelogs.outputs.type }} Docker builds:'
+ SLACK_USERNAME: 'GitHub Actions'
+ SLACK_MESSAGE: |-
+ ${{ github.repository }}: Failed to trigger ${{ needs.update-changelogs.outputs.type }} Docker builds.
+ Checkout: ${{ steps.checkout.outcome }}
+ Trigger build: ${{ steps.trigger.outcome }}
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
+ if: failure()
+
+ trigger-packages:
+ name: Trigger package builds
+ runs-on: ubuntu-latest
+ needs: update-changelogs
+ if: needs.update-changelogs.outputs.run == 'true'
+ steps:
+ - name: Checkout
+ id: checkout
+ uses: actions/checkout@v2
+ with:
+ ref: ${{ needs.update-changelogs.outputs.ref }}
+ - name: Trigger build
+ id: trigger
+ uses: benc-uk/workflow-dispatch@v1
+ with:
+ token: ${{ secrets.NETDATABOT_GITHUB_TOKEN }}
+ repo: ${{ github.repository }}
+ workflow: Packages
+ ref: ${{ needs.update-changelogs.outputs.ref }}
+ inputs: '{"version": "${{ needs.update-changelogs.outputs.version }}", "type": "${{ needs.update-changelogs.outputs.type }}"}'
+ - name: Failure Notification
+ uses: rtCamp/action-slack-notify@v2
+ env:
+ SLACK_COLOR: 'danger'
+ SLACK_FOOTER: ''
+ SLACK_ICON_EMOJI: ':github-actions:'
+ SLACK_TITLE: 'Failed to trigger ${{ needs.update-changelogs.outputs.type }} package builds:'
+ SLACK_USERNAME: 'GitHub Actions'
+ SLACK_MESSAGE: |-
+ ${{ github.repository }}: Failed to trigger ${{ needs.update-changelogs.outputs.type }} package builds.
+ Checkout: ${{ steps.checkout.outcome }}
+ Trigger build: ${{ steps.trigger.outcome }}
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
+ if: failure()
diff --git a/.github/workflows/repoconfig-packages.yml b/.github/workflows/repoconfig-packages.yml
new file mode 100644
index 0000000..824ddd3
--- /dev/null
+++ b/.github/workflows/repoconfig-packages.yml
@@ -0,0 +1,183 @@
+---
+# Handles building of binary packages for the agent.
+name: Repository Packages
+on:
+ workflow_dispatch: null
+ pull_request:
+ paths:
+ - packaging/repoconfig/**
+ - .github/workflows/repoconfig-packages.yml
+ - .github/data/distros.yml
+ push:
+ branches:
+ - master
+ paths:
+ - packaging/repoconfig/**
+ - .github/workflows/repoconfig-packages.yml
+ - .github/data/distros.yml
+env:
+ DISABLE_TELEMETRY: 1
+ REPO_PREFIX: netdata/netdata
+jobs:
+ matrix:
+ name: Prepare Build Matrix
+ runs-on: ubuntu-latest
+ outputs:
+ matrix: ${{ steps.set-matrix.outputs.matrix }}
+ steps:
+ - name: Checkout
+ id: checkout
+ uses: actions/checkout@v3
+ - name: Prepare tools
+ id: prepare
+ run: |
+ sudo apt-get update && sudo apt-get install -y python3-ruamel.yaml
+ - name: Read build matrix
+ id: set-matrix
+ shell: python3 {0}
+ run: |
+ from ruamel.yaml import YAML
+ import json
+ yaml = YAML(typ='safe')
+ entries = list()
+
+ with open('.github/data/distros.yml') as f:
+ data = yaml.load(f)
+
+ for i, v in enumerate(data['include']):
+ if 'packages' in data['include'][i]:
+ entries.append({
+ 'distro': data['include'][i]['distro'],
+ 'version': data['include'][i]['version'],
+ 'pkgclouddistro': data['include'][i]['packages']['repo_distro'],
+ 'format': data['include'][i]['packages']['type'],
+ 'base_image': data['include'][i]['base_image'] if 'base_image' in data['include'][i] else data['include'][i]['distro'],
+ 'platform': data['platform_map']['amd64']
+ })
+
+ entries.sort(key=lambda k: (k['distro'], k['version']))
+ matrix = json.dumps({'include': entries}, sort_keys=True)
+ print('Generated Matrix: ' + matrix)
+ print('::set-output name=matrix::' + matrix)
+ - name: Failure Notification
+ uses: rtCamp/action-slack-notify@v2
+ env:
+ SLACK_COLOR: 'danger'
+ SLACK_ICON_EMOJI: ':github-actions:'
+ SLACK_TITLE: 'Repository Package Build matrix generation failed:'
+ SLACK_USERNAME: 'GitHub Actions'
+ SLACK_MESSAGE: |-
+ ${{ github.repository }}: Failed to generate build matrix for repository package build.
+ Checkout: ${{ steps.checkout.outcome }}
+ Prepare Tools: ${{ steps.prepare.outcome }}
+ Read Build Matrix: ${{ steps.set-matrix.outcome }}
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
+ if: >-
+ ${{
+ failure()
+ && github.event_name != 'pull_request'
+ && startsWith(github.ref, 'refs/heads/master')
+ && github.repository == 'netdata/netdata'
+ }}
+
+ build:
+ name: Build
+ runs-on: ubuntu-latest
+ env:
+ DISABLE_TELEMETRY: 1
+ DOCKER_CLI_EXPERIMENTAL: enabled
+ needs:
+ - matrix
+ strategy:
+ matrix: ${{ fromJson(needs.matrix.outputs.matrix) }}
+ # We intentiaonally disable the fail-fast behavior so that a
+ # build failure for one version doesn't prevent us from publishing
+ # successfully built and tested packages for another version.
+ fail-fast: false
+ max-parallel: 8
+ steps:
+ - name: Checkout
+ id: checkout
+ uses: actions/checkout@v3
+ # Unlike normally, we do not need a deep clone or submodules for this.
+ - name: Fetch base image
+ id: fetch-images
+ uses: nick-invision/retry@v2
+ with:
+ max_attempts: 3
+ retry_wait_seconds: 30
+ timeout_seconds: 900
+ command: docker pull --platform ${{ matrix.platform }} ${{ matrix.base_image }}:${{ matrix.version }}
+ - name: Build Packages
+ id: build
+ shell: bash
+ run: |
+ docker run --security-opt seccomp=unconfined -e DISABLE_TELEMETRY=1 --platform ${{ matrix.platform }} \
+ -v "$PWD":/netdata ${{ matrix.base_image }}:${{ matrix.version }} \
+ /netdata/packaging/repoconfig/build-${{ matrix.format }}.sh
+ - name: SSH setup
+ id: ssh-setup
+ if: github.event_name == 'workflow_dispatch'
+ continue-on-error: true
+ uses: shimataro/ssh-key-action@v2
+ with:
+ key: ${{ secrets.NETDATABOT_PACKAGES_SSH_KEY }}
+ name: id_ecdsa
+ known_hosts: ${{ secrets.PACKAGES_KNOWN_HOSTS }}
+ - name: Upload to packages.netdata.cloud
+ id: package-upload
+ continue-on-error: true
+ if: github.event_name == 'workflow_dispatch'
+ run: |
+ .github/scripts/package-upload.sh \
+ ${{ matrix.repo_distro }} \
+ ${{ matrix.arch }} \
+ ${{ matrix.format }} \
+ netdata/netdata
+ .github/scripts/package-upload.sh \
+ ${{ matrix.repo_distro }} \
+ ${{ matrix.arch }} \
+ ${{ matrix.format }} \
+ netdata/netdata-edge
+ .github/scripts/package-upload.sh \
+ ${{ matrix.repo_distro }} \
+ ${{ matrix.arch }} \
+ ${{ matrix.format }} \
+ netdata/netdata-repoconfig
+ - name: Upload Packages
+ id: publish
+ if: github.event_name != 'pull_request' && github.repository == 'netdata/netdata'
+ shell: bash
+ env:
+ PKG_CLOUD_TOKEN: ${{ secrets.PACKAGE_CLOUD_API_KEY }}
+ run: |
+ printf "Packages to upload:\n%s" "$(ls artifacts/*.${{ matrix.format }})"
+ for pkgfile in artifacts/*.${{ matrix.format }} ; do
+ .github/scripts/package_cloud_wrapper.sh yank "${REPO_PREFIX}/${{ matrix.pkgclouddistro }}" \
+ "$(basename "${pkgfile}")" || true
+ .github/scripts/package_cloud_wrapper.sh push "${REPO_PREFIX}/${{ matrix.pkgclouddistro }}" "${pkgfile}"
+ .github/scripts/package_cloud_wrapper.sh yank "${REPO_PREFIX}-edge/${{ matrix.pkgclouddistro }}" \
+ "$(basename "${pkgfile}")" || true
+ .github/scripts/package_cloud_wrapper.sh push "${REPO_PREFIX}-edge/${{ matrix.pkgclouddistro }}" "${pkgfile}"
+ .github/scripts/package_cloud_wrapper.sh yank "${REPO_PREFIX}-repoconfig/${{ matrix.pkgclouddistro }}" \
+ "$(basename "${pkgfile}")" || true
+ .github/scripts/package_cloud_wrapper.sh push "${REPO_PREFIX}-repoconfig/${{ matrix.pkgclouddistro }}" "${pkgfile}"
+ done
+ - name: Failure Notification
+ if: ${{ failure() && github.repository == 'netdata/netdata' }}
+ uses: rtCamp/action-slack-notify@v2
+ env:
+ SLACK_COLOR: 'danger'
+ SLACK_FOOTER: ''
+ SLACK_ICON_EMOJI: ':github-actions:'
+ SLACK_TITLE: 'Repository Package Build failed:'
+ SLACK_USERNAME: 'GitHub Actions'
+ SLACK_MESSAGE: |-
+ ${{ github.repository }}: ${{ matrix.pkgclouddistro }} ${{ matrix.version }} repository package build failed.
+ Checkout: ${{ steps.checkout.outcome }}
+ Fetch images: ${{ steps.fetch-images.outcome }}
+ Build: ${{ steps.build.outcome }}
+ Import SSH Key: ${{ steps.ssh-setup.outcome }}
+ Publish to packages.netdata.cloud: ${{ steps.package-upload.outcome }}
+ Publish to PackageCloud: ${{ steps.publish.outcome }}
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
diff --git a/.github/workflows/review.yml b/.github/workflows/review.yml
new file mode 100644
index 0000000..5679b24
--- /dev/null
+++ b/.github/workflows/review.yml
@@ -0,0 +1,172 @@
+---
+# Runs various ReviewDog based checks against PR with suggested changes to improve quality
+name: Review
+on:
+ pull_request:
+ types: [opened, reopened, labeled, synchronize]
+env:
+ DISABLE_TELEMETRY: 1
+concurrency:
+ group: review-${{ github.ref }}
+ cancel-in-progress: true
+jobs:
+ prep-review:
+ name: Prepare Review Jobs
+ runs-on: ubuntu-latest
+ outputs:
+ actionlint: ${{ steps.actionlint.outputs.run }}
+ eslint: ${{ steps.eslint.outputs.run }}
+ hadolint: ${{ steps.hadolint.outputs.run }}
+ shellcheck: ${{ steps.shellcheck.outputs.run }}
+ yamllint: ${{ steps.yamllint.outputs.run }}
+ steps:
+ - name: Clone repository
+ uses: actions/checkout@v3
+ with:
+ submodules: recursive
+ fetch-depth: 0
+ - name: Check files for actionlint
+ id: actionlint
+ run: |
+ if [ "${{ contains(github.event.pull_request.labels.*.name, 'run-ci/actionlint') }}" = "true" ]; then
+ echo '::set-output name=run::true'
+ elif git diff --name-only origin/${{ github.base_ref }} HEAD | grep -Eq '\.github/workflows/.*' ; then
+ echo '::set-output name=run::true'
+ echo 'GitHub Actions workflows have changed, need to run actionlint.'
+ else
+ echo '::set-output name=run::false'
+ fi
+ - name: Check files for eslint
+ id: eslint
+ run: |
+ if [ "${{ contains(github.event.pull_request.labels.*.name, 'run-ci/eslint') }}" = "true" ]; then
+ echo '::set-output name=run::true'
+ elif git diff --name-only origin/${{ github.base_ref }} HEAD | grep -v "web/gui/dashboard" | grep -Eq '.*\.js|node\.d\.plugin\.in' ; then
+ echo '::set-output name=run::true'
+ echo 'JS files have changed, need to run ESLint.'
+ else
+ echo '::set-output name=run::false'
+ fi
+ - name: Check files for hadolint
+ id: hadolint
+ run: |
+ if [ "${{ contains(github.event.pull_request.labels.*.name, 'run-ci/hadolint') }}" = "true" ]; then
+ echo '::set-output name=run::true'
+ elif git diff --name-only origin/${{ github.base_ref }} HEAD | grep -Eq '.*Dockerfile.*' ; then
+ echo '::set-output name=run::true'
+ echo 'Dockerfiles have changed, need to run Hadolint.'
+ else
+ echo '::set-output name=run::false'
+ fi
+ - name: Check files for shellcheck
+ id: shellcheck
+ run: |
+ if [ "${{ contains(github.event.pull_request.labels.*.name, 'run-ci/shellcheck') }}" = "true" ]; then
+ echo '::set-output name=run::true'
+ elif git diff --name-only origin/${{ github.base_ref }} HEAD | grep -Eq '.*\.sh.*' ; then
+ echo '::set-output name=run::true'
+ echo 'Shell scripts have changed, need to run shellcheck.'
+ else
+ echo '::set-output name=run::false'
+ fi
+ - name: Check files for yamllint
+ id: yamllint
+ run: |
+ if [ "${{ contains(github.event.pull_request.labels.*.name, 'run-ci/yamllint') }}" = "true" ]; then
+ echo '::set-output name=run::true'
+ elif git diff --name-only origin/${{ github.base_ref }} HEAD | grep -Eq '.*\.ya?ml|python\.d/.*\.conf' ; then
+ echo '::set-output name=run::true'
+ echo 'YAML files have changed, need to run yamllint.'
+ else
+ echo '::set-output name=run::false'
+ fi
+
+ actionlint:
+ name: actionlint
+ needs: prep-review
+ if: needs.prep-review.outputs.actionlint == 'true'
+ runs-on: ubuntu-latest
+ steps:
+ - name: Git clone repository
+ uses: actions/checkout@v3
+ with:
+ submodules: recursive
+ fetch-depth: 0
+ - name: Run actionlint
+ uses: reviewdog/action-actionlint@v1
+ with:
+ github_token: ${{ secrets.GITHUB_TOKEN }}
+ reporter: github-pr-check
+
+ eslint:
+ name: eslint
+ needs: prep-review
+ if: needs.prep-review.outputs.eslint == 'true'
+ runs-on: ubuntu-latest
+ steps:
+ - name: Git clone repository
+ uses: actions/checkout@v3
+ with:
+ submodules: recursive
+ fetch-depth: 0
+ - name: Install eslint
+ run: npm install eslint -D
+ - name: Run eslint
+ uses: reviewdog/action-eslint@v1
+ with:
+ github_token: ${{ secrets.GITHUB_TOKEN }}
+ reporter: github-pr-check
+ eslint_flags: '.'
+
+ hadolint:
+ name: hadolint
+ needs: prep-review
+ if: needs.prep-review.outputs.hadolint == 'true'
+ runs-on: ubuntu-latest
+ steps:
+ - name: Git clone repository
+ uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+ - name: Run hadolint
+ uses: reviewdog/action-hadolint@v1
+ with:
+ github_token: ${{ secrets.GITHUB_TOKEN }}
+ reporter: github-pr-check
+
+ shellcheck:
+ name: shellcheck
+ needs: prep-review
+ if: needs.prep-review.outputs.shellcheck == 'true'
+ runs-on: ubuntu-latest
+ steps:
+ - name: Git clone repository
+ uses: actions/checkout@v3
+ with:
+ submodules: recursive
+ fetch-depth: 0
+ - name: Run shellcheck
+ uses: reviewdog/action-shellcheck@v1
+ with:
+ github_token: ${{ secrets.GITHUB_TOKEN }}
+ reporter: github-pr-check
+ path: "."
+ pattern: "*.sh*"
+ exclude: "./.git/*"
+
+ yamllint:
+ name: yamllint
+ needs: prep-review
+ if: needs.prep-review.outputs.yamllint == 'true'
+ runs-on: ubuntu-latest
+ steps:
+ - name: Git clone repository
+ uses: actions/checkout@v3
+ with:
+ submodules: recursive
+ fetch-depth: 0
+ - name: Run yamllint
+ 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..d483868
--- /dev/null
+++ b/.github/workflows/tests.yml
@@ -0,0 +1,41 @@
+---
+# 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'
+env:
+ DISABLE_TELEMETRY: 1
+concurrency:
+ group: tests-${{ github.ref }}
+ cancel-in-progress: true
+jobs:
+ unit-tests-legacy:
+ name: Unit Tests (legacy)
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v3
+ with:
+ submodules: recursive
+ - 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
diff --git a/.github/workflows/trigger-learn-update.yml b/.github/workflows/trigger-learn-update.yml
new file mode 100644
index 0000000..3d39eba
--- /dev/null
+++ b/.github/workflows/trigger-learn-update.yml
@@ -0,0 +1,37 @@
+---
+name: Trigger Netdata Learn documentation update
+on:
+ push:
+ branches:
+ - master
+ paths:
+ - "**.mdx?"
+ - "packaging/installer/kickstart.sh"
+concurrency:
+ group: learn-trigger-${{ github.ref }}
+ cancel-in-progress: true
+jobs:
+ trigger-ingest:
+ name: Trigger Netdata Learn ingest workflow.
+ if: github.repository == 'netdata/netdata'
+ runs-on: ubuntu-latest
+ steps:
+ - name: Trigger Netdata Learn ingest workflow.
+ uses: benc-uk/workflow-dispatch@v1
+ with:
+ token: ${{ secrets.NETDATABOT_GITHUB_TOKEN }}
+ repo: netdata/learn
+ workflow: Ingest
+ ref: refs/heads/master
+ - name: Failure Notification
+ uses: rtCamp/action-slack-notify@v2
+ env:
+ SLACK_COLOR: 'danger'
+ SLACK_FOOTER: ''
+ SLACK_ICON_EMOJI: ':github-actions:'
+ SLACK_TITLE: 'Triggering Netdata Learn documentation update failed:'
+ SLACK_USERNAME: 'GitHub Actions'
+ SLACK_MESSAGE: |-
+ ${{ github.repository }}: Failed to trigger Netdata Learn documentation update workflow.
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
+ if: failure()