-
Notifications
You must be signed in to change notification settings - Fork 107
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/lifecycle/analyzer.go #805
Conversation
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't do a full review of every line or anything, but I 👍 the direction.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
@jabrown85 I think this is ready for another review. My only question at this point - what should be the home of |
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
8f4a22b
to
fe83502
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks pretty good to me! It is a lot of changes. The tests are happy and I think it reads and feels better.
As far as the final package location goes, I think I like github.com/buildpacks/lifecycle/platform
and github.com/buildpacks/lifecycle/platform/launch
for the launcher specific deps. I think the naming is good for the one we use most of time and having a specific /launch
package for the launch-specific things feels good. I am also happy to discuss alternatives on naming
@jabrown85 I took a look at this today... the problem with putting everything that's currently in
It also feels weird putting things like What about Edit: I copy/pasted wrong before... fixed it ^^ |
Would If not, I'm also ok with |
LayersDir: opts.LayersDir, | ||
Logger: opts.Logger, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These could maybe be made private
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah - I made them public so they could be tested here:
Lines 104 to 105 in 8b9e787
h.AssertEq(t, sbomRestorer.LayersDir, "some-layers-dir") | |
h.AssertEq(t, sbomRestorer.Logger, logger) |
Signed-off-by: Natalie Arellano <narellano@vmware.com>
8b9e787
to
c828d03
Compare
Signed-off-by: Natalie Arellano <narellano@vmware.com>
With some small changes to avoid an import cycle, we can make a meaningful platform package Signed-off-by: Natalie Arellano <narellano@vmware.com>
Eventually only the platform package should switch on platform api Signed-off-by: Natalie Arellano <narellano@vmware.com>
Having the analyzer factory take a list of args will ensure we don't forget to update the creator when things change. Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
RestoresLayerMetadata bool | ||
} | ||
|
||
func (f *AnalyzerFactory) NewAnalyzer( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the past, adding new inputs to the analyzer/restorer/etc. was a source of bugs because we would forget to update the creator. Accepting the inputs as a list, while ugly, can avoid this problem.
return &DefaultConfigHandler{} | ||
} | ||
|
||
func (h *DefaultConfigHandler) ReadGroup(path string) ([]buildpack.GroupBuildpack, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted this to be in the lifecycle package, but its dependence on verifyBuildpackApis
(and needing to return the correct error code) made things a bit complicated.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
func (p *Platform) API() *api.Version { | ||
return p.api | ||
} | ||
|
||
// InputsResolver resolves inputs for each of the lifecycle phases. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hopefully, eventually! (for now just analyze...)
@@ -0,0 +1,56 @@ | |||
package platform |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These functions should eventually go somewhere else... but I think their new homes will be created when we do additional cleanup as part of buildpacks/rfcs#217
The lifecycle shouldn't have to depend on the cache package, just the interface Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Chatted with @natalieparellano - looks good!
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Resolves #635. By moving logic out of
main
, we can simplify our acceptance tests. It should also make the logic easier to follow (especially with respect to platform api branching).This still needs a few unit tests (marked withTODO
) but I am marking it ready so as to receive feedback on the general direction.If we like this, I will follow up with another PR to remove a bunch of tests from acceptance/analyzer_test.go.
I am hoping we could use this as a "template" for updating the other phases.