Skip to content

Commit

Permalink
Eval Status: Return repository UUID, populate entity info
Browse files Browse the repository at this point in the history
Signed-off-by: Adolfo García Veytia (puerco) <[email protected]>
  • Loading branch information
puerco committed Mar 21, 2024
1 parent e6bedd7 commit 8bb9616
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions internal/controlplane/handlers_evalstatus.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,14 @@ func buildRuleEvaluationStatusFromDBEvaluation(
Msg("error converting severity will use defaults")
}

entityInfo := map[string]string{}
if eval.Entity == db.EntitiesPullRequest {
entityInfo["provider"] = eval.Provider
entityInfo["repo_owner"] = eval.RepoOwner
entityInfo["repo_name"] = eval.RepoName
entityInfo["repository_id"] = eval.RepositoryID.UUID.String()
}

return &minderv1.RuleEvaluationStatus{
RuleEvaluationId: eval.RuleEvaluationID.String(),
RuleId: eval.RuleTypeID.String(),
Expand All @@ -286,7 +294,7 @@ func buildRuleEvaluationStatusFromDBEvaluation(
Entity: string(eval.Entity),
Status: string(eval.EvalStatus.EvalStatusTypes),
LastUpdated: timestamppb.New(eval.EvalLastUpdated.Time),
EntityInfo: map[string]string{},
EntityInfo: entityInfo,
Details: eval.EvalDetails.String,
Guidance: guidance,
RemediationStatus: string(eval.RemStatus.RemediationStatusTypes),
Expand All @@ -304,7 +312,7 @@ func buildEntityFromEvaluation(eval db.ListRuleEvaluationsByProfileIdRow) *minde
}

if ent.Type == minderv1.Entity_ENTITY_REPOSITORIES && eval.RepoOwner != "" && eval.RepoName != "" {
ent.Id = fmt.Sprintf("%s/%s", eval.RepoOwner, eval.RepoName)
ent.Id = eval.RepositoryID.UUID.String()
}
return ent
}
Expand Down

0 comments on commit 8bb9616

Please sign in to comment.