Plumb contexts through commands

This is to prepare for otel support.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Brian Goff
2023-09-09 22:27:44 +00:00
committed by Sebastiaan van Stijn
parent 9eb632dc7c
commit 5400a48aaf
146 changed files with 409 additions and 470 deletions

View File

@ -27,7 +27,7 @@ func NewLoadCommand(dockerCli command.Cli) *cobra.Command {
Short: "Load an image from a tar archive or STDIN",
Args: cli.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
return runLoad(dockerCli, opts)
return runLoad(cmd.Context(), dockerCli, opts)
},
Annotations: map[string]string{
"aliases": "docker image load, docker load",
@ -43,7 +43,7 @@ func NewLoadCommand(dockerCli command.Cli) *cobra.Command {
return cmd
}
func runLoad(dockerCli command.Cli, opts loadOptions) error {
func runLoad(ctx context.Context, dockerCli command.Cli, opts loadOptions) error {
var input io.Reader = dockerCli.In()
if opts.input != "" {
// We use sequential.Open to use sequential file access on Windows, avoiding
@ -65,7 +65,7 @@ func runLoad(dockerCli command.Cli, opts loadOptions) error {
if !dockerCli.Out().IsTerminal() {
opts.quiet = true
}
response, err := dockerCli.Client().ImageLoad(context.Background(), input, opts.quiet)
response, err := dockerCli.Client().ImageLoad(ctx, input, opts.quiet)
if err != nil {
return err
}