Merge pull request #46384 from rumpl/push-print-digest
c8d: Print the tag, digest and size after push
This commit is contained in:
commit
2243046bf8
1 changed files with 13 additions and 5 deletions
|
@ -18,6 +18,7 @@ import (
|
||||||
"github.com/docker/distribution/reference"
|
"github.com/docker/distribution/reference"
|
||||||
"github.com/docker/docker/api/types/registry"
|
"github.com/docker/docker/api/types/registry"
|
||||||
"github.com/docker/docker/errdefs"
|
"github.com/docker/docker/errdefs"
|
||||||
|
"github.com/docker/docker/pkg/progress"
|
||||||
"github.com/docker/docker/pkg/streamformatter"
|
"github.com/docker/docker/pkg/streamformatter"
|
||||||
"github.com/opencontainers/go-digest"
|
"github.com/opencontainers/go-digest"
|
||||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
|
@ -34,7 +35,7 @@ import (
|
||||||
// pointing to the new target repository. This will allow subsequent pushes
|
// pointing to the new target repository. This will allow subsequent pushes
|
||||||
// to perform cross-repo mounts of the shared content when pushing to a different
|
// to perform cross-repo mounts of the shared content when pushing to a different
|
||||||
// repository on the same registry.
|
// repository on the same registry.
|
||||||
func (i *ImageService) PushImage(ctx context.Context, targetRef reference.Named, metaHeaders map[string][]string, authConfig *registry.AuthConfig, outStream io.Writer) error {
|
func (i *ImageService) PushImage(ctx context.Context, targetRef reference.Named, metaHeaders map[string][]string, authConfig *registry.AuthConfig, outStream io.Writer) (retErr error) {
|
||||||
if _, tagged := targetRef.(reference.Tagged); !tagged {
|
if _, tagged := targetRef.(reference.Tagged); !tagged {
|
||||||
if _, digested := targetRef.(reference.Digested); !digested {
|
if _, digested := targetRef.(reference.Digested); !digested {
|
||||||
return errdefs.NotImplemented(errors.New("push all tags is not implemented"))
|
return errdefs.NotImplemented(errors.New("push all tags is not implemented"))
|
||||||
|
@ -62,13 +63,20 @@ func (i *ImageService) PushImage(ctx context.Context, targetRef reference.Named,
|
||||||
store := i.client.ContentStore()
|
store := i.client.ContentStore()
|
||||||
|
|
||||||
resolver, tracker := i.newResolverFromAuthConfig(ctx, authConfig)
|
resolver, tracker := i.newResolverFromAuthConfig(ctx, authConfig)
|
||||||
progress := pushProgress{Tracker: tracker}
|
pp := pushProgress{Tracker: tracker}
|
||||||
jobsQueue := newJobs()
|
jobsQueue := newJobs()
|
||||||
finishProgress := jobsQueue.showProgress(ctx, out, combinedProgress([]progressUpdater{
|
finishProgress := jobsQueue.showProgress(ctx, out, combinedProgress([]progressUpdater{
|
||||||
&progress,
|
&pp,
|
||||||
pullProgress{ShowExists: false, Store: store},
|
pullProgress{ShowExists: false, Store: store},
|
||||||
}))
|
}))
|
||||||
defer finishProgress()
|
defer func() {
|
||||||
|
finishProgress()
|
||||||
|
if retErr == nil {
|
||||||
|
if tagged, ok := targetRef.(reference.Tagged); ok {
|
||||||
|
progress.Messagef(out, "", "%s: digest: %s size: %d", tagged.Tag(), target.Digest, img.Target.Size)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
var limiter *semaphore.Weighted = nil // TODO: Respect max concurrent downloads/uploads
|
var limiter *semaphore.Weighted = nil // TODO: Respect max concurrent downloads/uploads
|
||||||
|
|
||||||
|
@ -77,7 +85,7 @@ func (i *ImageService) PushImage(ctx context.Context, targetRef reference.Named,
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
for dgst := range mountableBlobs {
|
for dgst := range mountableBlobs {
|
||||||
progress.addMountable(dgst)
|
pp.addMountable(dgst)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a store which fakes the local existence of possibly mountable blobs.
|
// Create a store which fakes the local existence of possibly mountable blobs.
|
||||||
|
|
Loading…
Reference in a new issue