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)
| 369 | |
| 370 | // ValidateWorkflowTemplate accepts a workflow template and performs validation against it. |
| 371 | func 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. |
| 389 | func ValidateClusterWorkflowTemplate(ctx context.Context, wftmplGetter templateresolution.WorkflowTemplateNamespacedGetter, cwftmplGetter templateresolution.ClusterWorkflowTemplateGetter, cwftmpl *wfv1.ClusterWorkflowTemplate, wfDefaults *wfv1.Workflow, opts ValidateOpts) error { |