1
0
mirror of https://github.com/ko-build/ko.git synced 2025-07-15 23:54:17 +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:
jonjohnsonjr
2020-02-19 09:30:01 -08:00
committed by GitHub
parent cfd680de28
commit 3c6a907da9
29 changed files with 1197 additions and 98 deletions

View File

@ -30,10 +30,8 @@ import (
// addCreate augments our CLI surface with apply.
func addCreate(topLevel *cobra.Command) {
koCreateFlags := []string{}
lo := &options.LocalOptions{}
no := &options.NameOptions{}
po := &options.PublishOptions{}
fo := &options.FilenameOptions{}
ta := &options.TagsOptions{}
so := &options.SelectorOptions{}
sto := &options.StrictOptions{}
bo := &options.BuildOptions{}
@ -75,10 +73,11 @@ func addCreate(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()
// Create a set of ko-specific flags to ignore when passing through
// kubectl global flags.
ignoreSet := make(map[string]struct{})
@ -145,10 +144,8 @@ func addCreate(topLevel *cobra.Command) {
}
},
}
options.AddLocalArg(create, lo)
options.AddNamingArgs(create, no)
options.AddPublishArg(create, po)
options.AddFileArg(create, fo)
options.AddTagsArg(create, ta)
options.AddSelectorArg(create, so)
options.AddStrictArg(create, sto)
options.AddBuildOptions(create, bo)