Skip to content

Commit

Permalink
fix(execution watch): check execution status before trying to get logs (
Browse files Browse the repository at this point in the history
#604)

* fix(execution watch): check execution status before trying to get logs.

* fix(execution watch): use IsCompleted instead of raw data
  • Loading branch information
nicufk authored Nov 30, 2021
1 parent f7c182a commit 2e9e920
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion cmd/kubectl-testkube/commands/scripts/watch_script_execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,17 @@ func NewWatchExecutionCmd() *cobra.Command {
}

client, _ := GetClient(cmd)
execution, err := client.GetExecution("", executionID)
if err != nil {

watchLogs(executionID, client)
ui.Failf("execution result retrievel failed with err %s", err)
}

if execution.ExecutionResult.IsCompleted() {
ui.Completed("execution is already finished")
} else {
watchLogs(executionID, client)
}

},
}
Expand Down

0 comments on commit 2e9e920

Please sign in to comment.