@@ -45,7 +45,18 @@ docker-publish:
45
45
fi ; \
46
46
# This generates a signature and publishes it to the registry, next to the image\
47
47
# Uses the keyless signing flow with Github Actions as identity provider\
48
- cosign sign -y " ${DOCKER_REPO} /${ORGANIZATION} /${OPERATOR_NAME} @$$ REPO_DIGEST_OF_IMAGE"
48
+ cosign sign -y " ${DOCKER_REPO} /${ORGANIZATION} /${OPERATOR_NAME} @$$ REPO_DIGEST_OF_IMAGE" ; \
49
+ # Generate the SBOM for the operator image, this leverages the already generated SBOM for the operator binary by cargo-cyclonedx\
50
+ syft scan --output cyclonedx-json=sbom.json --select-catalogers " -cargo-auditable-binary-cataloger" --scope all-layers --source-name " ${OPERATOR_NAME} " --source-version " ${VERSION} " " ${DOCKER_REPO} /${ORGANIZATION} /${OPERATOR_NAME} @$$ REPO_DIGEST_OF_IMAGE" ; \
51
+ # Determine the PURL for the container image\
52
+ PURL=" pkg:docker/${ORGANIZATION} /${OPERATOR_NAME} @$$ REPO_DIGEST_OF_IMAGE?repository_url=${DOCKER_REPO} " ; \
53
+ # Get metadata from the image\
54
+ IMAGE_DESCRIPTION=$$(docker inspect --format='{{.Config.Labels.description}}' "${DOCKER_REPO}/${ORGANIZATION}/${OPERATOR_NAME}:${VERSION}" ) ; \
55
+ IMAGE_NAME=$$(docker inspect --format='{{.Config.Labels.name}}' "${DOCKER_REPO}/${ORGANIZATION}/${OPERATOR_NAME}:${VERSION}" ) ; \
56
+ # Merge the SBOM with the metadata for the operator\
57
+ jq -s ' {"metadata":{"component":{"description":"' " $$ IMAGE_NAME. $$ IMAGE_DESCRIPTION" ' ","supplier":{"name":"Stackable GmbH","url":["https://stackable.tech/"]},"author":"Stackable GmbH","purl":"' " $$ PURL" ' ","publisher":"Stackable GmbH"}}} * .[0]' sbom.json > sbom.merged.json; \
58
+ # Attest the SBOM to the image\
59
+ cosign attest -y --predicate sbom.merged.json --type cyclonedx " ${DOCKER_REPO} /${ORGANIZATION} /${OPERATOR_NAME} @$$ REPO_DIGEST_OF_IMAGE"
49
60
50
61
# Push to Harbor
51
62
# We need to use "value" here to prevent the variable from being recursively expanded by make (username contains a dollar sign, since it's a Harbor bot)
@@ -137,7 +148,7 @@ regenerate-nix:
137
148
138
149
build : regenerate-charts regenerate-nix helm-package docker-build
139
150
140
- publish : build docker-publish helm-publish
151
+ publish : docker-publish helm-publish
141
152
142
153
run-dev :
143
154
kubectl apply -f deploy/stackable-operators-ns.yaml
0 commit comments