diff --git a/cmd/kubectl-testkube/commands/testworkflows/renderer/testworkflowexecution_obj.go b/cmd/kubectl-testkube/commands/testworkflows/renderer/testworkflowexecution_obj.go index 6c898ae1db..d79a884388 100644 --- a/cmd/kubectl-testkube/commands/testworkflows/renderer/testworkflowexecution_obj.go +++ b/cmd/kubectl-testkube/commands/testworkflows/renderer/testworkflowexecution_obj.go @@ -10,6 +10,7 @@ import ( "github.com/kubeshop/testkube/cmd/kubectl-testkube/commands/common/render" "github.com/kubeshop/testkube/pkg/api/v1/client" "github.com/kubeshop/testkube/pkg/api/v1/testkube" + tclcmd "github.com/kubeshop/testkube/pkg/tcl/testworkflowstcl/cmd" "github.com/kubeshop/testkube/pkg/ui" ) @@ -63,27 +64,8 @@ func printPrettyOutput(ui *ui.UI, execution testkube.TestWorkflowExecution) { ui.NL() ui.Warn("Tags: ", testkube.MapToString(execution.Tags)) } - if execution.RunningContext != nil { - ui.Warn("Running context: ") - ctx := execution.RunningContext - if ctx.Interface_ != nil { - ui.Warn("Interface: ") - ui.Warn(" Name: ", ctx.Interface_.Name) - if ctx.Interface_.Type_ != nil { - ui.Warn(" Type: ", string(*ctx.Interface_.Type_)) - } - } - if ctx.Actor != nil { - ui.Warn("Actor: ") - ui.Warn(" Name: ", ctx.Actor.Name) - ui.Warn(" Email: ", ctx.Actor.Email) - ui.Warn(" Execution id: ", ctx.Actor.ExecutionId) - ui.Warn(" Execution path: ", ctx.Actor.ExecutionPath) - if ctx.Actor.Type_ != nil { - ui.Warn(" Type: ", string(*ctx.Actor.Type_)) - } - } - } + // Pro edition only (tcl protected code) + tclcmd.PrintRunningContext(ui, execution) if execution.Result != nil && execution.Result.Status != nil { ui.Warn("Status: ", string(*execution.Result.Status)) if !execution.Result.QueuedAt.IsZero() { diff --git a/pkg/tcl/testworkflowstcl/cmd/cmd.go b/pkg/tcl/testworkflowstcl/cmd/cmd.go index 29e26b51e9..9d880c5cee 100644 --- a/pkg/tcl/testworkflowstcl/cmd/cmd.go +++ b/pkg/tcl/testworkflowstcl/cmd/cmd.go @@ -16,6 +16,7 @@ import ( "github.com/kubeshop/testkube/internal/common" "github.com/kubeshop/testkube/pkg/api/v1/testkube" + "github.com/kubeshop/testkube/pkg/ui" ) func GetRunningContext(runContext, token string, interfaceType testkube.TestWorkflowRunningContextInterfaceType) *testkube.TestWorkflowRunningContext { @@ -74,3 +75,27 @@ func getJWTPayload(token string) (map[string]interface{}, error) { return payload, nil } + +func PrintRunningContext(ui *ui.UI, execution testkube.TestWorkflowExecution) { + if execution.RunningContext != nil { + ui.Warn("Running context: ") + ctx := execution.RunningContext + if ctx.Interface_ != nil { + ui.Warn("Interface: ") + ui.Warn(" Name: ", ctx.Interface_.Name) + if ctx.Interface_.Type_ != nil { + ui.Warn(" Type: ", string(*ctx.Interface_.Type_)) + } + } + if ctx.Actor != nil { + ui.Warn("Actor: ") + ui.Warn(" Name: ", ctx.Actor.Name) + ui.Warn(" Email: ", ctx.Actor.Email) + ui.Warn(" Execution id: ", ctx.Actor.ExecutionId) + ui.Warn(" Execution path: ", ctx.Actor.ExecutionPath) + if ctx.Actor.Type_ != nil { + ui.Warn(" Type: ", string(*ctx.Actor.Type_)) + } + } + } +}