-
Notifications
You must be signed in to change notification settings - Fork 37
feat(crafter): support multiple tools in chainloop metadata #2481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Sylwester Piskozub <sylwesterpiskozub@gmail.com>
Signed-off-by: Sylwester Piskozub <sylwesterpiskozub@gmail.com>
Signed-off-by: Sylwester Piskozub <sylwesterpiskozub@gmail.com>
|
I am not a fan of keys with dynamic namespacing, it makes it very hard to consume, but @jiparis might have a different opinion. I'd rather to have smth like |
Signed-off-by: Sylwester Piskozub <sylwesterpiskozub@gmail.com>
| m.Annotations[AnnotationToolNameKey] = meta.Tools[0].Name | ||
| m.Annotations[AnnotationToolVersionKey] = meta.Tools[0].Version | ||
| // Extract all tools and set annotations | ||
| var tools []Tool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so even if we have one tool, it will use also the new annotation correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, example:
WRN API contacted in insecure mode
INF uploading sbom.cyclonedx-1.5.json - sha256:5ca3508f02893b0419b266927f66c7b9dd8b11dbea7faf7cdb9169df8f69d8e3
INF material added to attestation
┌─────────────┬─────────────────────────────────────────────────────────────────────────┐
│ Name │ skynet-sbom │
├─────────────┼─────────────────────────────────────────────────────────────────────────┤
│ Type │ SBOM_CYCLONEDX_JSON │
├─────────────┼─────────────────────────────────────────────────────────────────────────┤
│ Required │ No │
├─────────────┼─────────────────────────────────────────────────────────────────────────┤
│ Value │ sbom.cyclonedx-1.5.json │
├─────────────┼─────────────────────────────────────────────────────────────────────────┤
│ Digest │ sha256:5ca3508f02893b0419b266927f66c7b9dd8b11dbea7faf7cdb9169df8f69d8e3 │
├─────────────┼─────────────────────────────────────────────────────────────────────────┤
│ Annotations │ ------ │
├─────────────┼─────────────────────────────────────────────────────────────────────────┤
│ │ chainloop.material.tools: ["syft@0.101.1"] │
├─────────────┼─────────────────────────────────────────────────────────────────────────┤
│ │ chainloop.material.tool.name: syft │
├─────────────┼─────────────────────────────────────────────────────────────────────────┤
│ │ chainloop.material.tool.version: 0.101.1 │
└─────────────┴─────────────────────────────────────────────────────────────────────────┘
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we hide the deprecated method from the output?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated, hidden from att add and att status
# add
┌─────────────┬─────────────────────────────────────────────────────────────────────────┐
│ Name │ skynet-sbom │
├─────────────┼─────────────────────────────────────────────────────────────────────────┤
│ Type │ SBOM_CYCLONEDX_JSON │
├─────────────┼─────────────────────────────────────────────────────────────────────────┤
│ Required │ No │
├─────────────┼─────────────────────────────────────────────────────────────────────────┤
│ Value │ sbom.cyclonedx-1.5.json │
├─────────────┼─────────────────────────────────────────────────────────────────────────┤
│ Digest │ sha256:5ca3508f02893b0419b266927f66c7b9dd8b11dbea7faf7cdb9169df8f69d8e3 │
├─────────────┼─────────────────────────────────────────────────────────────────────────┤
│ Annotations │ ------ │
├─────────────┼─────────────────────────────────────────────────────────────────────────┤
│ │ chainloop.material.tools: ["syft@0.101.1"] │
└─────────────┴─────────────────────────────────────────────────────────────────────────┘
# status
┌───────────────────────────┬──────────────────────────────────────┐
│ Initialized At │ 27 Oct 25 13:42 UTC │
├───────────────────────────┼──────────────────────────────────────┤
│ Attestation ID │ a3d4ffcc-68f5-4d2e-b3b0-b96cf65922a4 │
│ Organization │ myorg │
│ Name │ policyatttest │
│ Project │ myproject │
│ Version │ v1.49.0 (prerelease) │
│ Contract │ contractinvpoll (revision 1) │
│ Policy violation strategy │ ADVISORY │
└───────────────────────────┴──────────────────────────────────────┘
┌──────────────────────────────────────────────────────────┐
│ Materials │
├─────────────┬────────────────────────────────────────────┤
│ Name │ skynet-sbom │
│ Type │ SBOM_CYCLONEDX_JSON │
│ Set │ Yes │
│ Required │ No │
│ Annotations │ ------ │
│ │ chainloop.material.tools: ["syft@0.101.1"] │
└─────────────┴────────────────────────────────────────────┘
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, let's check with @jiparis
| wantDigest: "sha256:fe2636fb6c698a29a315278b762b2000efd5959afe776ee4f79f1ed523365a33", | ||
| wantFilename: "sbom-spdx.json", | ||
| annotations: map[string]string{ | ||
| "chainloop.material.tool.name": "syft", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, this one, thanks
Signed-off-by: Sylwester Piskozub <sylwesterpiskozub@gmail.com>
This PR adds support for multiple tools extraction to metadata, while maintaining backwards compatibility.
Example