From 77462c77d9821fb788b55da2dadb7750173e2490 Mon Sep 17 00:00:00 2001 From: Armel Soro Date: Wed, 6 Sep 2023 11:08:24 +0200 Subject: [PATCH 1/3] Make sure to run parallel commands part of a composite command in parallel --- pkg/libdevfile/command.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/libdevfile/command.go b/pkg/libdevfile/command.go index 56aa51df3bf..0e4c823192b 100644 --- a/pkg/libdevfile/command.go +++ b/pkg/libdevfile/command.go @@ -33,8 +33,9 @@ func newCommand(devfileObj parser.DevfileObj, devfileCmd v1alpha2.Command) (comm case v1alpha2.CompositeCommandType: if util.SafeGetBool(devfileCmd.Composite.Parallel) { cmd = newParallelCompositeCommand(devfileObj, devfileCmd) + } else { + cmd = newCompositeCommand(devfileObj, devfileCmd) } - cmd = newCompositeCommand(devfileObj, devfileCmd) case v1alpha2.ExecCommandType: cmd = newExecCommand(devfileObj, devfileCmd) From 858860f69bb3320d2f819e773ffc7e169bc0d0b0 Mon Sep 17 00:00:00 2001 From: Armel Soro Date: Wed, 6 Sep 2023 18:06:40 +0200 Subject: [PATCH 2/3] Display warnings in case there are errors when executing pre-stop events --- pkg/component/delete/delete.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/component/delete/delete.go b/pkg/component/delete/delete.go index 26f1fb51af3..db0b95014d5 100644 --- a/pkg/component/delete/delete.go +++ b/pkg/component/delete/delete.go @@ -230,7 +230,7 @@ func (do *DeleteComponentClient) ExecutePreStopEvents(ctx context.Context, devfi ) err = libdevfile.ExecPreStopEvents(ctx, devfileObj, handler) if err != nil { - klog.V(4).Infof("Failed to execute %q event commands for component %q, cause: %v", libdevfile.PreStop, componentName, err.Error()) + log.Warningf("Failed to execute %q event commands for component %q, cause: %v", libdevfile.PreStop, componentName, err.Error()) } return nil From 39a6b5468a33344147b47c018010eac140775afe Mon Sep 17 00:00:00 2001 From: Armel Soro Date: Wed, 6 Sep 2023 18:12:52 +0200 Subject: [PATCH 3/3] Fix the command_composite_parallel.go implementation by lowering the case of the sub-command names Since this passed the Devfile validation logic, we should use the same logic as in command_composite.go --- pkg/libdevfile/command_composite_parallel.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/libdevfile/command_composite_parallel.go b/pkg/libdevfile/command_composite_parallel.go index 34eed10aab7..83467b0165a 100644 --- a/pkg/libdevfile/command_composite_parallel.go +++ b/pkg/libdevfile/command_composite_parallel.go @@ -52,7 +52,7 @@ func (o *parallelCompositeCommand) Execute(ctx context.Context, handler Handler, } commandExecs := util.NewConcurrentTasks(len(o.command.Composite.Commands)) for _, devfileCmd := range o.command.Composite.Commands { - cmd, err2 := newCommand(o.devfileObj, allCommands[devfileCmd]) + cmd, err2 := newCommand(o.devfileObj, allCommands[strings.ToLower(devfileCmd)]) if err2 != nil { return err2 }