Browse code

Merge pull request #40681 from thaJeztah/19.03_backport_schema2v1_dep_notice_on_error_only

[19.03 backport] Move schema1 deprecation notice

Sebastiaan van Stijn authored on 2020/04/03 08:22:50
Showing 1 changed files
... ...
@@ -188,10 +188,7 @@ func (p *v2Pusher) pushV2Tag(ctx context.Context, ref reference.NamedTagged, id
188 188
 
189 189
 		logrus.Warnf("failed to upload schema2 manifest: %v - falling back to schema1", err)
190 190
 
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))
192
-		logrus.Warn(msg)
193
-		progress.Message(p.config.ProgressOutput, "", msg)
194
-
191
+		// Note: this fallback is deprecated, see log messages below
195 192
 		manifestRef, err := reference.WithTag(p.repo.Named(), ref.Tag())
196 193
 		if err != nil {
197 194
 			return err
... ...
@@ -205,6 +202,11 @@ func (p *v2Pusher) pushV2Tag(ctx context.Context, ref reference.NamedTagged, id
205 205
 		if _, err = manSvc.Put(ctx, manifest, putOptions...); err != nil {
206 206
 			return err
207 207
 		}
208
+
209
+		// schema2 failed but schema1 succeeded
210
+		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))
211
+		logrus.Warn(msg)
212
+		progress.Message(p.config.ProgressOutput, "", msg)
208 213
 	}
209 214
 
210 215
 	var canonicalManifest []byte