|
9 | 9 | "os" |
10 | 10 | "strings" |
11 | 11 |
|
12 | | - "github.com/containerd/containerd/log" |
13 | 12 | "github.com/containerd/containerd/platforms" |
14 | 13 | "github.com/deislabs/cnab-go/bundle" |
| 14 | + "github.com/docker/app/internal/log" |
15 | 15 | "github.com/docker/app/types/metadata" |
16 | 16 | "github.com/docker/cli/cli" |
17 | 17 | "github.com/docker/cli/cli/command" |
@@ -83,6 +83,7 @@ func runPush(dockerCli command.Cli, name string, opts pushOptions) error { |
83 | 83 | return err |
84 | 84 | } |
85 | 85 | if retag.shouldRetag { |
| 86 | + logrus.Debugf(`Retagging invocation image "%q"`, retag.invocationImageRef.String()) |
86 | 87 | if err := retagInvocationImage(dockerCli, bndl, retag.invocationImageRef.String()); err != nil { |
87 | 88 | return err |
88 | 89 | } |
@@ -112,6 +113,7 @@ func resolveReferenceAndBundle(dockerCli command.Cli, name string) (*bundle.Bund |
112 | 113 | } |
113 | 114 |
|
114 | 115 | func pushInvocationImage(dockerCli command.Cli, retag retagResult) error { |
| 116 | + logrus.Debugf("Pushing the invocation image %q", retag.invocationImageRef) |
115 | 117 | repoInfo, err := registry.ParseRepositoryInfo(retag.invocationImageRef) |
116 | 118 | if err != nil { |
117 | 119 | return err |
@@ -150,21 +152,15 @@ func pushBundle(dockerCli command.Cli, opts pushOptions, bndl *bundle.Bundle, re |
150 | 152 | return errors.Wrapf(err, "fixing up %q for push", retag.cnabRef) |
151 | 153 | } |
152 | 154 | // push bundle manifest |
153 | | - descriptor, err := remotes.Push(newMuteLogContext(), bndl, retag.cnabRef, resolver, true, withAppAnnotations) |
| 155 | + logrus.Debugf("Pushing the bundle %q", retag.cnabRef) |
| 156 | + descriptor, err := remotes.Push(log.WithLogContext(context.Background()), bndl, retag.cnabRef, resolver, true, withAppAnnotations) |
154 | 157 | if err != nil { |
155 | 158 | return errors.Wrapf(err, "pushing to %q", retag.cnabRef) |
156 | 159 | } |
157 | 160 | fmt.Fprintf(os.Stdout, "Successfully pushed bundle to %s. Digest is %s.\n", retag.cnabRef.String(), descriptor.Digest) |
158 | 161 | return nil |
159 | 162 | } |
160 | 163 |
|
161 | | -func newMuteLogContext() context.Context { |
162 | | - logger := logrus.New() |
163 | | - logger.SetLevel(logrus.ErrorLevel) |
164 | | - logger.SetOutput(ioutil.Discard) |
165 | | - return log.WithLogger(context.Background(), logrus.NewEntry(logger)) |
166 | | -} |
167 | | - |
168 | 164 | func withAppAnnotations(index *ocischemav1.Index) error { |
169 | 165 | if index.Annotations == nil { |
170 | 166 | index.Annotations = make(map[string]string) |
|
0 commit comments