Skip to content

Commit

Permalink
Merge pull request #1183 from sarathchandra24/master
Browse files Browse the repository at this point in the history
Fix release cycles for fluentd and fluentbit images manually.
  • Loading branch information
benjaminhuo authored May 28, 2024
2 parents 5418a0e + 1c7e78c commit df135ee
Show file tree
Hide file tree
Showing 4 changed files with 196 additions and 93 deletions.
102 changes: 70 additions & 32 deletions .github/workflows/build-fb-image.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,12 @@
name: Building Fluent Bit image

on:
push:
branches:
- 'master'
tags:
- 'v*'
paths:
- ".github/workflows/build-fb-image.yaml"
- "cmd/fluent-watcher/fluentbit/**"
- "cmd/fluent-watcher/hooks/**"
- "pkg/filenotify/**"
pull_request:
branches:
- "master"
paths:
- ".github/workflows/build-fb-image.yaml"
- "cmd/fluent-watcher/fluentbit/**"
- "cmd/fluent-watcher/hooks/**"
- "pkg/filenotify/**"
workflow_dispatch:
inputs:
docker_tag_version:
description: 'Fluent Bit image release version'
required: true
default: '3.0.4'

env:
DOCKER_REPO: 'kubesphere'
Expand All @@ -38,10 +26,21 @@ jobs:
DOCKER_IMG_NAME: ${{ steps.set-outputs.outputs.DOCKER_IMG_NAME }}
version: ${{ steps.image-metadata.outputs.version }}
tags: ${{ steps.image-metadata.outputs.tags }}
release_tags: ${{ steps.image-tags.outputs.tags }}
labels: ${{ steps.image-metadata.outputs.labels }}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Extract version parts
id: extract_version
run: |
VERSION=${{ github.event.inputs.docker_tag_version }}
VERSION_WITHOUT_V=${VERSION#v}
MAJOR_MINOR=$(echo $VERSION_WITHOUT_V | cut -d. -f1-2)
echo "VERSION_WITHOUT_V=$VERSION_WITHOUT_V" >> $GITHUB_ENV
echo "MAJOR_MINOR=$MAJOR_MINOR" >> $GITHUB_ENV
- name: docker metadata for building
id: image-metadata
Expand All @@ -50,11 +49,25 @@ jobs:
images: "ghcr.io/${{ env.GITHUB_IMAGE }}"
tags: |
raw,latest
type=ref,event=branch
type=ref,event=pr
type=ref,event=tag
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=${{ github.event.inputs.docker_tag_version }}
type=raw,value=v${{ github.event.inputs.docker_tag_version }}
type=raw,value=${{ env.MAJOR_MINOR }}
type=raw,value=v${{ env.MAJOR_MINOR }}
env:
MAJOR_MINOR: ${{ env.MAJOR_MINOR }}

- name: docker tags for cloning
id: image-tags
uses: docker/metadata-action@v5
with:
tags: |
raw,latest
type=raw,value=${{ github.event.inputs.docker_tag_version }}
type=raw,value=v${{ github.event.inputs.docker_tag_version }}
type=raw,value=${{ env.MAJOR_MINOR }}
type=raw,value=v${{ env.MAJOR_MINOR }}
env:
MAJOR_MINOR: ${{ env.MAJOR_MINOR }}

- name: Set outputs
id: set-outputs
Expand All @@ -71,10 +84,21 @@ jobs:
version: ${{ steps.image-metadata.outputs.version }}
tags: ${{ steps.image-metadata.outputs.tags }}
labels: ${{ steps.image-metadata.outputs.labels }}
release_tags: ${{ steps.image-tags.outputs.tags }}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Extract version parts
id: extract_version
run: |
VERSION=${{ github.event.inputs.docker_tag_version }}
VERSION_WITHOUT_V=${VERSION#v}
MAJOR_MINOR=$(echo $VERSION_WITHOUT_V | cut -d. -f1-2)
echo "VERSION_WITHOUT_V=$VERSION_WITHOUT_V" >> $GITHUB_ENV
echo "MAJOR_MINOR=$MAJOR_MINOR" >> $GITHUB_ENV
- name: docker metadata
id: image-metadata
uses: docker/metadata-action@v5
Expand All @@ -84,12 +108,27 @@ jobs:
latest=false
suffix=-debug
tags: |
raw,latest
type=ref,event=branch
type=ref,event=pr
type=ref,event=tag
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=${{ github.event.inputs.docker_tag_version }}
type=raw,value=v${{ github.event.inputs.docker_tag_version }}
type=raw,value=${{ env.MAJOR_MINOR }}
type=raw,value=v${{ env.MAJOR_MINOR }}
env:
MAJOR_MINOR: ${{ env.MAJOR_MINOR }}

- name: docker tags for cloning
id: image-tags
uses: docker/metadata-action@v5
with:
flavor: |
latest=false
suffix=-debug
tags: |
type=raw,value=${{ github.event.inputs.docker_tag_version }}
type=raw,value=v${{ github.event.inputs.docker_tag_version }}
type=raw,value=${{ env.MAJOR_MINOR }}
type=raw,value=v${{ env.MAJOR_MINOR }}
env:
MAJOR_MINOR: ${{ env.MAJOR_MINOR }}

- name: Set outputs
id: set-outputs
Expand Down Expand Up @@ -213,7 +252,7 @@ jobs:
target_image: "${{ needs.build-prod-image-metadata.outputs.DOCKER_IMG_NAME }}"
target_registry: docker.io
platforms: "['linux/arm64', 'linux/amd64']"
is_latest: true
tags: ${{ needs.build-prod-image-metadata.outputs.release_tags }}
secrets:
source_registry_username: ${{ github.actor }}
source_registry_token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -233,8 +272,7 @@ jobs:
target_image: "${{ needs.build-debug-image-metadata.outputs.DOCKER_IMG_NAME }}"
target_registry: docker.io
platforms: "['linux/arm64', 'linux/amd64']"
is_latest: false
suffix: "-debug"
tags: ${{ needs.build-debug-image-metadata.outputs.release_tags }}
secrets:
source_registry_username: ${{ github.actor }}
source_registry_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
136 changes: 101 additions & 35 deletions .github/workflows/build-fd-image.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
name: Building Fluentd image

on:
push:
branches:
- 'master'
tags:
- 'v*'
paths:
- ".github/workflows/build-fd-image.yaml"
- "cmd/fluent-watcher/fluentd/**"
- "cmd/fluent-watcher/hooks/**"
- "pkg/filenotify/**"
workflow_dispatch:
inputs:
docker_tag_version:
description: 'Fluentd image release version'
required: true
default: '1.15.3'

env:
DOCKER_REPO: 'kubesphere'
Expand All @@ -34,6 +30,16 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Extract version parts
id: extract_version
run: |
VERSION=${{ github.event.inputs.docker_tag_version }}
VERSION_WITHOUT_V=${VERSION#v}
MAJOR_MINOR=$(echo $VERSION_WITHOUT_V | cut -d. -f1-2)
echo "VERSION_WITHOUT_V=$VERSION_WITHOUT_V" >> $GITHUB_ENV
echo "MAJOR_MINOR=$MAJOR_MINOR" >> $GITHUB_ENV
- name: docker metadata for amd64
id: image-metadata
Expand All @@ -45,11 +51,12 @@ jobs:
suffix=-amd64
tags: |
raw,latest
type=ref,event=branch
type=ref,event=pr
type=ref,event=tag
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=${{ github.event.inputs.docker_tag_version }}
type=raw,value=v${{ github.event.inputs.docker_tag_version }}
type=raw,value=${{ env.MAJOR_MINOR }}
type=raw,value=v${{ env.MAJOR_MINOR }}
env:
MAJOR_MINOR: ${{ env.MAJOR_MINOR }}

- name: Set outputs
id: set-outputs
Expand All @@ -67,6 +74,16 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Extract version parts
id: extract_version
run: |
VERSION=${{ github.event.inputs.docker_tag_version }}
VERSION_WITHOUT_V=${VERSION#v}
MAJOR_MINOR=$(echo $VERSION_WITHOUT_V | cut -d. -f1-2)
echo "VERSION_WITHOUT_V=$VERSION_WITHOUT_V" >> $GITHUB_ENV
echo "MAJOR_MINOR=$MAJOR_MINOR" >> $GITHUB_ENV
- name: docker metadata for arm64
id: image-metadata
Expand All @@ -78,11 +95,12 @@ jobs:
suffix=-arm64
tags: |
raw,latest
type=ref,event=branch
type=ref,event=pr
type=ref,event=tag
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=${{ github.event.inputs.docker_tag_version }}
type=raw,value=v${{ github.event.inputs.docker_tag_version }}
type=raw,value=${{ env.MAJOR_MINOR }}
type=raw,value=v${{ env.MAJOR_MINOR }}
env:
MAJOR_MINOR: ${{ env.MAJOR_MINOR }}

- name: Set outputs
id: set-outputs
Expand All @@ -98,9 +116,20 @@ jobs:
version: ${{ steps.image-metadata.outputs.version }}
tags: ${{ steps.image-metadata.outputs.tags }}
labels: ${{ steps.image-metadata.outputs.labels }}
release_tags: ${{ steps.image-tags.outputs.tags }}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Extract version parts
id: extract_version
run: |
VERSION=${{ github.event.inputs.docker_tag_version }}
VERSION_WITHOUT_V=${VERSION#v}
MAJOR_MINOR=$(echo $VERSION_WITHOUT_V | cut -d. -f1-2)
echo "VERSION_WITHOUT_V=$VERSION_WITHOUT_V" >> $GITHUB_ENV
echo "MAJOR_MINOR=$MAJOR_MINOR" >> $GITHUB_ENV
- name: docker metadata for arm64 base image
id: image-metadata
Expand All @@ -111,12 +140,26 @@ jobs:
latest=false
suffix=-arm64-base
tags: |
raw,latest
type=ref,event=branch
type=ref,event=pr
type=ref,event=tag
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=${{ github.event.inputs.docker_tag_version }}
type=raw,value=v${{ github.event.inputs.docker_tag_version }}
type=raw,value=${{ env.MAJOR_MINOR }}
type=raw,value=v${{ env.MAJOR_MINOR }}
env:
MAJOR_MINOR: ${{ env.MAJOR_MINOR }}
- name: docker metadata for arm64 base image
id: image-tags
uses: docker/metadata-action@v5
with:
flavor: |
latest=false
suffix=-arm64-base
tags: |
type=raw,value=${{ github.event.inputs.docker_tag_version }}
type=raw,value=v${{ github.event.inputs.docker_tag_version }}
type=raw,value=${{ env.MAJOR_MINOR }}
type=raw,value=v${{ env.MAJOR_MINOR }}
env:
MAJOR_MINOR: ${{ env.MAJOR_MINOR }}

- name: Set outputs
id: set-outputs
Expand Down Expand Up @@ -221,8 +264,7 @@ jobs:
target_image: "${{ needs.build-arm64-base-image-metadata.outputs.DOCKER_IMG_NAME }}"
target_registry: docker.io
platforms: "['linux/arm64']"
is_latest: false
suffix: "-arm64-base"
tags: ${{ needs.build-arm64-base-image-metadata.outputs.release_tags }}
secrets:
source_registry_username: ${{ github.actor }}
source_registry_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -291,25 +333,49 @@ jobs:
version: ${{ steps.image-metadata.outputs.version }}
tags: ${{ steps.image-metadata.outputs.tags }}
labels: ${{ steps.image-metadata.outputs.labels }}
release_tags: ${{ steps.image-tags.outputs.tags }}

steps:
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract version parts
id: extract_version
run: |
VERSION=${{ github.event.inputs.docker_tag_version }}
VERSION_WITHOUT_V=${VERSION#v}
MAJOR_MINOR=$(echo $VERSION_WITHOUT_V | cut -d. -f1-2)
echo "VERSION_WITHOUT_V=$VERSION_WITHOUT_V" >> $GITHUB_ENV
echo "MAJOR_MINOR=$MAJOR_MINOR" >> $GITHUB_ENV
- name: docker metadata for manifest
id: image-metadata
uses: docker/metadata-action@v5
with:
images: "ghcr.io/${{ env.GITHUB_IMAGE }}"
tags: |
raw,latest
type=ref,event=branch
type=ref,event=pr
type=ref,event=tag
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=${{ github.event.inputs.docker_tag_version }}
type=raw,value=v${{ github.event.inputs.docker_tag_version }}
type=raw,value=${{ env.MAJOR_MINOR }}
type=raw,value=v${{ env.MAJOR_MINOR }}
env:
MAJOR_MINOR: ${{ env.MAJOR_MINOR }}

- name: docker tags for cloning
id: image-tags
uses: docker/metadata-action@v5
with:
tags: |
type=raw,value=${{ github.event.inputs.docker_tag_version }}
type=raw,value=v${{ github.event.inputs.docker_tag_version }}
type=raw,value=${{ env.MAJOR_MINOR }}
type=raw,value=v${{ env.MAJOR_MINOR }}
env:
MAJOR_MINOR: ${{ env.MAJOR_MINOR }}

- name: Set outputs
id: set-outputs
Expand Down Expand Up @@ -352,7 +418,7 @@ jobs:
target_image: "${{ needs.prod-image-manifest.outputs.DOCKER_IMG_NAME }}"
target_registry: docker.io
platforms: "['linux/arm64', 'linux/amd64']"
is_latest: true
tags: ${{ needs.prod-image-manifest.outputs.release_tags }}
secrets:
source_registry_username: ${{ github.actor }}
source_registry_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
Loading

0 comments on commit df135ee

Please sign in to comment.