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

Function ValidateWorkflowTemplate

workflow/validate/validate.go:371–386  ·  view source on GitHub ↗

ValidateWorkflowTemplate accepts a workflow template and performs validation against it.

(ctx context.Context, wftmplGetter templateresolution.WorkflowTemplateNamespacedGetter, cwftmplGetter templateresolution.ClusterWorkflowTemplateGetter, wftmpl *wfv1.WorkflowTemplate, wfDefaults *wfv1.Workflow, opts ValidateOpts)

Source from the content-addressed store, hash-verified

369
370// ValidateWorkflowTemplate accepts a workflow template and performs validation against it.
371func ValidateWorkflowTemplate(ctx context.Context, wftmplGetter templateresolution.WorkflowTemplateNamespacedGetter, cwftmplGetter templateresolution.ClusterWorkflowTemplateGetter, wftmpl *wfv1.WorkflowTemplate, wfDefaults *wfv1.Workflow, opts ValidateOpts) error {
372 if len(wftmpl.Name) > maxCharsInObjectName {
373 return fmt.Errorf("workflow template name %q must not be more than 63 characters long (currently %d)", wftmpl.Name, len(wftmpl.Name))
374 }
375
376 wf := &wfv1.Workflow{
377 ObjectMeta: v1.ObjectMeta{
378 Labels: wftmpl.Labels,
379 Annotations: wftmpl.Annotations,
380 },
381 Spec: wftmpl.Spec,
382 }
383 opts.IgnoreEntrypoint = wf.Spec.Entrypoint == ""
384 opts.WorkflowTemplateValidation = true
385 return ValidateWorkflow(ctx, wftmplGetter, cwftmplGetter, wf, wfDefaults, opts)
386}
387
388// ValidateClusterWorkflowTemplate accepts a cluster workflow template and performs validation against it.
389func ValidateClusterWorkflowTemplate(ctx context.Context, wftmplGetter templateresolution.WorkflowTemplateNamespacedGetter, cwftmplGetter templateresolution.ClusterWorkflowTemplateGetter, cwftmpl *wfv1.ClusterWorkflowTemplate, wfDefaults *wfv1.Workflow, opts ValidateOpts) error {

Callers 6

LintWorkflowTemplateMethod · 0.92
LintWorkflowTemplateMethod · 0.92
validateWorkflowTemplateFunction · 0.85
TestMaxLengthNameFunction · 0.85

Calls 1

ValidateWorkflowFunction · 0.85

Tested by 2

validateWorkflowTemplateFunction · 0.68
TestMaxLengthNameFunction · 0.68