mirror of
https://github.com/ko-build/ko.git
synced 2025-07-12 23:50:31 +02:00
Add additional output formats (tarball and layout) (#134)
* Create a MultiPublisher MultiPublisher mimics io.MultiWriter in that it will publish an image to multiple publish.Interface implementations. * Add publish.{Tarball,Layout}Publisher This adds support for publishing in the tarball format and to an OCI image layout. The tarball format isn't great, yet. It only supports writing once instead of appending. * Consolidate options These were spread all over the place for no reasons. Now all the publisher related options are grouped together. * Add options for tarball/layout Adds --oci-layout-path, --tarball, and --push flags. --push=false will disable the default behavior of publishing to a registry. * go mod vendor * Add Close method to publish.Interface This allows us to defer writing to the tarball until we've collected all the images that have been published. * Fix tests
This commit is contained in:
@ -24,10 +24,8 @@ import (
|
||||
|
||||
// addResolve augments our CLI surface with resolve.
|
||||
func addResolve(topLevel *cobra.Command) {
|
||||
lo := &options.LocalOptions{}
|
||||
no := &options.NameOptions{}
|
||||
po := &options.PublishOptions{}
|
||||
fo := &options.FilenameOptions{}
|
||||
ta := &options.TagsOptions{}
|
||||
so := &options.SelectorOptions{}
|
||||
sto := &options.StrictOptions{}
|
||||
bo := &options.BuildOptions{}
|
||||
@ -62,20 +60,19 @@ func addResolve(topLevel *cobra.Command) {
|
||||
if err != nil {
|
||||
log.Fatalf("error creating builder: %v", err)
|
||||
}
|
||||
publisher, err := makePublisher(no, lo, ta)
|
||||
publisher, err := makePublisher(po)
|
||||
if err != nil {
|
||||
log.Fatalf("error creating publisher: %v", err)
|
||||
}
|
||||
defer publisher.Close()
|
||||
ctx := createCancellableContext()
|
||||
if err := resolveFilesToWriter(ctx, builder, publisher, fo, so, sto, os.Stdout); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
},
|
||||
}
|
||||
options.AddLocalArg(resolve, lo)
|
||||
options.AddNamingArgs(resolve, no)
|
||||
options.AddPublishArg(resolve, po)
|
||||
options.AddFileArg(resolve, fo)
|
||||
options.AddTagsArg(resolve, ta)
|
||||
options.AddSelectorArg(resolve, so)
|
||||
options.AddStrictArg(resolve, sto)
|
||||
options.AddBuildOptions(resolve, bo)
|
||||
|
Reference in New Issue
Block a user