@@ -11,6 +11,8 @@ import (
11
11
12
12
"github.com/operator-framework/operator-registry/alpha/action"
13
13
"github.com/operator-framework/operator-registry/alpha/declcfg"
14
+ "github.com/operator-framework/operator-registry/cmd/opm/internal/util"
15
+ containerd "github.com/operator-framework/operator-registry/pkg/image/containerdregistry"
14
16
"github.com/operator-framework/operator-registry/pkg/sqlite"
15
17
)
16
18
@@ -44,6 +46,29 @@ func NewCmd() *cobra.Command {
44
46
// returned from render.Run and logged as fatal errors.
45
47
logrus .SetOutput (ioutil .Discard )
46
48
49
+ skipTLSVerify , useHTTP , err := util .GetTLSOptions (cmd )
50
+ if err != nil {
51
+ log .Fatal (err )
52
+ }
53
+
54
+ cacheDir , err := os .MkdirTemp ("" , "render-registry-" )
55
+ if err != nil {
56
+ log .Fatal (err )
57
+ }
58
+
59
+ reg , err := containerd .NewRegistry (
60
+ containerd .WithCacheDir (cacheDir ),
61
+ containerd .SkipTLSVerify (skipTLSVerify ),
62
+ containerd .WithPlainHTTP (useHTTP ),
63
+ containerd .WithLog (nullLogger ()),
64
+ )
65
+ if err != nil {
66
+ log .Fatalf ("creating containerd registry: %v" , err )
67
+ }
68
+ defer reg .Destroy ()
69
+
70
+ render .Registry = reg
71
+
47
72
cfg , err := render .Run (cmd .Context ())
48
73
if err != nil {
49
74
log .Fatal (err )
@@ -55,5 +80,13 @@ func NewCmd() *cobra.Command {
55
80
},
56
81
}
57
82
cmd .Flags ().StringVarP (& output , "output" , "o" , "json" , "Output format (json|yaml)" )
83
+ cmd .Flags ().Bool ("skip-tls-verify" , false , "disable TLS verification" )
84
+ cmd .Flags ().Bool ("use-http" , false , "use plain HTTP" )
58
85
return cmd
59
86
}
87
+
88
+ func nullLogger () * logrus.Entry {
89
+ logger := logrus .New ()
90
+ logger .SetOutput (ioutil .Discard )
91
+ return logrus .NewEntry (logger )
92
+ }
0 commit comments