diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-05-29 10:37:59 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-29 10:37:59 -0400 |
commit | 0c750a9672d8078c655fb95f379600609b36dad4 (patch) | |
tree | 8ca8f81cdf302b1905d7a56f7c5c76ba5468c6f1 /pkg/domain/infra/abi/manifest.go | |
parent | 78c38460eb8ba9190d414f2da6a1414990cc6cfd (diff) | |
parent | dc80267b594e41cf7e223821dc1446683f0cae36 (diff) | |
download | podman-0c750a9672d8078c655fb95f379600609b36dad4.tar.gz podman-0c750a9672d8078c655fb95f379600609b36dad4.tar.bz2 podman-0c750a9672d8078c655fb95f379600609b36dad4.zip |
Merge pull request #6207 from vrothberg/auth-header
add X-Registry-Auth header support
Diffstat (limited to 'pkg/domain/infra/abi/manifest.go')
-rw-r--r-- | pkg/domain/infra/abi/manifest.go | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/pkg/domain/infra/abi/manifest.go b/pkg/domain/infra/abi/manifest.go index fca34dda2..6e311dec7 100644 --- a/pkg/domain/infra/abi/manifest.go +++ b/pkg/domain/infra/abi/manifest.go @@ -16,6 +16,7 @@ import ( "github.com/containers/image/v5/docker" "github.com/containers/image/v5/manifest" "github.com/containers/image/v5/transports/alltransports" + "github.com/containers/image/v5/types" libpodImage "github.com/containers/libpod/libpod/image" "github.com/containers/libpod/pkg/domain/entities" "github.com/containers/libpod/pkg/util" @@ -179,12 +180,28 @@ func (ir *ImageEngine) ManifestPush(ctx context.Context, names []string, opts en case "v2s2", "docker": manifestType = manifest.DockerV2Schema2MediaType default: - return errors.Errorf("unknown format %q. Choose on of the supported formats: 'oci' or 'v2s2'", opts.Format) + return errors.Errorf("unknown format %q. Choose one of the supported formats: 'oci' or 'v2s2'", opts.Format) } } + + // Set the system context. + sys := ir.Libpod.SystemContext() + if sys != nil { + sys = &types.SystemContext{} + } + sys.AuthFilePath = opts.Authfile + sys.DockerInsecureSkipTLSVerify = opts.SkipTLSVerify + + if opts.Username != "" && opts.Password != "" { + sys.DockerAuthConfig = &types.DockerAuthConfig{ + Username: opts.Username, + Password: opts.Password, + } + } + options := manifests.PushOptions{ Store: ir.Libpod.GetStore(), - SystemContext: ir.Libpod.SystemContext(), + SystemContext: sys, ImageListSelection: cp.CopySpecificImages, Instances: nil, RemoveSignatures: opts.RemoveSignatures, |