Skip to content

Commit

Permalink
duffle export should no longer store images in tar files
Browse files Browse the repository at this point in the history
Thus the --oci-layout flag is no longer needed.

Also improve the wording of the help text.

Ref cnabio#767
  • Loading branch information
glyn committed Jun 13, 2019
1 parent cd78023 commit 9e38ca0
Showing 1 changed file with 10 additions and 26 deletions.
36 changes: 10 additions & 26 deletions cmd/duffle/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import (
"fmt"
"io"

"github.com/pkg/errors"

"github.com/deislabs/duffle/pkg/duffle/home"
"github.com/deislabs/duffle/pkg/loader"
"github.com/deislabs/duffle/pkg/packager"
Expand All @@ -14,28 +12,19 @@ import (
)

const exportDesc = `
Packages a bundle, and by default any images referenced by the bundle, within
a single gzipped tarfile.
If neither --oci-layout nor --thin is specified, all images (incuding invocation
images) referenced by the bundle metadata are saved as tar files in the
artifacts/ directory along with an artifacts.json file which describes the
contents of the artifacts/ directory.
Packages a bundle, and by default any images referenced by the bundle, within a single gzipped tarfile.
If --oci-layout is specified, all images (incuding invocation images) referenced
by the bundle metadata are saved as an OCI image layout in the artifacts/layout/
directory.
Unless --thin is specified, a thick bundle is exported. A thick bundle contains the bundle manifest and all images
(including invocation images) referenced by the bundle metadata. Images are saved as an OCI image layout in the
artifacts/layout/ directory.
If --thin specified, only the bundle manifest is exported.
By default, this command will use the name and version information of
the bundle to create a compressed archive file called
<name>-<version>.tgz in the current directory. This destination can be
updated by specifying a file path to save the compressed bundle to using
the --output-file flag.
By default, this command will use the name and version information of the bundle to create a compressed archive file
called <name>-<version>.tgz in the current directory. This destination can be updated by specifying a file path to save
the compressed bundle to using the --output-file flag.
Pass in a path to a bundle file instead of a bundle in local storage by
using the --bundle-is-file flag like below:
A path to a bundle file may be passed in instead of a bundle in local storage by using the --bundle-is-file flag, thus:
$ duffle export [PATH] --bundle-is-file
`

Expand All @@ -47,7 +36,6 @@ type exportCmd struct {
thin bool
verbose bool
bundleIsFile bool
ociLayout bool
}

func newExportCmd(w io.Writer) *cobra.Command {
Expand All @@ -61,18 +49,14 @@ func newExportCmd(w io.Writer) *cobra.Command {
RunE: func(cmd *cobra.Command, args []string) error {
export.home = home.Home(homePath())
export.bundle = args[0]
if export.thin && export.ociLayout {
return errors.New("--thin and --oci-layout must not both be specified")
}

return export.run()
},
}

f := cmd.Flags()
f.StringVarP(&export.dest, "output-file", "o", "", "Save exported bundle to file path")
f.BoolVarP(&export.bundleIsFile, "bundle-is-file", "f", false, "Indicates that the bundle source is a file path")
f.BoolVarP(&export.ociLayout, "oci-layout", "l", false, "Export images as an OCI image layout")
f.BoolVarP(&export.bundleIsFile, "bundle-is-file", "f", false, "Interpret the bundle source as a file path")
f.BoolVarP(&export.thin, "thin", "t", false, "Export only the bundle manifest")
f.BoolVarP(&export.verbose, "verbose", "v", false, "Verbose output")

Expand All @@ -92,7 +76,7 @@ func (ex *exportCmd) run() error {
}

func (ex *exportCmd) Export(bundlefile string, l loader.BundleLoader) error {
is, err := packager.NewImageStore(ex.thin, ex.ociLayout)
is, err := packager.NewImageStore(ex.thin, true)
if err != nil {
return err
}
Expand Down

0 comments on commit 9e38ca0

Please sign in to comment.