Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the timeout flag value in verify* commands. #3391

Merged
merged 2 commits into from
Nov 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 9 additions & 4 deletions cmd/cosign/cli/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package cli

import (
"context"
"fmt"

"github.com/google/go-containerregistry/pkg/name"
Expand Down Expand Up @@ -142,7 +143,8 @@ against the transparency log.`,
v.NameOptions = append(v.NameOptions, name.Insecure)
}

ctx := cmd.Context()
ctx, cancel := context.WithTimeout(cmd.Context(), ro.Timeout)
defer cancel()

if o.CommonVerifyOptions.IgnoreTlog && !o.CommonVerifyOptions.PrivateInfrastructure {
ui.Warnf(ctx, fmt.Sprintf(ignoreTLogMessage, "signature"))
Expand Down Expand Up @@ -241,7 +243,8 @@ against the transparency log.`,
return fmt.Errorf("please set the --max-worker flag to a value that is greater than 0")
}

ctx := cmd.Context()
ctx, cancel := context.WithTimeout(cmd.Context(), ro.Timeout)
defer cancel()

if o.CommonVerifyOptions.IgnoreTlog && !o.CommonVerifyOptions.PrivateInfrastructure {
ui.Warnf(ctx, fmt.Sprintf(ignoreTLogMessage, "attestation"))
Expand Down Expand Up @@ -336,7 +339,8 @@ The blob may be specified as a path to a file or - for stdin.`,
IgnoreTlog: o.CommonVerifyOptions.IgnoreTlog,
}

ctx := cmd.Context()
ctx, cancel := context.WithTimeout(cmd.Context(), ro.Timeout)
defer cancel()

if o.CommonVerifyOptions.IgnoreTlog && !o.CommonVerifyOptions.PrivateInfrastructure {
ui.Warnf(ctx, fmt.Sprintf(ignoreTLogMessage, "blob"))
Expand Down Expand Up @@ -411,7 +415,8 @@ The blob may be specified as a path to a file.`,
path = args[0]
}

ctx := cmd.Context()
ctx, cancel := context.WithTimeout(cmd.Context(), ro.Timeout)
defer cancel()

if o.CommonVerifyOptions.IgnoreTlog && !o.CommonVerifyOptions.PrivateInfrastructure {
ui.Warnf(ctx, fmt.Sprintf(ignoreTLogMessage, "blob attestation"))
Expand Down