buildpacks / lifecycle

Reference implementation of the Cloud Native Buildpacks lifecycle
https://buildpacks.io
Apache License 2.0
185 stars 104 forks source link

Move logic out of cmd/builder #637

Open jabrown85 opened 3 years ago

jabrown85 commented 3 years ago

Description

We would like to push as much validation and processing out of the cmd/builder.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/builder.go, we should put as much validation as possible into builder.go. This probably means introducing and using interfaces that wrap file, and env access. We should write unit tests to cover and possibly remove validation specific acceptance tests. cmd/builder.go is probably the smallest compared to other phases but still has a bit of validation up front and error handling.

Additional context

natalieparellano commented 2 years ago

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

pbusko commented 4 weeks ago

is there anything specific you would like to move out from the cmd/lifecycle/builder.go? It already looks rather minimal tbh

natalieparellano commented 3 weeks ago

The restorer and the exporter are the real culprits here. It's likely we could add some units around builder instantiation.