Make sure to run parallel commands part of a composite command in parallel (#7075)

* Make sure to run parallel commands part of a composite command in parallel

* Display warnings in case there are errors when executing pre-stop events

* 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
This commit is contained in:
Armel Soro
2023-09-06 21:15:01 +02:00
committed by GitHub
parent 725a64014a
commit 00d39889b7
3 changed files with 4 additions and 3 deletions

View File

@@ -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

View File

@@ -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)

View File

@@ -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
}