Skip to content

Commit

Permalink
update(sign): pass context
Browse files Browse the repository at this point in the history
Signed-off-by: Luca Guerra <[email protected]>
  • Loading branch information
LucaGuerra authored and poiana committed Jul 7, 2023
1 parent 8a3cb3c commit 8440ac9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cmd/artifact/install/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ func (o *artifactInstallOptions) RunArtifactInstall(ctx context.Context, args []
digestRef := fmt.Sprintf("%s@%s", repo, result.RootDigest)

o.Printer.Info.Printfln("Verifying signature for %s", digestRef)
err = sign.VerifySignature(digestRef, sig)
err = sign.VerifySignature(ctx, digestRef, sig)
if err != nil {
return fmt.Errorf("error while verifying signature for %s: %w", digestRef, err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/follower/follower.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ func (f *Follower) pull(ctx context.Context) (filePaths []string, res *oci.Regis
// Verify the signature if needed
if f.Config.Signature != nil {
f.Verbosef("verifying signature")
err = sign.VerifySignature(res.RootDigest, f.Config.Signature)
err = sign.VerifySignature(ctx, res.RootDigest, f.Config.Signature)
if err != nil {
return filePaths, res, fmt.Errorf("could not verify signature for %s: %w", res.RootDigest, err)
}
Expand Down
4 changes: 2 additions & 2 deletions internal/sign/sign.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
)

// VerifySignature checks that a fully qualified reference is signed according to the parameters.
func VerifySignature(ref string, signature *index.Signature) error {
func VerifySignature(ctx context.Context, ref string, signature *index.Signature) error {
if signature == nil {
// nothing to do
return nil
Expand All @@ -43,5 +43,5 @@ func VerifySignature(ref string, signature *index.Signature) error {
CertOidcIssuerRegexp: signature.Cosign.CertificateOidcIssuerRegexp,
},
}
return v.DoVerify(context.Background(), []string{ref})
return v.DoVerify(ctx, []string{ref})
}

0 comments on commit 8440ac9

Please sign in to comment.