summaryrefslogtreecommitdiffstats
path: root/packaging
diff options
context:
space:
mode:
authorAustin S. Hemmelgarn <austin@netdata.cloud>2021-03-15 08:31:16 -0400
committerGitHub <noreply@github.com>2021-03-15 08:31:16 -0400
commite54982b6c814d1c6e1dda456fcf691d9b829eb91 (patch)
tree8748ffc75bbc7413fb6ed059ad4cb0a3db619c5e /packaging
parent6757aa9239493589ea8f22a1db22aca62ce8259b (diff)
Docker-based packaging workflow in GitHub Actions. (#9964)
* Add a new GHA workflow for building and publishing binary packages. This greatly simplifies the package handling code, significantly reduces the amount of things we are running in Travis, adds better CI for package builds for PRs, finally eliminates LXC from any of our CI, and enables us to make further major improvements much easier. * Migrate repo cleanup to GHA and remove dead code. * Fix RPM package builds. * Fix DEB installation.
Diffstat (limited to 'packaging')
-rw-r--r--packaging/Dockerfile.packager13
-rwxr-xr-xpackaging/scripts/install.sh23
-rwxr-xr-xpackaging/scripts/test.sh22
3 files changed, 46 insertions, 12 deletions
diff --git a/packaging/Dockerfile.packager b/packaging/Dockerfile.packager
index 14f711ca68..e0591491f2 100644
--- a/packaging/Dockerfile.packager
+++ b/packaging/Dockerfile.packager
@@ -1,36 +1,37 @@
ARG ARCH=amd64
ARG DISTRO=debian
+ARG TEST_BASE=debian
ARG DISTRO_VERSION=10
-ARG VERSION=0.1
+ARG PKG_VERSION=0.1
FROM netdata/package-builders:${DISTRO}${DISTRO_VERSION} AS build
ARG ARCH
ARG DISTRO
ARG DISTRO_VERSION
-ARG VERSION
+ARG PKG_VERSION
ENV ARCH=$ARCH
ENV DISTRO=$DISTRO
ENV DISTRO_VERSION=$DISTRO_VERSION
-ENV VERSION=$VERSION
+ENV VERSION=$PKG_VERSION
WORKDIR /netdata
COPY . .
RUN /build.sh
-FROM ${DISTRO}:${DISTRO_VERSION} AS runtime
+FROM ${TEST_BASE}:${DISTRO_VERSION} AS runtime
ARG ARCH
ARG DISTRO
ARG DISTRO_VERSION
-ARG VERSION
+ARG PKG_VERSION
ENV ARCH=$ARCH
ENV DISTRO=$DISTRO
ENV DISTRO_VERSION=$DISTRO_VERSION
-ENV VERSION=$VERSION
+ENV VERSION=$PKG_VERSION
COPY ./packaging/scripts/install.sh /install.sh
COPY ./packaging/scripts/test.sh /test.sh
diff --git a/packaging/scripts/install.sh b/packaging/scripts/install.sh
index db8d4a67f4..5418ecec46 100755
--- a/packaging/scripts/install.sh
+++ b/packaging/scripts/install.sh
@@ -27,6 +27,22 @@ install_fedora_like() {
"$PKGMGR" install -y curl nc jq
}
+install_centos() {
+ # Using a glob pattern here because I can't reliably determine what the
+ # resulting package name will be (TODO: There must be a better way!)
+
+ PKGMGR="$( (command -v dnf > /dev/null && echo "dnf") || echo "yum")"
+
+ # Install EPEL (needed for `jq`
+ "$PKGMGR" install -y epel-release
+
+ # Install NetData
+ "$PKGMGR" install -y /artifacts/netdata-"${VERSION}"-*.rpm
+
+ # Install testing tools
+ "$PKGMGR" install -y curl nc jq
+}
+
install_suse_like() {
# Using a glob pattern here because I can't reliably determine what the
# resulting package name will be (TODO: There must be a better way!)
@@ -38,16 +54,19 @@ install_suse_like() {
# Install testing tools
zypper install -y --no-recommends \
- curl netcat jq
+ curl gnu-netcat jq
}
case "${DISTRO}" in
debian | ubuntu)
install_debian_like
;;
- fedora | centos)
+ fedora)
install_fedora_like
;;
+ centos)
+ install_centos
+ ;;
opensuse)
install_suse_like
;;
diff --git a/packaging/scripts/test.sh b/packaging/scripts/test.sh
index 24ba2966f5..d33bcc2438 100755
--- a/packaging/scripts/test.sh
+++ b/packaging/scripts/test.sh
@@ -1,13 +1,21 @@
#!/bin/sh
+dump_log() {
+ cat ./netdata.log
+}
+
+trap dump_log EXIT
+
wait_for() {
host="${1}"
port="${2}"
name="${3}"
- timeout="${4:-30}"
+ timeout="30"
printf "Waiting for %s on %s:%s ... " "${name}" "${host}" "${port}"
+ sleep 30
+
i=0
while ! nc -z "${host}" "${port}"; do
sleep 1
@@ -20,8 +28,14 @@ wait_for() {
printf "OK\n"
}
-netdata -D > netdata.log 2>&1 &
+/usr/sbin/netdata -D > ./netdata.log 2>&1 &
+
+wait_for localhost 19999 netdata || exit 1
+
+curl -sS http://127.0.0.1:19999/api/v1/info > ./response || exit 1
+
+cat ./response
-wait_for localhost 19999 netdata
+jq '.version' ./response || exit 1
-curl -sS http://127.0.0.1:19999/api/v1/info | jq '.version'
+trap - EXIT