@@ -33,6 +33,10 @@ permissions:
3333 packages : write
3434
3535env :
36+ # # CUDA version and container operating system
37+ CUDA_VERSION : 12.5.1
38+ CUDA_OS : ubuntu24.04
39+
3640 # # Default versions are specified in packages.yaml but can be overridden
3741 # # note: nightly builds will always use the master/main branch
3842 EDM4EIC_VERSION : ${{ inputs.EDM4EIC_VERSION }}
5559 INTERNAL_TAG : pipeline-${{ github.run_id }}
5660
5761jobs :
62+ env :
63+ # # The env context is not available in matrix, only in steps,
64+ # # so this job is merely to transfer env to job outputs which
65+ # # can be used in matrix.
66+ name : Turn env into outputs
67+ runs-on : ubuntu-latest
68+ outputs :
69+ CUDA_VERSION : ${{ steps.env.outputs.CUDA_VERSION }}
70+ CUDA_OS : ${{ steps.env.outputs.CUDA_OS }}
71+ steps :
72+ - name : Turn env into outputs
73+ id : env
74+ run : |
75+ echo "CUDA_VERSION=${{ env.CUDA_VERSION }}" >> $GITHUB_OUTPUT
76+ echo "CUDA_OS=${{ env.CUDA_OS }}" >> $GITHUB_OUTPUT
77+
5878 base :
59- name : Build base on ${{ matrix.arch }}
79+ name : Build ${{ matrix.BUILD_IMAGE }} on ${{ matrix.arch }}
6080 runs-on : ${{ matrix.runner }}
81+ needs : env
6182 strategy :
6283 matrix :
6384 include :
7697 PLATFORM : linux/arm64
7798 runner : ubuntu-24.04-arm
7899 arch : arm64
100+ - BASE_IMAGE : nvidia/cuda:${{ needs.env.outputs.CUDA_VERSION }}-devel-${{ needs.env.outputs.CUDA_OS }}
101+ BUILD_IMAGE : cuda_devel
102+ PLATFORM : linux/amd64
103+ runner : ubuntu-latest
104+ arch : amd64
105+ - BASE_IMAGE : nvidia/cuda:${{ needs.env.outputs.CUDA_VERSION }}-runtime-${{ needs.env.outputs.CUDA_OS }}
106+ BUILD_IMAGE : cuda_runtime
107+ PLATFORM : linux/amd64
108+ runner : ubuntu-latest
109+ arch : amd64
79110 steps :
80111 - name : Checkout
81112 uses : actions/checkout@v4
@@ -130,16 +161,16 @@ jobs:
130161 uses : actions/cache@v4
131162 id : cache-base-mounts
132163 with :
133- path : cache-mount-base-${{ matrix.arch }}
134- key : ${{ matrix.arch }}-base-mounts-${{ github.ref_name }}
164+ path : cache-mount-base-${{ matrix.BUILD_IMAGE }}-${{ matrix. arch }}
165+ key : ${{ matrix.BUILD_IMAGE }}-${{ matrix. arch }}-base-mounts-${{ github.ref_name }}
135166 restore-keys : |
136- ${{ matrix.arch }}-base-mounts-main
137- ${{ matrix.arch }}-base-mounts-
167+ ${{ matrix.BUILD_IMAGE }}-${{ matrix. arch }}-base-mounts-main
168+ ${{ matrix.BUILD_IMAGE }}-${{ matrix. arch }}-base-mounts-
138169 - name : Inject cache mounts into builder
139170 uses : reproducible-containers/buildkit-cache-dance@v3
140171 with :
141172 builder : ${{ steps.buildx.outputs.name }}
142- cache-dir : cache-mount-base-${{ matrix.arch }}
173+ cache-dir : cache-mount-base-${{ matrix.BUILD_IMAGE }}-${{ matrix. arch }}
143174 cache-map : |
144175 {
145176 "var-cache-apt": "/var/cache/apt",
@@ -200,18 +231,24 @@ jobs:
200231 # We write this to a file for the next job
201232 run : |
202233 mkdir -p /tmp/digests
203- echo "${{ steps.meta.outputs.tags }}@${{ steps.build.outputs.digest }}" > /tmp/digests/${{ matrix.arch }}.digest
234+ echo "${{ steps.meta.outputs.tags }}@${{ steps.build.outputs.digest }}" > /tmp/digests/${{ matrix.BUILD_IMAGE }}-${{ matrix. arch }}.digest
204235 - name : Upload digest as artifact
205236 uses : actions/upload-artifact@v4
206237 with :
207- name : base-${{ matrix.arch }}-digest
208- path : /tmp/digests/${{ matrix.arch }}.digest
238+ name : base-${{ matrix.BUILD_IMAGE }}-${{ matrix. arch }}-digest
239+ path : /tmp/digests/${{ matrix.BUILD_IMAGE }}-${{ matrix. arch }}.digest
209240 retention-days : 1
210241
211242 base-manifest :
212- name : Push base manifest
243+ name : Push ${{ matrix.BUILD_IMAGE }} manifest
213244 runs-on : ubuntu-latest
214245 needs : base
246+ strategy :
247+ matrix :
248+ include :
249+ - BUILD_IMAGE : debian_stable_base
250+ - BUILD_IMAGE : cuda_devel
251+ - BUILD_IMAGE : cuda_runtime
215252 steps :
216253 - name : Set up QEMU (for imagetools)
217254 uses : docker/setup-qemu-action@v3
@@ -235,33 +272,47 @@ jobs:
235272 uses : actions/download-artifact@v4
236273 with :
237274 path : /tmp/digests
238- pattern : base-*-digest
275+ pattern : base-${{ matrix.BUILD_IMAGE }}- *-digest
239276 merge-multiple : true
240277 - name : Analyze digest artifacts
241278 id : digests
242279 run : |
243- # Read the digests from the files
244- DIGEST_AMD64=$(cat /tmp/digests/amd64.digest)
245- DIGEST_AMD64_V3=$(cat /tmp/digests/amd64_v3.digest)
246- DIGEST_ARM64=$(cat /tmp/digests/arm64.digest)
247- # Get the base image name from the digests (they'll be the same)
248- REGISTRY_IMAGE_TAG=$(echo $DIGEST_AMD64 | cut -d'@' -f1)
280+ # Loop over all available architecture artifacts
281+ ALL_DIGESTS=""
282+ FIRST_DIGEST=""
283+ shopt -s nullglob
284+ for digest_file in /tmp/digests/${{ matrix.BUILD_IMAGE }}-*.digest; do
285+ DIGEST=$(cat "$digest_file")
286+ echo "Found digest: $DIGEST"
287+ if [ -z "$ALL_DIGESTS" ]; then
288+ ALL_DIGESTS="$DIGEST"
289+ else
290+ ALL_DIGESTS="$ALL_DIGESTS $DIGEST"
291+ fi
292+ if [ -z "$FIRST_DIGEST" ]; then
293+ FIRST_DIGEST="$DIGEST"
294+ fi
295+ done
296+ shopt -u nullglob
297+ # Check if at least one digest was found
298+ if [ -z "$FIRST_DIGEST" ]; then
299+ echo "Error: No digest files found"
300+ exit 1
301+ fi
302+ # Get the base image name from the first digest
303+ REGISTRY_IMAGE_TAG=$(echo $FIRST_DIGEST | cut -d'@' -f1)
249304 REGISTRY_IMAGE=$(echo $REGISTRY_IMAGE_TAG | cut -d':' -f1)
250305 REGISTRY=$(echo $REGISTRY_IMAGE | cut -d'/' -f1-2)
251306 IMAGE=$(echo $REGISTRY_IMAGE | cut -d'/' -f3)
252307 TAG=$(echo $REGISTRY_IMAGE_TAG | cut -d':' -f2)
253308 echo "Registry Name: $REGISTRY"
254309 echo "Image Name: $IMAGE"
255310 echo "Tag Name: $TAG"
256- echo "AMD64 Digest: $DIGEST_AMD64"
257- echo "AMD64_V3 Digest: $DIGEST_AMD64_V3"
258- echo "ARM64 Digest: $DIGEST_ARM64"
311+ echo "All Digests: $ALL_DIGESTS"
259312 echo "registry=$REGISTRY" >> $GITHUB_OUTPUT
260313 echo "image=$IMAGE" >> $GITHUB_OUTPUT
261314 echo "tag=$TAG" >> $GITHUB_OUTPUT
262- echo "amd64=$DIGEST_AMD64" >> $GITHUB_OUTPUT
263- echo "amd64_v3=$DIGEST_AMD64_V3" >> $GITHUB_OUTPUT
264- echo "arm64=$DIGEST_ARM64" >> $GITHUB_OUTPUT
315+ echo "all=$ALL_DIGESTS" >> $GITHUB_OUTPUT
265316 - name : Extract Docker metadata for final tags
266317 id : meta
267318 uses : docker/metadata-action@v5
@@ -283,32 +334,78 @@ jobs:
283334 # Create the manifest list and tag it with the final tags
284335 docker buildx imagetools create \
285336 $TAG_ARGS \
286- ${{ steps.digests.outputs.amd64 }} \
287- ${{ steps.digests.outputs.amd64_v3 }} \
288- ${{ steps.digests.outputs.arm64 }}
337+ ${{ steps.digests.outputs.all }}
289338
290339 eic :
291340 name : Build ${{ matrix.BUILD_IMAGE }}${{ matrix.ENV }} on ${{ matrix.arch }}
292341 runs-on : ${{ matrix.runner }}
293342 needs : base-manifest
294343 strategy :
295344 matrix :
296- BUILD_IMAGE : [eic_]
297- BUILD_TYPE : [default]
298- BUILDER_IMAGE : [debian_stable_base]
299- RUNTIME_IMAGE : [debian_stable_base]
300- ENV : [ci, xl]
301- arch : [amd64, amd64_v3, arm64]
302345 include :
303- - arch : amd64
346+ - BUILD_IMAGE : eic_
347+ BUILD_TYPE : default
348+ BUILDER_IMAGE : debian_stable_base
349+ RUNTIME_IMAGE : debian_stable_base
350+ ENV : ci
351+ arch : amd64
352+ runner : ubuntu-latest
353+ PLATFORM : linux/amd64
354+ target : final
355+ - BUILD_IMAGE : eic_
356+ BUILD_TYPE : default
357+ BUILDER_IMAGE : debian_stable_base
358+ RUNTIME_IMAGE : debian_stable_base
359+ ENV : ci
360+ arch : amd64_v3
361+ runner : ubuntu-latest
362+ PLATFORM : linux/amd64/v3
363+ target : final
364+ - BUILD_IMAGE : eic_
365+ BUILD_TYPE : default
366+ BUILDER_IMAGE : debian_stable_base
367+ RUNTIME_IMAGE : debian_stable_base
368+ ENV : ci
369+ arch : arm64
370+ runner : ubuntu-24.04-arm
371+ PLATFORM : linux/arm64
372+ target : final
373+ - BUILD_IMAGE : eic_
374+ BUILD_TYPE : default
375+ BUILDER_IMAGE : debian_stable_base
376+ RUNTIME_IMAGE : debian_stable_base
377+ ENV : xl
378+ arch : amd64
304379 runner : ubuntu-latest
305380 PLATFORM : linux/amd64
306- - arch : amd64_v3
381+ target : final
382+ - BUILD_IMAGE : eic_
383+ BUILD_TYPE : default
384+ BUILDER_IMAGE : debian_stable_base
385+ RUNTIME_IMAGE : debian_stable_base
386+ ENV : xl
387+ arch : amd64_v3
307388 runner : ubuntu-latest
308389 PLATFORM : linux/amd64/v3
309- - arch : arm64
390+ target : final
391+ - BUILD_IMAGE : eic_
392+ BUILD_TYPE : default
393+ BUILDER_IMAGE : debian_stable_base
394+ RUNTIME_IMAGE : debian_stable_base
395+ ENV : xl
396+ arch : arm64
310397 runner : ubuntu-24.04-arm
311398 PLATFORM : linux/arm64
399+ target : final
400+ - BUILD_IMAGE : eic_
401+ BUILD_TYPE : default
402+ BUILDER_IMAGE : cuda_devel
403+ RUNTIME_IMAGE : cuda_devel
404+ ENV : cuda
405+ arch : amd64
406+ runner : ubuntu-latest
407+ PLATFORM : linux/amd64
408+ target : builder_concretization_default
312409 steps :
313410 - name : Free Disk Space (Ubuntu)
314411 uses : jlumbroso/free-disk-space@v1.3.1
@@ -413,6 +510,7 @@ jobs:
413510 secret-files : |
414511 mirrors=mirrors.yaml
415512 platforms : ${{ matrix.PLATFORM }}
513+ target : ${{ matrix.target }}
416514 labels : ${{ steps.meta.outputs.labels }}
417515 outputs : type=image,name=${{ env.GH_REGISTRY }}/${{ env.GH_REGISTRY_USER }}/${{ matrix.BUILD_IMAGE }}${{ matrix.ENV }},push-by-digest=true,name-canonical=true,push=true
418516 build-args : |
@@ -446,11 +544,12 @@ jobs:
446544 retention-days : 1
447545
448546 eic-manifest :
449- name : Push eic manifest
547+ name : Push ${{ matrix.BUILD_IMAGE }}${{ matrix.ENV }} manifest
450548 runs-on : ubuntu-latest
451549 needs : eic
452550 strategy :
453551 matrix :
552+ BUILD_IMAGE : [eic_]
454553 ENV : [ci, xl]
455554 steps :
456555 - name : Set up QEMU (for imagetools)
@@ -480,28 +579,42 @@ jobs:
480579 - name : Analyze digest artifacts
481580 id : digests
482581 run : |
483- # Read the digests from the files
484- DIGEST_AMD64=$(cat /tmp/digests/amd64.digest)
485- DIGEST_AMD64_V3=$(cat /tmp/digests/amd64_v3.digest)
486- DIGEST_ARM64=$(cat /tmp/digests/arm64.digest)
487- # Get the base image name from the digests (they'll be the same)
488- REGISTRY_IMAGE_TAG=$(echo $DIGEST_AMD64 | cut -d'@' -f1)
582+ # Loop over all available architecture artifacts
583+ ALL_DIGESTS=""
584+ FIRST_DIGEST=""
585+ shopt -s nullglob
586+ for digest_file in /tmp/digests/*.digest; do
587+ DIGEST=$(cat "$digest_file")
588+ echo "Found digest: $DIGEST"
589+ if [ -z "$ALL_DIGESTS" ]; then
590+ ALL_DIGESTS="$DIGEST"
591+ else
592+ ALL_DIGESTS="$ALL_DIGESTS $DIGEST"
593+ fi
594+ if [ -z "$FIRST_DIGEST" ]; then
595+ FIRST_DIGEST="$DIGEST"
596+ fi
597+ done
598+ shopt -u nullglob
599+ # Check if at least one digest was found
600+ if [ -z "$FIRST_DIGEST" ]; then
601+ echo "Error: No digest files found"
602+ exit 1
603+ fi
604+ # Get the base image name from the first digest
605+ REGISTRY_IMAGE_TAG=$(echo $FIRST_DIGEST | cut -d'@' -f1)
489606 REGISTRY_IMAGE=$(echo $REGISTRY_IMAGE_TAG | cut -d':' -f1)
490607 REGISTRY=$(echo $REGISTRY_IMAGE | cut -d'/' -f1-2)
491608 IMAGE=$(echo $REGISTRY_IMAGE | cut -d'/' -f3)
492609 TAG=$(echo $REGISTRY_IMAGE_TAG | cut -d':' -f2)
493610 echo "Registry Name: $REGISTRY"
494611 echo "Image Name: $IMAGE"
495612 echo "Tag Name: $TAG"
496- echo "AMD64 Digest: $DIGEST_AMD64"
497- echo "AMD64_V3 Digest: $DIGEST_AMD64_V3"
498- echo "ARM64 Digest: $DIGEST_ARM64"
613+ echo "All Digests: $ALL_DIGESTS"
499614 echo "registry=$REGISTRY" >> $GITHUB_OUTPUT
500615 echo "image=$IMAGE" >> $GITHUB_OUTPUT
501616 echo "tag=$TAG" >> $GITHUB_OUTPUT
502- echo "amd64=$DIGEST_AMD64" >> $GITHUB_OUTPUT
503- echo "amd64_v3=$DIGEST_AMD64_V3" >> $GITHUB_OUTPUT
504- echo "arm64=$DIGEST_ARM64" >> $GITHUB_OUTPUT
617+ echo "all=$ALL_DIGESTS" >> $GITHUB_OUTPUT
505618 - name : Extract Docker metadata for final tags
506619 id : meta
507620 uses : docker/metadata-action@v5
@@ -523,6 +636,4 @@ jobs:
523636 # Create the manifest list and tag it with the final tags
524637 docker buildx imagetools create \
525638 $TAG_ARGS \
526- ${{ steps.digests.outputs.amd64 }} \
527- ${{ steps.digests.outputs.amd64_v3 }} \
528- ${{ steps.digests.outputs.arm64 }}
639+ ${{ steps.digests.outputs.all }}
0 commit comments