From 89d573180ed19e72b908440fddba69c4e4c2518f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98ystein=20W=2E=20Gr=C3=A6ndsen?= Date: Wed, 10 May 2023 10:09:33 +0200 Subject: [PATCH] debug: to be removed. Just for debug --- server/events/apply_command_runner_test.go | 8 ++++---- server/events/policy_check_command_runner.go | 2 +- server/events/project_command_pool_executor.go | 5 ++++- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/server/events/apply_command_runner_test.go b/server/events/apply_command_runner_test.go index 90e94067ee..601f54200d 100644 --- a/server/events/apply_command_runner_test.go +++ b/server/events/apply_command_runner_test.go @@ -437,12 +437,12 @@ func TestApplyCommandRunner_ExecutionOrder(t *testing.T) { Description: "Don't block when abortOnExcecutionOrderFail is not set", ProjectContexts: []command.ProjectContext{ { - ExecutionOrderGroup: 0, - ProjectName: "First", + ExecutionOrderGroup: 0, + ProjectName: "First", }, { - ExecutionOrderGroup: 1, - ProjectName: "Second", + ExecutionOrderGroup: 1, + ProjectName: "Second", }, }, ProjectResults: []command.ProjectResult{ diff --git a/server/events/policy_check_command_runner.go b/server/events/policy_check_command_runner.go index c0283aae3e..18c5a63329 100644 --- a/server/events/policy_check_command_runner.go +++ b/server/events/policy_check_command_runner.go @@ -60,7 +60,7 @@ func (p *PolicyCheckCommandRunner) Run(ctx *command.Context, cmds []command.Proj var result command.Result if p.isParallelEnabled(cmds) { ctx.Log.Info("Running policy_checks in parallel") - result = runProjectCmdsParallel(cmds, p.prjCmdRunner.PolicyCheck, p.parallelPoolSize) + result = runProjectCmdsParallel(ctx, cmds, p.prjCmdRunner.PolicyCheck, p.parallelPoolSize) } else { result = runProjectCmds(cmds, p.prjCmdRunner.PolicyCheck) } diff --git a/server/events/project_command_pool_executor.go b/server/events/project_command_pool_executor.go index c3b19114d6..29b381180d 100644 --- a/server/events/project_command_pool_executor.go +++ b/server/events/project_command_pool_executor.go @@ -11,12 +11,14 @@ import ( type prjCmdRunnerFunc func(ctx command.ProjectContext) command.ProjectResult func runProjectCmdsParallel( + ctx *command.Context, cmds []command.ProjectContext, runnerFunc prjCmdRunnerFunc, poolSize int, ) command.Result { var results []command.ProjectResult mux := &sync.Mutex{} + ctx.Log.Info("DEBUG: in runProjectCmdsParallelGroups") wg := sizedwaitgroup.New(poolSize) for _, pCmd := range cmds { @@ -77,10 +79,11 @@ func runProjectCmdsParallelGroups( runnerFunc prjCmdRunnerFunc, poolSize int, ) command.Result { + ctx.Log.Info("DEBUG: in runProjectCmdsParallelGroups") var results []command.ProjectResult groups := splitByExecutionOrderGroup(cmds) for _, group := range groups { - res := runProjectCmdsParallel(group, runnerFunc, poolSize) + res := runProjectCmdsParallel(ctx, group, runnerFunc, poolSize) results = append(results, res.ProjectResults...) if res.HasErrors() && group[0].AbortOnExcecutionOrderFail { ctx.Log.Info("abort on execution order when failed")