Skip to content

Commit

Permalink
feat: enable showing verifier name 2
Browse files Browse the repository at this point in the history
  • Loading branch information
junczhu committed Nov 23, 2023
1 parent ae7da73 commit 6e96827
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 3 additions & 2 deletions pkg/controllers/verifier_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ func (r *VerifierReconciler) Reconcile(ctx context.Context, req ctrl.Request) (c
// creates a verifier reference from CRD spec and add store to map
func verifierAddOrReplace(spec configv1beta1.VerifierSpec, objectName string, namespace string) error {
verifierConfig, err := specToVerifierConfig(spec)

// add verifier name to verifier config
verifierConfig[types.Name] = objectName
if err != nil {
logrus.Error(err, "unable to convert crd specification to verifier config")
return fmt.Errorf("unable to convert crd specification to verifier config, err: %w", err)
Expand Down Expand Up @@ -139,7 +140,7 @@ func specToVerifierConfig(verifierSpec configv1beta1.VerifierSpec) (vc.VerifierC
}
}

verifierConfig[types.Name] = verifierSpec.Name
verifierConfig[types.SpecName] = verifierSpec.Name
verifierConfig[types.ArtifactTypes] = verifierSpec.ArtifactTypes
if verifierSpec.Source != nil {
verifierConfig[types.Source] = verifierSpec.Source
Expand Down
5 changes: 1 addition & 4 deletions pkg/verifier/plugin/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func NewVerifier(version string, verifierConfig config.VerifierConfig, pluginPat

verifierSpecName, ok := verifierConfig[types.SpecName]
if !ok {
verifierSpecName = verifierName
return nil, re.ErrorCodeConfigInvalid.WithDetail(fmt.Sprintf("failed to find verifier spec name in the verifier config with key: %s", types.SpecName))
}

var nestedReferences []string
Expand Down Expand Up @@ -114,9 +114,6 @@ func (vp *VerifierPlugin) verifyReference(
subjectReference common.Reference,
referenceDescriptor ocispecs.ReferenceDescriptor,
referrerStoreConfig *rc.StoreConfig) (*verifier.VerifierResult, error) {
if vp.specName == "" {
vp.specName = vp.name
}
pluginPath, err := vp.executor.FindInPaths(vp.specName, vp.path)
if err != nil {
return nil, re.ErrorCodePluginNotFound.NewError(re.Verifier, vp.name, re.EmptyLink, err, nil, re.HideStackTrace)
Expand Down

0 comments on commit 6e96827

Please sign in to comment.