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 1 commit
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
9 changes: 5 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,7 @@
v.NameOptions = append(v.NameOptions, name.Insecure)
}

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

Check failure on line 146 in cmd/cosign/cli/verify.go

View workflow job for this annotation

GitHub Actions / lint

lostcancel: the cancel function returned by context.WithTimeout should be called, not discarded, to avoid a context leak (govet)

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

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

Check failure on line 245 in cmd/cosign/cli/verify.go

View workflow job for this annotation

GitHub Actions / lint

lostcancel: the cancel function returned by context.WithTimeout should be called, not discarded, to avoid a context leak (govet)

if o.CommonVerifyOptions.IgnoreTlog && !o.CommonVerifyOptions.PrivateInfrastructure {
ui.Warnf(ctx, fmt.Sprintf(ignoreTLogMessage, "attestation"))
Expand Down Expand Up @@ -336,7 +337,7 @@
IgnoreTlog: o.CommonVerifyOptions.IgnoreTlog,
}

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

Check failure on line 340 in cmd/cosign/cli/verify.go

View workflow job for this annotation

GitHub Actions / lint

lostcancel: the cancel function returned by context.WithTimeout should be called, not discarded, to avoid a context leak (govet)

if o.CommonVerifyOptions.IgnoreTlog && !o.CommonVerifyOptions.PrivateInfrastructure {
ui.Warnf(ctx, fmt.Sprintf(ignoreTLogMessage, "blob"))
Expand Down Expand Up @@ -411,7 +412,7 @@
path = args[0]
}

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

Check failure on line 415 in cmd/cosign/cli/verify.go

View workflow job for this annotation

GitHub Actions / lint

lostcancel: the cancel function returned by context.WithTimeout should be called, not discarded, to avoid a context leak (govet)

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