mirror of
https://github.com/Icinga/icinga2.git
synced 2026-02-18 18:19:13 -05:00
More GHA & Containerfile cleanups
This commit is contained in:
parent
f308ea5e36
commit
7e0b3d8b08
2 changed files with 20 additions and 18 deletions
35
.github/workflows/linux.bash
vendored
35
.github/workflows/linux.bash
vendored
|
|
@ -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 <<EOF
|
||||
cat > /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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue