-
Notifications
You must be signed in to change notification settings - Fork 294
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
New flatten buildpacks/builder implementation - Part 2 - Implementing RFC-0123 #1985
New flatten buildpacks/builder implementation - Part 2 - Implementing RFC-0123 #1985
Conversation
During builder creation, end-users can provide the flag `--flatten` with the buildpacks they want to put in one layer. Signed-off-by: Juan Bustamante <jbustamante@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.
@jjbustamante apologies for being so slow to review this one. In general it looks good to me - I made some suggestions to potentially help readability but otherwise it looks like it does what it's supposed to do. It might make sense to add an acceptance test if we don't have one already.
type ModuleInfos interface { | ||
BuildModule() []dist.ModuleInfo | ||
} | ||
|
||
type FlattenModuleInfos interface { | ||
FlattenModules() []ModuleInfos | ||
} |
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.
Is there any way to combine these two interfaces? Is there a reason for them to be different?
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.
It is actually a way of having a two dimensional array.
FlattenModules() -> return an array of ModuleInfos where each element is an array of dist.ModuleInfo
Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
Signed-off-by: Juan Bustamante <juan.bustamante@broadcom.com>
Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #1985 +/- ##
==========================================
+ Coverage 79.49% 79.63% +0.15%
==========================================
Files 175 176 +1
Lines 13135 13199 +64
==========================================
+ Hits 10440 10510 +70
+ Misses 2026 2020 -6
Partials 669 669
Flags with carried forward coverage won't be shown. Click here to find out more. |
@@ -166,17 +163,9 @@ func constructBuilder(img imgutil.Image, newName string, errOnMissingLabel bool, | |||
return bldr, nil | |||
} | |||
|
|||
func FlattenAll() BuilderOption { |
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.
FlattenAll
came from my first pull request (see Part 1)- Because the RFC is changing the
pack builder create
interface, now the end-user must define which buildpacks must be flatten together, that's why I found more readable to useWithFlatten
as name to the option method
} | ||
return &buildpack.ManagedCollection{} | ||
return nil |
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 think I should return an managedCollectionV1 instance here.
Publish bool | ||
BuilderTomlPath string | ||
Registry string | ||
Policy string | ||
FlattenExclude []string |
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.
The --flaten-exclude
flag is being removed according to the RFC
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.
Nice work @jjbustamante. I left a few more nits - I think it could be helpful to add some more tests, but overall this is looking good.
Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
@natalieparellano .. if you can take one more look will be awesome |
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.
Looks good to me :)
Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
Summary
This PR implements RFC-0123.
The main idea can be summarize with the following class diagram:
Our first attempt to implement the flatten feature added a ManagedCollection structure, I extracted the methods to a new interface.
managedCollection
is a base implementation with all the common code for each implementation. The idea was to keep our initial implementation on managedCollectionV1 and implement the new behavior withmanagedCollectionV2
.According to the RFC, the user is responsible of defining which buildpacks they want to flatten. In order to represent this we added the
FlattenModuleInfos
interface. It is a two dimensional array with the group of modules we want to put together.managedCollectionV2
usesFlattenModuleInfos
to determine how to flatten the modules when they are added.Output
Before
After
Documentation
Related
Resolves #1880