mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
Replace platforms.Format with platforms.FormatAll in user-visible messages and logs.
Use FormatAll in user-visible messages and logs, since it includes the image's platform OS version (when set). Fixes https://github.com/moby/moby/issues/48659. Signed-off-by: Cesar Talledo <cesar.talledo@docker.com>
This commit is contained in:
@@ -166,7 +166,7 @@ func (i *ImageService) pullForBuilder(ctx context.Context, name string, authConf
|
||||
WARNING: Pulled image with specified platform (%s), but the resulting image's configured platform (%s) does not match.
|
||||
This is most likely caused by a bug in the build system that created the fetched image (%s).
|
||||
Please notify the image author to correct the configuration.`,
|
||||
platforms.Format(p), platforms.Format(imgPlat), name,
|
||||
platforms.FormatAll(p), platforms.FormatAll(imgPlat), name,
|
||||
)
|
||||
log.G(ctx).WithError(err).WithField("image", name).Warn("Ignoring error about platform mismatch where the manifest list points to an image whose configuration does not match the platform in the manifest.")
|
||||
}
|
||||
|
||||
@@ -223,7 +223,7 @@ func (i *ImageService) pullTag(ctx context.Context, ref reference.Named, platfor
|
||||
if strings.Contains(err.Error(), "platform") {
|
||||
platformStr := platforms.DefaultString()
|
||||
if platform != nil {
|
||||
platformStr = platforms.Format(*platform)
|
||||
platformStr = platforms.FormatAll(*platform)
|
||||
}
|
||||
return errdefs.NotFound(fmt.Errorf("no matching manifest for %s in the manifest list entries: %w", platformStr, err))
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ func (daemon *Daemon) containerCreate(ctx context.Context, daemonCfg *configStor
|
||||
}
|
||||
|
||||
if !images.OnlyPlatformWithFallback(p).Match(imgPlat) {
|
||||
warnings = append(warnings, fmt.Sprintf("The requested image's platform (%s) does not match the detected host platform (%s) and no specific platform was requested", platforms.Format(imgPlat), platforms.Format(p)))
|
||||
warnings = append(warnings, fmt.Sprintf("The requested image's platform (%s) does not match the detected host platform (%s) and no specific platform was requested", platforms.FormatAll(imgPlat), platforms.FormatAll(p)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ func (i *ImageService) manifestMatchesPlatform(ctx context.Context, img *image.I
|
||||
log.G(ctx).WithFields(log.Fields{
|
||||
"error": err,
|
||||
"image": img.ID,
|
||||
"desiredPlatform": platforms.Format(platform),
|
||||
"desiredPlatform": platforms.FormatAll(platform),
|
||||
}).Error("Error looking up image leases")
|
||||
return false, err
|
||||
}
|
||||
@@ -75,7 +75,7 @@ func (i *ImageService) manifestMatchesPlatform(ctx context.Context, img *image.I
|
||||
for _, r := range ls {
|
||||
logger := log.G(ctx).WithFields(log.Fields{
|
||||
"image": img.ID,
|
||||
"desiredPlatform": platforms.Format(platform),
|
||||
"desiredPlatform": platforms.FormatAll(platform),
|
||||
"resourceID": r.ID,
|
||||
"resourceType": r.Type,
|
||||
})
|
||||
@@ -121,7 +121,7 @@ func (i *ImageService) manifestMatchesPlatform(ctx context.Context, img *image.I
|
||||
Variant: md.Platform.Variant,
|
||||
}
|
||||
if !comparer.Match(p) {
|
||||
logger.WithField("otherPlatform", platforms.Format(p)).Debug("Manifest is not a match")
|
||||
logger.WithField("otherPlatform", platforms.FormatAll(p)).Debug("Manifest is not a match")
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -195,7 +195,7 @@ func (i *ImageService) GetImage(ctx context.Context, refOrID string, options bac
|
||||
if ref, err := reference.ParseNamed(refOrID); err == nil {
|
||||
imgName = reference.FamiliarString(ref)
|
||||
}
|
||||
retErr = errdefs.NotFound(errors.Errorf("image with reference %s was found but its platform (%s) does not match the specified platform (%s)", imgName, platforms.Format(imgPlat), platforms.Format(p)))
|
||||
retErr = errdefs.NotFound(errors.Errorf("image with reference %s was found but its platform (%s) does not match the specified platform (%s)", imgName, platforms.FormatAll(imgPlat), platforms.FormatAll(p)))
|
||||
}()
|
||||
ref, err := reference.ParseAnyReference(refOrID)
|
||||
if err != nil {
|
||||
|
||||
@@ -180,7 +180,7 @@ func (i *ImageService) pullForBuilder(ctx context.Context, name string, authConf
|
||||
WARNING: Pulled image with specified platform (%s), but the resulting image's configured platform (%s) does not match.
|
||||
This is most likely caused by a bug in the build system that created the fetched image (%s).
|
||||
Please notify the image author to correct the configuration.`,
|
||||
platforms.Format(p), platforms.Format(imgPlat), name,
|
||||
platforms.FormatAll(p), platforms.FormatAll(imgPlat), name,
|
||||
)
|
||||
log.G(ctx).WithError(err).WithField("image", name).Warn("Ignoring error about platform mismatch where the manifest list points to an image whose configuration does not match the platform in the manifest.")
|
||||
err = nil
|
||||
|
||||
@@ -836,7 +836,7 @@ func (p *puller) pullManifestList(ctx context.Context, ref reference.Named, mfst
|
||||
if pp != nil {
|
||||
platform = *pp
|
||||
}
|
||||
log.G(ctx).Debugf("%s resolved to a manifestList object with %d entries; looking for a %s match", ref, len(mfstList.Manifests), platforms.Format(platform))
|
||||
log.G(ctx).Debugf("%s resolved to a manifestList object with %d entries; looking for a %s match", ref, len(mfstList.Manifests), platforms.FormatAll(platform))
|
||||
|
||||
manifestMatches := filterManifests(mfstList.Manifests, platform)
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ func filterManifests(manifests []manifestlist.ManifestDescriptor, p ocispec.Plat
|
||||
if descP == nil || m.Match(*descP) {
|
||||
matches = append(matches, desc)
|
||||
if descP != nil {
|
||||
log.G(context.TODO()).Debugf("found match for %s with media type %s, digest %s", platforms.Format(p), desc.MediaType, desc.Digest.String())
|
||||
log.G(context.TODO()).Debugf("found match for %s with media type %s, digest %s", platforms.FormatAll(p), desc.MediaType, desc.Digest.String())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user