diff --git a/.github/workflows/alpine-bash.Dockerfile b/.github/workflows/alpine-bash.Dockerfile new file mode 100644 index 000000000..9119f5744 --- /dev/null +++ b/.github/workflows/alpine-bash.Dockerfile @@ -0,0 +1,8 @@ +# This Dockerfile is used in the linux job for Alpine Linux. +# +# As the linux.bash script is, in fact, a bash script and Alpine does not ship +# a bash by default, the "alpine:bash" container will be built using this +# Dockerfile in the GitHub Action. + +FROM alpine:3 +RUN ["apk", "--no-cache", "add", "bash"] diff --git a/.github/workflows/linux.bash b/.github/workflows/linux.bash index 1a2b5fb73..ec53adabe 100755 --- a/.github/workflows/linux.bash +++ b/.github/workflows/linux.bash @@ -1,12 +1,28 @@ #!/bin/bash set -exo pipefail -export PATH="/usr/lib/ccache:/usr/lib64/ccache:$PATH" +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=() case "$DISTRO" in + alpine:*) + # Packages inspired by the Alpine package, just + # - LibreSSL instead of OpenSSL 3 and + # - no MariaDB or libpq as they depend on OpenSSL. + # https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/community/icinga2/APKBUILD + apk add bison boost-dev ccache cmake flex g++ libedit-dev libressl-dev ninja-build tzdata + ln -vs /usr/lib/ninja-build/bin/ninja /usr/local/bin/ninja + + CMAKE_OPTS="-DUSE_SYSTEMD=OFF -DICINGA2_WITH_MYSQL=OFF -DICINGA2_WITH_PGSQL=OFF" + + # This test fails due to some glibc/musl mismatch regarding timezone PST/PDT. + # - https://www.openwall.com/lists/musl/2024/03/05/2 + # - https://gitlab.alpinelinux.org/alpine/aports/-/blob/b3ea02e2251451f9511086e1970f21eb640097f7/community/icinga2/disable-failing-tests.patch + sed -i '/icinga_legacytimeperiod\/dst$/d' /icinga2/test/CMakeLists.txt + ;; + amazonlinux:2) amazon-linux-extras install -y epel yum install -y bison ccache cmake3 gcc-c++ flex ninja-build system-rpm-config \ diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 829161cce..7410c6894 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -21,6 +21,10 @@ jobs: max-parallel: 2 matrix: distro: + # Alpine Linux to build Icinga 2 with LibreSSL, OpenBSD's default. + # The "alpine:bash" image will be built below based on "alpine:3". + - alpine:bash + - amazonlinux:2 - amazonlinux:2023 @@ -68,7 +72,13 @@ jobs: path: ccache key: ccache/${{ matrix.distro }} - - name: Build + - name: Build Alpine Docker Image + if: "matrix.distro == 'alpine:bash'" + run: >- + docker build --file .github/workflows/alpine-bash.Dockerfile + --tag alpine:bash `mktemp -d` + + - name: Build Icinga run: >- docker run --rm -v "$(pwd):/icinga2" -e DISTRO=${{ matrix.distro }} --platform ${{ matrix.platform }} ${{ matrix.distro }} /icinga2/.github/workflows/linux.bash