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

Commit 6a94234

Browse files
authored
Merge pull request #368 from tiborvass/19.03-remove-warning-on-v2schema1-pull
[19.03 backport] distribution: modify warning logic when pulling v2 schema1 manifests Upstream-commit: 421a3aa7375c33db33b5ea0e8aaa52a50aeaa8ed Component: engine
2 parents 214d4ba + 1507ce3 commit 6a94234

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)