35
35
uses : docker/setup-buildx-action@v2
36
36
with :
37
37
driver-opts : |
38
- image=moby/buildkit:v0.10.6
38
+ image=moby/buildkit:v0.12.4
39
39
40
40
41
41
- name : Build builder stage
81
81
for i in "${MODS[@]}"
82
82
do
83
83
REQS=$(jq -cr 'select(.requirements != []).requirements' ./"$i"/manifest.json)
84
+ ## Just for testing the pipeline with a subset of modules
85
+ if ! [[ "$i" =~ ^(googlecast|geizhals|fhem_forum|bt_presence)$ ]]; then
86
+ continue
87
+ fi
88
+ ## End of test
84
89
if [[ -z $REQS ]]; then
85
90
continue
86
91
fi
@@ -187,17 +192,6 @@ jobs:
187
192
run : |
188
193
./scripts/test-integration.sh ${{ steps.build-it.outputs.imageid }}
189
194
190
- - name : Find image String
191
- id : extract_image
192
- run : |
193
- echo "image_name=$(grep -m 1 '^FROM' Dockerfile | cut -d ' ' -f2 | cut -d ':' -f1)" >> $GITHUB_OUTPUT
194
- echo "image_version=$(grep -m 1 '^FROM' Dockerfile | cut -d ' ' -f2 | cut -d ':' -f2)" >> $GITHUB_OUTPUT
195
-
196
- - name : Update docs
197
- if : ${{ github.event_name == 'release' }}
198
- run : |
199
- sed -e "s/{FHEMPY_VERSION}/${{ needs.prepare_build.outputs.fhempyV }}/" -e "s/{PYTHON_VERSION}/${{ steps.extract_image.outputs.image_version}}/" -e "s/{DEBIAN_RELEASE}/buster/" -e s/{IMAGE_TAG}/${{ github.ref_name }}/ < README.tmpl > README.md
200
-
201
195
- name : Install cosign
202
196
if : github.event_name == 'release'
203
197
uses : sigstore/cosign-installer@v2.8.1
@@ -227,6 +221,8 @@ jobs:
227
221
type=semver,pattern={{major}},enable=${{ github.event.release.prerelease == 0 }}
228
222
type=ref,event=branch
229
223
type=ref,event=pr
224
+ labels : |
225
+ org.opencontainers.image.title=${{ env.IMAGE_NAME }}_${{ matrix.module }}
230
226
231
227
- name : Build and push Docker image for all plattforms
232
228
uses : docker/build-push-action@v3.2.0
@@ -238,7 +234,7 @@ jobs:
238
234
tags : ${{ steps.meta.outputs.tags }}
239
235
labels : ${{ steps.meta.outputs.labels }}
240
236
target : runtime
241
- cache-to : type=gha,scope=runtime-stage_cross-${{ matrix.module }}_${{ hashFiles('./requirements_mod.txt') }}
237
+ cache-to : type=gha,scope=runtime-stage_cross-${{ matrix.module }}_${{ hashFiles('./requirements_mod.txt') }},mode=max
242
238
cache-from : |
243
239
type=gha,scope=base_stage_cross
244
240
type=gha,scope=runtime-stage_cross
@@ -248,8 +244,9 @@ jobs:
248
244
249
245
- name : show image details
250
246
run : |
251
- echo ${{ steps.docker_build_runtime_cross.outputs.imageid }}
252
- echo ${{ steps.docker_build_runtime_cross.outputs.digest }}
247
+ echo "${{ steps.docker_build_runtime_cross.outputs.imageid }}"
248
+ echo "${{ steps.docker_build_runtime_cross.outputs.digest }}"
249
+ echo "${{ steps.docker_build_runtime_cross.outputs.metadata }}"
253
250
# Sign the resulting Docker image digest except on PRs.
254
251
# This will only write to the public Rekor transparency log when the Docker
255
252
# repository is public to avoid leaking data. If you would like to publish
@@ -262,7 +259,50 @@ jobs:
262
259
# This step uses the identity token to provision an ephemeral certificate
263
260
# against the sigstore community Fulcio instance.
264
261
run : echo "${{ steps.meta.outputs.tags }}" | xargs -I {} cosign sign {}@${{ steps.docker_build_runtime_cross.outputs.digest }}
262
+
263
+ - name : Create Job Summary
264
+ run : |
265
+ echo "### Image report for : ${{ github.sha }}" >> $GITHUB_STEP_SUMMARY
266
+ echo "| Module | Image name |" >> $GITHUB_STEP_SUMMARY
267
+ echo "|-------|----------------------------------------------------------------------|" >> $GITHUB_STEP_SUMMARY
268
+ echo "| ${{ matrix.module }} | ${{ fromJSON(steps.docker_build_runtime_cross.outputs.metadata)['image.name'] }} |" >> $GITHUB_STEP_SUMMARY
269
+ echo "| ${{ matrix.module }} | ${{ fromJSON(steps.docker_build_runtime_cross.outputs.metadata)['image.name'] }} |" > matrix_result.md
265
270
271
+ - name : Upload artifact
272
+ uses : actions/upload-artifact@v3
273
+ with :
274
+ name : ${{ hashFiles('matrix_result.md') || 'none' }}
275
+ path : matrix_result.md
276
+ if-no-files-found : warn
277
+
278
+ check-matrix :
279
+ runs-on : ubuntu-latest
280
+ needs : [buildImages,prepare_build]
281
+ permissions :
282
+ contents : write
283
+ steps :
284
+ - name : Checkout repository
285
+ uses : actions/checkout@v3
286
+
287
+ - uses : actions/download-artifact@v3
288
+
289
+ - name : Find image String
290
+ id : extract_image
291
+ run : |
292
+ echo "image_name=$(grep -m 1 '^FROM' Dockerfile | cut -d ' ' -f2 | cut -d ':' -f1)" >> $GITHUB_OUTPUT
293
+ echo "image_version=$(grep -m 1 '^FROM' Dockerfile | cut -d ' ' -f2 | cut -d ':' -f2)" >> $GITHUB_OUTPUT
294
+
295
+ - name : Update docs (readme.md)
296
+ run : |
297
+ cat */matrix_result.md > modules.md
298
+ IMAGE_LIST=$(cat modules.md)
299
+ echo "$IMAGE_LIST"
300
+ ESCAPED_DATA="$(echo "${IMAGE_LIST}" | sed 's/\n/\\n/g')"
301
+ echo "--------"
302
+ echo "$ESCAPED_DATA"
303
+ sed -e "s/{FHEMPY_VERSION}/${{ needs.prepare_build.outputs.fhempyV }}/" -e "s/{PYTHON_VERSION}/${{ steps.extract_image.outputs.image_version}}/" -e "s/{DEBIAN_RELEASE}/buster/" -e s,{IMAGE_TAG},${{ github.ref_name }}, < README.tmpl > README.md
304
+ sed -i -e "/{MODULES_IMAGE_LIST}/r modules.md" -e "/{MODULES_IMAGE_LIST}/d" README.md
305
+
266
306
- name : git commit README.md
267
307
id : commit
268
308
if : ${{ github.event_name == 'release' }}
@@ -277,4 +317,7 @@ jobs:
277
317
with :
278
318
token : ${{ secrets.BOT_PUSH_TOKEN }}
279
319
branch : main
280
- # unprotect_reviews: true
320
+
321
+ - name : Set step summary
322
+ run : |
323
+ cat README.md >> $GITHUB_STEP_SUMMARY
0 commit comments