lifecycle icon indicating copy to clipboard operation
lifecycle copied to clipboard

Move logic out of cmd/exporter

Open jabrown85 opened this issue 4 years ago • 1 comments

Description

We would like to push as much validation and processing out of the cmd/exporter.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/exporter.go, we should put as much validation as possible into exporter.go. This probably means introducing and using interfaces that wrap file, image, 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 report, err := exporter.Export(opts) 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/exporter.go.

jabrown85 avatar Jun 14 '21 19:06 jabrown85

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

natalieparellano avatar May 25 '22 15:05 natalieparellano