be build fail when parse failed to FunctionSpec

This commit is contained in:
yugo kobayashi
2022-08-19 00:58:22 +00:00
parent e2e9181bed
commit f086269d6e
6 changed files with 79 additions and 47 deletions

View File

@@ -51,13 +51,16 @@ func resourceToRNode(res *resource.Resource) (*yaml.RNode, error) {
}
// GetFunctionSpec return function spec is there is. Otherwise return nil
func GetFunctionSpec(res *resource.Resource) *runtimeutil.FunctionSpec {
func GetFunctionSpec(res *resource.Resource) (*runtimeutil.FunctionSpec, error) {
rnode, err := resourceToRNode(res)
if err != nil {
return nil
return nil, fmt.Errorf("%w", err)
}
return runtimeutil.GetFunctionSpec(rnode)
functionSpec, err := runtimeutil.GetFunctionSpec(rnode)
if err != nil {
return nil, fmt.Errorf("%w", err)
}
return functionSpec, nil
}
func toStorageMounts(mounts []string) []runtimeutil.StorageMount {