32
32
description : Optionally add metadata to build to indicate an unstable build, set to the contents you want to add.
33
33
type : string
34
34
required : false
35
- default : ' '
35
+ default : " "
36
36
secrets :
37
37
token :
38
38
description : The Github token or similar to authenticate with for the registry.
47
47
call-build-images-meta :
48
48
name : Extract any supporting metadata
49
49
outputs :
50
- build-type : ${{ steps.determine-build-type.outputs.BUILD_TYPE }}
51
50
major-version : ${{ steps.determine-major-version.outputs.replaced }}
52
51
runs-on : ubuntu-latest
53
52
environment : ${{ inputs.environment }}
@@ -59,171 +58,20 @@ jobs:
59
58
with :
60
59
ref : ${{ inputs.ref }}
61
60
62
- # Determine if this is a 1.8 type of build which is different
63
- - name : Determine build type
64
- id : determine-build-type
65
- run : |
66
- BUILD_TYPE="1.8"
67
- if [[ -f "dockerfiles/Dockerfile" ]]; then
68
- BUILD_TYPE="modern"
69
- fi
70
- echo "Detected type: $BUILD_TYPE"
71
- echo ::set-output name=BUILD_TYPE::$BUILD_TYPE
72
- shell : bash
73
-
74
- # For main branch/releases we want to also tag with the major version.
61
+ # For main branch/releases we want to tag with the major version.
75
62
# E.g. if we build version 1.9.2 we want to tag with 1.9.2 and 1.9.
76
63
- name : Determine major version tag
77
64
id : determine-major-version
78
65
uses : frabert/replace-string-action@v2.2
79
66
with :
80
67
pattern : ' ^(\d+\.\d+).*$'
81
68
string : ${{ inputs.version }}
82
- replace-with : ' $1'
83
- flags : ' g'
84
-
85
- # For 1.8 builds it is a little more complex so we have this build matrix to handle it.
86
- # This creates separate images for each architecture.
87
- # The later step then creates a multi-arch manifest for all of these.
88
- call-build-legacy-images-matrix :
89
- if : needs.call-build-images-meta.outputs.build-type == '1.8'
90
- name : Build single arch legacy images
91
- runs-on : ubuntu-latest
92
- environment : ${{ inputs.environment }}
93
- needs :
94
- - call-build-images-meta
95
- strategy :
96
- fail-fast : false
97
- matrix :
98
- arch : [ amd64, arm64, arm/v7 ]
99
- include :
100
- - arch : amd64
101
- suffix : x86_64
102
- - arch : arm/v7
103
- suffix : arm32v7
104
- - arch : arm64
105
- suffix : arm64v8
106
- permissions :
107
- contents : read
108
- packages : write
109
- steps :
110
- - name : Checkout the docker build repo for legacy builds
111
- uses : actions/checkout@v3
112
- with :
113
- repository : fluent/fluent-bit-docker-image
114
- ref : ' 1.8' # Fixed to this branch
115
-
116
- - name : Set up QEMU
117
- uses : docker/setup-qemu-action@v2
118
-
119
- - name : Set up Docker Buildx
120
- uses : docker/setup-buildx-action@v2
121
-
122
- - name : Log in to the Container registry
123
- uses : docker/login-action@v2
124
- with :
125
- registry : ${{ inputs.registry }}
126
- username : ${{ inputs.username }}
127
- password : ${{ secrets.token }}
128
-
129
- - id : debug-meta
130
- uses : docker/metadata-action@v4
131
- with :
132
- images : ${{ inputs.registry }}/${{ inputs.image }}
133
- tags : |
134
- raw,${{ inputs.version }}-debug
135
- raw,${{ needs.call-build-images-meta.outputs.major-version }}-debug
136
-
137
- - name : Build the legacy x86_64 debug image
138
- if : matrix.arch == 'amd64'
139
- uses : docker/build-push-action@v3
140
- with :
141
- file : ./Dockerfile.x86_64.debug
142
- context : .
143
- tags : ${{ steps.debug-meta.outputs.tags }}
144
- labels : ${{ steps.debug-meta.outputs.labels }}
145
- platforms : linux/amd64
146
- push : true
147
- load : false
148
- build-args : |
149
- FLB_TARBALL=https://github.com/fluent/fluent-bit/tarball/${{ inputs.ref }}
150
-
151
- - name : Extract metadata from Github
152
- id : meta
153
- uses : docker/metadata-action@v4
154
- with :
155
- images : ${{ inputs.registry }}/${{ inputs.image }}
156
- tags : |
157
- raw,${{ matrix.suffix }}-${{ inputs.version }}
158
-
159
- - name : Build the legacy ${{ matrix.arch }} image
160
- uses : docker/build-push-action@v3
161
- with :
162
- file : ./Dockerfile.${{ matrix.suffix }}
163
- context : .
164
- tags : ${{ steps.meta.outputs.tags }}
165
- labels : ${{ steps.meta.outputs.labels }}
166
- platforms : linux/${{ matrix.arch }}
167
- push : true
168
- load : false
169
- build-args : |
170
- FLB_TARBALL=https://github.com/fluent/fluent-bit/tarball/${{ inputs.ref }}
171
-
172
- # Create a multi-arch manifest for the separate 1.8 images.
173
- call-build-legacy-image-manifests :
174
- if : needs.call-build-images-meta.outputs.build-type == '1.8'
175
- name : Deploy multi-arch container image manifests
176
- permissions :
177
- contents : read
178
- packages : write
179
- runs-on : ubuntu-latest
180
- environment : ${{ inputs.environment }}
181
- needs :
182
- - call-build-images-meta
183
- - call-build-legacy-images-matrix
184
- steps :
185
- - name : Set up Docker Buildx
186
- uses : docker/setup-buildx-action@v2
187
-
188
- - name : Log in to the Container registry
189
- uses : docker/login-action@v2
190
- with :
191
- registry : ${{ inputs.registry }}
192
- username : ${{ inputs.username }}
193
- password : ${{ secrets.token }}
194
-
195
- - name : Pull all the images
196
- # Use platform to trigger warnings on invalid image metadata
197
- run : |
198
- docker pull --platform=linux/amd64 ${{ inputs.registry }}/${{ inputs.image }}:x86_64-${{ inputs.version }}
199
- docker pull --platform=linux/arm64 ${{ inputs.registry }}/${{ inputs.image }}:arm64v8-${{ inputs.version }}
200
- docker pull --platform=linux/arm/v7 ${{ inputs.registry }}/${{ inputs.image }}:arm32v7-${{ inputs.version }}
201
-
202
- - name : Create manifests for images
203
- # Latest is 1.9, not 1.8 now
204
- run : |
205
- docker manifest create ${{ inputs.registry }}/${{ inputs.image }}:${{ inputs.version }} \
206
- --amend ${{ inputs.registry }}/${{ inputs.image }}:x86_64-${{ inputs.version }} \
207
- --amend ${{ inputs.registry }}/${{ inputs.image }}:arm64v8-${{ inputs.version }} \
208
- --amend ${{ inputs.registry }}/${{ inputs.image }}:arm32v7-${{ inputs.version }}
209
- docker manifest push --purge ${{ inputs.registry }}/${{ inputs.image }}:${{ inputs.version }}
210
- env :
211
- DOCKER_CLI_EXPERIMENTAL : enabled
212
- shell : bash
213
-
214
- - name : Create major version manifest
215
- if : needs.call-build-images-meta.outputs.major-version != inputs.version
216
- run : |
217
- docker manifest push --purge ${{ inputs.registry }}/${{ inputs.image }}:${{ needs.call-build-images-meta.outputs.major-version }}
218
- env :
219
- DOCKER_CLI_EXPERIMENTAL : enabled
220
- shell : bash
69
+ replace-with : " $1"
70
+ flags : " g"
221
71
222
72
# This is the intended approach to multi-arch image and all the other checks scanning,
223
73
# signing, etc only trigger from this.
224
- # 1.8 images are legacy and were not scanned or signed previously so this keeps it simple.
225
74
call-build-images :
226
- if : needs.call-build-images-meta.outputs.build-type != '1.8'
227
75
needs :
228
76
- call-build-images-meta
229
77
name : Multiarch container images to GHCR
@@ -304,7 +152,6 @@ jobs:
304
152
needs :
305
153
- call-build-images-meta
306
154
- call-build-images
307
- if : needs.call-build-images-meta.outputs.build-type != '1.8'
308
155
runs-on : ubuntu-latest
309
156
environment : ${{ inputs.environment }}
310
157
permissions :
@@ -332,7 +179,6 @@ jobs:
332
179
if-no-files-found : error
333
180
334
181
call-build-images-scan :
335
- if : needs.call-build-images-meta.outputs.build-type != '1.8'
336
182
needs :
337
183
- call-build-images-meta
338
184
- call-build-images
@@ -353,22 +199,21 @@ jobs:
353
199
- name : Trivy - multi-arch
354
200
uses : aquasecurity/trivy-action@master
355
201
with :
356
- image-ref : ' ${{ inputs.registry }}/${{ inputs.image }}:${{ inputs.version }}'
357
- format : ' table'
358
- exit-code : ' 1 '
202
+ image-ref : " ${{ inputs.registry }}/${{ inputs.image }}:${{ inputs.version }}"
203
+ format : " table"
204
+ exit-code : " 1 "
359
205
ignore-unfixed : true
360
- vuln-type : ' os,library'
361
- severity : ' CRITICAL,HIGH'
206
+ vuln-type : " os,library"
207
+ severity : " CRITICAL,HIGH"
362
208
363
209
- name : Dockle - multi-arch
364
210
uses : hands-lab/dockle-action@v1
365
211
with :
366
- image : ' ${{ inputs.registry }}/${{ inputs.image }}:${{ inputs.version }}'
367
- exit-code : ' 1 '
212
+ image : " ${{ inputs.registry }}/${{ inputs.image }}:${{ inputs.version }}"
213
+ exit-code : " 1 "
368
214
exit-level : WARN
369
215
370
216
call-build-images-sign :
371
- if : needs.call-build-images-meta.outputs.build-type != '1.8'
372
217
needs :
373
218
- call-build-images-meta
374
219
- call-build-images
@@ -428,7 +273,6 @@ jobs:
428
273
429
274
# This takes a long time...
430
275
call-build-windows-container :
431
- if : needs.call-build-images-meta.outputs.build-type != '1.8'
432
276
name : Windows container image
433
277
runs-on : windows-2019
434
278
environment : ${{ inputs.environment }}
0 commit comments