Skip to content

Commit 1f5e1b7

Browse files
authored
Merge branch 'fluent:master' into master
2 parents 8c35c60 + 7859e8d commit 1f5e1b7

File tree

3,549 files changed

+789504
-125206
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,549 files changed

+789504
-125206
lines changed

.github/workflows/call-build-images.yaml

Lines changed: 175 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ on:
1515
registry:
1616
description: The registry to push container images to.
1717
type: string
18-
required: true
18+
required: false
19+
default: ghcr.io
1920
username:
2021
description: The username for the registry.
2122
type: string
@@ -33,6 +34,11 @@ on:
3334
type: string
3435
required: false
3536
default: ""
37+
push:
38+
description: Optionally push the images to the registry, defaults to true but for forks we cannot do this in PRs.
39+
type: boolean
40+
required: false
41+
default: true
3642
secrets:
3743
token:
3844
description: The Github token or similar to authenticate with for the registry.
@@ -69,28 +75,33 @@ jobs:
6975
replace-with: "$1"
7076
flags: "g"
7177

72-
# This is the intended approach to multi-arch image and all the other checks scanning,
73-
# signing, etc only trigger from this.
74-
call-build-images:
75-
needs:
76-
- call-build-images-meta
77-
name: Multiarch container images to GHCR
78-
runs-on: ubuntu-latest
79-
environment: ${{ inputs.environment }}
78+
# Taken from https://docs.docker.com/build/ci/github-actions/multi-platform/#distribute-build-across-multiple-runners
79+
# We split this out to make it easier to restart just one of them if it fails and do all in parallel
80+
call-build-single-arch-container-images:
81+
# Allow us to continue to create a manifest if we want
82+
continue-on-error: true
8083
permissions:
8184
contents: read
8285
packages: write
83-
outputs:
84-
production-digest: ${{ steps.build_push.outputs.digest }}
85-
debug-digest: ${{ steps.debug_build_push.outputs.digest }}
86+
strategy:
87+
fail-fast: false
88+
matrix:
89+
platform:
90+
- amd64
91+
- arm64
92+
- arm/v7
93+
target:
94+
- production
95+
- debug
96+
name: ${{ matrix.platform }}/${{ matrix.target }} container image build
97+
# Use GitHub Actions ARM hosted runners
98+
runs-on: ${{ (contains(matrix.platform, 'arm') && 'ubuntu-22.04-arm') || 'ubuntu-latest' }}
8699
steps:
87-
- name: Checkout code for modern style builds
100+
- name: Checkout code
88101
uses: actions/checkout@v4
89102
with:
90103
ref: ${{ inputs.ref }}
91-
92-
- name: Set up QEMU
93-
uses: docker/setup-qemu-action@v3
104+
token: ${{ secrets.token }}
94105

95106
- name: Set up Docker Buildx
96107
uses: docker/setup-buildx-action@v3
@@ -99,9 +110,58 @@ jobs:
99110
uses: docker/login-action@v3
100111
with:
101112
registry: ${{ inputs.registry }}
102-
username: ${{ inputs.username }}
113+
username: ${{ github.actor }}
103114
password: ${{ secrets.token }}
104115

