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: separate tagged image providers #219

Merged
merged 26 commits into from
Feb 21, 2024

Conversation

kzantow
Copy link
Contributor

@kzantow kzantow commented Feb 6, 2024

This PR makes the following top-level changes:

  • image.Provider interface has been reworked so providers have Name() method
  • image.Provider.Provide is required to return an image object fully populated (e.g. .Read() has been called)
  • A top-level stereoscope.ImageProviders function is added, allowing interested parties (e.g. syft) to get access to the individual tagged image providers
  • A top-level stereoscope.ImageProviderConfig is added which is the uber-configuration needed by all stereoscope-defined providers

Note: the top-level GetImage and GetImageFromSource remain unchanged with the caveat that the image.Source has changed from an int to a string. These functions will use the default set of image providers, so should continue to behave about the same as before, with the other caveat that if the user has a docker daemon and another supported daemon (containerd, podman), each daemon may be tried instead of stopping after attempting docker, which is the behavior today.

TODO:

  • should image.Provider have a Tags() []string method and ImageProviders(...) returns []image.Provider? (no, this is now []collections.TaggedValue[image.Provider])
  • fix existing tests
  • add more tests exercising the full functionality of each image provider
  • fully integrate with syft PR Refactor source creation and add --from flag syft#2610

tagged/tagged.go Outdated Show resolved Hide resolved
Signed-off-by: Keith Zantow <[email protected]>
Signed-off-by: Keith Zantow <[email protected]>
Signed-off-by: Keith Zantow <[email protected]>
providers.go Outdated Show resolved Hide resolved
Signed-off-by: Keith Zantow <[email protected]>
@wagoodman
Copy link
Contributor

should image.Platform be a parameter to the Provide function instead of configuration?

yeah, I think so

@wagoodman
Copy link
Contributor

naming: is Resolver better than Provider (or something else)?

I'm a fan of "provider" here, but will give it some thoughts

Signed-off-by: Keith Zantow <[email protected]>
tagged/tagged.go Outdated Show resolved Hide resolved
@kzantow kzantow marked this pull request as ready for review February 8, 2024 20:23
go.mod Outdated Show resolved Hide resolved
client.go Outdated Show resolved Hide resolved
.golangci.yaml Show resolved Hide resolved
tagged/tagged.go Outdated Show resolved Hide resolved
client.go Outdated Show resolved Hide resolved
pkg/image/image.go Outdated Show resolved Hide resolved
@kzantow kzantow merged commit cf0e754 into anchore:main Feb 21, 2024
7 checks passed
@kzantow kzantow deleted the feat/tagged-image-providers branch February 21, 2024 14:49
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