"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "daemon/images/image_pull.go" between
moby-20.10.7.tar.gz and moby-20.10.8.tar.gz

About: Moby is a framework to assemble specialized container systems (formerly project name Docker; see here to clarify the relationship between the projects).

image_pull.go  (moby-20.10.7):image_pull.go  (moby-20.10.8)
skipping to change at line 18 skipping to change at line 18
"github.com/containerd/containerd/leases" "github.com/containerd/containerd/leases"
"github.com/containerd/containerd/namespaces" "github.com/containerd/containerd/namespaces"
dist "github.com/docker/distribution" dist "github.com/docker/distribution"
"github.com/docker/distribution/reference" "github.com/docker/distribution/reference"
"github.com/docker/docker/api/types" "github.com/docker/docker/api/types"
"github.com/docker/docker/distribution" "github.com/docker/docker/distribution"
progressutils "github.com/docker/docker/distribution/utils" progressutils "github.com/docker/docker/distribution/utils"
"github.com/docker/docker/errdefs" "github.com/docker/docker/errdefs"
"github.com/docker/docker/pkg/progress" "github.com/docker/docker/pkg/progress"
"github.com/docker/docker/pkg/streamformatter"
"github.com/docker/docker/registry" "github.com/docker/docker/registry"
digest "github.com/opencontainers/go-digest" digest "github.com/opencontainers/go-digest"
specs "github.com/opencontainers/image-spec/specs-go/v1" specs "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/sirupsen/logrus"
) )
// PullImage initiates a pull operation. image is the repository name to pull, a nd // PullImage initiates a pull operation. image is the repository name to pull, a nd
// tag may be either empty, or indicate a specific tag to pull. // tag may be either empty, or indicate a specific tag to pull.
func (i *ImageService) PullImage(ctx context.Context, image, tag string, platfor m *specs.Platform, metaHeaders map[string][]string, authConfig *types.AuthConfig , outStream io.Writer) error { func (i *ImageService) PullImage(ctx context.Context, image, tag string, platfor m *specs.Platform, metaHeaders map[string][]string, authConfig *types.AuthConfig , outStream io.Writer) error {
start := time.Now() start := time.Now()
// Special case: "pull -a" may send an image name with a // Special case: "pull -a" may send an image name with a
// trailing :. This is ugly, but let's not break API // trailing :. This is ugly, but let's not break API
// compatibility. // compatibility.
image = strings.TrimSuffix(image, ":") image = strings.TrimSuffix(image, ":")
skipping to change at line 54 skipping to change at line 56
} else { } else {
ref, err = reference.WithTag(ref, tag) ref, err = reference.WithTag(ref, tag)
} }
if err != nil { if err != nil {
return errdefs.InvalidParameter(err) return errdefs.InvalidParameter(err)
} }
} }
err = i.pullImageWithReference(ctx, ref, platform, metaHeaders, authConfi g, outStream) err = i.pullImageWithReference(ctx, ref, platform, metaHeaders, authConfi g, outStream)
imageActions.WithValues("pull").UpdateSince(start) imageActions.WithValues("pull").UpdateSince(start)
return err if err != nil {
return err
}
if platform != nil {
// If --platform was specified, check that the image we pulled ma
tches
// the expected platform. This check is for situations where the
image
// is a single-arch image, in which case (for backward compatibil
ity),
// we allow the image to have a non-matching architecture. The co
de
// below checks for this situation, and returns a warning to the
client,
// as well ass logs it to the daemon logs.
img, err := i.GetImage(image, platform)
// Note that this is a special case where GetImage returns both a
n image
// and an error: https://github.com/docker/docker/blob/v20.10.7/d
aemon/images/image.go#L175-L183
if errdefs.IsNotFound(err) && img != nil {
po := streamformatter.NewJSONProgressOutput(outStream, fa
lse)
progress.Messagef(po, "", `WARNING: %s`, err.Error())
logrus.WithError(err).WithField("image", image).Warn("ign
oring platform mismatch on single-arch image")
}
}
return nil
} }
func (i *ImageService) pullImageWithReference(ctx context.Context, ref reference .Named, platform *specs.Platform, metaHeaders map[string][]string, authConfig *t ypes.AuthConfig, outStream io.Writer) error { func (i *ImageService) pullImageWithReference(ctx context.Context, ref reference .Named, platform *specs.Platform, metaHeaders map[string][]string, authConfig *t ypes.AuthConfig, outStream io.Writer) error {
// Include a buffer so that slow client connections don't affect // Include a buffer so that slow client connections don't affect
// transfer performance. // transfer performance.
progressChan := make(chan progress.Progress, 100) progressChan := make(chan progress.Progress, 100)
writesDone := make(chan struct{}) writesDone := make(chan struct{})
ctx, cancelFunc := context.WithCancel(ctx) ctx, cancelFunc := context.WithCancel(ctx)
 End of changes. 3 change blocks. 
1 lines changed or deleted 34 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)