diff options
author | Austin S. Hemmelgarn <austin@netdata.cloud> | 2021-08-18 09:11:02 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-18 09:11:02 -0400 |
commit | 28bea5ea903df78fd0212460b8ff9a1303784144 (patch) | |
tree | d0fe0bea73ce9001febb56013a97e846bdbba450 /.github/scripts | |
parent | db1476214d938cc3e1b9536a4beb83736621188b (diff) |
Add Debian 11 (Bullseye) to CI. (#11334)
* Add Debian 11 (Bullseye) to CI.
Official feature freeze is in a couple of days, and the release is soon
to follow.
* Fix handling of Debian 11 package builds.
* Fix build dependencies for Debian 11.
`dh-systemd` has long since been deprecated, we should instead be
depending on the minimum version of `debhelper` that includes the
required code. We need to special-case Ubuntu 16.04 because it predates
the merge of `dh-systemd` into `debhelper`.
* Use correct Docker image for Debian 11.
* Add repoconfig package build for Debian 11.
* Simplify handling of package building and testing.
This should fix the CI issues we’re seeing with package builds, or at
least make them easier to diagnose.
Diffstat (limited to '.github/scripts')
-rwxr-xr-x | .github/scripts/pkg-test.sh | 128 |
1 files changed, 128 insertions, 0 deletions
diff --git a/.github/scripts/pkg-test.sh b/.github/scripts/pkg-test.sh new file mode 100755 index 0000000000..e54882beaf --- /dev/null +++ b/.github/scripts/pkg-test.sh @@ -0,0 +1,128 @@ +#!/bin/sh + +install_debian_like() { + # This is needed to ensure package installs don't prompt for any user input. + export DEBIAN_FRONTEND=noninteractive + + apt-get update + + # Install NetData + apt-get install -y /netdata/artifacts/netdata_"${VERSION}"_*.deb || exit 1 + + # Install testing tools + apt-get install -y --no-install-recommends curl netcat jq || exit 1 +} + +install_fedora_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!) + + PKGMGR="$( (command -v dnf > /dev/null && echo "dnf") || echo "yum")" + + pkg_version="$(echo "${VERSION}" | tr - .)" + + # Install NetData + "$PKGMGR" install -y /netdata/artifacts/netdata-"${pkg_version}"-*.rpm + + # Install testing tools + "$PKGMGR" install -y curl nc jq || exit 1 +} + +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")" + + pkg_version="$(echo "${VERSION}" | tr - .)" + + # Install EPEL (needed for `jq` + "$PKGMGR" install -y epel-release || exit 1 + + # Install NetData + "$PKGMGR" install -y /netdata/artifacts/netdata-"${pkg_version}"-*.rpm + + # Install testing tools + "$PKGMGR" install -y curl nc jq || exit 1 +} + +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!) + + pkg_version="$(echo "${VERSION}" | tr - .)" + + # Install NetData + zypper install -y --allow-unsigned-rpm /netdata/artifacts/netdata-"${pkg_version}"-*.rpm + + # Install testing tools + zypper install -y --no-recommends curl netcat-openbsd jq || exit 1 +} + +dump_log() { + cat ./netdata.log +} + +wait_for() { + host="${1}" + port="${2}" + name="${3}" + timeout="30" + + if command -v nc > /dev/null ; then + netcat="nc" + elif command -v netcat > /dev/null ; then + netcat="netcat" + else + printf "Unable to find a usable netcat command.\n" + return 1 + fi + + printf "Waiting for %s on %s:%s ... " "${name}" "${host}" "${port}" + + sleep 30 + + i=0 + while ! ${netcat} -z "${host}" "${port}"; do + sleep 1 + if [ "$i" -gt "$timeout" ]; then + printf "Timed out!\n" + return 1 + fi + i="$((i + 1))" + done + printf "OK\n" +} + +case "${DISTRO}" in + debian | ubuntu) + install_debian_like + ;; + fedora) + install_fedora_like + ;; + centos) + install_centos + ;; + opensuse) + install_suse_like + ;; + *) + printf "ERROR: unsupported distro: %s_%s\n" "${DISTRO}" "${DISTRO_VERSION}" + exit 1 + ;; +esac + +trap dump_log EXIT + +/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 + +jq '.version' ./response || exit 1 + +trap - EXIT |