Skip to content

feat(fluentbit): add enable_flb_null to fluentbit filter params #934

feat(fluentbit): add enable_flb_null to fluentbit filter params

feat(fluentbit): add enable_flb_null to fluentbit filter params #934

name: Build/Push Fluent Operator image
on:
push:
branches:
- "master"
tags:
- "v*"
paths:
- ".github/workflows/build-op-image.yaml"
- ".github/workflows/clone-docker-image-action.yaml"
- "apis/**"
- "cmd/fluent-manager/**"
- "controllers/**"
- "hack/**"
- "manifests/setup/setup.yaml"
- "pkg/fluentd/router/**"
- "pkg/fluentd/operator/**"
- "pkg/fluentd/utils/**"
- "Makefile"
pull_request:
branches:
- "master"
paths:
- ".github/workflows/build-op-image.yaml"
- ".github/workflows/clone-docker-image-action.yaml"
- "apis/**"
- "cmd/fluent-manager/**"
- "controllers/**"
- "hack/**"
- "manifests/setup/setup.yaml"
- "pkg/fluentd/router/**"
- "pkg/fluentd/operator/**"
- "pkg/fluentd/utils/**"
env:
GHCR_REPO: 'ghcr.io/${{ github.repository }}/fluent-operator'
DOCKERHUB_REPO: 'kubesphere/fluent-operator'
permissions:
contents: read
packages: write
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
build:
name: Build image (${{ matrix.platform }})
runs-on: ${{ matrix.runs-on }}
permissions:
actions: read
packages: write
outputs:
digest_amd64: ${{ steps.output-digests.outputs.amd64 }}
digest_arm64: ${{ steps.output-digests.outputs.arm64 }}
tags: ${{ steps.image-metadata.outputs.tags }}
strategy:
fail-fast: false
matrix:
platform:
- linux/amd64
- linux/arm64
include:
- runs-on: ubuntu-latest
- runs-on: ubuntu-24.04-arm # Builds arm64 on arm64 hosts
platform: linux/arm64
steps:
- name: Checkout code
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-depth: 0
- name: Install Go
id: setup-go
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
with:
go-version-file: go.mod
cache-dependency-path: go.sum
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
with:
platforms: linux/amd64,linux/arm64
- name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
with:
registry: docker.io
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Configure image tags
id: image-metadata
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0
with:
images: |
${{ env.GHCR_REPO }}
${{ github.event_name != 'pull_request' && env.DOCKERHUB_REPO || '' }}
flavor: |
latest=false
tags: |
type=raw,value=latest,enable=${{ github.ref_type == 'tag' }}
type=ref,event=tag
type=semver,pattern={{version}},enable=${{ github.ref_type == 'tag' }}
type=semver,pattern={{major}}.{{minor}},enable=${{ github.ref_type == 'tag' }}
type=sha,format=long,prefix=,priority=1000
- name: Build image (pull request)
if: github.event_name == 'pull_request'
id: build-pr
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
with:
context: .
file: cmd/fluent-manager/Dockerfile
platforms: ${{ matrix.platform }}
labels: ${{ steps.image-metadata.outputs.labels }}
provenance: false
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
GO_VERSION=${{ steps.setup-go.outputs.go-version }}
push: false
- name: Build and push image
if: github.event_name != 'pull_request'
id: build
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
with:
context: .
file: cmd/fluent-manager/Dockerfile
platforms: ${{ matrix.platform }}
labels: ${{ steps.image-metadata.outputs.labels }}
provenance: false
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
GO_VERSION=${{ steps.setup-go.outputs.go-version }}
outputs: type=image,"name=${{ env.GHCR_REPO }},${{ env.DOCKERHUB_REPO }}",push-by-digest=true,name-canonical=true,push=true
- name: Output image digests
if: github.event_name != 'pull_request'
id: output-digests
run: |
platform="${{ matrix.platform }}"
# Convert "linux/amd64" to just amd64 for the output variable name
arch=${platform#linux/}
echo "${arch}=${{ steps.build.outputs.digest }}" >> $GITHUB_OUTPUT
manifest:
name: Publish image manifest
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Login to GHCR
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Docker Hub
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
with:
registry: docker.io
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Create image manifest
uses: int128/docker-manifest-create-action@b60433fd4312d7a64a56d769b76ebe3f45cf36b4 # v2.1.0
with:
push: true
tags: ${{ needs.build.outputs.tags }} # Includes GHCR and Docker Hub
sources: |
${{ env.GHCR_REPO }}@${{ needs.build.outputs.digest_amd64 }}
${{ env.GHCR_REPO }}@${{ needs.build.outputs.digest_arm64 }}