Skip to content

Commit

Permalink
chore: address comments
Browse files Browse the repository at this point in the history
Signed-off-by: Binbin Li <[email protected]>
  • Loading branch information
binbin-li committed Jan 20, 2025
1 parent 4465a75 commit 0895284
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
8 changes: 4 additions & 4 deletions executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,10 @@ func (e *Executor) verifyArtifact(ctx context.Context, subject string, subjectDe
continue
}
verifierReport, err := verifier.Verify(ctx, &VerifyOptions{
ArtifactStore: e.Store,
Subject: subject,
SubjectDescriptor: subjectDesc,
Artifact: artifact,
Store: e.Store,
Subject: subject,
SubjectDescriptor: subjectDesc,
ArtifactDescriptor: artifact,
})
if err != nil {
return nil, fmt.Errorf("failed to verify artifact %s with verifier %s: %w", subject, verifier.Name(), err)
Expand Down
2 changes: 1 addition & 1 deletion executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func (m *mockVerifier) Verify(ctx context.Context, opts *VerifyOptions) (*Verifi
if m.verifyResult == nil {
return &VerificationResult{}, errors.New("verify result not initialized")
}
if result, ok := m.verifyResult[opts.Artifact.Digest.String()]; ok {
if result, ok := m.verifyResult[opts.ArtifactDescriptor.Digest.String()]; ok {
return result, nil
}
return &VerificationResult{}, nil
Expand Down
9 changes: 5 additions & 4 deletions verifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ type Verifier interface {

// VerifyOptions represents the options to verify a subject against an artifact.
type VerifyOptions struct {
// ArtifactStore is the store to access the artifacts. Required.
ArtifactStore Store
// Store is the store to access the artifacts. Required.
Store Store

// Subject is the subject reference of the artifact being verified.
// Required.
Expand All @@ -55,8 +55,9 @@ type VerifyOptions struct {
// Required.
SubjectDescriptor ocispec.Descriptor

// Artifact is the descriptor of the artifact being verified against.
Artifact ocispec.Descriptor
// ArtifactDescriptor is the descriptor of the artifact being verified
// against. Required.
ArtifactDescriptor ocispec.Descriptor
}

// VerificationResult defines the verification result that a verifier plugin
Expand Down

0 comments on commit 0895284

Please sign in to comment.