From 7e0b3d8b08c62539d5d87ebe378465cbb4748caf Mon Sep 17 00:00:00 2001 From: Yonas Habteab Date: Wed, 18 Feb 2026 13:28:38 +0100 Subject: [PATCH] More GHA & Containerfile cleanups --- .github/workflows/linux.bash | 35 +++++++++++++++++++---------------- Containerfile | 3 +-- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/.github/workflows/linux.bash b/.github/workflows/linux.bash index b65e2a490..69db54617 100755 --- a/.github/workflows/linux.bash +++ b/.github/workflows/linux.bash @@ -5,7 +5,7 @@ export PATH="/usr/lib/ccache/bin:/usr/lib/ccache:/usr/lib64/ccache:$PATH" export CCACHE_DIR=/icinga2/ccache export CTEST_OUTPUT_ON_FAILURE=1 CMAKE_OPTS=() -PROTOBUF_INCLUDE_DIR="" +SCL_ENABLE_GCC=() # -Wstringop-overflow is notorious for false positives and has been a problem for years. # See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88443 # -Wtemplate-id-cdtor leaks from using the generated headers. We should reenable this once @@ -72,6 +72,10 @@ case "$DISTRO" in case "$DISTRO" in *:8) dnf config-manager --enable powertools + # Our Protobuf package on RHEL 8 is built with GCC 13, and since the ABI is not compatible with GCC 8, + # we need to enable the SCL repository and install the GCC 13 packages to be able to link against it. + SCL_ENABLE_GCC=(scl enable gcc-toolset-13 --) + dnf install -y gcc-toolset-13-gcc-c++ gcc-toolset-13-annobin-plugin-gcc ;; *) dnf config-manager --enable crb @@ -86,17 +90,15 @@ case "$DISTRO" in case "$DISTRO" in *:[8-9]) rpm --import https://packages.icinga.com/icinga.key - cat > /etc/yum.repos.d/icinga-build-deps.repo < /etc/yum.repos.d/icinga-build-deps.repo <<'EOF' [icinga-build-deps] name=Icinga Build Dependencies -baseurl=https://packages.icinga.com/build-dependencies/rhel/${DISTRO#*:}/release +baseurl=https://packages.icinga.com/build-dependencies/rhel/$releasever/release enabled=1 gpgcheck=1 gpgkey=https://packages.icinga.com/icinga.key EOF dnf install -y icinga-protobuf - # And of course, make sure to add our custom Protobuf includes to the compiler include path. - PROTOBUF_INCLUDE_DIR="-isystem $(rpm -E '%{_includedir}')/icinga-protobuf" # Tell CMake where to find our own Protobuf CMake config files. CMAKE_OPTS+=(-DCMAKE_PREFIX_PATH="$(rpm -E '%{_libdir}')/icinga-protobuf/cmake") ;; @@ -106,7 +108,6 @@ EOF ;; esac -WITH_OPENTELEMETRY=ON case "$DISTRO" in alpine:*) CMAKE_OPTS+=( @@ -121,17 +122,20 @@ case "$DISTRO" in source <(dpkg-buildflags --export=sh) export CFLAGS="${CFLAGS} ${WARN_FLAGS}" export CXXFLAGS="${CXXFLAGS} ${WARN_FLAGS}" + # The default Protobuf compiler is too old for OTel, so we need to turn it off on Debian 11 and Ubuntu 22.04. - if [ "$DISTRO" = "debian:11" ] || [ "$DISTRO" = "ubuntu:22.04" ]; then - WITH_OPENTELEMETRY=OFF - fi + case "$DISTRO" in + debian:11|ubuntu:22.04) + CMAKE_OPTS+=(-DICINGA2_WITH_OPENTELEMETRY=OFF) + ;; + esac ;; *) # Turn off with OTel on Amazon Linux 2 as the default Protobuf compiler is way too old. if [ "$DISTRO" = "amazonlinux:2" ]; then - WITH_OPENTELEMETRY=OFF + CMAKE_OPTS+=(-DICINGA2_WITH_OPENTELEMETRY=OFF) fi - CMAKE_OPTS+=(-DCMAKE_{C,CXX}_FLAGS="$(rpm -E '%{optflags} %{?march_flag}') ${WARN_FLAGS} ${PROTOBUF_INCLUDE_DIR}") + CMAKE_OPTS+=(-DCMAKE_{C,CXX}_FLAGS="$(rpm -E '%{optflags} %{?march_flag}') ${WARN_FLAGS}") export LDFLAGS="$(rpm -E '%{?build_ldflags}')" ;; esac @@ -139,18 +143,17 @@ esac mkdir /icinga2/build cd /icinga2/build -cmake \ +"${SCL_ENABLE_GCC[@]}" cmake \ -GNinja \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DICINGA2_UNITY_BUILD=ON \ - -DICINGA2_WITH_OPENTELEMETRY="${WITH_OPENTELEMETRY}" \ -DUSE_SYSTEMD=ON \ -DICINGA2_USER=$(id -un) \ -DICINGA2_GROUP=$(id -gn) \ "${CMAKE_OPTS[@]}" .. -ninja -v +"${SCL_ENABLE_GCC[@]}" ninja -v -ninja test -ninja install +"${SCL_ENABLE_GCC[@]}" ninja test +"${SCL_ENABLE_GCC[@]}" ninja install icinga2 daemon -C diff --git a/Containerfile b/Containerfile index 145c6258f..984b7df43 100644 --- a/Containerfile +++ b/Containerfile @@ -127,8 +127,7 @@ RUN --mount=type=bind,source=.,target=/icinga2,readonly \ -DICINGA2_SYSCONFIGFILE=/etc/sysconfig/icinga2 \ -DICINGA2_RUNDIR=/run \ -DICINGA2_WITH_COMPAT=OFF \ - -DICINGA2_WITH_LIVESTATUS=OFF \ - -DICINGA2_WITH_OPENTELEMETRY=ON && \ + -DICINGA2_WITH_LIVESTATUS=OFF && \ make -j$([ "$MAKE_JOBS" = auto ] && nproc || echo "$MAKE_JOBS") && \ CTEST_OUTPUT_ON_FAILURE=1 make test && \ make install DESTDIR=/icinga2-install