Skip to content

Commit b420dad

Browse files
authored
Merge pull request #90 from yangcao77/changes-before-2.2.0
library for devfile 2.1.0 cut off
2 parents 2aa02fa + 665d584 commit b420dad

File tree

7 files changed

+16
-192
lines changed

7 files changed

+16
-192
lines changed

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-20210507143755-39103b31c0f3
6+
github.com/devfile/api/v2 v2.1.0
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

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7Do
7575
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
7676
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
7777
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
78-
github.com/devfile/api/v2 v2.0.0-20210507143755-39103b31c0f3 h1:gm67QZRqq8vCtrpxXlTNPf7xss5rjn9CFcPtAUr+nqo=
79-
github.com/devfile/api/v2 v2.0.0-20210507143755-39103b31c0f3/go.mod h1:Cot4snybn3qhIh48oIFi9McocnIx7zY5fFbjfrIpPvg=
78+
github.com/devfile/api/v2 v2.1.0 h1:hodMaQpa9onnx8uG5NBxIuzBjC7AUkLTGCcuvZyED7g=
79+
github.com/devfile/api/v2 v2.1.0/go.mod h1:Cot4snybn3qhIh48oIFi9McocnIx7zY5fFbjfrIpPvg=
8080
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
8181
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
8282
github.com/docker/docker v0.7.3-0.20190327010347-be7ac8be2ae0/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=

pkg/devfile/generator/utils_test.go

