Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions pkg/cosign/fetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ import (
"context"
"crypto/x509"
"encoding/json"
"errors"
"fmt"
"os"
"runtime"
"sync"

"github.com/google/go-containerregistry/pkg/name"
"github.com/sigstore/cosign/v2/pkg/cosign/bundle"
"github.com/sigstore/cosign/v2/pkg/oci"
ociremote "github.com/sigstore/cosign/v2/pkg/oci/remote"
"golang.org/x/sync/errgroup"
)
Expand Down Expand Up @@ -67,8 +69,15 @@ func FetchSignaturesForReference(_ context.Context, ref name.Reference, opts ...
if err != nil {
return nil, err
}
sigs, err := FetchSignatures(simg)
if err != nil {
return nil, fmt.Errorf("%s: %w", ref, err)
}
return sigs, nil
}

sigs, err := simg.Signatures()
func FetchSignatures(se oci.SignedEntity) ([]SignedPayload, error) {
sigs, err := se.Signatures()
if err != nil {
return nil, fmt.Errorf("remote image: %w", err)
}
Expand All @@ -77,7 +86,7 @@ func FetchSignaturesForReference(_ context.Context, ref name.Reference, opts ...
return nil, fmt.Errorf("fetching signatures: %w", err)
}
if len(l) == 0 {
return nil, fmt.Errorf("no signatures associated with %s", ref)
return nil, errors.New("no signatures associated")
}

signatures := make([]SignedPayload, len(l))
Expand Down
Loading