From a14bd4360ad6cc102c4601a252a16c520ada5891 Mon Sep 17 00:00:00 2001 From: Bryce Gibson Date: Wed, 5 Jun 2024 15:00:17 +1000 Subject: [PATCH 1/2] config: test build with FLB_HAVE_STATIC_CONF Signed-off-by: Bryce Gibson --- .github/workflows/pr-compile-check.yaml | 17 +++++++++++++++++ dockerfiles/Dockerfile | 1 + 2 files changed, 18 insertions(+) diff --git a/.github/workflows/pr-compile-check.yaml b/.github/workflows/pr-compile-check.yaml index 42381a8a1d1..cbd17e8f97a 100644 --- a/.github/workflows/pr-compile-check.yaml +++ b/.github/workflows/pr-compile-check.yaml @@ -78,3 +78,20 @@ jobs: run: | ldd ./bin/fluent-bit working-directory: build + + pr-compile-static-config: + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Checkout Fluent Bit code + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Attempt to build current source with FLB_STATIC_CONF enabled + working-directory: packaging + run: ./build.sh + env: + FLB_DISTRO: ubuntu/20.04 + FLB_ARG: --build-arg=FLB_STATIC_CONF=yes diff --git a/dockerfiles/Dockerfile b/dockerfiles/Dockerfile index d0fc7fd3845..28f017ec947 100644 --- a/dockerfiles/Dockerfile +++ b/dockerfiles/Dockerfile @@ -78,6 +78,7 @@ RUN cmake -DFLB_RELEASE=On \ -DFLB_NIGHTLY_BUILD="$FLB_NIGHTLY_BUILD" \ -DFLB_LOG_NO_CONTROL_CHARS=On \ -DFLB_CHUNK_TRACE="$FLB_CHUNK_TRACE" \ + ${FLB_STATIC_CONF:+-DFLB_STATIC_CONF=/tmp} \ .. RUN make -j "$(getconf _NPROCESSORS_ONLN)" From 94a9f680f5a737618fecefa6c5bc5f7eacca4f9e Mon Sep 17 00:00:00 2001 From: Bryce Gibson Date: Thu, 6 Jun 2024 07:44:14 +1000 Subject: [PATCH 2/2] build: add support for FLB_STATIC_CONF in build.sh - WIP MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This it to verify compilation. It's not trivial to use this flag otherwise because a user needs to put their config in the Docker images 🤔 Signed-off-by: Bryce Gibson --- .github/workflows/pr-compile-check.yaml | 2 +- dockerfiles/Dockerfile | 5 ++++- packaging/build.sh | 2 ++ packaging/distros/amazonlinux/Dockerfile | 2 ++ packaging/distros/centos/Dockerfile | 2 ++ packaging/distros/debian/Dockerfile | 2 ++ packaging/distros/raspbian/Dockerfile | 2 ++ packaging/distros/ubuntu/Dockerfile | 2 ++ 8 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-compile-check.yaml b/.github/workflows/pr-compile-check.yaml index cbd17e8f97a..706d9845624 100644 --- a/.github/workflows/pr-compile-check.yaml +++ b/.github/workflows/pr-compile-check.yaml @@ -94,4 +94,4 @@ jobs: run: ./build.sh env: FLB_DISTRO: ubuntu/20.04 - FLB_ARG: --build-arg=FLB_STATIC_CONF=yes + FLB_ARG: --build-arg=FLB_STATIC_CONF=/tmp diff --git a/dockerfiles/Dockerfile b/dockerfiles/Dockerfile index 28f017ec947..2f0b2ec0886 100644 --- a/dockerfiles/Dockerfile +++ b/dockerfiles/Dockerfile @@ -65,6 +65,9 @@ COPY . ./ # We split the builder setup out so people can target it or use as a base image without doing a full build. FROM builder-base AS builder WORKDIR /src/fluent-bit/build/ + +ARG FLB_STATIC_CONF + RUN cmake -DFLB_RELEASE=On \ -DFLB_JEMALLOC=On \ -DFLB_TLS=On \ @@ -78,7 +81,7 @@ RUN cmake -DFLB_RELEASE=On \ -DFLB_NIGHTLY_BUILD="$FLB_NIGHTLY_BUILD" \ -DFLB_LOG_NO_CONTROL_CHARS=On \ -DFLB_CHUNK_TRACE="$FLB_CHUNK_TRACE" \ - ${FLB_STATIC_CONF:+-DFLB_STATIC_CONF=/tmp} \ + ${FLB_STATIC_CONF:+-DFLB_STATIC_CONF=}"${FLB_STATIC_CONF:-}" \ .. RUN make -j "$(getconf _NPROCESSORS_ONLN)" diff --git a/packaging/build.sh b/packaging/build.sh index cec48e8ad8c..c4392a24179 100755 --- a/packaging/build.sh +++ b/packaging/build.sh @@ -10,6 +10,7 @@ FLB_DISTRO=${FLB_DISTRO:-} FLB_OUT_DIR=${FLB_OUT_DIR:-} FLB_NIGHTLY_BUILD=${FLB_NIGHTLY_BUILD:-} FLB_JEMALLOC=${FLB_JEMALLOC:-On} +FLB_STATIC_CONF=${FLB_STATIC_CONF:-} DOCKER=${FLB_DOCKER_CLI:-docker} # Use this to pass special arguments to docker build @@ -90,6 +91,7 @@ if ! ${DOCKER} build \ --build-arg FLB_NIGHTLY_BUILD="$FLB_NIGHTLY_BUILD" \ --build-arg FLB_JEMALLOC="$FLB_JEMALLOC" \ --build-arg FLB_TD="$FLB_TD" \ + --build-arg FLB_STATIC_CONF="$FLB_STATIC_CONF" \ $FLB_ARG \ -t "$MAIN_IMAGE" \ -f "$IMAGE_CONTEXT_DIR/Dockerfile" \ diff --git a/packaging/distros/amazonlinux/Dockerfile b/packaging/distros/amazonlinux/Dockerfile index fa9b17c5bd7..d079fda3a1d 100644 --- a/packaging/distros/amazonlinux/Dockerfile +++ b/packaging/distros/amazonlinux/Dockerfile @@ -85,6 +85,7 @@ ARG FLB_OUT_KAFKA=On ARG FLB_OUT_PGSQL=On ARG FLB_JEMALLOC=On ARG FLB_CHUNK_TRACE=On +ARG FLB_STATIC_CONF RUN cmake3 -DCMAKE_INSTALL_PREFIX="$CMAKE_INSTALL_PREFIX" \ -DCMAKE_INSTALL_SYSCONFDIR="$CMAKE_INSTALL_SYSCONFDIR" \ @@ -97,6 +98,7 @@ RUN cmake3 -DCMAKE_INSTALL_PREFIX="$CMAKE_INSTALL_PREFIX" \ -DFLB_NIGHTLY_BUILD="$FLB_NIGHTLY_BUILD" \ -DFLB_JEMALLOC="${FLB_JEMALLOC}" \ -DFLB_CHUNK_TRACE="${FLB_CHUNK_TRACE}" \ + ${FLB_STATIC_CONF:+-DFLB_STATIC_CONF=}"${FLB_STATIC_CONF:-}" \ ../ VOLUME [ "/output" ] diff --git a/packaging/distros/centos/Dockerfile b/packaging/distros/centos/Dockerfile index 8e70b32d478..64786ffb3f9 100644 --- a/packaging/distros/centos/Dockerfile +++ b/packaging/distros/centos/Dockerfile @@ -163,6 +163,7 @@ ARG FLB_HTTP_SERVER=On ARG FLB_OUT_KAFKA=On ARG FLB_JEMALLOC=On ARG FLB_CHUNK_TRACE=On +ARG FLB_STATIC_CONF # cmake3 exists in every image - cmake references the older cmake2 in centos 7 RUN cmake3 -DCMAKE_INSTALL_PREFIX="$CMAKE_INSTALL_PREFIX" \ @@ -177,6 +178,7 @@ RUN cmake3 -DCMAKE_INSTALL_PREFIX="$CMAKE_INSTALL_PREFIX" \ -DFLB_JEMALLOC_OPTIONS="$FLB_JEMALLOC_OPTIONS" \ -DFLB_JEMALLOC="${FLB_JEMALLOC}" \ -DFLB_CHUNK_TRACE="${FLB_CHUNK_TRACE}" \ + ${FLB_STATIC_CONF:+-DFLB_STATIC_CONF=}"${FLB_STATIC_CONF:-}" \ ../ VOLUME [ "/output" ] diff --git a/packaging/distros/debian/Dockerfile b/packaging/distros/debian/Dockerfile index d37871501cc..a69575c6c67 100644 --- a/packaging/distros/debian/Dockerfile +++ b/packaging/distros/debian/Dockerfile @@ -117,6 +117,7 @@ ARG FLB_OUT_KAFKA=On ARG FLB_OUT_PGSQL=On ARG FLB_JEMALLOC=On ARG FLB_CHUNK_TRACE=On +ARG FLB_STATIC_CONF ENV CFLAGS=$CFLAGS RUN cmake -DCMAKE_INSTALL_PREFIX="$CMAKE_INSTALL_PREFIX" \ @@ -130,6 +131,7 @@ RUN cmake -DCMAKE_INSTALL_PREFIX="$CMAKE_INSTALL_PREFIX" \ -DFLB_NIGHTLY_BUILD="$FLB_NIGHTLY_BUILD" \ -DFLB_JEMALLOC="${FLB_JEMALLOC}" \ -DFLB_CHUNK_TRACE="${FLB_CHUNK_TRACE}" \ + ${FLB_STATIC_CONF:+-DFLB_STATIC_CONF=}"${FLB_STATIC_CONF:-}" \ ../ VOLUME [ "/output" ] diff --git a/packaging/distros/raspbian/Dockerfile b/packaging/distros/raspbian/Dockerfile index 03ca9708772..302f853a4cd 100644 --- a/packaging/distros/raspbian/Dockerfile +++ b/packaging/distros/raspbian/Dockerfile @@ -58,6 +58,7 @@ ARG FLB_OUT_KAFKA=On ARG FLB_OUT_PGSQL=On ARG FLB_JEMALLOC=On ARG FLB_CHUNK_TRACE=On +ARG FLB_STATIC_CONF ENV CFLAGS=$CFLAGS RUN cmake -DCMAKE_INSTALL_PREFIX="$CMAKE_INSTALL_PREFIX" \ @@ -71,6 +72,7 @@ RUN cmake -DCMAKE_INSTALL_PREFIX="$CMAKE_INSTALL_PREFIX" \ -DFLB_NIGHTLY_BUILD="$FLB_NIGHTLY_BUILD" \ -DFLB_JEMALLOC="${FLB_JEMALLOC}" \ -DFLB_CHUNK_TRACE="${FLB_CHUNK_TRACE}" \ + ${FLB_STATIC_CONF:+-DFLB_STATIC_CONF=}"${FLB_STATIC_CONF:-}" \ ../ VOLUME [ "/output" ] diff --git a/packaging/distros/ubuntu/Dockerfile b/packaging/distros/ubuntu/Dockerfile index 2ca0704580e..f42c5bc4322 100644 --- a/packaging/distros/ubuntu/Dockerfile +++ b/packaging/distros/ubuntu/Dockerfile @@ -172,6 +172,7 @@ ARG FLB_OUT_KAFKA=On ARG FLB_OUT_PGSQL=On ARG FLB_JEMALLOC=On ARG FLB_CHUNK_TRACE=On +ARG FLB_STATIC_CONF ENV CFLAGS=$CFLAGS RUN cmake -DCMAKE_INSTALL_PREFIX="$CMAKE_INSTALL_PREFIX" \ @@ -185,6 +186,7 @@ RUN cmake -DCMAKE_INSTALL_PREFIX="$CMAKE_INSTALL_PREFIX" \ -DFLB_NIGHTLY_BUILD="$FLB_NIGHTLY_BUILD" \ -DFLB_JEMALLOC="${FLB_JEMALLOC}" \ -DFLB_CHUNK_TRACE="${FLB_CHUNK_TRACE}" \ + ${FLB_STATIC_CONF:+-DFLB_STATIC_CONF=}"${FLB_STATIC_CONF:-}" \ ../ VOLUME [ "/output" ]