Consider making JibContainerBuilder interface more fluent.
See original GitHub issueContinuing from #881…
Considering that we are modeling JibContainerBuilder
’s interface off of the Stream
API, and that JibContainerBuilder
begins with Jib.from
, we should probably make the rest of the API more fluent as well.
addLayer(List<Path>, String)
-> layer(List<Path>, String)
addLayer(LayerConfiguration)
-> layer(LayerConfiguration)
setLayers(List<LayerConfiguration>)
-> layer(List<LayerConfiguration>)
setEntrypoint(List<String>/String...)
-> entrypoint(List<String>/String...)
setProgramArguments(List<String>/String...)
-> programArguments(List<String>/String...)
setEnvironment(Map<String, String>)
-> environment(Map<String, String>)
setEnvironmentVariable(String, String)
-> environmentVariable(String, String)
setExposedPorts(List<Port>/Port...)
-> expose(List<Port>/Port...)
addExposedPort(Port)
-> expose(Port)
setLabels(Map<String, String>)
-> label(Map<String, String>)
addLabel(String, String)
-> label(String, String)
Also, currently, the collection setters (like setExposedPorts
) replace previously-set ports. If converting to use this more fluent API, these collection setters should append, not replace. We could add methods like exposeOnly(Map)
that behaves like the original setters.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (6 by maintainers)
Top GitHub Comments
We could provide
exposeOnly(Map<>)
variants that take aMap
?Closing and sticking with current design since it is clearer in the functions’ intentions, especially for methods like
addExposedPort
vssetExposedPort
(expose
vsexposeOnly
is less clear and still involves extraOnly
portion).