Skip to content

Commit c95f71f

Browse files
committed
Merge branch 'master' of github.com:devfile/library into 309-relativeURI
2 parents 78e6b28 + ae471a9 commit c95f71f

File tree

7 files changed

+3441
-7
lines changed

7 files changed

+3441
-7
lines changed

devfile.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
schemaVersion: 2.0.0
1+
schemaVersion: 2.1.0
22
metadata:
33
name: nodejs
44
version: 1.0.0

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/devfile/library
33
go 1.13
44

55
require (
6-
github.com/devfile/api/v2 v2.0.0-20210111205815-273464363288
6+
github.com/devfile/api/v2 v2.0.0-20210121164412-49ba915897f4
77
github.com/fatih/color v1.7.0
88
github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32
99
github.com/gobwas/glob v0.2.3

go.sum

+3-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7Do
4444
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
4545
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
4646
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
47-
github.com/devfile/api/v2 v2.0.0-20210111205815-273464363288 h1:3Ea0dVgtCEyWSjobneehLnqIGoK2pS6bWnGnJ1ek24Q=
48-
github.com/devfile/api/v2 v2.0.0-20210111205815-273464363288/go.mod h1:ujP0i3nip2g/aSOXGEy3A7vTC6EIe1kZf9Cteja6OJg=
47+
github.com/devfile/api/v2 v2.0.0-20210121164412-49ba915897f4 h1:jDzWFpF/BoyaemoPjAzw5SmlX172JsSsh+Frujm5Ww4=
48+
github.com/devfile/api/v2 v2.0.0-20210121164412-49ba915897f4/go.mod h1:Cot4snybn3qhIh48oIFi9McocnIx7zY5fFbjfrIpPvg=
4949
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
5050
github.com/docker/docker v0.7.3-0.20190327010347-be7ac8be2ae0/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
5151
github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
@@ -290,6 +290,7 @@ github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsT
290290
github.com/prometheus/procfs v0.0.11/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
291291
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
292292
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
293+
github.com/santhosh-tekuri/jsonschema v1.2.4/go.mod h1:TEAUOeZSmIxTTuHatJzrvARHiuO9LYd+cIxzgEHCQI4=
293294
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
294295
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
295296
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=

main.go

+16-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ package main
22

33
import (
44
"fmt"
5+
"os"
56
"reflect"
7+
"strings"
68

79
devfilepkg "github.com/devfile/library/pkg/devfile"
810
"github.com/devfile/library/pkg/devfile/parser"
@@ -11,7 +13,20 @@ import (
1113
)
1214

1315
func main() {
14-
devfile, err := ParseDevfile("./devfile.yaml")
16+
var devfile parser.DevfileObj
17+
var err error
18+
if len(os.Args) > 1 {
19+
if strings.HasPrefix(os.Args[1], "http") {
20+
devfile, err = devfilepkg.ParseFromURLAndValidate(os.Args[1])
21+
} else {
22+
devfile, err = ParseDevfile(os.Args[1])
23+
}
24+
fmt.Println("parsing devfile from " + os.Args[1])
25+
26+
} else {
27+
devfile, err = ParseDevfile("devfile.yaml")
28+
fmt.Println("parsing devfile from " + devfile.Ctx.GetAbsPath())
29+
}
1530
if err != nil {
1631
fmt.Println(err)
1732
} else {

pkg/devfile/parser/data/v2/2.0.0/devfileJsonSchema200.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package version200
22

3-
// https://raw.githubusercontent.com/devfile/api/master/schemas/devfile.json
3+
// https://raw.githubusercontent.com/devfile/api/2.0.x/schemas/latest/devfile.json
44
const JsonSchema200 = `{
55
"description": "Devfile describes the structure of a cloud-native workspace and development environment.",
66
"type": "object",
7-
"title": "Devfile schema - Version 2.0.0-alpha2",
7+
"title": "Devfile schema - Version 2.0.0",
88
"required": [
99
"schemaVersion"
1010
],

0 commit comments

Comments
 (0)