create workflow by template reference

This commit is contained in:
rushtehrani
2019-12-12 22:08:21 -08:00
parent 0cbfe67c21
commit 2179af0d76
2 changed files with 7 additions and 2 deletions

View File

@@ -8,6 +8,11 @@ import (
)
func (r *ResourceManager) CreateWorkflow(namespace string, workflow *model.Workflow) (createdWorkflow *model.Workflow, err error) {
workflowTemplate, err := r.workflowRepository.GetWorkflowTemplate(workflow.WorkflowTemplate.UID)
if err != nil {
return nil, util.NewUserError(codes.NotFound, "Workflow template not found.")
}
opts := &argo.Options{
Namespace: namespace,
}
@@ -18,7 +23,7 @@ func (r *ResourceManager) CreateWorkflow(namespace string, workflow *model.Workf
})
}
createdWorkflows, err := r.argClient.Create(workflow.WorkflowTemplate.GetManifestBytes(), opts)
createdWorkflows, err := r.argClient.Create(workflowTemplate.GetManifestBytes(), opts)
if err != nil {
return
}

View File

@@ -24,7 +24,7 @@ func NewWorkflowServer(resourceManager *manager.ResourceManager) *WorkflowServer
func (s *WorkflowServer) CreateWorkflow(ctx context.Context, req *api.CreateWorkflowRequest) (*api.Workflow, error) {
workflow := &model.Workflow{
WorkflowTemplate: model.WorkflowTemplate{
Manifest: req.Workflow.WorkflowTemplate.Manifest,
UID: req.Workflow.WorkflowTemplate.Uid,
},
}
for _, param := range req.Workflow.Parameters {