mirror of
https://github.com/anchore/syft.git
synced 2026-10-31 22:46:36 +01:00
perf: keep only the image squash when scanning with the squashed scope
- stereoscope builds a squashed tree for every layer, each a full copy of the one below, so memory grows with layers x files. The squashed scope only ever reads the top one. - new `GetSourceConfig.WithImageSquashOnly(bool)` (and `sourceproviders.Config` field) reads images with stereoscope's `image.WithImageSquashOnly`, scoped to that one read - the CLI turns it on when `--scope squashed` (the default) - an image source read this way returns an error from `FileResolver` for `all-layers` and `deep-squashed` instead of panicking on the missing layer squashes Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
This commit is contained in:
@@ -239,7 +239,9 @@ func getSource(ctx context.Context, opts *options.Catalog, userInput string, sou
|
||||
}).
|
||||
WithBasePath(opts.Source.BasePath).
|
||||
WithSources(sources...).
|
||||
WithDefaultImagePullSource(opts.Source.Image.DefaultPullSource)
|
||||
WithDefaultImagePullSource(opts.Source.Image.DefaultPullSource).
|
||||
// only the squashed scope reads from the image squash alone, every other scope needs each layer's squash
|
||||
WithImageSquashOnly(source.ParseScope(opts.Scope) == source.SquashedScope)
|
||||
|
||||
var err error
|
||||
var platform *image.Platform
|
||||
|
||||
Reference in New Issue
Block a user