116+
- name: Build and push by digest the standard ${{ matrix.target }} image
117+
id: build
118+
uses: docker/build-push-action@v6
119+
with:
120+
# Use path context rather than Git context as we want local files
121+
file: ./dockerfiles/Dockerfile
122+
context: .
123+
target: ${{ matrix.target }}
124+
outputs: type=image,name=${{ inputs.registry }}/${{ inputs.image }},push-by-digest=true,name-canonical=true,push=${{ inputs.push }}
125+
platforms: linux/${{ matrix.platform }}
126+
# Must be disabled to provide legacy format images from the registry
127+
provenance: false
128+
# This is configured in outputs above
129+
push: ${{ inputs.push }}
130+
load: false
131+
build-args: |
132+
FLB_NIGHTLY_BUILD=${{ inputs.unstable }}
133+
RELEASE_VERSION=${{ inputs.version }}
134+
WAMR_BUILD_TARGET=${{ (contains(matrix.platform, 'arm/v7') && 'ARMV7') || '' }}
135+
136+
- name: Export ${{ matrix.target }} digest
137+
run: |
138+
mkdir -p /tmp/digests
139+
digest="${{ steps.build.outputs.digest }}"
140+
touch "/tmp/digests/${digest#sha256:}"
141+
shell: bash
142+
143+
- name: Upload ${{ matrix.target }} digest
144+
uses: actions/upload-artifact@v4
145+
with:
146+
name: ${{ matrix.target }}-digests-${{ (contains(matrix.platform, 'arm/v7') && 'arm-v7') || matrix.platform }}
147+
path: /tmp/digests/*
148+
if-no-files-found: error
149+
retention-days: 1
150+
151+
# Take the digests and produce a multi-arch manifest from them.
152+
call-build-container-image-manifests:
153+
if: inputs.push
154+
permissions:
155+
contents: read
156+
packages: write
157+
name: Upload multi-arch container image manifests
158+
runs-on: ubuntu-latest
159+
needs:
160+
- call-build-images-meta
161+
- call-build-single-arch-container-images
162+
outputs:
163+
version: ${{ steps.meta.outputs.version }}
164+
steps:
105165
- name: Extract metadata from Github
106166
id: meta
107167
uses: docker/metadata-action@v5
@@ -112,24 +172,49 @@ jobs:
112172
raw,${{ needs.call-build-images-meta.outputs.major-version }}
113173
raw,latest
114174
115-
- name: Build the production images
116-
id: build_push
117-
uses: docker/build-push-action@v6
175+
- name: Download production digests
176+
uses: actions/download-artifact@v4
118177
with:
119-
file: ./dockerfiles/Dockerfile
120-
context: .
121-
tags: ${{ steps.meta.outputs.tags }}
122-
labels: ${{ steps.meta.outputs.labels }}
123-
platforms: linux/amd64, linux/arm64, linux/arm/v7, linux/s390x
124-
target: production
125-
# Must be disabled to provide legacy format images from the registry
126-
provenance: false
127-
push: true
128-
load: false
129-
build-args: |
130-
FLB_NIGHTLY_BUILD=${{ inputs.unstable }}
131-
RELEASE_VERSION=${{ inputs.version }}
178+
pattern: production-digests-*
179+
path: /tmp/production-digests
180+
merge-multiple: true
181+
182+
- name: Set up Docker Buildx
183+
uses: docker/setup-buildx-action@v3
132184

185+
- name: Log in to the Container registry
186+
uses: docker/login-action@v3
187+
with:
188+
registry: ${{ inputs.registry }}
189+
username: ${{ github.actor }}
190+
password: ${{ secrets.token }}
191+
192+
- name: Create production manifest
193+
run: |
194+
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
195+
$(printf '${{ inputs.registry }}/${{ inputs.image }}@sha256:%s ' *)
196+
shell: bash
197+
working-directory: /tmp/production-digests
198+
199+
- name: Inspect image
200+
run: |
201+
docker buildx imagetools inspect ${{ inputs.registry }}/${{ inputs.image }}:${{ steps.meta.outputs.version }}
202+
shell: bash
203+
204+
# Take the digests and produce a multi-arch manifest from them.
205+
call-build-debug-container-image-manifests:
206+
if: inputs.push
207+
permissions:
208+
contents: read
209+
packages: write
210+
name: Upload debug multi-arch container image manifests
211+
runs-on: ubuntu-latest
212+
needs:
213+
- call-build-images-meta
214+
- call-build-single-arch-container-images
215+
outputs:
216+
version: ${{ steps.debug-meta.outputs.version }}
217+
steps:
133218
- id: debug-meta
134219
uses: docker/metadata-action@v5
135220
with:
@@ -139,28 +224,40 @@ jobs:
139224
raw,${{ needs.call-build-images-meta.outputs.major-version }}-debug
140225
raw,latest-debug
141226
142-
- name: Build the debug multi-arch images
143-
id: debug_build_push
144-
uses: docker/build-push-action@v6
227+
- name: Download debug digests
228+
uses: actions/download-artifact@v4
145229
with:
146-
file: ./dockerfiles/Dockerfile
147-
context: .
148-
tags: ${{ steps.debug-meta.outputs.tags }}
149-
labels: ${{ steps.debug-meta.outputs.labels }}
150-
platforms: linux/amd64, linux/arm64, linux/arm/v7, linux/s390x
151-
# Must be disabled to provide legacy format images from the registry
152-
provenance: false
153-
target: debug
154-
push: true
155-
load: false
156-
build-args: |
157-
FLB_NIGHTLY_BUILD=${{ inputs.unstable }}
158-
RELEASE_VERSION=${{ inputs.version }}
230+
pattern: debug-digests-*
231+
path: /tmp/debug-digests
232+
merge-multiple: true
233+
234+
- name: Set up Docker Buildx
235+
uses: docker/setup-buildx-action@v3
236+
237+
- name: Log in to the Container registry
238+
uses: docker/login-action@v3
239+
with:
240+
registry: ${{ inputs.registry }}
241+
username: ${{ github.actor }}
242+
password: ${{ secrets.token }}
243+
244+
- name: Create debug manifest
245+
run: |
246+
docker buildx imagetools create $DOCKER_PUSH_EXTRA_FLAGS $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
247+
$(printf '${{ inputs.registry }}/${{ inputs.image }}@sha256:%s ' *)
248+
shell: bash
249+
working-directory: /tmp/debug-digests
250+
251+
- name: Inspect image
252+
run: |
253+
docker buildx imagetools inspect ${{ inputs.registry }}/${{ inputs.image }}:${{ steps.debug-meta.outputs.version }}
254+
shell: bash
159255

160256
call-build-images-generate-schema:
257+
if: inputs.push
161258
needs:
162259
- call-build-images-meta
163-
- call-build-images
260+
- call-build-container-image-manifests
164261
runs-on: ubuntu-latest
165262
environment: ${{ inputs.environment }}
166263
permissions:
@@ -188,9 +285,10 @@ jobs:
188285
if-no-files-found: error
189286

190287
call-build-images-scan:
288+
if: inputs.push
191289
needs:
192290
- call-build-images-meta
193-
- call-build-images
291+
- call-build-container-image-manifests
194292
name: Trivy + Dockle image scan
195293
runs-on: ubuntu-latest
196294
environment: ${{ inputs.environment }}
@@ -223,9 +321,11 @@ jobs:
223321
exit-level: WARN
224322

225323
call-build-images-sign:
324+
if: inputs.push
226325
needs:
227326
- call-build-images-meta
228-
- call-build-images
327+
- call-build-container-image-manifests
328+
- call-build-debug-container-image-manifests
229329
name: Deploy and sign multi-arch container image manifests
230330
permissions:
231331
contents: read
@@ -246,13 +346,13 @@ jobs:
246346
#
247347
# We use recursive signing on the manifest to cover all the images.
248348
run: |
249-
cosign sign --recursive \
349+
cosign sign --recursive --force \
250350
-a "repo=${{ github.repository }}" \
251351
-a "workflow=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
252352
-a "ref=${{ github.sha }}" \
253353
-a "release=${{ inputs.version }}" \
254-
"${{ inputs.registry }}/${{ inputs.image }}@${{ needs.call-build-images.outputs.production-digest }}" \
255-
"${{ inputs.registry }}/${{ inputs.image }}@${{ needs.call-build-images.outputs.debug-digest }}"
354+
"${{ inputs.registry }}/${{ inputs.image }}@${{ needs.call-build-container-image-manifests.outputs.version }}" \
355+
"${{ inputs.registry }}/${{ inputs.image }}@${{ needs.call-build-debug-container-image-manifests.outputs.version }}"
256356
shell: bash
257357
# Ensure we move on to key-based signing as well
258358
continue-on-error: true
@@ -265,13 +365,13 @@ jobs:
265365
# The key needs to cope with newlines
266366
run: |
267367
echo -e "${COSIGN_PRIVATE_KEY}" > /tmp/my_cosign.key
268-
cosign sign --key /tmp/my_cosign.key --recursive \
368+
cosign sign --key /tmp/my_cosign.key --recursive --force \
269369
-a "repo=${{ github.repository }}" \
270370
-a "workflow=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
271371
-a "ref=${{ github.sha }}" \
272372
-a "release=${{ inputs.version }}" \
273-
"${{ inputs.registry }}/${{ inputs.image }}@${{ needs.call-build-images.outputs.production-digest }}" \
274-
"${{ inputs.registry }}/${{ inputs.image }}@${{ needs.call-build-images.outputs.debug-digest }}"
373+
"${{ inputs.registry }}/${{ inputs.image }}@${{ needs.call-build-container-image-manifests.outputs.version }}" \
374+
"${{ inputs.registry }}/${{ inputs.image }}@${{ needs.call-build-debug-container-image-manifests.outputs.version }}"
275375
rm -f /tmp/my_cosign.key
276376
shell: bash
277377
continue-on-error: true
@@ -301,16 +401,33 @@ jobs:
301401
with:
302402
ref: ${{ inputs.ref }}
303403

404+
# - name: Set up Docker Buildx
405+
# uses: docker/setup-buildx-action@v3
406+
304407
- name: Log in to the Container registry
305408
uses: docker/login-action@v3
306409
with:
307410
registry: ${{ inputs.registry }}
308411
username: ${{ inputs.username }}
309412
password: ${{ secrets.token }}
310413

414+
- name: Pull the last release image to speed up the build with a cache
415+
continue-on-error: true
416+
run: |
417+
VERSION=$(gh release list --json tagName,isLatest --jq '.[] | select(.isLatest)|.tagName | sub("^v"; "")')
418+
echo VERSION="$VERSION"
419+
docker pull ${{ inputs.registry }}/${{ inputs.image }}:windows-${{ matrix.windows-base-version }}-$VERSION
420+
shell: bash
421+
env:
422+
GH_TOKEN: ${{ secrets.token }}
423+
311424
- name: Build the production images
312425
run: |
313426
docker build -t ${{ inputs.registry }}/${{ inputs.image }}:windows-${{ matrix.windows-base-version }}-${{ inputs.version }} --build-arg FLB_NIGHTLY_BUILD=${{ inputs.unstable }} --build-arg WINDOWS_VERSION=ltsc${{ matrix.windows-base-version }} -f ./dockerfiles/Dockerfile.windows .
427+
428+
- name: Push the production images
429+
if: inputs.push
430+
run: |
314431
docker push ${{ inputs.registry }}/${{ inputs.image }}:windows-${{ matrix.windows-base-version }}-${{ inputs.version }}
315432
316433
# We cannot use this action as it requires privileged mode

.github/workflows/call-build-linux-packages.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,7 @@ jobs:
105105
call-build-linux-packages:
106106
name: ${{ matrix.distro }} package build and stage to S3
107107
environment: ${{ inputs.environment }}
108-
# Ensure for OSS Fluent Bit repo we enable usage of Actuated runners for ARM builds, for forks it should keep existing ubuntu-22.04 usage.
109-
runs-on: ${{ (contains(matrix.distro, 'arm' ) && (github.repository == 'fluent/fluent-bit') && 'actuated-arm64-8cpu-16gb') || 'ubuntu-22.04' }}
108+
runs-on: ${{ ((contains(matrix.distro, 'arm' ) || contains(matrix.distro, 'raspbian')) && 'ubuntu-22.04-arm') || 'ubuntu-22.04' }}
110109
permissions:
111110
contents: read
112111
strategy:
@@ -120,15 +119,15 @@ jobs:
120119
with:
121120
ref: ${{ inputs.ref }}
122121

123-
- name: Set up Actuated mirror
124-
if: contains(matrix.distro, 'arm' ) && (github.repository == 'fluent/fluent-bit')
125-
uses: self-actuated/hub-mirror@master
122+
- name: Set up Docker Buildx
123+
uses: docker/setup-buildx-action@v3
126124

125+
# Raspbian requires ARMv6 emulation
127126
- name: Set up QEMU
127+
if: contains(matrix.distro, 'raspbian')
128128
uses: docker/setup-qemu-action@v3
129-
130-
- name: Set up Docker Buildx
131-
uses: docker/setup-buildx-action@v3
129+
with:
130+
image: tonistiigi/binfmt:qemu-v7.0.0-28 # See: https://github.com/docker/setup-qemu-action/issues/198#issuecomment-2653791775
132131

133132
- name: Replace all special characters with dashes
134133
id: formatted_distro
@@ -219,6 +218,7 @@ jobs:
219218
environment: ${{ inputs.environment }}
220219
needs:
221220
- call-build-linux-packages
221+
continue-on-error: ${{ inputs.ignore_failing_targets || false }}
222222
steps:
223223
- name: Install dependencies
224224
timeout-minutes: 10

0 commit comments

Comments
 (0)