+1-11
Original file line numberDiff line numberDiff line change
@@ -303,16 +303,6 @@ func TestAddSyncFolder(t *testing.T) {
303303
},
304304
},
305305
},
306-
{
307-
Name: projectNames[1],
308-
ProjectSource: v1.ProjectSource{
309-
Github: &v1.GithubProjectSource{
310-
GitLikeProjectSource: v1.GitLikeProjectSource{
311-
Remotes: map[string]string{"origin": projectRepos[0]},
312-
},
313-
},
314-
},
315-
},
316306
{
317307
Name: projectNames[1],
318308
ProjectSource: v1.ProjectSource{
@@ -348,7 +338,7 @@ func TestAddSyncFolder(t *testing.T) {
348338
ClonePath: invalidClonePaths[0],
349339
Name: projectNames[0],
350340
ProjectSource: v1.ProjectSource{
351-
Github: &v1.GithubProjectSource{
341+
Git: &v1.GitProjectSource{
352342
GitLikeProjectSource: v1.GitLikeProjectSource{
353343
Remotes: map[string]string{"origin": projectRepos[0]},
354344
},

pkg/devfile/parser/data/v2/2.1.0/devfileJsonSchema210.go

+3-159
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package version210
22

3-
// https://raw.githubusercontent.com/devfile/api/main/schemas/latest/devfile.json
3+
// https://raw.githubusercontent.com/devfile/api/2.1.x/schemas/latest/devfile.json
44
const JsonSchema210 = `{
55
"description": "Devfile describes the structure of a cloud-native devworkspace and development environment.",
66
"type": "object",
7-
"title": "Devfile schema - Version 2.1.0-alpha",
7+
"title": "Devfile schema - Version 2.1.0",
88
"required": [
99
"schemaVersion"
1010
],
@@ -657,7 +657,7 @@ const JsonSchema210 = `{
657657
"type": "string"
658658
},
659659
"icon": {
660-
"description": "Optional devfile icon",
660+
"description": "Optional devfile icon, can be a URI or a relative path in the project",
661661
"type": "string"
662662
},
663663
"language": {
@@ -1306,11 +1306,6 @@ const JsonSchema210 = `{
13061306
"git"
13071307
]
13081308
},
1309-
{
1310-
"required": [
1311-
"github"
1312-
]
1313-
},
13141309
{
13151310
"required": [
13161311
"zip"
@@ -1356,48 +1351,12 @@ const JsonSchema210 = `{
13561351
},
13571352
"additionalProperties": false
13581353
},
1359-
"github": {
1360-
"description": "Project's GitHub source. Deprecated, use 'Git' instead",
1361-
"type": "object",
1362-
"properties": {
1363-
"checkoutFrom": {
1364-
"description": "Defines from what the project should be checked out. Required if there are more than one remote configured",
1365-
"type": "object",
1366-
"properties": {
1367-
"remote": {
1368-
"description": "The remote name should be used as init. Required if there are more than one remote configured",
1369-
"type": "string"
1370-
},
1371-
"revision": {
1372-
"description": "The revision to checkout from. Should be branch name, tag or commit id. Default branch is used if missing or specified revision is not found.",
1373-
"type": "string"
1374-
}
1375-
},
1376-
"additionalProperties": false
1377-
},
1378-
"remotes": {
1379-
"description": "The remotes map which should be initialized in the git project. Must have at least one remote configured",
1380-
"type": "object",
1381-
"additionalProperties": {
1382-
"type": "string"
1383-
}
1384-
}
1385-
},
1386-
"additionalProperties": false
1387-
},
13881354
"name": {
13891355
"description": "Project name",
13901356
"type": "string",
13911357
"maxLength": 63,
13921358
"pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"
13931359
},
1394-
"sparseCheckoutDirs": {
1395-
"description": "Populate the project sparsely with selected directories.",
1396-
"type": "array",
1397-
"items": {
1398-
"type": "string"
1399-
}
1400-
},
14011360
"zip": {
14021361
"description": "Project's Zip source",
14031362
"type": "object",
@@ -1431,11 +1390,6 @@ const JsonSchema210 = `{
14311390
"git"
14321391
]
14331392
},
1434-
{
1435-
"required": [
1436-
"github"
1437-
]
1438-
},
14391393
{
14401394
"required": [
14411395
"zip"
@@ -1481,35 +1435,6 @@ const JsonSchema210 = `{
14811435
},
14821436
"additionalProperties": false
14831437
},
1484-
"github": {
1485-
"description": "Project's GitHub source. Deprecated, use 'Git' instead",
1486-
"type": "object",
1487-
"properties": {
1488-
"checkoutFrom": {
1489-
"description": "Defines from what the project should be checked out. Required if there are more than one remote configured",
1490-
"type": "object",
1491-
"properties": {
1492-
"remote": {
1493-
"description": "The remote name should be used as init. Required if there are more than one remote configured",
1494-
"type": "string"
1495-
},
1496-
"revision": {
1497-
"description": "The revision to checkout from. Should be branch name, tag or commit id. Default branch is used if missing or specified revision is not found.",
1498-
"type": "string"
1499-
}
1500-
},
1501-
"additionalProperties": false
1502-
},
1503-
"remotes": {
1504-
"description": "The remotes map which should be initialized in the git project. Must have at least one remote configured",
1505-
"type": "object",
1506-
"additionalProperties": {
1507-
"type": "string"
1508-
}
1509-
}
1510-
},
1511-
"additionalProperties": false
1512-
},
15131438
"name": {
15141439
"description": "Project name",
15151440
"type": "string",
@@ -1563,11 +1488,6 @@ const JsonSchema210 = `{
15631488
"git"
15641489
]
15651490
},
1566-
{
1567-
"required": [
1568-
"github"
1569-
]
1570-
},
15711491
{
15721492
"required": [
15731493
"zip"
@@ -1616,51 +1536,12 @@ const JsonSchema210 = `{
16161536
},
16171537
"additionalProperties": false
16181538
},
1619-
"github": {
1620-
"description": "Project's GitHub source. Deprecated, use 'Git' instead",
1621-
"type": "object",
1622-
"required": [
1623-
"remotes"
1624-
],
1625-
"properties": {
1626-
"checkoutFrom": {
1627-
"description": "Defines from what the project should be checked out. Required if there are more than one remote configured",
1628-
"type": "object",
1629-
"properties": {
1630-
"remote": {
1631-
"description": "The remote name should be used as init. Required if there are more than one remote configured",
1632-
"type": "string"
1633-
},
1634-
"revision": {
1635-
"description": "The revision to checkout from. Should be branch name, tag or commit id. Default branch is used if missing or specified revision is not found.",
1636-
"type": "string"
1637-
}
1638-
},
1639-
"additionalProperties": false
1640-
},
1641-
"remotes": {
1642-
"description": "The remotes map which should be initialized in the git project. Must have at least one remote configured",
1643-
"type": "object",
1644-
"additionalProperties": {
1645-
"type": "string"
1646-
}
1647-
}
1648-
},
1649-
"additionalProperties": false
1650-
},
16511539
"name": {
16521540
"description": "Project name",
16531541
"type": "string",
16541542
"maxLength": 63,
16551543
"pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"
16561544
},
1657-
"sparseCheckoutDirs": {
1658-
"description": "Populate the project sparsely with selected directories.",
1659-
"type": "array",
1660-
"items": {
1661-
"type": "string"
1662-
}
1663-
},
16641545
"zip": {
16651546
"description": "Project's Zip source",
16661547
"type": "object",
@@ -1695,11 +1576,6 @@ const JsonSchema210 = `{
16951576
"git"
16961577
]
16971578
},
1698-
{
1699-
"required": [
1700-
"github"
1701-
]
1702-
},
17031579
{
17041580
"required": [
17051581
"zip"
@@ -1748,38 +1624,6 @@ const JsonSchema210 = `{
17481624
},
17491625
"additionalProperties": false
17501626
},
1751-
"github": {
1752-
"description": "Project's GitHub source. Deprecated, use 'Git' instead",
1753-
"type": "object",
1754-
"required": [
1755-
"remotes"
1756-
],
1757-
"properties": {
1758-
"checkoutFrom": {
1759-
"description": "Defines from what the project should be checked out. Required if there are more than one remote configured",
1760-
"type": "object",
1761-
"properties": {
1762-
"remote": {
1763-
"description": "The remote name should be used as init. Required if there are more than one remote configured",
1764-
"type": "string"
1765-
},
1766-
"revision": {
1767-
"description": "The revision to checkout from. Should be branch name, tag or commit id. Default branch is used if missing or specified revision is not found.",
1768-
"type": "string"
1769-
}
1770-
},
1771-
"additionalProperties": false
1772-
},
1773-
"remotes": {
1774-
"description": "The remotes map which should be initialized in the git project. Must have at least one remote configured",
1775-
"type": "object",
1776-
"additionalProperties": {
1777-
"type": "string"
1778-
}
1779-
}
1780-
},
1781-
"additionalProperties": false
1782-
},
17831627
"name": {
17841628
"description": "Project name",
17851629
"type": "string",

pkg/devfile/parser/data/v2/common/project_helper.go

-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ func GetProjectSourceType(projectSrc v1.ProjectSource) (v1.ProjectSourceType, er
4747
switch {
4848
case projectSrc.Git != nil:
4949
return v1.GitProjectSourceType, nil
50-
case projectSrc.Github != nil:
51-
return v1.GitHubProjectSourceType, nil
5250
case projectSrc.Zip != nil:
5351
return v1.ZipProjectSourceType, nil
5452
case projectSrc.Custom != nil:

pkg/devfile/parser/data/v2/common/project_helper_test.go

-8
Original file line numberDiff line numberDiff line change
@@ -134,14 +134,6 @@ func TestGetProjectSrcType(t *testing.T) {
134134
projectSrcType: v1.GitProjectSourceType,
135135
wantErr: false,
136136
},
137-
{
138-
name: "Github project",
139-
projectSrc: v1.ProjectSource{
140-
Github: &v1.GithubProjectSource{},
141-
},
142-
projectSrcType: v1.GitHubProjectSourceType,
143-
wantErr: false,
144-
},
145137
{
146138
name: "Zip project",
147139
projectSrc: v1.ProjectSource{

pkg/devfile/parser/parse_test.go

+9-9
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ func Test_parseParentAndPluginFromURI(t *testing.T) {
7676
{
7777
ClonePath: "/data",
7878
ProjectSource: v1.ProjectSource{
79-
Github: &v1.GithubProjectSource{
79+
Git: &v1.GitProjectSource{
8080
GitLikeProjectSource: v1.GitLikeProjectSource{
8181
Remotes: map[string]string{
8282
"master": "https://githube.com/somerepo/someproject.git",
@@ -248,7 +248,7 @@ func Test_parseParentAndPluginFromURI(t *testing.T) {
248248
Attributes: parentOverridesFromMainDevfile,
249249
ClonePath: "/projects",
250250
ProjectSource: v1.ProjectSource{
251-
Github: &v1.GithubProjectSource{
251+
Git: &v1.GitProjectSource{
252252
GitLikeProjectSource: v1.GitLikeProjectSource{
253253
Remotes: map[string]string{
254254
"master": "https://githube.com/somerepo/someproject.git",
@@ -379,7 +379,7 @@ func Test_parseParentAndPluginFromURI(t *testing.T) {
379379
Attributes: importFromUri1,
380380
ClonePath: "/data",
381381
ProjectSource: v1.ProjectSource{
382-
Github: &v1.GithubProjectSource{
382+
Git: &v1.GitProjectSource{
383383
GitLikeProjectSource: v1.GitLikeProjectSource{
384384
Remotes: map[string]string{
385385
"master": "https://githube.com/somerepo/someproject.git",
@@ -766,7 +766,7 @@ func Test_parseParentAndPluginFromURI(t *testing.T) {
766766
{
767767
ClonePath: "/data",
768768
ProjectSource: v1.ProjectSource{
769-
Github: &v1.GithubProjectSource{
769+
Git: &v1.GitProjectSource{
770770
GitLikeProjectSource: v1.GitLikeProjectSource{
771771
Remotes: map[string]string{
772772
"master": "https://githube.com/somerepo/someproject.git",
@@ -843,7 +843,7 @@ func Test_parseParentAndPluginFromURI(t *testing.T) {
843843
Attributes: importFromUri2,
844844
ClonePath: "/data",
845845
ProjectSource: v1.ProjectSource{
846-
Github: &v1.GithubProjectSource{
846+
Git: &v1.GitProjectSource{
847847
GitLikeProjectSource: v1.GitLikeProjectSource{
848848
Remotes: map[string]string{
849849
"master": "https://githube.com/somerepo/someproject.git",
@@ -953,7 +953,7 @@ func Test_parseParentAndPluginFromURI(t *testing.T) {
953953
{
954954
ClonePath: "/data",
955955
ProjectSource: v1.ProjectSource{
956-
Github: &v1.GithubProjectSource{
956+
Git: &v1.GitProjectSource{
957957
GitLikeProjectSource: v1.GitLikeProjectSource{
958958
Remotes: map[string]string{
959959
"master": "https://githube.com/somerepo/someproject.git",
@@ -1056,7 +1056,7 @@ func Test_parseParentAndPluginFromURI(t *testing.T) {
10561056
Attributes: importFromUri2,
10571057
ClonePath: "/data",
10581058
ProjectSource: v1.ProjectSource{
1059-
Github: &v1.GithubProjectSource{
1059+
Git: &v1.GitProjectSource{
10601060
GitLikeProjectSource: v1.GitLikeProjectSource{
10611061
Remotes: map[string]string{
10621062
"master": "https://githube.com/somerepo/someproject.git",
@@ -1595,7 +1595,7 @@ func Test_parseParentAndPluginFromURI(t *testing.T) {
15951595
{
15961596
ClonePath: "/data",
15971597
ProjectSource: v1.ProjectSource{
1598-
Github: &v1.GithubProjectSource{
1598+
Git: &v1.GitProjectSource{
15991599
GitLikeProjectSource: v1.GitLikeProjectSource{
16001600
Remotes: map[string]string{
16011601
"master": "https://githube.com/somerepo/someproject.git",
@@ -1737,7 +1737,7 @@ func Test_parseParentAndPluginFromURI(t *testing.T) {
17371737
Attributes: parentOverridesFromMainDevfile,
17381738
ClonePath: "/projects",
17391739
ProjectSource: v1.ProjectSource{
1740-
Github: &v1.GithubProjectSource{
1740+
Git: &v1.GitProjectSource{
17411741
GitLikeProjectSource: v1.GitLikeProjectSource{
17421742
Remotes: map[string]string{
17431743
"master": "https://githube.com/somerepo/someproject.git",

0 commit comments

Comments
 (0)