Skip to content

Commit

Permalink
Fix UX issue when exec command fails to run as part of a deploy comma…
Browse files Browse the repository at this point in the history
…nd (#6673)

For the context, before the changes, the "Execution output" message
was displayed on the same line as the spinner, e.g.:

```
↪ Executing command:
◓  Executing command in container (command: exec-deploy)Execution output:
/bin/sh: line 1: helm: command not found
 ✗  Executing command in container (command: exec-deploy) [8s]
 ✗  failed to execute (command: exec-deploy)
```

This is now fixed by ending the spinner as soon as possible,
and then displaying the command output:

```
↪ Executing command:
 ✗  Executing command in container (command: exec-deploy) [8s]
Execution output:
/bin/sh: line 1: helm: command not found
 ✗  failed to execute (command: exec-deploy)

```
  • Loading branch information
rm3l authored Mar 23, 2023
1 parent 47234b9 commit 2ef5316
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/deploy/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,9 @@ func (o *deployHandler) Execute(command v1alpha2.Command) error {
// Wait for the command to complete execution
_, err = o.kubeClient.WaitForJobToComplete(createdJob)
done <- struct{}{}

spinner.End(err == nil)

if err != nil {
err = fmt.Errorf("failed to execute (command: %s)", command.Id)
// Print the job logs if the job failed
Expand All @@ -203,8 +206,6 @@ func (o *deployHandler) Execute(command v1alpha2.Command) error {
_ = util.DisplayLog(false, jobLogs, log.GetStderr(), o.componentName, 100)
}

spinner.End(err == nil)

return err
}

Expand Down

0 comments on commit 2ef5316

Please sign in to comment.