@@ -18,10 +18,13 @@ package commands
1818
1919import (
2020 gocontext "context"
21+ "os"
22+ "strconv"
2123
2224 containerd "github.com/containerd/containerd/v2/client"
2325 "github.com/containerd/containerd/v2/pkg/epoch"
2426 "github.com/containerd/containerd/v2/pkg/namespaces"
27+ ptypes "github.com/containerd/containerd/v2/protobuf/types"
2528 "github.com/containerd/log"
2629 "github.com/urfave/cli"
2730)
@@ -62,5 +65,22 @@ func NewClient(context *cli.Context, opts ...containerd.Opt) (*containerd.Client
6265 return nil , nil , nil , err
6366 }
6467 ctx , cancel := AppContext (context )
68+ var suppressDeprecationWarnings bool
69+ if s := os .Getenv ("CONTAINERD_SUPPRESS_DEPRECATION_WARNINGS" ); s != "" {
70+ suppressDeprecationWarnings , err = strconv .ParseBool (s )
71+ if err != nil {
72+ log .L .WithError (err ).Warn ("Failed to parse CONTAINERD_SUPPRESS_DEPRECATION_WARNINGS=" + s )
73+ }
74+ }
75+ if ! suppressDeprecationWarnings {
76+ resp , err := client .IntrospectionService ().Server (ctx , & ptypes.Empty {})
77+ if err != nil {
78+ log .L .WithError (err ).Warn ("Failed to check deprecations" )
79+ } else {
80+ for _ , d := range resp .Deprecations {
81+ log .L .Warn ("DEPRECATION: " + d .Message )
82+ }
83+ }
84+ }
6585 return client , ctx , cancel , nil
6686}
0 commit comments