Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: change the Test Workflow orchestration mechanism to atomic instructions #5676

Merged
merged 87 commits into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from 81 commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
7f997dc
fix(testworkflows): avoid unnecessary empty data in ContainerConfig
rangoo94 Jul 4, 2024
58fdd48
feat(testworkflows): add basic implementation to build list of operat…
rangoo94 Jul 4, 2024
e6c0f97
feat(testworkflows): migrate basics of container execution for handli…
rangoo94 Jul 8, 2024
95de9c6
feat: support conditions with new Init Process kind
rangoo94 Jul 8, 2024
3baabcb
feat: encapsulate init process' container state
rangoo94 Jul 12, 2024
cc1508b
chore: rename container to setup
rangoo94 Jul 15, 2024
12d9f91
feat: support dynamic environment variables
rangoo94 Jul 15, 2024
19e9437
feat: add mock for pause in the Init Process
rangoo94 Jul 15, 2024
a07a9c4
feat: discriminate TestWorkflow instructions with ActionType
rangoo94 Jul 15, 2024
84471b4
chore: rename Paused to PausedOnStart
rangoo94 Jul 15, 2024
4b98da5
chore: change StepData mutations
rangoo94 Jul 15, 2024
19d428b
chore: extract action.Action to separate package
rangoo94 Jul 15, 2024
4134a52
fixup
rangoo94 Jul 16, 2024
9fb7b81
fixup
rangoo94 Jul 16, 2024
c9a6fda
fixup
rangoo94 Jul 16, 2024
e6fd11e
feat: move *Stage to separate package
rangoo94 Jul 16, 2024
0cc2462
chore: reorganize action files
rangoo94 Jul 16, 2024
6cc36b6
chore: delete unused
rangoo94 Jul 16, 2024
ad462fd
chore: extract lightweight version of actions to avoid increase in In…
rangoo94 Jul 16, 2024
b2a4a4e
fix typo
rangoo94 Jul 16, 2024
9a0408d
feat: abstract the executions in the Init Process
rangoo94 Jul 17, 2024
f4ed9e5
fix: aborting Test Workflow processes
rangoo94 Jul 17, 2024
7ce4b3b
fixup
rangoo94 Jul 17, 2024
2db7cdf
fixup
rangoo94 Jul 17, 2024
472e95d
fixup
rangoo94 Jul 17, 2024
afa56e8
fix: support statuses properly in the Init Process
rangoo94 Jul 18, 2024
65de8be
fix: parsing container logs
rangoo94 Jul 18, 2024
8257478
chore: delete debug information
rangoo94 Jul 18, 2024
995a55c
feat: make the root operation constant
rangoo94 Jul 18, 2024
e355239
feat: support timeout for Test Workflow steps
rangoo94 Jul 19, 2024
bc6f8b1
feat: add back retry functionality for the Test Workflows
rangoo94 Jul 19, 2024
db93f40
feat: support pause/resume for Test Workflows
rangoo94 Jul 19, 2024
c55ab3a
chore: delete unused code
rangoo94 Jul 19, 2024
57dd92c
fix: watching services
rangoo94 Jul 19, 2024
03e3c64
fix: some unit tests
rangoo94 Jul 22, 2024
2fdc2fe
fixup linting
rangoo94 Jul 22, 2024
f9f90b2
chore: add instructions check in unit test
rangoo94 Jul 22, 2024
e3b5d26
chore: refactor action unit tests a bit
rangoo94 Jul 22, 2024
57ec303
fix: build correct conditions when there are grouped steps
rangoo94 Jul 23, 2024
ec3a4b0
chore: adjust processor tests
rangoo94 Jul 23, 2024
7140c52
chore: delete unused function
rangoo94 Jul 23, 2024
38f5d99
feat: streamline the output in the Init Process, to allow obfuscating…
rangoo94 Jul 23, 2024
6efded0
feat: mask secret environment variables
rangoo94 Jul 24, 2024
63d0893
chore: extract function to get last step
rangoo94 Jul 24, 2024
437476a
chore: unify internal machine for Init Process
rangoo94 Jul 24, 2024
7766fd5
chore: move step timeout logic to the Init Process main switch
rangoo94 Jul 24, 2024
3f36289
fix: use default ContainerConfig for setup step container
rangoo94 Jul 24, 2024
b09e9cc
fixup move MapResourcesToKubernetesResources to stage package
rangoo94 Jul 24, 2024
2112967
feat: use /bin/sh instead of /.tktw/bin/sh in case the Init/Toolkit i…
rangoo94 Jul 24, 2024
75a3bcf
chore: fail property accessor in case of nullish value to access
rangoo94 Jul 24, 2024
08adf52
fixup unit tests
rangoo94 Jul 24, 2024
bebbf77
fix: detecting aborted steps
rangoo94 Jul 24, 2024
a7e2b2d
feat: ensure that aborted step is considered aborted, not skipped
rangoo94 Jul 25, 2024
2082104
fix: machine for retry in the Init Process
rangoo94 Jul 25, 2024
ff5dd8d
chore: rename `instructions` related to Actions to `actions`
rangoo94 Jul 25, 2024
fafb724
fix: send again toolkit/init image data along with Pod information fr…
rangoo94 Jul 25, 2024
d8aa2ae
chore: simplify StepStatusFromCode
rangoo94 Jul 25, 2024
f4f2201
fix: clean up printing in the Init Process
rangoo94 Jul 25, 2024
1ad9e80
chore: clean up getting actions in Processor tests
rangoo94 Jul 25, 2024
731b997
chore: rename variable in Control Server
rangoo94 Jul 25, 2024
ee8f5f6
chore: extract control server options to separate file
rangoo94 Jul 25, 2024
7d34c93
chore: expose a bit configuration of sensitive words minimum length
rangoo94 Jul 25, 2024
363594e
chore: delete obsolete todos
rangoo94 Jul 25, 2024
36f496a
fix: avoid copying binaries from the Init image when it's not necessary
rangoo94 Jul 25, 2024
317ef62
fix: unit tests
rangoo94 Jul 25, 2024
b23bcbb
fixup rewrite todo comment
rangoo94 Jul 25, 2024
3a9a440
fixup delete obsolete comment
rangoo94 Jul 25, 2024
4c34a95
fixup delete obsolete commented out code
rangoo94 Jul 25, 2024
06a9bb3
fix: group conditions
rangoo94 Jul 25, 2024
8b0fcf1
fixup
rangoo94 Jul 25, 2024
0cf26f8
fixup delete obsolete comment
rangoo94 Jul 25, 2024
c956772
fixup delete obsolete comment
rangoo94 Jul 25, 2024
96aacdf
chore: wrap errors
rangoo94 Jul 25, 2024
bc0eb69
chore: reduce the size of Init Process
rangoo94 Jul 25, 2024
421317f
fix: detect the Toolkit properly
rangoo94 Jul 25, 2024
f178f94
fixup savethefiles
rangoo94 Jul 25, 2024
2594a5a
fixup toolkit container
rangoo94 Jul 25, 2024
b9ce54d
fixup toolkit container
rangoo94 Jul 25, 2024
9428013
chore: rename SensitiveReadWriter to Obfuscator
rangoo94 Jul 25, 2024
a416a04
feat: show last characters in the obfuscated log output
rangoo94 Jul 25, 2024
866f1f5
feat: make some environment variables sensitive by default
rangoo94 Jul 25, 2024
0a115d3
fixup add more default sensitive variables
rangoo94 Jul 25, 2024
3bc7fb4
chore: first set of code review fixes
rangoo94 Jul 26, 2024
0508326
chore: make the 00 and 01 special groups constants
rangoo94 Jul 26, 2024
81e8203
chore: log error for mkdir of working directory
rangoo94 Jul 26, 2024
8218338
chore: delete commented out code
rangoo94 Jul 26, 2024
9cb876c
fix: handle errors in the setup step
rangoo94 Jul 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmd/kubectl-testkube/commands/testworkflows/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/kubeshop/testkube/cmd/kubectl-testkube/commands/common"
"github.com/kubeshop/testkube/cmd/kubectl-testkube/commands/common/render"
"github.com/kubeshop/testkube/cmd/kubectl-testkube/commands/testworkflows/renderer"
"github.com/kubeshop/testkube/cmd/testworkflow-init/data"
"github.com/kubeshop/testkube/cmd/testworkflow-init/instructions"
apiclientv1 "github.com/kubeshop/testkube/pkg/api/v1/client"
"github.com/kubeshop/testkube/pkg/api/v1/testkube"
"github.com/kubeshop/testkube/pkg/testworkflows/testworkflowprocessor/constants"
Expand Down Expand Up @@ -304,7 +304,7 @@ func printRawLogLines(logs []byte, steps []testkube.TestWorkflowSignature, resul
line = line[getTimestampLength(line)+1:]
}

