Skip to content

Commit cdd749a

Browse files
authored
feat(policies): Support new evaluation fields in control plane API (chainloop-dev#1409)
Signed-off-by: Jose I. Paris <[email protected]>
1 parent cdb5cba commit cdd749a

File tree

8 files changed

+296
-202
lines changed

8 files changed

+296
-202
lines changed

app/cli/internal/action/workflow_run_describe.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ type PolicyEvaluation struct {
9191
PolicyReference *PolicyReference `json:"policy_reference,omitempty"`
9292
With map[string]string `json:"with,omitempty"`
9393
Type string `json:"type"`
94+
Skipped bool `json:"skipped"`
95+
SkipReasons []string `json:"skip_reasons,omitempty"`
9496
}
9597

9698
type PolicyViolation struct {
@@ -240,6 +242,8 @@ func policyEvaluationPBToAction(in *pb.PolicyEvaluation) *PolicyEvaluation {
240242
Type: in.Type,
241243
PolicyReference: pr,
242244
Violations: violations,
245+
Skipped: in.Skipped,
246+
SkipReasons: in.SkipReasons,
243247
}
244248
}
245249

app/controlplane/api/controlplane/v1/response_messages.pb.go

Lines changed: 222 additions & 202 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/controlplane/api/controlplane/v1/response_messages.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ message PolicyEvaluation {
124124
string type = 8;
125125
repeated PolicyViolation violations = 9;
126126
PolicyReference policy_reference = 10;
127+
bool skipped = 12;
128+
repeated string skip_reasons = 13;
127129
}
128130

129131
message PolicyViolation {

app/controlplane/api/gen/frontend/controlplane/v1/response_messages.ts

Lines changed: 34 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/controlplane/api/gen/jsonschema/controlplane.v1.PolicyEvaluation.jsonschema.json

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/controlplane/api/gen/jsonschema/controlplane.v1.PolicyEvaluation.schema.json

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/controlplane/internal/service/attestation.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,8 @@ func extractPolicyEvaluations(in map[string][]*chainloop.PolicyEvaluation) map[s
453453
With: ev.With,
454454
Type: ev.Type,
455455
Violations: violations,
456+
Skipped: ev.Skipped,
457+
SkipReasons: ev.SkipReasons,
456458
}
457459

458460
if ev.PolicyReference != nil {

app/controlplane/internal/service/workflowrun.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ func (s *WorkflowRunService) View(ctx context.Context, req *pb.WorkflowRunServic
129129
if err != nil {
130130
return nil, handleUseCaseErr(err, s.log)
131131
}
132+
} else {
133+
return nil, errors.BadRequest("invalid", "id or digest required")
132134
}
133135

134136
attestation, err := bizAttestationToPb(run.Attestation)

0 commit comments

Comments
 (0)