summaryrefslogtreecommitdiff
path: root/libpod/runtime_img.go
diff options
context:
space:
mode:
authorumohnani8 <umohnani@redhat.com>2017-12-12 13:33:10 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2017-12-14 18:37:17 +0000
commit1e7d880b561318aa2ad89d7583addad1904e5a36 (patch)
tree7773e3d409c410ae9bb3a210e106dddc28e302b5 /libpod/runtime_img.go
parentbf0d35904752c2ac5c607c4a82237f074c862744 (diff)
downloadpodman-1e7d880b561318aa2ad89d7583addad1904e5a36.tar.gz
podman-1e7d880b561318aa2ad89d7583addad1904e5a36.tar.bz2
podman-1e7d880b561318aa2ad89d7583addad1904e5a36.zip
Add manifest type conversion to kpod push
User can select from 3 manifest types: oci, v2s1, or v2s2 e.g kpod push --format v2s2 alpine dir:my-directory Added "compress" flag to enable compression when true Signed-off-by: umohnani8 <umohnani@redhat.com> Closes: #126 Approved by: rhatdan
Diffstat (limited to 'libpod/runtime_img.go')
-rw-r--r--libpod/runtime_img.go16
1 files changed, 10 insertions, 6 deletions
diff --git a/libpod/runtime_img.go b/libpod/runtime_img.go
index d5da35c42..6107c2fdb 100644
--- a/libpod/runtime_img.go
+++ b/libpod/runtime_img.go
@@ -78,6 +78,10 @@ type CopyOptions struct {
Reference string
// ImageConfig is the Image spec for the image created when a tar archive is imported
ImageConfig ociv1.Image
+ // ManifestMIMEType is the manifest type of the image when saving to a directory
+ ManifestMIMEType string
+ // ForceCompress compresses the image layers when saving to a directory using the dir transport if true
+ ForceCompress bool
}
// Image API
@@ -643,7 +647,7 @@ func (r *Runtime) PullImage(imgName string, options CopyOptions) (string, error)
signaturePolicyPath = options.SignaturePolicyPath
}
- sc := common.GetSystemContext(signaturePolicyPath, options.AuthFile)
+ sc := common.GetSystemContext(signaturePolicyPath, options.AuthFile, false)
srcRef, err := alltransports.ParseImageName(imgName)
if err != nil {
@@ -664,7 +668,7 @@ func (r *Runtime) PullImage(imgName string, options CopyOptions) (string, error)
}
defer policyContext.Destroy()
- copyOptions := common.GetCopyOptions(options.Writer, signaturePolicyPath, &options.DockerRegistryOptions, nil, options.SigningOptions, options.AuthFile)
+ copyOptions := common.GetCopyOptions(options.Writer, signaturePolicyPath, &options.DockerRegistryOptions, nil, options.SigningOptions, options.AuthFile, "", false)
for _, imageInfo := range pullStructs {
// Print the following statement only when pulling from a docker or atomic registry
@@ -721,7 +725,7 @@ func (r *Runtime) PushImage(source string, destination string, options CopyOptio
signaturePolicyPath = options.SignaturePolicyPath
}
- sc := common.GetSystemContext(signaturePolicyPath, options.AuthFile)
+ sc := common.GetSystemContext(signaturePolicyPath, options.AuthFile, options.ForceCompress)
policyContext, err := getPolicyContext(sc)
if err != nil {
@@ -735,7 +739,7 @@ func (r *Runtime) PushImage(source string, destination string, options CopyOptio
return errors.Wrapf(err, "error getting source imageReference for %q", source)
}
- copyOptions := common.GetCopyOptions(options.Writer, signaturePolicyPath, nil, &options.DockerRegistryOptions, options.SigningOptions, options.AuthFile)
+ copyOptions := common.GetCopyOptions(options.Writer, signaturePolicyPath, nil, &options.DockerRegistryOptions, options.SigningOptions, options.AuthFile, options.ManifestMIMEType, options.ForceCompress)
// Copy the image to the remote destination
err = cp.Image(policyContext, dest, src, copyOptions)
@@ -1004,7 +1008,7 @@ func (r *Runtime) ImportImage(path string, options CopyOptions) error {
}
var reference = options.Reference
- sc := common.GetSystemContext("", "")
+ sc := common.GetSystemContext("", "", false)
// if reference not given, get the image digest
if reference == "" {
@@ -1020,7 +1024,7 @@ func (r *Runtime) ImportImage(path string, options CopyOptions) error {
}
defer policyContext.Destroy()
- copyOptions := common.GetCopyOptions(os.Stdout, "", nil, nil, common.SigningOptions{}, "")
+ copyOptions := common.GetCopyOptions(os.Stdout, "", nil, nil, common.SigningOptions{}, "", "", false)
dest, err := is.Transport.ParseStoreReference(r.store, reference)
if err != nil {