From e2ebf712824823a7e976ee91bb82353c7b34c042 Mon Sep 17 00:00:00 2001 From: Ajay Date: Thu, 26 Oct 2023 16:49:38 +0000 Subject: [PATCH] dockerfiles: adding s390x support Signed-off-by: Ajay --- .github/workflows/call-build-images.yaml | 4 ++-- .github/workflows/call-test-images.yaml | 6 ++++-- CMakeLists.txt | 5 +++++ README.md | 4 ++++ cmake/s390x.cmake | 8 ++++++++ dockerfiles/Dockerfile | 2 +- dockerfiles/README.md | 2 +- 7 files changed, 25 insertions(+), 6 deletions(-) create mode 100644 cmake/s390x.cmake diff --git a/.github/workflows/call-build-images.yaml b/.github/workflows/call-build-images.yaml index fd2cf5b1dff..507dc405873 100644 --- a/.github/workflows/call-build-images.yaml +++ b/.github/workflows/call-build-images.yaml @@ -120,7 +120,7 @@ jobs: context: . tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - platforms: linux/amd64, linux/arm64, linux/arm/v7 + platforms: linux/amd64, linux/arm64, linux/arm/v7, linux/s390x target: production # Must be disabled to provide legacy format images from the registry provenance: false @@ -147,7 +147,7 @@ jobs: context: . tags: ${{ steps.debug-meta.outputs.tags }} labels: ${{ steps.debug-meta.outputs.labels }} - platforms: linux/amd64, linux/arm64, linux/arm/v7 + platforms: linux/amd64, linux/arm64, linux/arm/v7, linux/s390x # Must be disabled to provide legacy format images from the registry provenance: false target: debug diff --git a/.github/workflows/call-test-images.yaml b/.github/workflows/call-test-images.yaml index 29bc0cd3d5d..5b890b7c638 100644 --- a/.github/workflows/call-test-images.yaml +++ b/.github/workflows/call-test-images.yaml @@ -76,7 +76,7 @@ jobs: strategy: fail-fast: false matrix: - arch: [ linux/amd64, linux/arm64, linux/arm/v7 ] + arch: [ linux/amd64, linux/arm64, linux/arm/v7, linux/s390x ] include: # Rather than extract the specific central arch we just provide it - arch: linux/amd64 @@ -85,6 +85,8 @@ jobs: expected: arm64 - arch: linux/arm/v7 expected: arm + - arch: linux/s390x + expected: s390x steps: - name: Log in to the Container registry uses: docker/login-action@v3 @@ -128,7 +130,7 @@ jobs: strategy: fail-fast: false # verify all matrix: - arch: [ linux/amd64, linux/arm64, linux/arm/v7 ] + arch: [ linux/amd64, linux/arm64, linux/arm/v7, linux/s390x ] steps: - name: Checkout repository uses: actions/checkout@v4 diff --git a/CMakeLists.txt b/CMakeLists.txt index 99109309405..6a54b19f9eb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -394,6 +394,11 @@ if (FLB_SYSTEM_MACOS) include(cmake/macos-setup.cmake) endif() +# Build for SystemZ - s390x arch +if (FLB_SYSTEM_LINUX) + include(cmake/s390x.cmake) +endif () + # Extract Git commit information for debug output. # Note that this is only set when cmake is run, the intent here is to use in CI for verification of releases so is acceptable. # For a better solution see https://jonathanhamberg.com/post/cmake-embedding-git-hash/ but this is simple and easy. diff --git a/README.md b/README.md index 9da7effb7c1..030e7c7c535 100644 --- a/README.md +++ b/README.md @@ -101,6 +101,10 @@ tags [here](https://docs.fluentbit.io/manual/installation/docker). Fluent Bit is fully supported on Windows environments, get started with [these instructions](https://docs.fluentbit.io/manual/installation/windows). +#### Running on s390x + +Fluent Bit is supported on Linux on IBM Z(s390x), but the WASM and LUA filter plugins are not. + ### Plugins: Inputs, Filters and Outputs [Fluent Bit](http://fluentbit.io) is based in a pluggable architecture where different plugins plays a major role in the data pipeline: diff --git a/cmake/s390x.cmake b/cmake/s390x.cmake new file mode 100644 index 00000000000..af70127ceb4 --- /dev/null +++ b/cmake/s390x.cmake @@ -0,0 +1,8 @@ +if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(SystemZ|s390x)") + message(STATUS "Forcing characters to be signed, as on x86_64.") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsigned-char") + message(STATUS "Cannot build WAMR on this platform, so WASM support is disabled.") + set(FLB_WASM OFF) + message(STATUS "This platform does not support LuaJIT, so it's disabled.") + set(FLB_LUAJIT OFF) +endif () diff --git a/dockerfiles/Dockerfile b/dockerfiles/Dockerfile index 322734377fd..b49e6c92b5e 100644 --- a/dockerfiles/Dockerfile +++ b/dockerfiles/Dockerfile @@ -8,7 +8,7 @@ # docker buildx rm builder # docker buildx create --name builder --use # docker buildx inspect --bootstrap -# docker buildx build --platform "linux/amd64,linux/arm64,linux/arm/v7" -f ./dockerfiles/Dockerfile.multiarch --build-arg FLB_TARBALL=https://github.com/fluent/fluent-bit/archive/v1.8.11.tar.gz ./dockerfiles/ +# docker buildx build --platform "linux/amd64,linux/arm64,linux/arm/v7,linux/s390x" -f ./dockerfiles/Dockerfile.multiarch --build-arg FLB_TARBALL=https://github.com/fluent/fluent-bit/archive/v1.8.11.tar.gz ./dockerfiles/ # Set this to the current release version: it gets done so as part of the release. ARG RELEASE_VERSION=2.2.0 diff --git a/dockerfiles/README.md b/dockerfiles/README.md index b83aa8b4582..ca880e01082 100644 --- a/dockerfiles/README.md +++ b/dockerfiles/README.md @@ -40,7 +40,7 @@ docker buildx inspect --bootstrap ``` 4. Build Fluent Bit from the **root of the Git repo (not from this directory)**: ``` -docker buildx build --platform "linux/amd64,linux/arm64,linux/arm/v7" --target=production -f dockerfiles/Dockerfile . +docker buildx build --platform "linux/amd64,linux/arm64,linux/arm/v7,linux/s390x" --target=production -f dockerfiles/Dockerfile . ``` ## Build and test