Allow HTTP tracing in push/pull via --trace flag

Signed-off-by: Phil Estes <estesp@amazon.com>
This commit is contained in:
Phil Estes
2021-02-16 21:01:52 -05:00
parent 88d97362b3
commit 51992133af
3 changed files with 37 additions and 0 deletions

View File

@@ -18,6 +18,7 @@ package images
import (
"fmt"
"net/http/httptrace"
"github.com/containerd/containerd"
"github.com/containerd/containerd/cmd/ctr/commands"
@@ -54,6 +55,10 @@ command. As part of this process, we do the following:
Name: "all-platforms",
Usage: "pull content and metadata from all platforms",
},
cli.BoolFlag{
Name: "trace",
Usage: "enable HTTP tracing for registry interactions",
},
cli.BoolFlag{
Name: "all-metadata",
Usage: "Pull metadata for all platforms",
@@ -88,6 +93,9 @@ command. As part of this process, we do the following:
return err
}
if context.Bool("trace") {
ctx = httptrace.WithClientTrace(ctx, NewDebugClientTrace(ctx))
}
img, err := content.Fetch(ctx, client, ref, config)
if err != nil {
return err