start := data.StartHintRe.FindStringSubmatch(line)
start := instructions.StartHintRe.FindStringSubmatch(line)
if len(start) == 0 {
line += "\x07"
fmt.Println(line)
Expand Down
13 changes: 7 additions & 6 deletions cmd/tcl/testworkflow-toolkit/commands/execute.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
commontcl "github.com/kubeshop/testkube/cmd/tcl/testworkflow-toolkit/common"
"github.com/kubeshop/testkube/cmd/tcl/testworkflow-toolkit/spawn"
"github.com/kubeshop/testkube/cmd/testworkflow-init/data"
"github.com/kubeshop/testkube/cmd/testworkflow-init/instructions"
"github.com/kubeshop/testkube/cmd/testworkflow-toolkit/env"
"github.com/kubeshop/testkube/cmd/testworkflow-toolkit/transfer"
"github.com/kubeshop/testkube/internal/common"
Expand Down Expand Up @@ -92,7 +93,7 @@ func buildTestExecution(test testworkflowsv1.StepExecuteTest, async bool) (func(
return
}

data.PrintOutput(env.Ref(), "test-start", &testExecutionDetails{
instructions.PrintOutput(env.Ref(), "test-start", &testExecutionDetails{
Id: exec.Id,
Name: exec.Name,
TestName: exec.TestName,
Expand Down Expand Up @@ -126,7 +127,7 @@ func buildTestExecution(test testworkflowsv1.StepExecuteTest, async bool) (func(
break loop
}
if prevStatus != status {
data.PrintOutput(env.Ref(), "test-status", &executionResult{Id: exec.Id, Status: string(status)})
instructions.PrintOutput(env.Ref(), "test-status", &executionResult{Id: exec.Id, Status: string(status)})
}
prevStatus = status
}
Expand All @@ -140,7 +141,7 @@ func buildTestExecution(test testworkflowsv1.StepExecuteTest, async bool) (func(
color = ui.Red
}

data.PrintOutput(env.Ref(), "test-end", &executionResult{Id: exec.Id, Status: string(status)})
instructions.PrintOutput(env.Ref(), "test-end", &executionResult{Id: exec.Id, Status: string(status)})
fmt.Printf("%s • %s\n", color(execName), string(status))
return
}, nil
Expand All @@ -161,7 +162,7 @@ func buildWorkflowExecution(workflow testworkflowsv1.StepExecuteWorkflow, async
return
}

data.PrintOutput(env.Ref(), "testworkflow-start", &testWorkflowExecutionDetails{
instructions.PrintOutput(env.Ref(), "testworkflow-start", &testWorkflowExecutionDetails{
Id: exec.Id,
Name: exec.Name,
TestWorkflowName: exec.Workflow.Name,
Expand Down Expand Up @@ -195,7 +196,7 @@ func buildWorkflowExecution(workflow testworkflowsv1.StepExecuteWorkflow, async
break loop
}
if prevStatus != status {
data.PrintOutput(env.Ref(), "testworkflow-status", &executionResult{Id: exec.Id, Status: string(status)})
instructions.PrintOutput(env.Ref(), "testworkflow-status", &executionResult{Id: exec.Id, Status: string(status)})
}
prevStatus = status
}
Expand All @@ -209,7 +210,7 @@ func buildWorkflowExecution(workflow testworkflowsv1.StepExecuteWorkflow, async
color = ui.Red
}

data.PrintOutput(env.Ref(), "testworkflow-end", &executionResult{Id: exec.Id, Status: string(status)})
instructions.PrintOutput(env.Ref(), "testworkflow-end", &executionResult{Id: exec.Id, Status: string(status)})
fmt.Printf("%s • %s\n", color(execName), string(status))
return
}, nil
Expand Down
3 changes: 2 additions & 1 deletion cmd/tcl/testworkflow-toolkit/commands/kill.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
commontcl "github.com/kubeshop/testkube/cmd/tcl/testworkflow-toolkit/common"
"github.com/kubeshop/testkube/cmd/tcl/testworkflow-toolkit/spawn"
"github.com/kubeshop/testkube/cmd/testworkflow-init/data"
"github.com/kubeshop/testkube/cmd/testworkflow-init/instructions"
"github.com/kubeshop/testkube/cmd/testworkflow-toolkit/artifacts"
"github.com/kubeshop/testkube/cmd/testworkflow-toolkit/env"
"github.com/kubeshop/testkube/pkg/expressions"
Expand Down Expand Up @@ -104,7 +105,7 @@ func NewKillCmd() *cobra.Command {

logsFilePath, err := spawn.SaveLogs(context.Background(), clientSet, storage, env.Namespace(), id, service+"/", index)
if err == nil {
data.PrintOutput(env.Ref(), "service", ServiceInfo{Group: groupRef, Name: service, Index: index, Logs: storage.FullPath(logsFilePath)})
instructions.PrintOutput(env.Ref(), "service", ServiceInfo{Group: groupRef, Name: service, Index: index, Logs: storage.FullPath(logsFilePath)})
log("saved logs")
} else {
log("warning", "problem saving the logs", err.Error())
Expand Down
16 changes: 8 additions & 8 deletions cmd/tcl/testworkflow-toolkit/commands/parallel.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ import (
testworkflowsv1 "github.com/kubeshop/testkube-operator/api/testworkflows/v1"
commontcl "github.com/kubeshop/testkube/cmd/tcl/testworkflow-toolkit/common"
"github.com/kubeshop/testkube/cmd/tcl/testworkflow-toolkit/spawn"
"github.com/kubeshop/testkube/cmd/testworkflow-init/data"
"github.com/kubeshop/testkube/cmd/testworkflow-init/instructions"
"github.com/kubeshop/testkube/cmd/testworkflow-toolkit/artifacts"
"github.com/kubeshop/testkube/cmd/testworkflow-toolkit/env"
"github.com/kubeshop/testkube/cmd/testworkflow-toolkit/transfer"
"github.com/kubeshop/testkube/internal/common"
"github.com/kubeshop/testkube/pkg/api/v1/testkube"
"github.com/kubeshop/testkube/pkg/expressions"
"github.com/kubeshop/testkube/pkg/testworkflows/testworkflowcontroller"
"github.com/kubeshop/testkube/pkg/testworkflows/testworkflowprocessor"
"github.com/kubeshop/testkube/pkg/testworkflows/testworkflowprocessor/constants"
"github.com/kubeshop/testkube/pkg/testworkflows/testworkflowprocessor/presets"
"github.com/kubeshop/testkube/pkg/testworkflows/testworkflowprocessor/stage"
"github.com/kubeshop/testkube/pkg/ui"
)

Expand Down Expand Up @@ -163,7 +163,7 @@ func NewParallelCmd() *cobra.Command {

// Send initial output
for index := range specs {
data.PrintOutput(env.Ref(), "parallel", ParallelStatus{
instructions.PrintOutput(env.Ref(), "parallel", ParallelStatus{
Index: index,
Description: descriptions[index],
})
Expand Down Expand Up @@ -200,7 +200,7 @@ func NewParallelCmd() *cobra.Command {
}

// Compute the bundle instructions
sig := testworkflowprocessor.MapSignatureListToInternal(bundle.Signature)
sig := stage.MapSignatureListToInternal(bundle.Signature)
namespace := bundle.Job.Namespace
if namespace == "" {
namespace = env.Namespace()
Expand Down Expand Up @@ -228,7 +228,7 @@ func NewParallelCmd() *cobra.Command {
if shouldSaveLogs {
logsFilePath, err := spawn.SaveLogs(context.Background(), clientSet, storage, namespace, id, "", index)
if err == nil {
data.PrintOutput(env.Ref(), "parallel", ParallelStatus{Index: int(index), Logs: storage.FullPath(logsFilePath)})
instructions.PrintOutput(env.Ref(), "parallel", ParallelStatus{Index: int(index), Logs: storage.FullPath(logsFilePath)})
log("saved logs")
} else {
log("warning", "problem saving the logs", err.Error())
Expand All @@ -246,7 +246,7 @@ func NewParallelCmd() *cobra.Command {
}()

// Inform about the step structure
data.PrintOutput(env.Ref(), "parallel", ParallelStatus{Index: int(index), Signature: sig})
instructions.PrintOutput(env.Ref(), "parallel", ParallelStatus{Index: int(index), Signature: sig})

// Control the execution
// TODO: Consider aggregated controller to limit number of watchers
Expand Down Expand Up @@ -291,11 +291,11 @@ func NewParallelCmd() *cobra.Command {
prevStep = v.Current
prevStatus = v.Status
if v.Result.IsFinished() {
data.PrintOutput(env.Ref(), "parallel", ParallelStatus{Index: int(index), Status: v.Status, Result: v.Result})
instructions.PrintOutput(env.Ref(), "parallel", ParallelStatus{Index: int(index), Status: v.Status, Result: v.Result})
ctxCancel()
return v.Result.IsPassed()
} else {
data.PrintOutput(env.Ref(), "parallel", ParallelStatus{Index: int(index), Status: v.Status, Current: v.Current})
instructions.PrintOutput(env.Ref(), "parallel", ParallelStatus{Index: int(index), Status: v.Status, Current: v.Current})
}
}
}
Expand Down
19 changes: 10 additions & 9 deletions cmd/tcl/testworkflow-toolkit/commands/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
testworkflowsv1 "github.com/kubeshop/testkube-operator/api/testworkflows/v1"
commontcl "github.com/kubeshop/testkube/cmd/tcl/testworkflow-toolkit/common"
"github.com/kubeshop/testkube/cmd/tcl/testworkflow-toolkit/spawn"
"github.com/kubeshop/testkube/cmd/testworkflow-init/data"
"github.com/kubeshop/testkube/cmd/testworkflow-init/instructions"
"github.com/kubeshop/testkube/cmd/testworkflow-toolkit/env"
"github.com/kubeshop/testkube/cmd/testworkflow-toolkit/transfer"
"github.com/kubeshop/testkube/internal/common"
Expand Down Expand Up @@ -111,7 +111,7 @@ func NewServicesCmd() *cobra.Command {
}

// Initialize empty array of details for each of the services
data.PrintHintDetails(env.Ref(), fmt.Sprintf("services.%s", name), []ServiceState{})
instructions.PrintHintDetails(env.Ref(), fmt.Sprintf("services.%s", name), []ServiceState{})
}

// Analyze instances to run
Expand Down Expand Up @@ -189,12 +189,12 @@ func NewServicesCmd() *cobra.Command {
for i := range svcInstances {
state[name][i].Description = svcInstances[i].Description
}
data.PrintHintDetails(env.Ref(), fmt.Sprintf("services.%s", name), state)
instructions.PrintHintDetails(env.Ref(), fmt.Sprintf("services.%s", name), state)
}

// Inform about each service instance
for _, instance := range instances {
data.PrintOutput(env.Ref(), "service", ServiceInfo{
instructions.PrintOutput(env.Ref(), "service", ServiceInfo{
Group: groupRef,
Index: instance.Index,
Name: instance.Name,
Expand Down Expand Up @@ -274,7 +274,8 @@ func NewServicesCmd() *cobra.Command {
if namespace == "" {
namespace = env.Namespace()
}
mainRef := bundle.Job.Spec.Template.Spec.Containers[0].Name

mainRef := bundle.Actions().GetLastRef()

// Deploy the resources
// TODO: Avoid using Job
Expand Down Expand Up @@ -329,7 +330,7 @@ func NewServicesCmd() *cobra.Command {
state[instance.Name][index].Ip = v.PodIP
log(fmt.Sprintf("assigned to %s IP", ui.LightBlue(v.PodIP)))
info.Status = ServiceStatusRunning
data.PrintOutput(env.Ref(), "service", info)
instructions.PrintOutput(env.Ref(), "service", info)
}

if v.Current == mainRef {
Expand All @@ -349,7 +350,7 @@ func NewServicesCmd() *cobra.Command {
if !started {
info.Status = ServiceStatusFailed
log("container failed")
data.PrintOutput(env.Ref(), "service", info)
instructions.PrintOutput(env.Ref(), "service", info)
return false
}

Expand Down Expand Up @@ -377,7 +378,7 @@ func NewServicesCmd() *cobra.Command {
log("container ready")
info.Status = ServiceStatusReady
}
data.PrintOutput(env.Ref(), "service", info)
instructions.PrintOutput(env.Ref(), "service", info)

return ready
}
Expand All @@ -387,7 +388,7 @@ func NewServicesCmd() *cobra.Command {

// Inform about the services state
for k := range state {
data.PrintHintDetails(env.Ref(), fmt.Sprintf("services.%s", k), state[k])
instructions.PrintHintDetails(env.Ref(), fmt.Sprintf("services.%s", k), state[k])
}

// Notify the results
Expand Down
4 changes: 2 additions & 2 deletions cmd/tcl/testworkflow-toolkit/spawn/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ import (
"github.com/kubeshop/testkube/pkg/api/v1/testkube"
"github.com/kubeshop/testkube/pkg/expressions"
"github.com/kubeshop/testkube/pkg/testworkflows/testworkflowcontroller"
"github.com/kubeshop/testkube/pkg/testworkflows/testworkflowprocessor"
"github.com/kubeshop/testkube/pkg/testworkflows/testworkflowprocessor/constants"
"github.com/kubeshop/testkube/pkg/testworkflows/testworkflowprocessor/stage"
)

func MapDynamicListToStringList(list []interface{}) []string {
Expand Down Expand Up @@ -174,7 +174,7 @@ func ProcessFetch(transferSrv transfer.Server, fetch []testworkflowsv1.StepParal
Env: []corev1.EnvVar{
{Name: "TK_NS", Value: env.Namespace()},
{Name: "TK_REF", Value: env.Ref()},
testworkflowprocessor.BypassToolkitCheck,
stage.BypassToolkitCheck,
},
Args: &result,
},
Expand Down
74 changes: 74 additions & 0 deletions cmd/testworkflow-init/commands/run.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package commands

import (
"slices"

"github.com/kubeshop/testkube/cmd/testworkflow-init/constants"
"github.com/kubeshop/testkube/cmd/testworkflow-init/data"
"github.com/kubeshop/testkube/cmd/testworkflow-init/orchestration"
"github.com/kubeshop/testkube/cmd/testworkflow-init/output"
"github.com/kubeshop/testkube/pkg/expressions"
"github.com/kubeshop/testkube/pkg/testworkflows/testworkflowprocessor/action/actiontypes/lite"
)

func Run(run lite.ActionExecute, container lite.LiteActionContainer) {
machine := data.GetInternalTestWorkflowMachine()
state := data.GetState()
step := state.GetStep(run.Ref)

// Abandon executing if the step was finished before
if step.IsFinished() {
return
}

// Obtain command to run
command := make([]string, 0)
if container.Config.Command != nil {
command = slices.Clone(*container.Config.Command)
}
if container.Config.Args != nil {
command = append(command, *container.Config.Args...)
}

// Resolve the command to run
for i := range command {
value, err := expressions.CompileAndResolveTemplate(command[i], machine, expressions.FinalizerFail)
if err != nil {
output.ExitErrorf(data.CodeInternal, "failed to compute argument '%d': %s", i, err.Error())
}
command[i], _ = value.Static().StringValue()
}

// Run the operation
execution := orchestration.Executions.Create(command[0], command[1:])
result, err := execution.Run()
if err != nil {
output.ExitErrorf(data.CodeInternal, "failed to execute: %v", err)
}

// Initialize local state
var status data.StepStatus

success := result.ExitCode == 0

// Compute the result
if run.Negative {
success = !success
}
if result.Aborted {
status = data.StepStatusAborted
} else if success {
status = data.StepStatusPassed
} else {
status = data.StepStatusFailed
}

// Abandon saving execution data if the step has been finished before
if step.IsFinished() {
return
}

// Notify about the status
step.SetStatus(status).SetExitCode(result.ExitCode)
orchestration.FinishExecution(step, constants.ExecutionResult{ExitCode: result.ExitCode, Iteration: int(step.Iteration)})
}
Loading
Loading