()
| 46 | } |
| 47 | |
| 48 | func (action *PolicyEval) Run() (*policydevel.EvalSummary, error) { |
| 49 | var attClient pb.AttestationServiceClient |
| 50 | if action.CPConnection != nil { |
| 51 | attClient = pb.NewAttestationServiceClient(action.CPConnection) |
| 52 | } |
| 53 | |
| 54 | evalOpts := &policydevel.EvalOptions{ |
| 55 | PolicyPath: action.opts.PolicyPath, |
| 56 | MaterialKind: action.opts.Kind, |
| 57 | Annotations: action.opts.Annotations, |
| 58 | MaterialPath: action.opts.MaterialPath, |
| 59 | Inputs: action.opts.Inputs, |
| 60 | AllowedHostnames: action.opts.AllowedHostnames, |
| 61 | Debug: action.opts.Debug, |
| 62 | AttestationClient: attClient, |
| 63 | ControlPlaneConn: action.CPConnection, |
| 64 | ProjectName: action.opts.ProjectName, |
| 65 | ProjectVersionName: action.opts.ProjectVersionName, |
| 66 | } |
| 67 | |
| 68 | // Evaluate policy |
| 69 | resp, err := policydevel.Evaluate(evalOpts, action.Logger) |
| 70 | if err != nil { |
| 71 | return nil, err |
| 72 | } |
| 73 | |
| 74 | return resp, nil |
| 75 | } |
no test coverage detected