diff options
author | umohnani8 <umohnani@redhat.com> | 2017-12-12 13:33:10 -0500 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2017-12-14 18:37:17 +0000 |
commit | 1e7d880b561318aa2ad89d7583addad1904e5a36 (patch) | |
tree | 7773e3d409c410ae9bb3a210e106dddc28e302b5 /libpod/common/common.go | |
parent | bf0d35904752c2ac5c607c4a82237f074c862744 (diff) | |
download | podman-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/common/common.go')
-rw-r--r-- | libpod/common/common.go | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/libpod/common/common.go b/libpod/common/common.go index 8a7fbcd5e..6af3cd232 100644 --- a/libpod/common/common.go +++ b/libpod/common/common.go @@ -16,31 +16,33 @@ var ( ) // GetCopyOptions constructs a new containers/image/copy.Options{} struct from the given parameters -func GetCopyOptions(reportWriter io.Writer, signaturePolicyPath string, srcDockerRegistry, destDockerRegistry *DockerRegistryOptions, signing SigningOptions, authFile string) *cp.Options { +func GetCopyOptions(reportWriter io.Writer, signaturePolicyPath string, srcDockerRegistry, destDockerRegistry *DockerRegistryOptions, signing SigningOptions, authFile, manifestType string, forceCompress bool) *cp.Options { if srcDockerRegistry == nil { srcDockerRegistry = &DockerRegistryOptions{} } if destDockerRegistry == nil { destDockerRegistry = &DockerRegistryOptions{} } - srcContext := srcDockerRegistry.GetSystemContext(signaturePolicyPath, authFile) - destContext := destDockerRegistry.GetSystemContext(signaturePolicyPath, authFile) + srcContext := srcDockerRegistry.GetSystemContext(signaturePolicyPath, authFile, forceCompress) + destContext := destDockerRegistry.GetSystemContext(signaturePolicyPath, authFile, forceCompress) return &cp.Options{ - RemoveSignatures: signing.RemoveSignatures, - SignBy: signing.SignBy, - ReportWriter: reportWriter, - SourceCtx: srcContext, - DestinationCtx: destContext, + RemoveSignatures: signing.RemoveSignatures, + SignBy: signing.SignBy, + ReportWriter: reportWriter, + SourceCtx: srcContext, + DestinationCtx: destContext, + ForceManifestMIMEType: manifestType, } } // GetSystemContext Constructs a new containers/image/types.SystemContext{} struct from the given signaturePolicy path -func GetSystemContext(signaturePolicyPath, authFilePath string) *types.SystemContext { +func GetSystemContext(signaturePolicyPath, authFilePath string, forceCompress bool) *types.SystemContext { sc := &types.SystemContext{} if signaturePolicyPath != "" { sc.SignaturePolicyPath = signaturePolicyPath } sc.AuthFilePath = authFilePath + sc.DirForceCompress = forceCompress return sc } |