Skip to content

Commit f15d9c6

Browse files
Add SBOM and sign image
Sign the image with cosign. Add Software Bill of Materials with trivy as signed cosign attestations. This informatin is needed for securing the supply chain. You can verify the image with cosign. You can get the SBOM from the attestations and then use trivy to check for vulnerabilities. Signed-off-by: Jordi Massaguer Pla <jmassaguerpla@suse.com>
1 parent 2da3adb commit f15d9c6

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

.github/workflows/build_and_push_models.yml

+16
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,22 @@ jobs:
108108
run: docker tag $DOCKER_IMAGE_NAME_SHORT:$DOCKER_IMAGE_TAG $REGISTRY/$IMAGE_NAME/$DOCKER_IMAGE_NAME_SHORT:$DOCKER_IMAGE_TAG
109109
- name: Push Docker image
110110
run: docker push $REGISTRY/$IMAGE_NAME/$DOCKER_IMAGE_NAME_SHORT:$DOCKER_IMAGE_TAG
111+
- name: Build SBOM
112+
uses: aquasecurity/trivy-action@0.14.0
113+
with:
114+
image-ref: $REGISTRY/$IMAGE_NAME/$DOCKER_IMAGE_NAME_SHORT:$DOCKER_IMAGE_TAG
115+
format: 'spdx-json'
116+
output: 'sbom.spdx.json'
117+
- name: Install sigstore cosign
118+
uses: sigstore/cosign-installer@main
119+
- name: Write signing key to disk (only needed for `cosign sign --key`)
120+
run: echo "${{ secrets.SIGNING_SECRET }}" > cosign.key
121+
- name: Sign image
122+
run: cosign sign --key cosign.key $REGISTRY/$IMAGE_NAME/$DOCKER_IMAGE_NAME_SHORT:$DOCKER_IMAGE_TAG
123+
env:
124+
COSING_PASSWORD: ""
125+
- name: Sign attestations
126+
run: cosign attest --key cosign.key --type spdx --predicate sbom.spdx.json $REGISTRY/$IMAGE_NAME/$DOCKER_IMAGE_NAME_SHORT:$DOCKER_IMAGE_TAG
111127
- name: Terraform Destroy
112128
if: ${{ always() }}
113129
run: terraform destroy -auto-approve

0 commit comments

Comments
 (0)