@cryptotaxi247 / netdata-1 / commits / 7eb25b2ff

Add log grouping in installer and static build code when running under GitHub Actions. (#11720)

* Add log grouping in installer code when running under GitHub Actions. This will make our CI logs much easier to understand. * Add log grouping to static build process. * Use oneliner style group commands in netdata-installer.sh

Austin S. Hemmelgarn committed Oct 28, 2021 at 13:12 UTC 7eb25b2ff51bc7c40a4886c23ac97fb295f242cf
11 files changed +87 -3
.github/dockerfiles/Dockerfile.build_test
+1
@@ -5,6 +5,7 @@ FROM ${BASE}
5 ARG PRE
6 ENV PRE=${PRE}
7 ENV DO_NOT_TRACK=1
8 +ENV GITHUB_ACTIONS=true
9
10 COPY . /netdata
11
netdata-installer.sh
+53 -2
@@ -598,6 +598,8 @@ bundle_libmosquitto() {
598 return 0
599 fi
600
601 + [ -n "${GITHUB_ACTIONS}" ] && echo "::group::Bundling libmosquitto."
602 +
603 progress "Prepare custom libmosquitto version"
604
605 MOSQUITTO_PACKAGE_VERSION="$(cat packaging/mosquitto.version)"
@@ -623,6 +625,8 @@ bundle_libmosquitto() {
625 run_failed "Unable to fetch sources for libmosquitto."
626 defer_error_highlighted "Unable to fetch sources for libmosquitto. You will not be able to connect this node to Netdata Cloud."
627 fi
628 +
629 + [ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
630 }
631
632 bundle_libmosquitto
@@ -698,6 +702,8 @@ bundle_libwebsockets() {
702 return 0
703 fi
704
705 + [ -n "${GITHUB_ACTIONS}" ] && echo "::group::Bundling libwebsockets."
706 +
707 progress "Prepare libwebsockets"
708
709 LIBWEBSOCKETS_PACKAGE_VERSION="$(cat packaging/libwebsockets.version)"
@@ -724,6 +730,8 @@ bundle_libwebsockets() {
730 run_failed "Unable to fetch sources for libwebsockets."
731 defer_error_highlighted "Unable to fetch sources for libwebsockets. You may not be able to connect this node to Netdata Cloud."
732 fi
733 +
734 + [ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
735 }
736
737 bundle_libwebsockets
@@ -770,6 +778,8 @@ bundle_protobuf() {
778 return 0
779 fi
780
781 + [ -n "${GITHUB_ACTIONS}" ] && echo "::group::Bundling protobuf."
782 +
783 PROTOBUF_PACKAGE_VERSION="$(cat packaging/protobuf.version)"
784
785 tmp="$(mktemp -d -t netdata-protobuf-XXXXXX)"
@@ -794,6 +804,8 @@ bundle_protobuf() {
804 run_failed "Unable to fetch sources for protobuf."
805 defer_error_highlighted "Unable to fetch sources for protobuf. You may not be able to connect this node to Netdata Cloud."
806 fi
807 +
808 + [ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
809 }
810
811 bundle_protobuf
@@ -848,6 +860,8 @@ bundle_judy() {
860 progress "/usr/include/Judy.h does not exist, but we need libJudy, building our own copy"
861 fi
862
863 + [ -n "${GITHUB_ACTIONS}" ] && echo "::group::Bundling libJudy."
864 +
865 progress "Prepare libJudy"
866
867 JUDY_PACKAGE_VERSION="$(cat packaging/judy.version)"
@@ -869,6 +883,8 @@ bundle_judy() {
883 else
884 run_failed "Failed to build libJudy."
885 if [ -n "${NETDATA_BUILD_JUDY}" ]; then
886 + [ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
887 +
888 exit 1
889 else
890 defer_error_highlighted "Failed to build libJudy. dbengine support will be disabled."
@@ -877,11 +893,15 @@ bundle_judy() {
893 else
894 run_failed "Unable to fetch sources for libJudy."
895 if [ -n "${NETDATA_BUILD_JUDY}" ]; then
896 + [ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
897 +
898 exit 1
899 else
900 defer_error_highlighted "Unable to fetch sources for libJudy. dbengine support will be disabled."
901 fi
902 fi
903 +
904 + [ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
905 }
906
907 bundle_judy
@@ -922,6 +942,8 @@ bundle_jsonc() {
942 return 0
943 fi
944
945 + [ -n "${GITHUB_ACTIONS}" ] && echo "::group::Bundling JSON-C."
946 +
947 progress "Prepare JSON-C"
948
949 JSONC_PACKAGE_VERSION="$(cat packaging/jsonc.version)"
@@ -947,6 +969,8 @@ bundle_jsonc() {
969 run_failed "Unable to fetch sources for JSON-C."
970 defer_error_highlighted "Unable to fetch sources for JSON-C. Netdata Cloud support will be disabled."
971 fi
972 +
973 + [ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
974 }
975
976 bundle_jsonc
@@ -999,6 +1023,8 @@ bundle_libbpf() {
1023 return 0
1024 fi
1025
1026 + [ -n "${GITHUB_ACTIONS}" ] && echo "::group::Bundling libbpf."
1027 +
1028 rename_libbpf_packaging
1029
1030 progress "Prepare libbpf"
@@ -1034,6 +1060,8 @@ bundle_libbpf() {
1060 defer_error_highlighted "Unable to fetch sources for libbpf. You may not be able to use eBPF plugin."
1061 fi
1062 fi
1063 +
1064 + [ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
1065 }
1066
1067 bundle_libbpf
@@ -1059,6 +1087,8 @@ fi
1087
1088 # -----------------------------------------------------------------------------
1089 echo >&2
1090 +
1091 +[ -n "${GITHUB_ACTIONS}" ] && echo "::group::Configuring Netdata."
1092 progress "Run autotools to configure the build environment"
1093
1094 if [ "$have_autotools" ]; then
@@ -1077,10 +1107,14 @@ run ./configure \
1107 ${NETDATA_CONFIGURE_OPTIONS} \
1108 CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" || exit 1
1109
1110 +[ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
1111 +
1112 # remove the build_error hook
1113 trap - EXIT
1114
1115 # -----------------------------------------------------------------------------
1116 +[ -n "${GITHUB_ACTIONS}" ] && echo "::group::Building Netdata."
1117 +
1118 progress "Cleanup compilation directory"
1119
1120 run $make clean
@@ -1090,7 +1124,11 @@ progress "Compile netdata"
1124
1125 run $make ${MAKEOPTS} || exit 1
1126
1127 +[ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
1128 +
1129 # -----------------------------------------------------------------------------
1130 +[ -n "${GITHUB_ACTIONS}" ] && echo "::group::Installing Netdata."
1131 +
1132 progress "Migrate configuration files for node.d.plugin and charts.d.plugin"
1133
1134 # migrate existing configuration files
@@ -1450,6 +1488,8 @@ else
1488 run find "${NETDATA_PREFIX}/usr/libexec/netdata" -type d -exec chmod 0755 {} \;
1489 fi
1490
1491 +[ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
1492 +
1493 # -----------------------------------------------------------------------------
1494
1495 # govercomp compares go.d.plugin versions. Exit codes:
@@ -1517,6 +1557,8 @@ install_go() {
1557 return 0
1558 fi
1559
1560 + [ -n "${GITHUB_ACTIONS}" ] && echo "::group::Installing go.d.plugin."
1561 +
1562 # When updating this value, ensure correct checksums in packaging/go.d.checksums
1563 GO_PACKAGE_VERSION="$(cat packaging/go.d.version)"
1564 ARCH_MAP=(
@@ -1564,6 +1606,7 @@ install_go() {
1606 defer_error "go.d plugin download failed, go.d plugin will not be available"
1607 echo >&2 "Either check the error or consider disabling it by issuing '--disable-go' in the installer"
1608 echo >&2
1609 + [ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
1610 return 0
1611 fi
1612
@@ -1579,6 +1622,7 @@ install_go() {
1622
1623 run_failed "go.d.plugin package files checksum validation failed."
1624 defer_error "go.d.plugin package files checksum validation failed, go.d.plugin will not be available"
1625 + [ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
1626 return 0
1627 fi
1628
@@ -1595,7 +1639,8 @@ install_go() {
1639 fi
1640 run chmod 0750 "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/go.d.plugin"
1641 rm -rf "${tmp}"
1598 - return 0
1642 +
1643 + [ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
1644 }
1645
1646 install_go
@@ -1688,6 +1733,8 @@ install_ebpf() {
1733 return 0
1734 fi
1735
1736 + [ -n "${GITHUB_ACTIONS}" ] && echo "::group::Installing eBPF code."
1737 +
1738 remove_old_ebpf
1739
1740 progress "Installing eBPF plugin"
@@ -1708,6 +1755,8 @@ install_ebpf() {
1755 run_failed "Failed to download eBPF collector package"
1756 echo 2>&" Removing temporary directory ${tmp} ..."
1757 rm -rf "${tmp}"
1758 +
1759 + [ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
1760 return 1
1761 fi
1762
@@ -1722,6 +1771,8 @@ install_ebpf() {
1771 RET=$?
1772 if [ "${RET}" != "0" ]; then
1773 rm -rf "${tmp}"
1774 +
1775 + [ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
1776 return 1
1777 fi
1778 fi
@@ -1730,7 +1781,7 @@ install_ebpf() {
1781
1782 rm -rf "${tmp}"
1783
1733 - return 0
1784 + [ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
1785 }
1786
1787 progress "eBPF Kernel Collector"
packaging/makeself/build-static.sh
+1 -1
@@ -59,7 +59,7 @@ if [ -t 1 ]; then
59 /bin/sh /usr/src/netdata.git/packaging/makeself/build.sh "${@}"
60 else
61 run docker run -e BUILDARCH="${BUILDARCH}" -v "$(pwd)":/usr/src/netdata.git:rw \
62 - "${DOCKER_CONTAINER_NAME}" \
62 + -e GITHUB_ACTIONS="${GITHUB_ACTIONS}" "${DOCKER_CONTAINER_NAME}" \
63 /bin/sh /usr/src/netdata.git/packaging/makeself/build.sh "${@}"
64 fi
65
packaging/makeself/jobs/10-prepare-destination.install.sh
+4
@@ -4,6 +4,8 @@
4 # shellcheck source=packaging/makeself/functions.sh
5 . "$(dirname "${0}")/../functions.sh" "${@}" || exit 1
6
7 +[ -n "${GITHUB_ACTIONS}" ] && echo "::group::Preparing build environment"
8 +
9 [ -d "${NETDATA_INSTALL_PATH}.old" ] && run rm -rf "${NETDATA_INSTALL_PATH}.old"
10 [ -d "${NETDATA_INSTALL_PATH}" ] && run mv -f "${NETDATA_INSTALL_PATH}" "${NETDATA_INSTALL_PATH}.old"
11
@@ -15,3 +17,5 @@ run cd "${NETDATA_INSTALL_PATH}/usr"
17 run ln -s ../bin bin
18 run ln -s ../sbin sbin
19 run ln -s . local
20 +
21 +[ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
packaging/makeself/jobs/20-openssl.install.sh
+4
@@ -4,6 +4,8 @@
4 # shellcheck source=packaging/makeself/functions.sh
5 . "$(dirname "${0}")/../functions.sh" "${@}" || exit 1
6
7 +[ -n "${GITHUB_ACTIONS}" ] && echo "::group::Building OpenSSL"
8 +
9 version="$(cat "$(dirname "${0}")/../openssl.version")"
10
11 export CFLAGS='-fno-lto'
@@ -19,3 +21,5 @@ cd "${NETDATA_MAKESELF_PATH}/tmp/openssl" || exit 1
21 run ./config -static no-tests --prefix=/openssl-static --openssldir=/opt/netdata/etc/ssl
22 run make -j "$(nproc)"
23 run make -j "$(nproc)" install_sw
24 +
25 +[ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
packaging/makeself/jobs/50-bash-5.1.8.install.sh
+4
@@ -4,6 +4,8 @@
4 # shellcheck source=packaging/makeself/functions.sh
5 . "$(dirname "${0}")/../functions.sh" "${@}" || exit 1
6
7 +[ -n "${GITHUB_ACTIONS}" ] && echo "::group::building bash"
8 +
9 fetch "bash-5.1.8" "http://ftp.gnu.org/gnu/bash/bash-5.1.8.tar.gz"
10
11 export PKG_CONFIG_PATH="/openssl-static/lib/pkgconfig"
@@ -32,3 +34,5 @@ run make install
34 if [ ${NETDATA_BUILD_WITH_DEBUG} -eq 0 ]; then
35 run strip "${NETDATA_INSTALL_PATH}"/bin/bash
36 fi
37 +
38 +[ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
packaging/makeself/jobs/50-curl-7.78.0.install.sh
+4
@@ -4,6 +4,8 @@
4 # shellcheck source=packaging/makeself/functions.sh
5 . "$(dirname "${0}")/../functions.sh" "${@}" || exit 1
6
7 +[ -n "${GITHUB_ACTIONS}" ] && echo "::group::Building cURL"
8 +
9 fetch "curl-7.78.0" "https://curl.haxx.se/download/curl-7.78.0.tar.gz"
10
11 export CFLAGS="-I/openssl-static/include"
@@ -45,3 +47,5 @@ run make install
47 if [ ${NETDATA_BUILD_WITH_DEBUG} -eq 0 ]; then
48 run strip "${NETDATA_INSTALL_PATH}"/bin/curl
49 fi
50 +
51 +[ -n "${GITHUB_ACTIONS}" ] && echo "::group::Preparing build environment"
packaging/makeself/jobs/50-fping-5.0.install.sh
+4
@@ -4,6 +4,8 @@
4 # shellcheck source=packaging/makeself/functions.sh
5 . "$(dirname "${0}")/../functions.sh" "${@}" || exit 1
6
7 +[ -n "${GITHUB_ACTIONS}" ] && echo "::group::Building fping"
8 +
9 fetch "fping-5.0" "https://fping.org/dist/fping-5.0.tar.gz"
10
11 export CFLAGS="-static -I/openssl-static/include"
@@ -28,3 +30,5 @@ run make install
30 if [ ${NETDATA_BUILD_WITH_DEBUG} -eq 0 ]; then
31 run strip "${NETDATA_INSTALL_PATH}"/bin/fping
32 fi
33 +
34 +[ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
packaging/makeself/jobs/50-ioping-1.2.install.sh
+4
@@ -4,6 +4,8 @@
4 # shellcheck source=packaging/makeself/functions.sh
5 . "$(dirname "${0}")/../functions.sh" "${@}" || exit 1
6
7 +[ -n "${GITHUB_ACTIONS}" ] && echo "::group::Building ioping"
8 +
9 fetch "ioping-1.2" "https://github.com/koct9i/ioping/archive/v1.2.tar.gz"
10
11 export CFLAGS="-static"
@@ -16,3 +18,5 @@ run install -o root -g root -m 4750 ioping "${NETDATA_INSTALL_PATH}"/usr/libexec
18 if [ ${NETDATA_BUILD_WITH_DEBUG} -eq 0 ]; then
19 run strip "${NETDATA_INSTALL_PATH}"/usr/libexec/netdata/plugins.d/ioping
20 fi
21 +
22 +[ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
packaging/makeself/jobs/70-netdata-git.install.sh
+4
@@ -34,6 +34,8 @@ run ./netdata-installer.sh \
34 --use-system-protobuf \
35 --dont-scrub-cflags-even-though-it-may-break-things
36
37 +[ -n "${GITHUB_ACTIONS}" ] && echo "::group::Finishing netdata install"
38 +
39 # Properly mark the install type
40 cat > "${NETDATA_INSTALL_PATH}/etc/netdata/.install-type" <<-EOF
41 INSTALL_TYPE='manual-static'
@@ -55,3 +57,5 @@ if [ ${NETDATA_BUILD_WITH_DEBUG} -eq 0 ]; then
57 run strip "${NETDATA_INSTALL_PATH}"/usr/libexec/netdata/plugins.d/apps.plugin
58 run strip "${NETDATA_INSTALL_PATH}"/usr/libexec/netdata/plugins.d/cgroup-network
59 fi
60 +
61 +[ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
packaging/makeself/jobs/99-makeself.install.sh
+4
@@ -4,6 +4,8 @@
4 # shellcheck source=packaging/makeself/functions.sh
5 . "$(dirname "${0}")/../functions.sh" "${@}" || exit 1
6
7 +[ -n "${GITHUB_ACTIONS}" ] && echo "::group::Building self-extracting archive"
8 +
9 run cd "${NETDATA_SOURCE_PATH}" || exit 1
10
11 # -----------------------------------------------------------------------------
@@ -105,4 +107,6 @@ if [ "${BUILDARCH}" = "x86_64" ]; then
107 run ln -s "./${FILE}" "artifacts/netdata-${VERSION}.gz.run"
108 fi
109
110 +[ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
111 +
112 echo >&2 "Self-extracting installer moved to 'artifacts/${FILE}'"