Skip to content
This repository was archived by the owner on Oct 13, 2023. It is now read-only.

Commit 1507ce3

Browse files
author
Tibor Vass
committed
distribution: modify warning logic when pulling v2 schema1 manifests
The warning on pull was incorrectly asking to contact registry admins. It is kept on push however. Pulling manifest lists with v2 schema1 manifests will not be supported thus there is a warning for those, but wording changed to suggest repository author to upgrade. Finally, a milder warning on regular pull is kept ONLY for DockerHub users in order to incite moving away from schema1. Signed-off-by: Tibor Vass <tibor@docker.com> (cherry picked from commit 647dfe99a50badd27f0508c67eddc4b4923fcef7) Signed-off-by: Tibor Vass <tibor@docker.com> Upstream-commit: f9232e3f11bcf71110dcbf807bf3297b629026dc Component: engine
1 parent 60135e6 commit 1507ce3

3 files changed

Lines changed: 10 additions & 9 deletions

File tree

components/engine/distribution/pull_v2.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -392,9 +392,14 @@ func (p *v2Puller) pullV2Tag(ctx context.Context, ref reference.Named, platform
392392
if p.config.RequireSchema2 {
393393
return false, fmt.Errorf("invalid manifest: not schema2")
394394
}
395-
msg := schema1DeprecationMessage(ref)
396-
logrus.Warn(msg)
397-
progress.Message(p.config.ProgressOutput, "", msg)
395+
396+
// give registries time to upgrade to schema2 and only warn if we know a registry has been upgraded long time ago
397+
// TODO: condition to be removed
398+
if reference.Domain(ref) == "docker.io" {
399+
msg := fmt.Sprintf("Image %s uses outdated schema1 manifest format. Please upgrade to a schema2 image for better future compatibility. More information at https://docs.docker.com/registry/spec/deprecated-schema-v1/", ref)
400+
logrus.Warn(msg)
401+
progress.Message(p.config.ProgressOutput, "", msg)
402+
}
398403

399404
id, manifestDigest, err = p.pullSchema1(ctx, ref, v, platform)
400405
if err != nil {
@@ -791,7 +796,7 @@ func (p *v2Puller) pullManifestList(ctx context.Context, ref reference.Named, mf
791796

792797
switch v := manifest.(type) {
793798
case *schema1.SignedManifest:
794-
msg := schema1DeprecationMessage(ref)
799+
msg := fmt.Sprintf("[DEPRECATION NOTICE] v2 schema1 manifests in manifest lists are not supported and will break in a future release. Suggest author of %s to upgrade to v2 schema2. More information at https://docs.docker.com/registry/spec/deprecated-schema-v1/", ref)
795800
logrus.Warn(msg)
796801
progress.Message(p.config.ProgressOutput, "", msg)
797802

components/engine/distribution/push_v2.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ func (p *v2Pusher) pushV2Tag(ctx context.Context, ref reference.NamedTagged, id
188188

189189
logrus.Warnf("failed to upload schema2 manifest: %v - falling back to schema1", err)
190190

191-
msg := schema1DeprecationMessage(ref)
191+
msg := fmt.Sprintf("[DEPRECATION NOTICE] registry v2 schema1 support will be removed in an upcoming release. Please contact admins of the %s registry NOW to avoid future disruption. More information at https://docs.docker.com/registry/spec/deprecated-schema-v1/", reference.Domain(ref))
192192
logrus.Warn(msg)
193193
progress.Message(p.config.ProgressOutput, "", msg)
194194

components/engine/distribution/registry.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,3 @@ func (th *existingTokenHandler) AuthorizeRequest(req *http.Request, params map[s
156156
req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", th.token))
157157
return nil
158158
}
159-
160-
func schema1DeprecationMessage(ref reference.Named) string {
161-
return fmt.Sprintf("[DEPRECATION NOTICE] registry v2 schema1 support will be removed in an upcoming release. Please contact admins of the %s registry NOW to avoid future disruption.", reference.Domain(ref))
162-
}

0 commit comments

Comments
 (0)