mirror of
https://github.com/onepanelio/onepanel.git
synced 2025-10-22 05:00:07 +08:00
create workflow by template reference
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
@@ -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 {
|
||||
|
Reference in New Issue
Block a user