Skip to content
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

feat(image): save layers metadata into report #8394

Open
wants to merge 33 commits into
base: main
Choose a base branch
from

Conversation

DmitriyLewen
Copy link
Contributor

@DmitriyLewen DmitriyLewen commented Feb 13, 2025

Description

We added --max-image-size flag.
But we decided to go further and provide users with information about the image layers.

Changes:

  • add artifactVersion and use it to calculate cache key.
  • add layersMetadata for BlobInfo and Report.Metadata:
    • size of uncompressed layer
    • diffID
    • Digest
    • CreatedBy (for BlobInfo only)
    • OpaqueDirs (for BlobInfo only)
    • WhiteoutFiles (for BlobInfo only)
  • mark fields from p. 2 as deprecated

Related PRs

Checklist

  • I've read the guidelines for contributing to this repository.
  • I've followed the conventions in the PR title.
  • I've added tests that prove my fix is effective or that my feature works.
  • I've updated the documentation with the relevant information (if needed).
  • I've added usage information (if the PR introduces new options)
  • I've included a "before" and "after" example to the description (if the PR is a user interface change).

@DmitriyLewen DmitriyLewen changed the title feat(image): Save layers metadata into report feat(image): save layers metadata into report Feb 17, 2025
@@ -140,7 +141,7 @@ type Scanner struct {
// Driver defines operations of scanner
type Driver interface {
Scan(ctx context.Context, target, artifactKey string, blobKeys []string, options types.ScanOptions) (
results types.Results, osFound ftypes.OS, err error)
results types.Results, osFound ftypes.OS, layersMetadata ftypes.LayersMetadata, err error)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if returning a new struct like ScanReponse or types.Report? IIUC, it will not break compatibility unless we change the protobuf interfaces.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added scanResponse - 945ddc3

RepoTags []string `json:",omitempty"`
RepoDigests []string `json:",omitempty"`
ImageConfig v1.ConfigFile `json:",omitempty"`
LayersMetadata ftypes.LayersMetadata `json:",omitempty"`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It belongs to Metadata. Layers is descriptive enough for me.

Suggested change
LayersMetadata ftypes.LayersMetadata `json:",omitempty"`
Layers ftypes.LayersMetadata `json:",omitempty"`

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated in fb65b08

@DmitriyLewen DmitriyLewen marked this pull request as ready for review February 18, 2025 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants