This will add a warning log in the daemon, and will send the message
to be displayed by the CLI.
Signed-off-by: Tibor Vass <tibor@docker.com>
(cherry picked from commit d35f8f4329bef6de0db3457959d81a32c2a530c6)
Signed-off-by: Tibor Vass <tibor@docker.com>
| ... | ... |
@@ -23,7 +23,7 @@ import ( |
| 23 | 23 |
"github.com/docker/docker/distribution/metadata" |
| 24 | 24 |
"github.com/docker/docker/distribution/xfer" |
| 25 | 25 |
"github.com/docker/docker/image" |
| 26 |
- "github.com/docker/docker/image/v1" |
|
| 26 |
+ v1 "github.com/docker/docker/image/v1" |
|
| 27 | 27 |
"github.com/docker/docker/layer" |
| 28 | 28 |
"github.com/docker/docker/pkg/ioutils" |
| 29 | 29 |
"github.com/docker/docker/pkg/progress" |
| ... | ... |
@@ -392,6 +392,10 @@ func (p *v2Puller) pullV2Tag(ctx context.Context, ref reference.Named, platform |
| 392 | 392 |
if p.config.RequireSchema2 {
|
| 393 | 393 |
return false, fmt.Errorf("invalid manifest: not schema2")
|
| 394 | 394 |
} |
| 395 |
+ msg := schema1DeprecationMessage(ref) |
|
| 396 |
+ logrus.Warn(msg) |
|
| 397 |
+ progress.Message(p.config.ProgressOutput, "", msg) |
|
| 398 |
+ |
|
| 395 | 399 |
id, manifestDigest, err = p.pullSchema1(ctx, ref, v, platform) |
| 396 | 400 |
if err != nil {
|
| 397 | 401 |
return false, err |
| ... | ... |
@@ -787,6 +791,10 @@ func (p *v2Puller) pullManifestList(ctx context.Context, ref reference.Named, mf |
| 787 | 787 |
|
| 788 | 788 |
switch v := manifest.(type) {
|
| 789 | 789 |
case *schema1.SignedManifest: |
| 790 |
+ msg := schema1DeprecationMessage(ref) |
|
| 791 |
+ logrus.Warn(msg) |
|
| 792 |
+ progress.Message(p.config.ProgressOutput, "", msg) |
|
| 793 |
+ |
|
| 790 | 794 |
platform := toOCIPlatform(manifestMatches[0].Platform) |
| 791 | 795 |
id, _, err = p.pullSchema1(ctx, manifestRef, v, &platform) |
| 792 | 796 |
if err != nil {
|
| ... | ... |
@@ -188,6 +188,10 @@ 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 := schema1DeprecationMessage(ref) |
|
| 192 |
+ logrus.Warn(msg) |
|
| 193 |
+ progress.Message(p.config.ProgressOutput, "", msg) |
|
| 194 |
+ |
|
| 191 | 195 |
manifestRef, err := reference.WithTag(p.repo.Named(), ref.Tag()) |
| 192 | 196 |
if err != nil {
|
| 193 | 197 |
return err |
| ... | ... |
@@ -156,3 +156,7 @@ func (th *existingTokenHandler) AuthorizeRequest(req *http.Request, params map[s |
| 156 | 156 |
req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", th.token))
|
| 157 | 157 |
return nil |
| 158 | 158 |
} |
| 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 |
+} |