Skip to content

Commit b7feb76

Browse files
authored
Merge pull request #1005 from crazy-max/ci-inspect
ci: inspect sbom and provenance
2 parents b625868 + fae8018 commit b7feb76

File tree

1 file changed

+39
-19
lines changed

1 file changed

+39
-19
lines changed

.github/workflows/ci.yml

+39-19
Original file line numberDiff line numberDiff line change
@@ -598,12 +598,24 @@ jobs:
598598
strategy:
599599
fail-fast: false
600600
matrix:
601-
attrs:
602-
- ''
603-
- mode=max
604-
- builder-id=foo
605-
- false
606-
- true
601+
include:
602+
- target: image
603+
output: type=image,name=localhost:5000/name/app:latest,push=true
604+
attr: mode=max
605+
- target: image
606+
output: type=image,name=localhost:5000/name/app:latest,push=true
607+
attr: ''
608+
- target: binary
609+
output: /tmp/buildx-build
610+
attr: mode=max
611+
- target: binary
612+
output: /tmp/buildx-build
613+
attr: ''
614+
services:
615+
registry:
616+
image: registry:2
617+
ports:
618+
- 5000:5000
607619
steps:
608620
-
609621
name: Checkout
@@ -622,11 +634,24 @@ jobs:
622634
with:
623635
context: ./test/go
624636
file: ./test/go/Dockerfile
625-
target: binary
626-
outputs: type=oci,dest=/tmp/build.tar
627-
provenance: ${{ matrix.attrs }}
628-
cache-from: type=gha,scope=provenance
629-
cache-to: type=gha,scope=provenance,mode=max
637+
target: ${{ matrix.target }}
638+
outputs: ${{ matrix.output }}
639+
provenance: ${{ matrix.attr }}
640+
-
641+
name: Inspect Provenance
642+
if: matrix.target == 'image'
643+
run: |
644+
docker buildx imagetools inspect localhost:5000/name/app:latest --format '{{json .Provenance}}'
645+
-
646+
name: Check output folder
647+
if: matrix.target == 'binary'
648+
run: |
649+
tree /tmp/buildx-build
650+
-
651+
name: Print local Provenance
652+
if: matrix.target == 'binary'
653+
run: |
654+
cat /tmp/buildx-build/provenance.json | jq
630655
631656
sbom:
632657
runs-on: ubuntu-latest
@@ -667,22 +692,17 @@ jobs:
667692
cache-from: type=gha,scope=attests-${{ matrix.target }}
668693
cache-to: type=gha,scope=attests-${{ matrix.target }},mode=max
669694
-
670-
name: Inspect image
695+
name: Inspect SBOM
671696
if: matrix.target == 'image'
672697
run: |
673-
docker buildx imagetools inspect localhost:5000/name/app:latest --format '{{json .}}'
698+
docker buildx imagetools inspect localhost:5000/name/app:latest --format '{{json .SBOM}}'
674699
-
675700
name: Check output folder
676701
if: matrix.target == 'binary'
677702
run: |
678703
tree /tmp/buildx-build
679704
-
680-
name: Print provenance
681-
if: matrix.target == 'binary'
682-
run: |
683-
cat /tmp/buildx-build/provenance.json | jq
684-
-
685-
name: Print SBOM
705+
name: Print local SBOM
686706
if: matrix.target == 'binary'
687707
run: |
688708
cat /tmp/buildx-build/sbom.spdx.json | jq

0 commit comments

Comments
 (0)