Skip to content

Commit

Permalink
Update src/pkg/utils/cosign.go
Browse files Browse the repository at this point in the history
Co-authored-by: Wayne Starr <Racer159@users.noreply.github.com>
  • Loading branch information
mjnagel and Racer159 authored Oct 12, 2023
1 parent 062809d commit f61288f
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions src/pkg/utils/cosign.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,19 +238,27 @@ func GetCosignArtifacts(image string) (cosignList []string, err error) {
attRef, _ := ociremote.AttestationTag(ref, remoteOpts...)

sigs, err := simg.Signatures()
if err == nil {
layers, _ := sigs.Layers()
if len(layers) > 0 {
cosignArtifactList = append(cosignArtifactList, sigRef.String())
}
if err != nil {
return cosignArtifactList, err
}
layers, err := sigs.Layers()
if err != nil {
return cosignArtifactList, err
}
if len(layers) > 0 {
cosignArtifactList = append(cosignArtifactList, sigRef.String())
}

atts, err := simg.Attestations()
if err == nil {
layers, _ := atts.Layers()
if len(layers) > 0 {
cosignArtifactList = append(cosignArtifactList, attRef.String())
}
if err != nil {
return cosignArtifactList, err
}
layers, err = atts.Layers()
if err != nil {
return cosignArtifactList, err
}
if len(layers) > 0 {
cosignArtifactList = append(cosignArtifactList, attRef.String())
}
return cosignArtifactList, nil
}

0 comments on commit f61288f

Please sign in to comment.