Skip to content

Commit

Permalink
Merge pull request #1447 from cw-Guo/feat/upgrade-fluentbit-image
Browse files Browse the repository at this point in the history
feat: add VERSION file for fluentbit image
  • Loading branch information
benjaminhuo authored Jan 3, 2025
2 parents 369c7e5 + 373dee4 commit abccb78
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 8 deletions.
32 changes: 26 additions & 6 deletions .github/workflows/build-fb-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ name: Building Fluent Bit image

on:
workflow_dispatch:
inputs:
docker_tag_version:
description: 'Fluent Bit image release version'
required: true
default: '3.1.8'

env:
DOCKER_REPO: 'kubesphere'
Expand All @@ -18,7 +13,26 @@ permissions:
packages: write

jobs:
get-version:
runs-on: ubuntu-latest
name: get fluent-bit version
outputs:
VERSION: ${{ steps.get-version.outputs.VERSION }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}

- name: Read fluent-bit version from file
id: get-version
run: |
VERSION=$(cat cmd/fluent-watcher/fluentbit/VERSION) # Read the version from the VERSION file
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
determine-tags:
needs:
- get-version
runs-on: ubuntu-latest
name: Determine image tags
outputs:
Expand All @@ -29,7 +43,7 @@ jobs:
- name: Determine image version tag
id: determine-tags
run: |
VERSION=${{ github.event.inputs.docker_tag_version }}
VERSION=${{ needs.get-version.outputs.VERSION }}
VERSION_WITHOUT_V=${VERSION#v}
MAJOR_MINOR=$(echo $VERSION_WITHOUT_V | cut -d. -f1-2)
Expand Down Expand Up @@ -143,6 +157,7 @@ jobs:
build-FluentBit-prod-image:
needs:
- get-version
- build-prod-image-metadata
runs-on: ubuntu-latest
timeout-minutes: 30
Expand Down Expand Up @@ -184,9 +199,12 @@ jobs:
platforms: linux/amd64,linux/arm64
tags: ${{ needs.build-prod-image-metadata.outputs.tags }}
labels: ${{ needs.build-prod-image-metadata.outputs.labels }}
build-args: |
FLUENT_BIT_BASE_VERSION=${{ needs.get-version.outputs.VERSION }}
build-FluentBit-debug-image:
needs:
- get-version
- build-debug-image-metadata
runs-on: ubuntu-latest
timeout-minutes: 30
Expand Down Expand Up @@ -228,6 +246,8 @@ jobs:
platforms: linux/amd64,linux/arm64
tags: ${{ needs.build-debug-image-metadata.outputs.tags }}
labels: ${{ needs.build-debug-image-metadata.outputs.labels }}
build-args: |
FLUENT_BIT_BASE_VERSION=${{ needs.get-version.outputs.VERSION }}
scan-FluentBit-image:
name: Scan prod image
Expand Down
4 changes: 3 additions & 1 deletion cmd/fluent-watcher/fluentbit/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
ARG FLUENT_BIT_BASE_VERSION=3.2.4

FROM golang:1.23.2-alpine3.19 as buildergo
RUN mkdir -p /fluent-bit
RUN mkdir -p /code
Expand All @@ -6,7 +8,7 @@ WORKDIR /code
RUN echo $(ls -al /code)
RUN CGO_ENABLED=0 go build -ldflags '-w -s' -o /fluent-bit/fluent-bit /code/cmd/fluent-watcher/fluentbit/main.go

FROM fluent/fluent-bit:3.1.8
FROM fluent/fluent-bit:${FLUENT_BIT_BASE_VERSION}
LABEL Description="Fluent Bit docker image" Vendor="Fluent" Version="1.0"

COPY conf/fluent-bit.conf conf/fluent-bit.yaml conf/parsers.conf /fluent-bit/etc/
Expand Down
4 changes: 3 additions & 1 deletion cmd/fluent-watcher/fluentbit/Dockerfile.debug
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
ARG FLUENT_BIT_BASE_VERSION=3.2.4

FROM golang:1.23.2-alpine3.19 as buildergo
RUN mkdir -p /fluent-bit
RUN mkdir -p /code
Expand All @@ -6,7 +8,7 @@ WORKDIR /code
RUN echo $(ls -al /code)
RUN CGO_ENABLED=0 go build -ldflags '-w -s' -o /fluent-bit/fluent-bit /code/cmd/fluent-watcher/fluentbit/main.go

FROM fluent/fluent-bit:3.1.8-debug
FROM fluent/fluent-bit:${FLUENT_BIT_BASE_VERSION}-debug
LABEL Description="Fluent Bit docker image" Vendor="Fluent" Version="1.0"

COPY conf/fluent-bit.conf conf/fluent-bit.yaml conf/parsers.conf /fluent-bit/etc/
Expand Down
1 change: 1 addition & 0 deletions cmd/fluent-watcher/fluentbit/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.2.4

0 comments on commit abccb78

Please sign in to comment.