diff options
Diffstat (limited to '')
-rwxr-xr-x | .github/scripts/build-dist.sh | 70 | ||||
-rwxr-xr-x | .github/scripts/check-updater.sh | 38 | ||||
-rwxr-xr-x | .github/scripts/gen-docker-tags.py | 13 | ||||
-rwxr-xr-x | .github/scripts/old_package_purging.sh (renamed from .travis/package_management/old_package_purging.sh) | 17 | ||||
-rwxr-xr-x | .github/scripts/package_cloud_wrapper.sh (renamed from .travis/package_management/package_cloud_wrapper.sh) | 4 |
5 files changed, 129 insertions, 13 deletions
diff --git a/.github/scripts/build-dist.sh b/.github/scripts/build-dist.sh new file mode 100755 index 000000000..f7e27324c --- /dev/null +++ b/.github/scripts/build-dist.sh @@ -0,0 +1,70 @@ +#!/bin/sh +# +# Builds the netdata-vX.y.Z-xxxx.tar.gz source tarball (dist) + +set -e + +# shellcheck source=.github/scripts/functions.sh +. "$(dirname "$0")/functions.sh" + +NAME="${NAME:-netdata}" +VERSION="${VERSION:-"$(git describe --always)"}" +BASENAME="$NAME-$VERSION" + +prepare_build() { + progress "Preparing build" + ( + test -d artifacts || mkdir -p artifacts + echo "${VERSION}" > packaging/version + ) >&2 +} + +build_dist() { + progress "Building dist" + ( + command -v git > /dev/null && [ -d .git ] && git clean -d -f + autoreconf -ivf + ./configure \ + --prefix=/usr \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --libexecdir=/usr/libexec \ + --with-zlib \ + --with-math \ + --with-user=netdata \ + CFLAGS=-O2 + make dist + mv "${BASENAME}.tar.gz" artifacts/ + ) >&2 +} + +prepare_assets() { + progress "Preparing assets" + ( + cp packaging/version artifacts/latest-version.txt + cd artifacts || exit 1 + ln -f "${BASENAME}.tar.gz" netdata-latest.tar.gz + ln -f "${BASENAME}.gz.run" netdata-latest.gz.run + sha256sum -b ./* > "sha256sums.txt" + ) >&2 +} + +steps="prepare_build build_dist prepare_assets" + +_main() { + for step in $steps; do + if ! run "$step"; then + if [ -t 1 ]; then + debug + else + fail "Build failed" + fi + fi + done + + echo "🎉 All Done!" +} + +if [ -n "$0" ] && [ x"$0" != x"-bash" ]; then + _main "$@" +fi diff --git a/.github/scripts/check-updater.sh b/.github/scripts/check-updater.sh new file mode 100755 index 000000000..3ef4857f9 --- /dev/null +++ b/.github/scripts/check-updater.sh @@ -0,0 +1,38 @@ +#!/bin/sh +# +set -e +# shellcheck source=.github/scripts/functions.sh +. "$(dirname "$0")/functions.sh" + +check_successfull_update() { + progress "Check netdata version after update" + ( + netdata_version=$(netdata -v | awk '{print $2}') + updater_version=$(cat packaging/version) + if [ "$netdata_version" = "$updater_version" ]; then + echo "Update successfull!" + else + exit 1 + fi + ) >&2 +} + +steps="check_successfull_update" + +_main() { + for step in $steps; do + if ! run "$step"; then + if [ -t 1 ]; then + debug + else + fail "Build failed" + fi + fi + done + + echo "🎉 All Done!" +} + +if [ -n "$0" ] && [ x"$0" != x"-bash" ]; then + _main "$@" +fi diff --git a/.github/scripts/gen-docker-tags.py b/.github/scripts/gen-docker-tags.py new file mode 100755 index 000000000..6c6251155 --- /dev/null +++ b/.github/scripts/gen-docker-tags.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python3 + +import sys + +REPO = 'netdata/netdata' + +version = sys.argv[1].split('.') + +MAJOR = ':'.join([REPO, version[0]]) +MINOR = ':'.join([REPO, '.'.join(version[0:2])]) +PATCH = ':'.join([REPO, '.'.join(version[0:3])]) + +print(','.join([MAJOR, MINOR, PATCH])) diff --git a/.travis/package_management/old_package_purging.sh b/.github/scripts/old_package_purging.sh index 89ecd753f..c90c4b780 100755 --- a/.travis/package_management/old_package_purging.sh +++ b/.github/scripts/old_package_purging.sh @@ -26,7 +26,7 @@ delete_files_for_version() { pkg=${pkg/\"/} pkg=${pkg/\"/} echo "Attempting yank on ${pkg}.." - .travis/package_management/package_cloud_wrapper.sh yank "${PACKAGING_USER}/${DEPLOY_REPO}" "${pkg}" || echo "Nothing to yank or error on ${pkg}" + .github/scripts/package_cloud_wrapper.sh yank "${REPO}" "${pkg}" || echo "Nothing to yank or error on ${pkg}" done } @@ -34,18 +34,13 @@ delete_files_for_version() { TOP_LEVEL=$(basename "$(git rev-parse --show-toplevel)") CWD=$(git rev-parse --show-cdup) if [ -n "$CWD" ] || [ ! "${TOP_LEVEL}" == "netdata" ]; then - echo "Run as .travis/package_management/$(basename "$0") from top level directory of netdata git repository" + 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 "${PACKAGING_USER}" ]; then - echo "No PACKAGING_USER variable found" - exit 1 -fi - -if [ -z "${DEPLOY_REPO}" ]; then - echo "No DEPLOY_REPO variable found" +if [ -z "${REPO}" ]; then + echo "No REPO variable found" exit 1 fi @@ -68,8 +63,8 @@ DATE_UNTIL_TO_DELETE=$(date --date="${PACKAGE_CLOUD_RETENTION_DAYS} day ago" +%Y 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 ${PACKAGING_USER}/${DEPLOY_REPO}" -curl -sS "https://${PKG_CLOUD_TOKEN}:@packagecloud.io/api/v1/repos/${PACKAGING_USER}/${DEPLOY_REPO}/packages.json" > "${PKG_LIST_FILE}" +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 # diff --git a/.travis/package_management/package_cloud_wrapper.sh b/.github/scripts/package_cloud_wrapper.sh index 48a372d37..7640ef484 100755 --- a/.travis/package_management/package_cloud_wrapper.sh +++ b/.github/scripts/package_cloud_wrapper.sh @@ -21,7 +21,7 @@ PKG_CLOUD_CONFIG="$HOME/.package_cloud_configuration.cfg" TOP_LEVEL=$(basename "$(git rev-parse --show-toplevel)") CWD=$(git rev-parse --show-cdup) if [ -n "$CWD" ] || [ ! "${TOP_LEVEL}" == "netdata" ]; then - echo "Run as .travis/package_management/$(basename "$0") from top level directory of netdata git repository" + echo "Run as .github/scripts/$(basename "$0") from top level directory of netdata git repository" echo "Docker build process aborted" exit 1 fi @@ -29,7 +29,7 @@ fi # Install dependency if not there if ! command -v package_cloud > /dev/null 2>&1; then echo "No package cloud gem found, installing" - gem install -V package_cloud || (echo "Package cloud installation failed. you might want to check if required dependencies are there (ruby gcc gcc-c++ ruby-devel)" && exit 1) + sudo gem install -V package_cloud || (echo "Package cloud installation failed. you might want to check if required dependencies are there (ruby gcc gcc-c++ ruby-devel)" && exit 1) else echo "Found package_cloud gem, continuing" fi |