-
Notifications
You must be signed in to change notification settings - Fork 3.1k
/
wait.go
32 lines (26 loc) · 889 Bytes
/
wait.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package commands
import (
"github.com/spf13/cobra"
"github.com/argoproj/argo-workflows/v3/cmd/argo/commands/client"
"github.com/argoproj/argo-workflows/v3/cmd/argo/commands/common"
)
func NewWaitCommand() *cobra.Command {
var ignoreNotFound bool
command := &cobra.Command{
Use: "wait [WORKFLOW...]",
Short: "waits for workflows to complete",
Example: `# Wait on a workflow:
argo wait my-wf
# Wait on the latest workflow:
argo wait @latest
`,
Run: func(cmd *cobra.Command, args []string) {
ctx, apiClient := client.NewAPIClient(cmd.Context())
serviceClient := apiClient.NewWorkflowServiceClient()
namespace := client.Namespace()
common.WaitWorkflows(ctx, serviceClient, namespace, args, ignoreNotFound, false)
},
}
command.Flags().BoolVar(&ignoreNotFound, "ignore-not-found", false, "Ignore the wait if the workflow is not found")
return command
}