From 63787114b4084f98557388f67189222b0deae621 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20Garc=C3=ADa=20Veytia=20=28puerco=29?= Date: Thu, 21 Mar 2024 12:48:56 +0100 Subject: [PATCH] Eval Status: Return repository UUID, populate entity info MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Adolfo GarcĂ­a Veytia (puerco) --- internal/controlplane/handlers_evalstatus.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/internal/controlplane/handlers_evalstatus.go b/internal/controlplane/handlers_evalstatus.go index 99b8813472..bcc01ec485 100644 --- a/internal/controlplane/handlers_evalstatus.go +++ b/internal/controlplane/handlers_evalstatus.go @@ -278,6 +278,14 @@ func buildRuleEvaluationStatusFromDBEvaluation( Msg("error converting severity will use defaults") } + entityInfo := map[string]string{} + if eval.Entity == db.EntitiesRepository { + 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(), @@ -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), @@ -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 }