diff options
author | James Mills <1290234+prologic@users.noreply.github.com> | 2020-01-28 05:51:18 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-28 05:51:18 +1000 |
commit | d307ba7ec545f9e76f55cd9f2af08ffd6db6fbc2 (patch) | |
tree | 3e9170472756960f063d4c95b14c6063bc9a2325 /packaging/build_package_install_test.sh | |
parent | cb7f19ba2dc40d24ec9cd68c08a7d20acd891a37 (diff) |
Adds Docker based build system for Binary Packages, CI/CD, Smoke Testing and Development. (#7735)
* Added Dockerfile for building, packaging and performing basic smoke tests of the package(s) and NetData Agent itself
* Moved install of package per distro into a script and refactor in order to supprot other distro(s)
* Add support for RPM based systems too (Fedora, CentOS)
* Drop the unnecessary (for now) Debian cleanup steps
* Reverse the order of installing NetData agent and testing tools
* Update default VERSION to 0.1 to match builder images
* Added support for openSUSE
* Minor fixes from review
* Update Dockerfile
Co-Authored-By: Austin S. Hemmelgarn <ahferroin7@gmail.com>
* Update Dockerfile
Co-Authored-By: Austin S. Hemmelgarn <ahferroin7@gmail.com>
* Move thigns around a bit
* Re-update test/install shell scripts to be POSIX. We don't really want to depend on Bash here
* Fixed support for yum vs. dnf
* Fixed paths to scripts
* Added a script to kick off the build/package/install/test flow more easily for both humans and CI/CD
Co-authored-by: Austin S. Hemmelgarn <ahferroin7@gmail.com>
Diffstat (limited to 'packaging/build_package_install_test.sh')
-rwxr-xr-x | packaging/build_package_install_test.sh | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/packaging/build_package_install_test.sh b/packaging/build_package_install_test.sh new file mode 100755 index 0000000000..e3b3362d41 --- /dev/null +++ b/packaging/build_package_install_test.sh @@ -0,0 +1,37 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-3.0-or-later + +set -e + +# 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 || echo "") +if [ -n "${CWD}" ] || [ ! "${TOP_LEVEL}" = "netdata" ]; then + echo "Run as ./packaging/$(basename "$0") from top level directory of netdata git repository" + exit 1 +fi + +if [ $# -lt 2 ] || [ $# -gt 3 ]; then + echo "Usage: ./packaging/$(basename "$0") <distro> <distro_version> [<netdata_version>]" + exit 1 +fi + +if ! command -v docker > /dev/null; then + echo "Docker CLI not found. You need Docker to run this!" + exit 2 +fi + +DISTRO="$1" +DISTRO_VERSION="$2" +# TODO: Auto compute this? +VERSION="${3:-1.19.0}" + +TAG="netdata/netdata:${DISTRO}_${DISTRO_VERSION}" + +docker build \ + -f ./packaging/Dockerfile.packager \ + --build-arg DISTRO="$DISTRO" \ + --build-arg DISTRO_VERSION="$DISTRO_VERSION" \ + --build-arg VERSION="$VERSION" \ + -t "$TAG" . | + tee build.log |