@cryptotaxi247 / netdata-1 / commits / cd8c7a26b

Add Amazon Linux 2 to CI and platform support. (#14599)

* Add Amazon Linux 2 to CI and platform support. * Fix conditional in repoconfig spec file. * Fix package testing script. * Add support to kickstart.sh. * Fix pkg-test.sh typo. * Fix CI support package handling. * Make updater log to stderr if running under CI. * Fix broken sed expressions in installer. * Fix updater CI check WRT auto-update checking. * Update .github/scripts/pkg-test.sh Co-authored-by: Tasos Katsoulas <12612986+tkatsoulas@users.noreply.github.com> * Clean up package testing code. * Fix filename matching for package testing. --------- Co-authored-by: Tasos Katsoulas <12612986+tkatsoulas@users.noreply.github.com>

Austin S. Hemmelgarn committed Mar 13, 2023 at 07:35 UTC cd8c7a26b6dbbbc3da6b603e0c6e2c50439ff598
11 files changed +133 -27
.github/data/distros.yml
+11
@@ -74,6 +74,17 @@ include:
74 - el/8Server
75 - el/8Client
76
77 + - distro: amazonlinux
78 + version: "2"
79 + packages:
80 + type: rpm
81 + repo_distro: amazonlinux/2
82 + arches:
83 + - x86_64
84 + - aarch64
85 + test:
86 + ebpf-core: false
87 +
88 - distro: centos
89 version: "7"
90 eol_check: false
.github/scripts/ci-support-pkgs.sh
+10 -7
@@ -5,10 +5,13 @@
5
6 set -e
7
8 -if [ -f /etc/centos-release ] || [ -f /etc/redhat-release ] || [ -f /etc/fedora-release ] || [ -f /etc/almalinux-release ]; then
9 - # Alma, Fedora, CentOS, Redhat
10 - dnf install -y procps-ng cronie cronie-anacron || yum install -y procps-ng cronie cronie-anacron
11 -elif [ -f /etc/arch-release ]; then
12 - # Arch
13 - pacman -S --noconfirm cronie
14 -fi
8 +. /etc/os-release
9 +
10 +case "${ID}" in
11 + amzn|almalinux|centos|fedora)
12 + dnf install -y procps-ng cronie cronie-anacron || yum install -y procps-ng cronie cronie-anacron
13 + ;;
14 + arch)
15 + pacman -S --noconfirm cronie
16 + ;;
17 +esac
.github/scripts/pkg-test.sh
+25 -3
@@ -13,6 +13,7 @@ install_debian_like() {
13 apt-get update
14
15 # Install Netdata
16 + # Strange quoting is required here so that glob matching works.
17 apt-get install -y /netdata/artifacts/netdata_"${VERSION}"*_*.deb || exit 1
18
19 # Install testing tools
@@ -28,7 +29,8 @@ install_fedora_like() {
29 pkg_version="$(echo "${VERSION}" | tr - .)"
30
31 # Install Netdata
31 - "$PKGMGR" install -y /netdata/artifacts/netdata-"${pkg_version}"-*.rpm
32 + # Strange quoting is required here so that glob matching works.
33 + "$PKGMGR" install -y /netdata/artifacts/netdata-"${pkg_version}"-*.rpm || exit 1
34
35 # Install testing tools
36 "$PKGMGR" install -y curl nc jq || exit 1
@@ -50,9 +52,25 @@ install_centos() {
52 "$PKGMGR" install -y epel-release || exit 1
53
54 # Install Netdata
53 - "$PKGMGR" install -y /netdata/artifacts/netdata-"${pkg_version}"-*.rpm
55 + # Strange quoting is required here so that glob matching works.
56 + "$PKGMGR" install -y /netdata/artifacts/netdata-"${pkg_version}"-*.rpm || exit 1
57
58 # Install testing tools
59 + # shellcheck disable=SC2086
60 + "$PKGMGR" install -y ${opts} curl nc jq || exit 1
61 +}
62 +
63 +install_amazon_linux() {
64 + PKGMGR="$( (command -v dnf > /dev/null && echo "dnf") || echo "yum")"
65 +
66 + pkg_version="$(echo "${VERSION}" | tr - .)"
67 +
68 + # Install Netdata
69 + # Strange quoting is required here so that glob matching works.
70 + "$PKGMGR" install -y /netdata/artifacts/netdata-"${pkg_version}"-*.rpm || exit 1
71 +
72 + # Install testing tools
73 + # shellcheck disable=SC2086
74 "$PKGMGR" install -y ${opts} curl nc jq || exit 1
75 }
76
@@ -63,7 +81,8 @@ install_suse_like() {
81 pkg_version="$(echo "${VERSION}" | tr - .)"
82
83 # Install Netdata
66 - zypper install -y --allow-unsigned-rpm /netdata/artifacts/netdata-"${pkg_version}"-*.rpm
84 + # Strange quoting is required here so that glob matching works.
85 + zypper install -y --allow-unsigned-rpm /netdata/artifacts/netdata-"${pkg_version}"-*.rpm || exit 1
86
87 # Install testing tools
88 zypper install -y --no-recommends curl netcat-openbsd jq || exit 1
@@ -114,6 +133,9 @@ case "${DISTRO}" in
133 centos | rockylinux | almalinux)
134 install_centos
135 ;;
136 + amazonlinux)
137 + install_amazon_linux
138 + ;;
139 opensuse)
140 install_suse_like
141 ;;
.github/scripts/run-updater-check.sh
+1
@@ -2,6 +2,7 @@
2
3 echo ">>> Installing CI support packages..."
4 /netdata/.github/scripts/ci-support-pkgs.sh
5 +mkdir -p /etc/cron.daily # Needed to make auto-update checking work correctly on some platforms.
6 echo ">>> Installing Netdata..."
7 /netdata/packaging/installer/kickstart.sh --dont-wait --build-only --disable-telemetry || exit 1
8 echo "::group::>>> Pre-Update Environment File Contents"
netdata-installer.sh
+6 -5
@@ -1018,13 +1018,14 @@ if [ ! -f "${NETDATA_PREFIX}/etc/netdata/.installer-cleanup-of-stock-configs-don
1018 (find -L "${NETDATA_PREFIX}/etc/netdata" -type f -not -path '*/\.*' -not -path "${NETDATA_PREFIX}/etc/netdata/orig/*" \( -name '*.conf.old' -o -name '*.conf' -o -name '*.conf.orig' -o -name '*.conf.installer_backup.*' \)) | while IFS= read -r x; do
1019 if [ -f "${x}" ]; then
1020 # find it relative filename
1021 - f=$("$x" | sed "${NETDATA_PREFIX}/etc/netdata/")
1021 + p="$(echo "${NETDATA_PREFIX}/etc/netdata" | sed -e 's/\//\\\//')"
1022 + f="$(echo "${x}" | sed -e "s/${p}//")"
1023
1024 # find the stock filename
1024 - t=$("${f}" | sed ".conf.installer_backup.*/.conf")
1025 - t=$("${t}" | sed ".conf.old/.conf")
1026 - t=$("${t}" | sed ".conf.orig/.conf")
1027 - t=$("${t}" | sed "orig//")
1025 + t="$(echo "${f}" | sed -e 's/\.conf\.installer_backup\..*/\.conf/')"
1026 + t="$(echo "${t}" | sed -e 's/\.conf\.old/\.conf/')"
1027 + t="$(echo "${t}" | sed -e 's/\.conf\.orig/\.conf/')"
1028 + t="$(echo "${t}" | sed -e 's/orig//')"
1029
1030 if [ -z "${md5sum}" ] || [ ! -x "${md5sum}" ]; then
1031 # we don't have md5sum - keep it
packaging/PLATFORM_SUPPORT.md
+8 -7
@@ -88,13 +88,14 @@ platforms that we officially support ourselves to the intermediate tier. Our [st
88 expected to work on these platforms if available. Source-based installs are expected to work on these platforms
89 with minimal user effort.
90
91 -| Platform | Version | Official Native Packages | Notes |
92 -|---------------|---------|--------------------------|-------------------------------------------------------------------------|
93 -| Alpine Linux | 3.16 | No | |
94 -| Alpine Linux | 3.15 | No | |
95 -| Alpine Linux | 3.14 | No | |
96 -| Arch Linux | Latest | No | We officially recommend the community packages available for Arch Linux |
97 -| Manjaro Linux | Latest | No | We officially recommend the community packages available for Arch Linux |
91 +| Platform | Version | Official Native Packages | Notes |
92 +|---------------|---------|--------------------------|------------------------------------------------------------------------------------------------------|
93 +| Alpine Linux | 3.16 | No | |
94 +| Alpine Linux | 3.15 | No | |
95 +| Alpine Linux | 3.14 | No | |
96 +| Amazon Linux | 2 | x86\_64, AArch64 | Scheduled for promotion to Core tier at some point after the release of v1.39.0 of the Netdata Agent |
97 +| Arch Linux | Latest | No | We officially recommend the community packages available for Arch Linux |
98 +| Manjaro Linux | Latest | No | We officially recommend the community packages available for Arch Linux |
99
100 ### Community
101
packaging/installer/kickstart.sh
+20 -3
@@ -667,7 +667,7 @@ get_system_info() {
667 warning "Distribution auto-detection overridden by user. This is not guaranteed to work, and is not officially supported."
668 fi
669
670 - supported_compat_names="debian ubuntu centos fedora opensuse ol arch"
670 + supported_compat_names="debian ubuntu centos fedora opensuse ol amzn arch"
671
672 if str_in_list "${DISTRO}" "${supported_compat_names}"; then
673 DISTRO_COMPAT_NAME="${DISTRO}"
@@ -1269,7 +1269,7 @@ pkg_installed() {
1269 dpkg-query --show --showformat '${Status}' "${1}" 2>&1 | cut -f 1 -d ' ' | grep -q '^install$'
1270 return $?
1271 ;;
1272 - centos|fedora|opensuse|ol)
1272 + centos|fedora|opensuse|ol|amzn)
1273 rpm -q "${1}" > /dev/null 2>&1
1274 return $?
1275 ;;
@@ -1313,7 +1313,7 @@ netdata_avail_check() {
1313 env DEBIAN_FRONTEND=noninteractive apt-cache policy netdata | grep -q repo.netdata.cloud/repos/;
1314 return $?
1315 ;;
1316 - centos|fedora|ol)
1316 + centos|fedora|ol|amzn)
1317 # shellcheck disable=SC2086
1318 ${pm_cmd} search --nogpgcheck -v netdata | grep -qE 'Repo *: netdata(-edge)?$'
1319 return $?
@@ -1482,6 +1482,23 @@ try_package_install() {
1482 INSTALL_TYPE="binpkg-rpm"
1483 NATIVE_VERSION="${INSTALL_VERSION:+"-${INSTALL_VERSION}.${SYSARCH}"}"
1484 ;;
1485 + amzn)
1486 + if command -v dnf > /dev/null; then
1487 + pm_cmd="dnf"
1488 + repo_subcmd="makecache"
1489 + else
1490 + pm_cmd="yum"
1491 + fi
1492 + repo_prefix="amazonlinux/${SYSVERSION}"
1493 + pkg_type="rpm"
1494 + pkg_suffix=".noarch"
1495 + pkg_vsep="-"
1496 + pkg_install_opts="${interactive_opts}"
1497 + repo_update_opts="${interactive_opts}"
1498 + uninstall_subcmd="remove"
1499 + INSTALL_TYPE="binpkg-rpm"
1500 + NATIVE_VERSION="${INSTALL_VERSION:+"-${INSTALL_VERSION}.${SYSARCH}"}"
1501 + ;;
1502 *)
1503 warning "We do not provide native packages for ${DISTRO}."
1504 return 2
packaging/installer/netdata-updater.sh
+2 -2
@@ -838,8 +838,8 @@ ndtmpdir=
838
839 trap cleanup EXIT
840
841 -if [ -t 2 ]; then
842 - # we are running on a terminal
841 +if [ -t 2 ] || [ "${GITHUB_ACTIONS}" ]; then
842 + # we are running on a terminal or under CI
843 # open fd 3 and send it to stderr
844 exec 3>&2
845 else
packaging/repoconfig/netdata-edge.repo.al new
+21
@@ -0,0 +1,21 @@
1 +[netdata-edge]
2 +name=Netdata Edge
3 +baseurl=https://repo.netdata.cloud/repos/edge/amazonlinux/$releasever/$basearch
4 +repo_gpgcheck=1
5 +gpgcheck=1
6 +gpgkey=https://repo.netdata.cloud/netdatabot.gpg.key
7 +enabled=1
8 +sslverify=1
9 +sslcacert=/etc/pki/tls/certs/ca-bundle.crt
10 +priority=50
11 +
12 +[netdata-repoconfig]
13 +name=Netdata Repository Config
14 +baseurl=https://repo.netdata.cloud/repos/repoconfig/amazonlinux/$releasever/$basearch
15 +repo_gpgcheck=1
16 +gpgcheck=1
17 +gpgkey=https://repo.netdata.cloud/netdatabot.gpg.key
18 +enabled=1
19 +sslverify=1
20 +sslcacert=/etc/pki/tls/certs/ca-bundle.crt
21 +priority=50
packaging/repoconfig/netdata-repo.spec
+8
@@ -16,6 +16,8 @@ Source4: netdata.repo.centos
16 Source5: netdata-edge.repo.centos
17 Source6: netdata.repo.ol
18 Source7: netdata-edge.repo.ol
19 +Source8: netdata.repo.al
20 +Source9: netdata-edge.repo.al
21
22 BuildArch: noarch
23
@@ -43,9 +45,15 @@ install -pm 644 %{SOURCE3} ./netdata-edge.repo
45 %endif
46
47 %if 0%{?centos_ver}
48 +# Amazon Linux 2 looks like CentOS, but with extra macros.
49 +%if 0%{?amzn2}
50 +install -pm 644 %{SOURCE8} ./netdata.repo
51 +install -pm 644 %{SOURCE9} ./netdata-edge.repo
52 +%else
53 install -pm 644 %{SOURCE4} ./netdata.repo
54 install -pm 644 %{SOURCE5} ./netdata-edge.repo
55 %endif
56 +%endif
57
58 %if 0%{?oraclelinux}
59 install -pm 644 %{SOURCE6} ./netdata.repo
packaging/repoconfig/netdata.repo.al new
+21
@@ -0,0 +1,21 @@
1 +[netdata]
2 +name=Netdata
3 +baseurl=https://repo.netdata.cloud/repos/stable/amazonlinux/$releasever/$basearch
4 +repo_gpgcheck=1
5 +gpgcheck=1
6 +gpgkey=https://repo.netdata.cloud/netdatabot.gpg.key
7 +enabled=1
8 +sslverify=1
9 +sslcacert=/etc/pki/tls/certs/ca-bundle.crt
10 +priority=50
11 +
12 +[netdata-repoconfig]
13 +name=Netdata Repository Config
14 +baseurl=https://repo.netdata.cloud/repos/repoconfig/amazonlinux/$releasever/$basearch
15 +repo_gpgcheck=1
16 +gpgcheck=1
17 +gpgkey=https://repo.netdata.cloud/netdatabot.gpg.key
18 +enabled=1
19 +sslverify=1
20 +sslcacert=/etc/pki/tls/certs/ca-bundle.crt
21 +priority=50