Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 8 additions & 3 deletions cmd/argoexec/commands/wait.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,25 @@ import (
)

func NewWaitCommand() *cobra.Command {
var captureStderr bool

var command = cobra.Command{
Use: "wait",
Short: "wait for main container to finish and save artifacts",
Run: func(cmd *cobra.Command, args []string) {
err := waitContainer()
err := waitContainer(captureStderr)
if err != nil {
log.Fatalf("%+v", err)
}
},
}

command.PersistentFlags().BoolVarP(&captureStderr, "capture-stderr", "c", false, "capture stdout and stderr")

return &command
}

func waitContainer() error {
func waitContainer(captureStderr bool) error {
wfExecutor := initExecutor()
defer wfExecutor.HandleError()
defer stats.LogStats()
Expand Down Expand Up @@ -62,7 +67,7 @@ func waitContainer() error {
return err
}
// Capture output script result
err = wfExecutor.CaptureScriptResult()
err = wfExecutor.CaptureScriptResult(captureStderr)
if err != nil {
wfExecutor.AddError(err)
return err
Expand Down
2 changes: 1 addition & 1 deletion workflow/controller/workflowpod.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ func (woc *wfOperationCtx) newInitContainer(tmpl *wfv1.Template) apiv1.Container

func (woc *wfOperationCtx) newWaitContainer(tmpl *wfv1.Template) (*apiv1.Container, error) {
ctr := woc.newExecContainer(common.WaitContainerName, tmpl)
ctr.Command = []string{"argoexec", "wait"}
ctr.Command = []string{"argoexec", "wait", "--capture-stderr"}
switch woc.controller.Config.ContainerRuntimeExecutor {
case common.ContainerRuntimeExecutorPNS:
ctr.SecurityContext = &apiv1.SecurityContext{
Expand Down
6 changes: 3 additions & 3 deletions workflow/executor/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -746,8 +746,8 @@ func (we *WorkflowExecutor) GetMainContainerID() (string, error) {
return we.mainContainerID, nil
}

// CaptureScriptResult will add the stdout of a script template as output result
func (we *WorkflowExecutor) CaptureScriptResult() error {
// CaptureScriptResult will add the stdout (and optionally stderr) of a script template as output result
func (we *WorkflowExecutor) CaptureScriptResult(combinedOutput bool) error {

if we.ExecutionControl == nil || !we.ExecutionControl.IncludeScriptOutput {
log.Infof("No Script output reference in workflow. Capturing script output ignored")
Expand All @@ -761,7 +761,7 @@ func (we *WorkflowExecutor) CaptureScriptResult() error {
if err != nil {
return err
}
reader, err := we.RuntimeExecutor.GetOutputStream(mainContainerID, false)
reader, err := we.RuntimeExecutor.GetOutputStream(mainContainerID, combinedOutput)
if err != nil {
return err
}
Expand Down