progress: basic workflow execution from template.

This commit is contained in:
Andrey Melnikov
2020-04-08 16:42:32 -07:00
parent d4c919c9be
commit 02815b9cf0
4 changed files with 40 additions and 13 deletions

View File

@@ -5,7 +5,6 @@ import (
"errors"
"github.com/onepanelio/core/pkg/util"
"google.golang.org/grpc/codes"
"gopkg.in/yaml.v2"
"math"
"sort"
"strings"
@@ -60,22 +59,12 @@ func apiWorkflowExecution(wf *v1.WorkflowExecution) (workflow *api.WorkflowExecu
}
func apiWorkflowTemplate(wft *v1.WorkflowTemplate) *api.WorkflowTemplate {
mapping := make(map[interface{}]interface{})
if err := yaml.Unmarshal([]byte(wft.Manifest), mapping); err != nil {
return nil
}
finalManifest, err := yaml.Marshal(mapping["spec"])
if err != nil {
return nil
}
return &api.WorkflowTemplate{
Uid: wft.UID,
CreatedAt: wft.CreatedAt.UTC().Format(time.RFC3339),
Name: wft.Name,
Version: wft.Version,
Manifest: string(finalManifest),
Manifest: wft.Manifest,
IsLatest: wft.IsLatest,
IsArchived: wft.IsArchived,
}