From a37860e15c625de76a56b0fd793580cb1a46e49e Mon Sep 17 00:00:00 2001 From: Juan Antonio Osorio Date: Mon, 15 Jul 2024 11:54:38 +0300 Subject: [PATCH] Add Execution ID in the executor's evaluation param logs (#3889) The execution ID is very handy to link together a single run when debugging Minder. Unfortunately, it's not set everywhere... so let's do that! This way, we'll be able to better debug minder throughout the execution of policy for an entity. Signed-off-by: Juan Antonio Osorio --- internal/engine/eval_status.go | 1 + internal/engine/interfaces/interface.go | 2 ++ 2 files changed, 3 insertions(+) diff --git a/internal/engine/eval_status.go b/internal/engine/eval_status.go index 789361a2cc..c4eedbe24f 100644 --- a/internal/engine/eval_status.go +++ b/internal/engine/eval_status.go @@ -55,6 +55,7 @@ func (e *executor) createEvalStatusParams( ArtifactID: artID, PullRequestID: prID, ProjectID: inf.ProjectID, + ExecutionID: *inf.ExecutionID, // Execution ID is required in the executor. } // Prepare params for fetching the current rule evaluation from the database diff --git a/internal/engine/interfaces/interface.go b/internal/engine/interfaces/interface.go index c370cd8dad..b38cf9d2b3 100644 --- a/internal/engine/interfaces/interface.go +++ b/internal/engine/interfaces/interface.go @@ -147,6 +147,7 @@ type EvalStatusParams struct { evalErr error actionsOnOff map[ActionType]ActionOpt actionsErr evalerrors.ActionsError + ExecutionID uuid.UUID } // Ensure EvalStatusParams implements the necessary interfaces @@ -250,6 +251,7 @@ func (e *EvalStatusParams) DecorateLogger(l zerolog.Logger) zerolog.Logger { Str("rule_type", e.GetRule().GetType()). Str("rule_name", e.GetRule().GetName()). Str("rule_type_id", e.GetRuleTypeID().String()). + Str("execution_id", e.ExecutionID.String()). Logger() if e.RepoID.Valid { outl = outl.With().Str("repository_id", e.RepoID.UUID.String()).Logger()