diff options
Diffstat (limited to '')
-rw-r--r-- | .github/CODEOWNERS | 44 | ||||
-rw-r--r-- | .github/ISSUE_TEMPLATE/config.yml | 3 | ||||
-rw-r--r-- | .github/data/distros.yml | 92 | ||||
-rwxr-xr-x | .github/scripts/check-updater.sh | 13 | ||||
-rwxr-xr-x | .github/scripts/ci-support-pkgs.sh | 14 | ||||
-rwxr-xr-x | .github/scripts/gen-docker-tags.py | 5 | ||||
-rwxr-xr-x | .github/scripts/netdata-pkgcloud-cleanup.py | 190 | ||||
-rwxr-xr-x | .github/scripts/old_package_purging.sh | 88 | ||||
-rwxr-xr-x | .github/scripts/package-upload.sh | 43 | ||||
-rwxr-xr-x | .github/scripts/prepare-release-base.sh | 5 | ||||
-rwxr-xr-x | .github/scripts/run-updater-check.sh | 2 | ||||
-rw-r--r-- | .github/workflows/add-to-project.yml | 26 | ||||
-rw-r--r-- | .github/workflows/build.yml | 59 | ||||
-rw-r--r-- | .github/workflows/cloud_regression.yml | 1 | ||||
-rw-r--r-- | .github/workflows/docker.yml | 88 | ||||
-rw-r--r-- | .github/workflows/packagecloud.yml | 36 | ||||
-rw-r--r-- | .github/workflows/packaging.yml | 50 | ||||
-rw-r--r-- | .github/workflows/release.yml | 9 | ||||
-rw-r--r-- | .github/workflows/repoconfig-packages.yml | 43 |
19 files changed, 624 insertions, 187 deletions
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index b0a6db160..dac9f84cb 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -5,11 +5,11 @@ * @Ferroin # Ownership by directory structure -.travis/ @Ferroin @iigorkarpov @maneamarius -.github/ @Ferroin @iigorkarpov @maneamarius +.travis/ @Ferroin +.github/ @Ferroin aclk/ @stelfrag @underhood -build/ @Ferroin @iigorkarpov @maneamarius -contrib/debian @Ferroin @iigorkarpov @maneamarius +build/ @Ferroin +contrib/debian @Ferroin collectors/ @vlvkobal collectors/ebpf.plugin/ @thiagoftsm @vlvkobal collectors/charts.d.plugin/ @ilyam8 @Ferroin @@ -26,32 +26,32 @@ health/health.d/ @thiagoftsm @vlvkobal health/notifications/ @Ferroin @thiagoftsm ml/ @andrewm4894 @vkalintiris libnetdata/ @thiagoftsm @vkalintiris -packaging/ @Ferroin @iigorkarpov @maneamarius +packaging/ @Ferroin registry/ @jacekkolasa streaming/ @thiagoftsm @vlvkobal -system/ @Ferroin @iigorkarpov @maneamarius -tests/ @Ferroin @iigorkarpov @maneamarius @vkalintiris +system/ @Ferroin +tests/ @Ferroin @vkalintiris web/ @thiagoftsm @vlvkobal @vkalintiris web/gui/ @jacekkolasa # Ownership by filetype (overwrites ownership by directory) -*.am @Ferroin @iigorkarpov @maneamarius +*.am @Ferroin *.md @DShreve2 -Dockerfile* @Ferroin @iigorkarpov @maneamarius +Dockerfile* @Ferroin # Ownership of specific files -.gitignore @Ferroin @iigorkarpov @maneamarius @vkalintiris -.travis.yml @Ferroin @iigorkarpov @maneamarius -.lgtm.yml @Ferroin @iigorkarpov @maneamarius -.eslintrc @Ferroin @iigorkarpov @maneamarius -.eslintignore @Ferroin @iigorkarpov @maneamarius -.csslintrc @Ferroin @iigorkarpov @maneamarius -.codeclimate.yml @Ferroin @iigorkarpov @maneamarius -.codacy.yml @Ferroin @iigorkarpov @maneamarius -.yamllint.yml @Ferroin @iigorkarpov @maneamarius -netdata.spec.in @Ferroin @iigorkarpov @maneamarius -netdata-installer.sh @Ferroin @iigorkarpov @maneamarius -packaging/version @netdatabot @Ferroin @iigorkarpov @maneamarius +.gitignore @Ferroin @vkalintiris +.travis.yml @Ferroin +.lgtm.yml @Ferroin +.eslintrc @Ferroin +.eslintignore @Ferroin +.csslintrc @Ferroin +.codeclimate.yml @Ferroin +.codacy.yml @Ferroin +.yamllint.yml @Ferroin +netdata.spec.in @Ferroin +netdata-installer.sh @Ferroin +packaging/version @netdatabot @Ferroin LICENSE.md @DShreve2 @Ferroin @vkalintiris -CHANGELOG.md @netdatabot @Ferroin @iigorkarpov @maneamarius +CHANGELOG.md @netdatabot @Ferroin diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index c21d50e0c..79678d7b5 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -4,9 +4,6 @@ contact_links: - name: "Netdata Agent: Question" url: https://github.com/netdata/netdata/discussions/new?category=q-a about: Ask a question about Netdata Agent - - name: "Netdata Agent Dashboard" - url: https://github.com/netdata/dashboard/issues/new/choose - about: Create a report to help us improve our dashboard - name: "Netdata Cloud" url: https://github.com/netdata/netdata-cloud/issues/new/choose about: Create a report to help us improve our web application diff --git a/.github/data/distros.yml b/.github/data/distros.yml index 133cdbd13..8ef32785b 100644 --- a/.github/data/distros.yml +++ b/.github/data/distros.yml @@ -1,10 +1,21 @@ # This defines the full set of distros we run CI on. --- platform_map: # map packaging architectures to docker platforms - i386: linux/i386 + aarch64: linux/arm64/v8 amd64: linux/amd64 - armhf: linux/arm/v7 arm64: linux/arm64/v8 + armhf: linux/arm/v7 + armhfp: linux/arm/v7 + i386: linux/i386 + x86_64: linux/amd64 +arch_order: # sort order for per-architecture jobs in CI + - amd64 + - x86_64 + - i386 + - armhf + - armhfp + - arm64 + - aarch64 include: - &alpine distro: alpine @@ -13,6 +24,8 @@ include: apk add -U bash jsonc_removal: | apk del json-c-dev + test: + ebpf-core: true - <<: *alpine version: "3.16" - <<: *alpine @@ -26,6 +39,8 @@ include: version: latest env_prep: | pacman --noconfirm -Syu && pacman --noconfirm -Sy grep libffi + test: + ebpf-core: true - &alma distro: almalinux @@ -37,8 +52,10 @@ include: type: rpm repo_distro: el/9 arches: - - amd64 - - arm64 + - x86_64 + - aarch64 + test: + ebpf-core: true - <<: *alma version: "8" packages: @@ -51,7 +68,9 @@ include: type: rpm repo_distro: el/7 arches: - - amd64 + - x86_64 + test: + ebpf-core: false - &debian distro: debian @@ -68,16 +87,15 @@ include: - amd64 - armhf - arm64 + test: + ebpf-core: true - <<: *debian version: "10" packages: <<: *debian_packages repo_distro: debian/buster - - <<: *debian - version: "9" - packages: - <<: *debian_packages - repo_distro: debian/stretch + test: + ebpf-core: false - &fedora distro: fedora @@ -88,38 +106,59 @@ include: type: rpm repo_distro: fedora/36 arches: - - amd64 - - armhf - - arm64 + - x86_64 + - armhfp + - aarch64 + test: + ebpf-core: true - <<: *fedora version: "35" packages: <<: *fedora_packages repo_distro: fedora/35 + test: + ebpf-core: true - &opensuse distro: opensuse - version: "15.3" + version: "15.4" base_image: opensuse/leap jsonc_removal: | zypper rm -y libjson-c-devel - packages: + packages: &opensuse_packages type: rpm - repo_distro: opensuse/15.3 + repo_distro: opensuse/15.4 arches: - - amd64 - - arm64 + - x86_64 + - aarch64 + test: + ebpf-core: true + - <<: *opensuse + version: "15.3" + packages: + <<: *opensuse_packages + repo_distro: opensuse/15.3 + test: + ebpf-core: false - - distro: oraclelinux + - &oracle + distro: oraclelinux version: "8" jsonc_removal: | dnf remove -y json-c-devel - packages: + packages: &oracle_packages type: rpm repo_distro: ol/8 arches: - - amd64 - - arm64 + - x86_64 + - aarch64 + test: + ebpf-core: true + - <<: *oracle + version: "9" + packages: + <<: *oracle_packages + repo_distro: ol/9 - &ubuntu distro: ubuntu @@ -135,11 +174,8 @@ include: - amd64 - armhf - arm64 - - <<: *ubuntu - version: "21.10" - packages: - <<: *ubuntu_packages - repo_distro: ubuntu/impish + test: + ebpf-core: true - <<: *ubuntu version: "20.04" packages: @@ -155,3 +191,5 @@ include: - amd64 - armhf - arm64 + test: + ebpf-core: false diff --git a/.github/scripts/check-updater.sh b/.github/scripts/check-updater.sh index 1051f1eee..3df0c9de4 100755 --- a/.github/scripts/check-updater.sh +++ b/.github/scripts/check-updater.sh @@ -17,7 +17,18 @@ check_successful_update() { ) >&2 } -steps="check_successful_update" +check_autoupdate_enabled() { + progress "Check autoupdate still enabled after update" + ( + if [ -f /etc/periodic/daily/netdata-updater ] || [ -f /etc/cron.daily/netdata-updater ]; then + echo "Update successful!" + else + exit 1 + fi + ) >&2 +} + +steps="check_successful_update check_autoupdate_enabled" _main() { for step in $steps; do diff --git a/.github/scripts/ci-support-pkgs.sh b/.github/scripts/ci-support-pkgs.sh new file mode 100755 index 000000000..bfa9c83a5 --- /dev/null +++ b/.github/scripts/ci-support-pkgs.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +# This script installs supporting packages needed for CI, which provide following: +# cron, pidof + +set -e + +if [ -f /etc/centos-release ] || [ -f /etc/redhat-release ] || [ -f /etc/fedora-release ] || [ -f /etc/almalinux-release ]; then + # Alma, Fedora, CentOS, Redhat + dnf install -y procps-ng cronie cronie-anacron || yum install -y procps-ng cronie cronie-anacron +elif [ -f /etc/arch-release ]; then + # Arch + pacman -S --noconfirm cronie +fi diff --git a/.github/scripts/gen-docker-tags.py b/.github/scripts/gen-docker-tags.py index 6c6251155..df4dc0263 100755 --- a/.github/scripts/gen-docker-tags.py +++ b/.github/scripts/gen-docker-tags.py @@ -2,9 +2,10 @@ import sys -REPO = 'netdata/netdata' - version = sys.argv[1].split('.') +suffix = sys.argv[2] + +REPO = f'netdata/netdata{suffix}' MAJOR = ':'.join([REPO, version[0]]) MINOR = ':'.join([REPO, '.'.join(version[0:2])]) diff --git a/.github/scripts/netdata-pkgcloud-cleanup.py b/.github/scripts/netdata-pkgcloud-cleanup.py new file mode 100755 index 000000000..f6311e47c --- /dev/null +++ b/.github/scripts/netdata-pkgcloud-cleanup.py @@ -0,0 +1,190 @@ +#!/bin/env python3 + +import requests +from requests.auth import HTTPBasicAuth +from datetime import date, datetime, timedelta +import os +import sys +import argparse +from pprint import pprint +from datetime import datetime +from dateutil import parser + + +class PackageCloud: + NUM_PACKAGE_MINOR_TO_KEEP = 5 + NUM_RETENTION_DAYS = 30 + # number of pages to process. Use '0' to process all + MAX_PAGES = 0 + + def __init__(self, repo_type, dry_run=True, auth_token=None): + self.headers = { + "Accept" : "application/json", + "Content-Type" : "application/json", + } + self.dry_run = dry_run + self.repo_type = repo_type + if repo_type == "stable": + repo = "netdata/netdata" + elif repo_type == "devel": + repo = "netdata/netdata-devel" + elif repo_type == "edge": + repo = "netdata/netdata-edge" + else: + print(f"ERROR: unknown repo type '{repo_type}'!\nAccepted values are: stable,devel,edge") + sys.exit(1) + self.base_url = f"https://packagecloud.io/api/v1/repos/{repo}" + self.auth = HTTPBasicAuth(username=auth_token, password='') if auth_token else None + + def get_all_packages(self): + page = 1 + all_pkg_list = [] + while True: + url = f"{self.base_url}/packages.json?page={page}" + if page > self.MAX_PAGES and self.MAX_PAGES != 0: + break + else: + pkg_list = requests.get(url, auth=self.auth, headers=self.headers).json() + if len(pkg_list) == 0: + break + else: + print(f"Processing page: {page}") + for element in pkg_list: + self.is_pkg_older_than_days(element, 30) + if element['name'] != 'netdata-repo' and element['name'] != 'netdata-repo-edge': + all_pkg_list.append(element) + page += 1 + return all_pkg_list + + def delete_package(self, destroy_url): + if self.dry_run: + print(f" - DRY_RUN mode. Not deleting package '{destroy_url}'.") + else: + print(f" - Deleting package: {destroy_url}") + url = f"https://packagecloud.io{destroy_url}" + response = requests.delete(url, auth=self.auth, headers=self.headers).json() + response = None + if not response: + print(f" Package deleted successfully.") + else: + print(f" Failed deleting package!") + + def get_destroy_url(self, pkg_url): + url = f"https://packagecloud.io{pkg_url}" + response = requests.get(url, auth=self.auth, headers=self.headers) + response.raise_for_status() + return response.json()['destroy_url'] + + def get_packages_for_distro(self, distro, all_pkg_list): + distro_pkg_list = [ pkg for pkg in all_pkg_list if pkg['distro_version'] == distro ] + return distro_pkg_list + + def get_packages_for_arch(self, arch, all_pkg_list): + arch_pkg_list = [ pkg for pkg in all_pkg_list if pkg['package_url'].split('/')[11] == arch ] + return arch_pkg_list + + def get_arches(self, pkg_list): + arches = list(set([pkg['package_url'].split('/')[11] for pkg in pkg_list ])) + return arches + + def get_pkg_list(self, pkg_name, pkg_list): + filtered_list = [ pkg for pkg in pkg_list if pkg['name'] == pkg_name ] + return filtered_list + + def get_minor_versions(self, all_versions): + minor_versions = ['.'.join(version.split('.')[:-1]) for version in all_versions ] + minor_versions = list(set(minor_versions)) + minor_versions.sort() + return minor_versions + + def is_pkg_older_than_days(self, pkg, num_days): + pkg_create_date = datetime.strptime(pkg['created_at'], '%Y-%m-%dT%H:%M:%S.%fZ') + time_difference = datetime.now() - pkg_create_date + return time_difference.days > num_days + + def cleanup_repo(self): + if self.repo_type == 'stable': + self.cleanup_stable_repo() + else: + self.cleanup_edge_repo() + + def cleanup_edge_repo(self): + all_pkg_list = self.get_all_packages() + pkgs_to_delete = [] + pkgs_to_keep = [] + for package in all_pkg_list: + if self.is_pkg_older_than_days(package, self.NUM_RETENTION_DAYS): + pkgs_to_delete.append(package) + else: + pkgs_to_keep.append(package) + print(f"Keeping the following packages (newer than {self.NUM_RETENTION_DAYS} days):") + for pkg in pkgs_to_keep: + print(f" > pkg: {pkg['package_html_url']} / created_at: {pkg['created_at']}") + print(f"Deleting the following packages (older than {self.NUM_RETENTION_DAYS} days):") + for pkg in pkgs_to_delete: + print(f" > pkg: {pkg['package_html_url']} / created_at: {pkg['created_at']}") + self.delete_package(pkg['destroy_url']) + + def cleanup_stable_repo(self): + all_pkg_list = self.get_all_packages() + all_distros = list(set([ pkg['distro_version'] for pkg in all_pkg_list ])) + all_distros = sorted(all_distros) + print(f"<> Distributions list: {all_distros}") + + for distro in all_distros: + print(f">> Processing distro: {distro}") + pkg_list_distro = self.get_packages_for_distro(distro, all_pkg_list) + arches = self.get_arches(pkg_list_distro) + print(f" <> Arch list: {arches}") + for arch in arches: + print(f" >> Processing arch: {distro} -> {arch}") + pkg_list_arch = self.get_packages_for_arch(arch, pkg_list_distro) + pkg_names = [pkg['name'] for pkg in pkg_list_arch] + pkg_names = list(set(pkg_names)) + print(f" <> Package names: {pkg_names}") + for pkg_name in pkg_names: + print(f" >> Processing package: {distro} -> {arch} -> {pkg_name}") + pkg_list = self.get_pkg_list(pkg_name, pkg_list_arch) + pkg_versions = [pkg['version'] for pkg in pkg_list] + pkg_minor_versions = self.get_minor_versions(pkg_versions) + pkg_minor_to_keep = pkg_minor_versions[-self.NUM_PACKAGE_MINOR_TO_KEEP:] + print(f" <> Minor Package Versions to Keep: {pkg_minor_to_keep}") + pkg_minor_to_delete = list(set(pkg_minor_versions) - set(pkg_minor_to_keep)) + print(f" <> Minor Package Versions to Delete: {pkg_minor_to_delete}") + urls_to_keep = [pkg['package_url'] for pkg in pkg_list if '.'.join(pkg['version'].split('.')[:-1]) in pkg_minor_to_keep] + urls_to_delete = [pkg['package_url'] for pkg in pkg_list if '.'.join(pkg['version'].split('.')[:-1]) in pkg_minor_to_delete] + for pkg_url in urls_to_delete: + destroy_url = self.get_destroy_url(pkg_url) + self.delete_package(destroy_url) + + +def configure(): + parser = argparse.ArgumentParser() + parser.add_argument('--repo-type', '-r', required=True, + help='Repository type against to perform cleanup') + parser.add_argument('--dry-run', '-d', action='store_true', + help='Dry-run Mode') + args = parser.parse_args() + try: + token = os.environ['PKGCLOUD_TOKEN'] + except Exception as e: + print(f"FATAL: 'PKGCLOUD_TOKEN' environment variable is not set!", file=sys.stderr) + sys.exit(1) + repo_type = args.repo_type + dry_run = args.dry_run + conf = { + 'repo_type': args.repo_type, + 'dry_run': args.dry_run, + 'token': token + } + return conf + + +def main(): + config = configure() + pkg_cloud = PackageCloud(config['repo_type'], config['dry_run'], config['token']) + pkg_cloud.cleanup_repo() + + +if __name__ == "__main__": + main() diff --git a/.github/scripts/old_package_purging.sh b/.github/scripts/old_package_purging.sh deleted file mode 100755 index 727a1c256..000000000 --- a/.github/scripts/old_package_purging.sh +++ /dev/null @@ -1,88 +0,0 @@ -#!/usr/bin/env bash -# -# Script to handle package cloud retention policy -# Our open source subscription is limited, -# so we use this script to control the number of packages maintained historically -# -# Dependencies: -# - PACKAGE_CLOUD_RETENTION_DAYS -# This is to indicate for how many days back we want to maintain the various RPM and DEB packages on package cloud -# -# Copyright : SPDX-License-Identifier: GPL-3.0-or-later -# -# Author : Pavlos Emm. Katsoulakis <paul@netdata.cloud> -# -set -e - -delete_files_for_version() { - local v="$1" - - # Delete the selected filenames in version - FILES_IN_VERSION=$(jq --sort-keys --arg v "${v}" '.[] | select ( .version | contains($v))' "${PKG_LIST_FILE}" | grep filename | cut -d':' -f 2) - - # Iterate through the files and delete them - for pkg in ${FILES_IN_VERSION/\\n/}; do - pkg=${pkg/,/} - pkg=${pkg/\"/} - pkg=${pkg/\"/} - echo "Attempting yank on ${pkg}.." - .github/scripts/package_cloud_wrapper.sh yank "${REPO}" "${pkg}" || echo "Nothing to yank or error on ${pkg}" - done -} - -# If we are not in netdata git repo, at the top level directory, fail -TOP_LEVEL=$(basename "$(git rev-parse --show-toplevel)") -CWD=$(git rev-parse --show-cdup) -if [ -n "$CWD" ] || [ ! "${TOP_LEVEL}" == "netdata" ]; then - echo "Run as .github/scripts/$(basename "$0") from top level directory of netdata git repository" - echo "Old packages yanking cancelled" - exit 1 -fi - -if [ -z "${REPO}" ]; then - echo "No REPO variable found" - exit 1 -fi - -if [ -z ${PKG_CLOUD_TOKEN} ]; then - echo "No PKG_CLOUD_TOKEN variable found" - exit 1 -fi - -if [ -z ${PACKAGE_CLOUD_RETENTION_DAYS} ]; then - echo "No PACKAGE_CLOUD_RETENTION_DAYS variable found" - exit 1 -fi - -TMP_DIR="$(mktemp -d /tmp/netdata-old-package-yanking-XXXXXX)" -PKG_LIST_FILE="${TMP_DIR}/complete_package_list.json" -DATE_EPOCH="1970-01-01" -DATE_UNTIL_TO_DELETE=$(date --date="${PACKAGE_CLOUD_RETENTION_DAYS} day ago" +%Y-%m-%d) - - -echo "Created temp directory: ${TMP_DIR}" -echo "We will be purging contents up until ${DATE_UNTIL_TO_DELETE}" - -echo "Calling package could to retrieve all available packages on ${REPO}" -curl -sS "https://${PKG_CLOUD_TOKEN}:@packagecloud.io/api/v1/repos/${REPO}/packages.json" > "${PKG_LIST_FILE}" - -# Get versions within the desired duration -# -VERSIONS_TO_PURGE=$(jq --arg s "${DATE_EPOCH}" --arg e "${DATE_UNTIL_TO_DELETE}" ' -[($s, $e) | strptime("%Y-%m-%d")[0:3]] as $r - | map(select( - (.created_at[:19] | strptime("%Y-%m-%dT%H:%M:%S")[0:3]) as $d - | $d >= $r[0] and $d <= $r[1] -))' "${PKG_LIST_FILE}" | grep '"version":' | sort -u | sed -e 's/ //g' | cut -d':' -f2) - -echo "We will be deleting the following versions: ${VERSIONS_TO_PURGE}" -for v in ${VERSIONS_TO_PURGE/\n//}; do - v=${v/\"/} - v=${v/\"/} - v=${v/,/} - echo "Remove all files for version $v" - delete_files_for_version "${v}" -done - -# Done, clean up -[ -d "${TMP_DIR}" ] && rm -rf "${TMP_DIR}" diff --git a/.github/scripts/package-upload.sh b/.github/scripts/package-upload.sh new file mode 100755 index 000000000..fd8a8cda2 --- /dev/null +++ b/.github/scripts/package-upload.sh @@ -0,0 +1,43 @@ +#!/bin/sh + +set -e + +host="packages.netdata.cloud" +user="netdatabot" + +distro="${1}" +arch="${2}" +format="${3}" +repo="${4}" + +staging="${TMPDIR:-/tmp}/package-staging" +prefix="/home/netdatabot/incoming/${repo}/" + +packages="$(find artifacts -name "*.${format}")" + +mkdir -p "${staging}" + +case "${format}" in + deb) + src="${staging}/$(echo "${distro}" | cut -f 1 -d '/')/pool/" + mkdir -p "${src}" + + for pkg in ${packages}; do + cp "${pkg}" "${src}" + done + ;; + rpm) + src="${staging}/${distro}/${arch}/" + mkdir -p "${src}" + + for pkg in ${packages}; do + cp "${pkg}" "${src}" + done + ;; + *) + echo "Unrecognized package format ${format}." + exit 1 + ;; +esac + +rsync -vrptO "${staging}/" "${user}@${host}:${prefix}" diff --git a/.github/scripts/prepare-release-base.sh b/.github/scripts/prepare-release-base.sh index 838c4e86b..7c24f6b66 100755 --- a/.github/scripts/prepare-release-base.sh +++ b/.github/scripts/prepare-release-base.sh @@ -6,6 +6,7 @@ REPO="${1}" EVENT_NAME="${2}" EVENT_TYPE="${3}" EVENT_VERSION="${4}" +RELEASE_TEST="${5}" ############################################################## # Version validation functions @@ -94,7 +95,7 @@ check_newer_patch_version() { git config user.name "netdatabot" git config user.email "bot@netdata.cloud" -if [ "${REPO}" != "netdata/netdata" ]; then +if [ "${REPO}" != "netdata/netdata" ] && [ -z "${RELEASE_TEST}" ]; then echo "::notice::Not running in the netdata/netdata repository, not queueing a release build." echo "::set-output name=run::false" elif [ "${EVENT_NAME}" = 'schedule' ] || [ "${EVENT_TYPE}" = 'nightly' ]; then @@ -153,7 +154,7 @@ elif [ "${EVENT_TYPE}" = 'minor' ] && [ "${EVENT_VERSION}" != "nightly" ]; then echo "::set-output name=ref::${EVENT_VERSION}" echo "::set-output name=type::release" echo "::set-output name=branch::master" - echo "::set-output name=new-branch:${branch_name}" + echo "::set-output name=new-branch::${branch_name}" echo "::set-output name=version::$(tr -d 'v' < packaging/version)" elif [ "${EVENT_TYPE}" = 'major' ] && [ "${EVENT_VERSION}" != "nightly" ]; then echo "::notice::Preparing a major release build." diff --git a/.github/scripts/run-updater-check.sh b/.github/scripts/run-updater-check.sh index d8961f8b4..31ab71de8 100755 --- a/.github/scripts/run-updater-check.sh +++ b/.github/scripts/run-updater-check.sh @@ -1,5 +1,7 @@ #!/bin/sh +echo ">>> Installing CI support packages..." +/netdata/.github/scripts/ci-support-pkgs.sh echo ">>> Installing Netdata..." /netdata/packaging/installer/kickstart.sh --dont-wait --build-only --disable-telemetry || exit 1 echo "::group::Environment File Contents" diff --git a/.github/workflows/add-to-project.yml b/.github/workflows/add-to-project.yml new file mode 100644 index 000000000..ae58cfce2 --- /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.3.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.3.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 index 16196342b..2b31cc261 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,6 +32,11 @@ jobs: with: fetch-depth: 0 submodules: recursive + - name: Fix tags + id: fix-tags + if: github.event_name != 'push' + run: | + git fetch -f origin ${{ github.ref }}:${{ github.ref }} - name: Mark Stable id: channel if: github.event_name == 'workflow_dispatch' && github.event.inputs.type != 'nightly' @@ -40,6 +45,7 @@ jobs: - name: Build id: build run: | + git describe mkdir -p artifacts ./packaging/installer/install-required-packages.sh --dont-wait --non-interactive netdata autoreconf -ivf @@ -71,6 +77,7 @@ jobs: 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 }} @@ -80,6 +87,7 @@ jobs: 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. @@ -99,6 +107,11 @@ jobs: with: fetch-depth: 0 submodules: recursive + - name: Fix tags + id: fix-tags + if: github.event_name != 'push' + run: | + git fetch -f origin ${{ github.ref }}:${{ github.ref }} - name: Mark Stable id: channel if: github.event_name == 'workflow_dispatch' && github.event.inputs.type != 'nightly' @@ -142,6 +155,7 @@ jobs: 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 }} @@ -151,6 +165,7 @@ jobs: 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. @@ -173,19 +188,32 @@ jobs: 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) - del data['platform_map'] + for i, v in enumerate(data['include']): - data['include'][i]['artifact_key'] = data['include'][i]['distro'] + str(data['include'][i]['version']).replace('.', '') - if 'packages' in data['include'][i]: - del data['include'][i]['packages'] - if 'base_image' in data['include'][i]: - data['include'][i]['distro'] = data['include'][i]['base_image'] - del data['include'][i]['base_image'] - data['include'][i]['distro'] = ':'.join([data['include'][i]['distro'], str(data['include'][i]['version'])]) - del data['include'][i]['version'] - matrix = json.dumps(data, sort_keys=True) + 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 @@ -207,6 +235,7 @@ jobs: 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. @@ -306,6 +335,7 @@ jobs: failure() && startsWith(github.ref, 'refs/heads/master') && github.event_name != 'pull_request' + && github.repository == 'netdata/netdata' }} source-build: # Test various source build arrangements. @@ -378,6 +408,7 @@ jobs: 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. @@ -455,6 +486,7 @@ jobs: 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. @@ -521,6 +553,7 @@ jobs: 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. @@ -569,6 +602,7 @@ jobs: 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. @@ -617,12 +651,13 @@ jobs: 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' + if: github.event_name == 'workflow_dispatch' && github.event.inputs.type == 'nightly' && github.repository == 'netdata/netdata' needs: - updater-check - source-build @@ -690,7 +725,7 @@ jobs: 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' + if: github.event_name == 'workflow_dispatch' && github.event.inputs.type == 'release' && github.repository == 'netdata/netdata' needs: - updater-check - source-build diff --git a/.github/workflows/cloud_regression.yml b/.github/workflows/cloud_regression.yml index 03b12c157..b6e321fe1 100644 --- a/.github/workflows/cloud_regression.yml +++ b/.github/workflows/cloud_regression.yml @@ -13,6 +13,7 @@ on: jobs: trigger_cloud_regression_tests: runs-on: ubuntu-latest + if: github.repository == 'netdata/netdata' steps: - name: Evaluate workflow dispatch parameters env: diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index b1df95c33..b7eb53c8e 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -59,6 +59,7 @@ jobs: failure() && github.event_name != 'pull_request' && startsWith(github.ref, 'refs/heads/master') + && github.repository == 'netdata/netdata' }} docker-ci: @@ -114,6 +115,7 @@ jobs: failure() && github.event_name != 'pull_request' && startsWith(github.ref, 'refs/heads/master') + && github.repository == 'netdata/netdata' }} normalize-tag: # Fix the release tag if needed @@ -149,7 +151,7 @@ jobs: 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 }})" \ + 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 @@ -168,6 +170,7 @@ jobs: 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 }} @@ -177,7 +180,7 @@ jobs: uses: docker/build-push-action@v3 with: platforms: linux/amd64,linux/i386,linux/arm/v7,linux/arm64,linux/ppc64le - push: true + push: ${{ github.repository == 'netdata/netdata' }} tags: ${{ env.tags }} build-args: OFFICIAL_IMAGE=${{ env.OFFICIAL_IMAGE }} - name: Failure Notification @@ -204,9 +207,10 @@ jobs: 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' + 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 }} @@ -214,3 +218,81 @@ jobs: 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/packagecloud.yml b/.github/workflows/packagecloud.yml new file mode 100644 index 000000000..ba70c177b --- /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 index d793d48a8..ec4e42c00 100644 --- a/.github/workflows/packaging.yml +++ b/.github/workflows/packaging.yml @@ -46,7 +46,7 @@ jobs: import json import re FULL_CI_REGEX = '/actions run full ci' - ALWAYS_RUN_ARCHES = ["amd64"] + ALWAYS_RUN_ARCHES = ["amd64", "x86_64"] PR_BODY = """${{ github.event.pull_request.body }}""" yaml = YAML(typ='safe') entries = list() @@ -65,14 +65,14 @@ jobs: entries.append({ 'distro': data['include'][i]['distro'], 'version': data['include'][i]['version'], - 'pkgclouddistro': data['include'][i]['packages']['repo_distro'], + '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: (k['arch'], k['distro'], k['version'])) + 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) @@ -94,6 +94,7 @@ jobs: failure() && github.event_name != 'pull_request' && startsWith(github.ref, 'refs/heads/master') + && github.repository == 'netdata/netdata' }} version-check: @@ -149,6 +150,7 @@ jobs: failure() && github.event_name != 'pull_request' && startsWith(github.ref, 'refs/heads/master') + && github.repository == 'netdata/netdata' }} build: @@ -214,28 +216,38 @@ jobs: -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' + 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.pkgclouddistro }} \ + .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.pkgclouddistro }} "${pkgfile}" + .github/scripts/package_cloud_wrapper.sh push ${{ needs.version-check.outputs.repo }}/${{ matrix.repo_distro }} "${pkgfile}" done - - name: Clean - id: cleanup - if: github.event_name == 'workflow_dispatch' - shell: bash - env: - REPO: ${{ needs.version-check.outputs.repo }} - PKG_CLOUD_TOKEN: ${{ secrets.PACKAGE_CLOUD_API_KEY }} - PACKAGE_CLOUD_RETENTION_DAYS: ${{ needs.version-check.outputs.retention }} - run: .github/scripts/old_package_purging.sh - name: Failure Notification uses: rtCamp/action-slack-notify@v2 env: @@ -244,19 +256,21 @@ jobs: SLACK_TITLE: 'Package Build failed:' SLACK_USERNAME: 'GitHub Actions' SLACK_MESSAGE: |- - ${{ github.repository }}: ${{ matrix.pkgclouddistro }} ${{ matrix.version }} package build for ${{ matrix.arch }} failed. + ${{ 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 }} - Publish: ${{ steps.upload.outcome }} - Cleanup: ${{ steps.cleanup.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 index ae28c0019..e16ecaba7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -41,7 +41,8 @@ jobs: ${{ github.repository }} \ ${{ github.event_name }} \ ${{ github.event.inputs.type }} \ - ${{ github.event.inputs.version }} + ${{ 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' @@ -111,7 +112,7 @@ jobs: name: Trigger artifact builds runs-on: ubuntu-latest needs: update-changelogs - if: ${{ needs.update-changelogs.outputs.run }} == 'true' + if: needs.update-changelogs.outputs.run == 'true' steps: - name: Checkout id: checkout @@ -146,7 +147,7 @@ jobs: name: Trigger docker builds runs-on: ubuntu-latest needs: update-changelogs - if: ${{ needs.update-changelogs.outputs.run }} == 'true' + if: needs.update-changelogs.outputs.run == 'true' steps: - name: Checkout id: checkout @@ -181,7 +182,7 @@ jobs: name: Trigger package builds runs-on: ubuntu-latest needs: update-changelogs - if: ${{ needs.update-changelogs.outputs.run }} == 'true' + if: needs.update-changelogs.outputs.run == 'true' steps: - name: Checkout id: checkout diff --git a/.github/workflows/repoconfig-packages.yml b/.github/workflows/repoconfig-packages.yml index b0600cc0b..824ddd341 100644 --- a/.github/workflows/repoconfig-packages.yml +++ b/.github/workflows/repoconfig-packages.yml @@ -7,12 +7,14 @@ on: 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 @@ -50,11 +52,10 @@ jobs: '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'], - 'arch': 'amd64' + 'platform': data['platform_map']['amd64'] }) - entries.sort(key=lambda k: (k['arch'], k['distro'], k['version'])) + 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) @@ -76,6 +77,7 @@ jobs: failure() && github.event_name != 'pull_request' && startsWith(github.ref, 'refs/heads/master') + && github.repository == 'netdata/netdata' }} build: @@ -113,6 +115,35 @@ jobs: 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' @@ -133,7 +164,7 @@ jobs: .github/scripts/package_cloud_wrapper.sh push "${REPO_PREFIX}-repoconfig/${{ matrix.pkgclouddistro }}" "${pkgfile}" done - name: Failure Notification - if: ${{ failure() }} + if: ${{ failure() && github.repository == 'netdata/netdata' }} uses: rtCamp/action-slack-notify@v2 env: SLACK_COLOR: 'danger' @@ -146,5 +177,7 @@ jobs: Checkout: ${{ steps.checkout.outcome }} Fetch images: ${{ steps.fetch-images.outcome }} Build: ${{ steps.build.outcome }} - Publish: ${{ steps.publish.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 }} |