forked from devfile/library
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
31 lines (25 loc) · 691 Bytes
/
main.go
File metadata and controls
31 lines (25 loc) · 691 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package main
import (
"fmt"
"github.com/devfile/parser/pkg/devfile/parser"
devfileParser "github.com/devfile/parser/pkg/devfile/parser"
)
func main() {
devfile, err := ParseDevfile("devfile.yaml")
if err != nil {
fmt.Println(err)
} else {
for _, component := range devfile.Data.GetAliasedComponents() {
if component.Dockerfile != nil {
fmt.Println(component.Dockerfile.DockerfileLocation)
break
}
}
}
}
//ParseDevfile to parse devfile from library
func ParseDevfile(devfileLocation string) (devfileoj parser.DevfileObj, err error) {
var devfile devfileParser.DevfileObj
devfile, err = devfileParser.ParseAndValidate(devfileLocation)
return devfile, err
}