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

Move logic out of cmd/restorer #636

Open
jabrown85 opened this issue Jun 14, 2021 · 2 comments · May be fixed by #1338
Open

Move logic out of cmd/restorer #636

jabrown85 opened this issue Jun 14, 2021 · 2 comments · May be fixed by #1338

Comments

@jabrown85
Copy link
Contributor

Description

We would like to push as much validation and processing out of the cmd/restorer.go as possible. The cmds are hard to test and keep growing because there is already validation logic present.

Proposed solution

Instead of validating inside of cmd/restorer.go, we should put as much validation as possible into restorer.go. This probably means introducing and using interfaces that wrap file, registry/docker, cache stores, and env access. We should write unit tests to cover and possibly remove validation specific acceptance tests.

Additional context

  • We need to keep creator as well as library authors in mind here a bit. Having group, plan, err := restorer.Restore(cacheStore) makes sense for platforms building on top of lifecycle, like buildkit. So we may wish to introduce new methods that write the files that can optionally be executed by those platforms and always executed by cmd/restorer.go.
@natalieparellano
Copy link
Member

TODO: eventually layer.NewSBOMRestorer should become layer.NewDefaultSBOMRestorer, and then we can use the constructor in cmd/analyzer.go

@natalieparellano natalieparellano added the good first issue A good first issue to get started with. label May 25, 2022
@natalieparellano
Copy link
Member

See #805 (analyzer) and #860 (detector) for how this is done for other phases.

@natalieparellano natalieparellano removed the good first issue A good first issue to get started with. label Jan 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants