MCPcopy
hub / github.com/kubevela/kubevela / Run

Function Run

pkg/builtin/registry/registry.go:89–107  ·  view source on GitHub ↗

Run executes tasks Deprecated: Run is deprecated, you should use DoTasks is builtin package, it will automatically register all internal functions

(spec map[string]interface{}, io util.IOStreams)

Source from the content-addressed store, hash-verified

87// Run executes tasks
88// Deprecated: Run is deprecated, you should use DoTasks is builtin package, it will automatically register all internal functions
89func Run(spec map[string]interface{}, io util.IOStreams) (map[string]interface{}, error) {
90 var (
91 ctx = newCallCtx(io, spec)
92 retSpec = map[string]interface{}{}
93 )
94
95 tasks := GetTasks()
96
97 for key, params := range spec {
98 if do, ok := tasks[key]; ok {
99 if err := do(ctx, params); err != nil {
100 return nil, errors.WithMessagef(err, "do task %s", key)
101 }
102 } else {
103 retSpec[key] = params
104 }
105 }
106 return retSpec, nil
107}

Callers 2

RunBuildInTasksFunction · 0.92
TestDoTasksFunction · 0.70

Calls 2

newCallCtxFunction · 0.85
GetTasksFunction · 0.85

Tested by 1

TestDoTasksFunction · 0.56