This repository has been archived by the owner on May 31, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 82
/
workflow_meta.go
51 lines (41 loc) · 1.53 KB
/
workflow_meta.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package update
import (
"context"
"fmt"
"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/core"
"github.com/flyteorg/flytectl/clierrors"
"github.com/flyteorg/flytectl/cmd/config"
cmdCore "github.com/flyteorg/flytectl/cmd/core"
)
const (
updateWorkflowShort = "Update workflow metadata"
updateWorkflowLong = `
Update the description on the workflow:
::
flytectl update workflow-meta -p flytesnacks -d development core.control_flow.merge_sort.merge_sort --description "Mergesort workflow example"
Archiving workflow named entity would cause this to disappear from flyteconsole UI:
::
flytectl update workflow-meta -p flytesnacks -d development core.control_flow.merge_sort.merge_sort --archive
Activate workflow named entity:
::
flytectl update workflow-meta -p flytesnacks -d development core.control_flow.merge_sort.merge_sort --activate
Usage
`
)
func getUpdateWorkflowFunc(namedEntityConfig *NamedEntityConfig) func(ctx context.Context, args []string, cmdCtx cmdCore.CommandContext) error {
return func(ctx context.Context, args []string, cmdCtx cmdCore.CommandContext) error {
project := config.GetConfig().Project
domain := config.GetConfig().Domain
if len(args) != 1 {
return fmt.Errorf(clierrors.ErrWorkflowNotPassed)
}
name := args[0]
err := namedEntityConfig.UpdateNamedEntity(ctx, name, project, domain, core.ResourceType_WORKFLOW, cmdCtx)
if err != nil {
fmt.Printf(clierrors.ErrFailedWorkflowUpdate, name, err)
return err
}
fmt.Printf("updated metadata successfully on %v", name)
return nil
}
}