Преглед изворни кода

distribution: Extract schema1 deprecation notice

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Paweł Gronowski пре 1 година
родитељ
комит
2cb94ade6c
2 измењених фајлова са 6 додато и 2 уклоњено
  1. 4 0
      distribution/errors.go
  2. 2 2
      distribution/pull_v2.go

+ 4 - 0
distribution/errors.go

@@ -212,3 +212,7 @@ func (e reservedNameError) Error() string {
 }
 }
 
 
 func (e reservedNameError) Forbidden() {}
 func (e reservedNameError) Forbidden() {}
+
+func DeprecatedSchema1ImageMessage(ref reference.Named) string {
+	return fmt.Sprintf("[DEPRECATION NOTICE] Docker Image Format v1, and Docker Image manifest version 2, schema 1 support will be removed in an upcoming release. Suggest the author of %s to upgrade the image to the OCI Format, or Docker Image manifest v2, schema 2. More information at https://docs.docker.com/go/deprecated-image-specs/", ref)
+}

+ 2 - 2
distribution/pull_v2.go

@@ -435,7 +435,7 @@ func (p *puller) pullTag(ctx context.Context, ref reference.Named, platform *oci
 
 
 	switch v := manifest.(type) {
 	switch v := manifest.(type) {
 	case *schema1.SignedManifest:
 	case *schema1.SignedManifest:
-		msg := fmt.Sprintf("[DEPRECATION NOTICE] Docker Image Format v1, and Docker Image manifest version 2, schema 1 support will be removed in an upcoming release. Suggest the author of %s to upgrade the image to the OCI Format, or Docker Image manifest v2, schema 2. More information at https://docs.docker.com/go/deprecated-image-specs/", ref)
+		msg := DeprecatedSchema1ImageMessage(ref)
 		log.G(ctx).Warn(msg)
 		log.G(ctx).Warn(msg)
 		progress.Message(p.config.ProgressOutput, "", msg)
 		progress.Message(p.config.ProgressOutput, "", msg)
 
 
@@ -868,7 +868,7 @@ func (p *puller) pullManifestList(ctx context.Context, ref reference.Named, mfst
 
 
 		switch v := manifest.(type) {
 		switch v := manifest.(type) {
 		case *schema1.SignedManifest:
 		case *schema1.SignedManifest:
-			msg := fmt.Sprintf("[DEPRECATION NOTICE] Docker Image Format v1, and Docker Image manifest version 2, schema 1 support will be removed in an upcoming release. Suggest the author of %s to upgrade the image to the OCI Format, or Docker Image manifest v2, schema 2. More information at https://docs.docker.com/go/deprecated-image-specs/", ref)
+			msg := DeprecatedSchema1ImageMessage(ref)
 			log.G(ctx).Warn(msg)
 			log.G(ctx).Warn(msg)
 			progress.Message(p.config.ProgressOutput, "", msg)
 			progress.Message(p.config.ProgressOutput, "", msg)