validate workflow template

This commit is contained in:
rushtehrani
2019-12-20 18:42:04 -08:00
parent 0484dc0289
commit d000114eb3
2 changed files with 11 additions and 0 deletions

View File

@@ -155,6 +155,11 @@ func (r *ResourceManager) ListWorkflows(namespace, workflowTemplateUID string) (
}
func (r *ResourceManager) CreateWorkflowTemplate(namespace string, workflowTemplate *model.WorkflowTemplate) (*model.WorkflowTemplate, error) {
// validate workflow template
if err := r.argClient.ValidateWorkflow(workflowTemplate.GetManifestBytes()); err != nil {
return nil, util.NewUserError(codes.InvalidArgument, err.Error())
}
workflowTemplate, err := r.workflowRepository.CreateWorkflowTemplate(namespace, workflowTemplate)
if err != nil {
return nil, util.NewUserErrorWrap(err, "Workflow template")