MCPcopy
hub / github.com/argoproj/argo-workflows / SplitWorkflowYAMLFile

Function SplitWorkflowYAMLFile

workflow/common/parse.go:122–138  ·  view source on GitHub ↗

SplitWorkflowYAMLFile is a helper to split a body into multiple workflow objects

(ctx context.Context, body []byte, strict bool)

Source from the content-addressed store, hash-verified

120
121// SplitWorkflowYAMLFile is a helper to split a body into multiple workflow objects
122func SplitWorkflowYAMLFile(ctx context.Context, body []byte, strict bool) ([]wfv1.Workflow, error) {
123 log := logging.RequireLoggerFromContext(ctx)
124 manifests := make([]wfv1.Workflow, 0)
125 for _, res := range ParseObjects(ctx, body, strict) {
126 obj, err := res.Object, res.Err
127 v, ok := obj.(*wfv1.Workflow)
128 if !ok {
129 log.WithField("name", obj.GetName()).Warn(ctx, "Object is not of kind Workflow. Ignoring...")
130 continue
131 }
132 if err != nil { // only returns parsing errors for workflow types
133 return nil, err
134 }
135 manifests = append(manifests, *v)
136 }
137 return manifests, nil
138}
139
140// SplitWorkflowTemplateYAMLFile is a helper to split a body into multiple workflow template objects
141func SplitWorkflowTemplateYAMLFile(ctx context.Context, body []byte, strict bool) ([]wfv1.WorkflowTemplate, error) {

Callers 2

TestExampleWorkflowsFunction · 0.92

Calls 5

RequireLoggerFromContextFunction · 0.92
ParseObjectsFunction · 0.85
WarnMethod · 0.65
WithFieldMethod · 0.65
GetNameMethod · 0.65

Tested by 2

TestExampleWorkflowsFunction · 0.74