diff --git a/go.mod b/go.mod index c2ac4bb9..5038fbfa 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/devfile/library go 1.13 require ( - github.com/devfile/api/v2 v2.0.0-20210507143755-39103b31c0f3 + github.com/devfile/api/v2 v2.0.0-20210519125756-e7f24e33ee17 github.com/fatih/color v1.7.0 github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32 github.com/gobwas/glob v0.2.3 diff --git a/go.sum b/go.sum index 9ef7274b..40fde0a9 100644 --- a/go.sum +++ b/go.sum @@ -75,8 +75,8 @@ github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7Do github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/devfile/api/v2 v2.0.0-20210507143755-39103b31c0f3 h1:gm67QZRqq8vCtrpxXlTNPf7xss5rjn9CFcPtAUr+nqo= -github.com/devfile/api/v2 v2.0.0-20210507143755-39103b31c0f3/go.mod h1:Cot4snybn3qhIh48oIFi9McocnIx7zY5fFbjfrIpPvg= +github.com/devfile/api/v2 v2.0.0-20210519125756-e7f24e33ee17 h1:+XRdBE7jM0mBdJbjLlu+fKKILHAeamuf5oK+BZZk0Qs= +github.com/devfile/api/v2 v2.0.0-20210519125756-e7f24e33ee17/go.mod h1:Cot4snybn3qhIh48oIFi9McocnIx7zY5fFbjfrIpPvg= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/docker/docker v0.7.3-0.20190327010347-be7ac8be2ae0/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= diff --git a/pkg/devfile/generator/utils_test.go b/pkg/devfile/generator/utils_test.go index 71f9e065..f034d4cc 100644 --- a/pkg/devfile/generator/utils_test.go +++ b/pkg/devfile/generator/utils_test.go @@ -303,16 +303,6 @@ func TestAddSyncFolder(t *testing.T) { }, }, }, - { - Name: projectNames[1], - ProjectSource: v1.ProjectSource{ - Github: &v1.GithubProjectSource{ - GitLikeProjectSource: v1.GitLikeProjectSource{ - Remotes: map[string]string{"origin": projectRepos[0]}, - }, - }, - }, - }, { Name: projectNames[1], ProjectSource: v1.ProjectSource{ @@ -348,7 +338,7 @@ func TestAddSyncFolder(t *testing.T) { ClonePath: invalidClonePaths[0], Name: projectNames[0], ProjectSource: v1.ProjectSource{ - Github: &v1.GithubProjectSource{ + Git: &v1.GitProjectSource{ GitLikeProjectSource: v1.GitLikeProjectSource{ Remotes: map[string]string{"origin": projectRepos[0]}, }, diff --git a/pkg/devfile/parser/data/v2/2.1.0/devfileJsonSchema210.go b/pkg/devfile/parser/data/v2/2.1.0/devfileJsonSchema210.go index 57c734a8..6efb79c6 100644 --- a/pkg/devfile/parser/data/v2/2.1.0/devfileJsonSchema210.go +++ b/pkg/devfile/parser/data/v2/2.1.0/devfileJsonSchema210.go @@ -4,7 +4,7 @@ package version210 const JsonSchema210 = `{ "description": "Devfile describes the structure of a cloud-native devworkspace and development environment.", "type": "object", - "title": "Devfile schema - Version 2.1.0-alpha", + "title": "Devfile schema - Version 2.1.0", "required": [ "schemaVersion" ], @@ -657,7 +657,7 @@ const JsonSchema210 = `{ "type": "string" }, "icon": { - "description": "Optional devfile icon", + "description": "Optional devfile icon, can be a URI or a relative path in the project", "type": "string" }, "language": { @@ -1306,11 +1306,6 @@ const JsonSchema210 = `{ "git" ] }, - { - "required": [ - "github" - ] - }, { "required": [ "zip" @@ -1356,48 +1351,12 @@ const JsonSchema210 = `{ }, "additionalProperties": false }, - "github": { - "description": "Project's GitHub source. Deprecated, use 'Git' instead", - "type": "object", - "properties": { - "checkoutFrom": { - "description": "Defines from what the project should be checked out. Required if there are more than one remote configured", - "type": "object", - "properties": { - "remote": { - "description": "The remote name should be used as init. Required if there are more than one remote configured", - "type": "string" - }, - "revision": { - "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.", - "type": "string" - } - }, - "additionalProperties": false - }, - "remotes": { - "description": "The remotes map which should be initialized in the git project. Must have at least one remote configured", - "type": "object", - "additionalProperties": { - "type": "string" - } - } - }, - "additionalProperties": false - }, "name": { "description": "Project name", "type": "string", "maxLength": 63, "pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" }, - "sparseCheckoutDirs": { - "description": "Populate the project sparsely with selected directories.", - "type": "array", - "items": { - "type": "string" - } - }, "zip": { "description": "Project's Zip source", "type": "object", @@ -1431,11 +1390,6 @@ const JsonSchema210 = `{ "git" ] }, - { - "required": [ - "github" - ] - }, { "required": [ "zip" @@ -1481,35 +1435,6 @@ const JsonSchema210 = `{ }, "additionalProperties": false }, - "github": { - "description": "Project's GitHub source. Deprecated, use 'Git' instead", - "type": "object", - "properties": { - "checkoutFrom": { - "description": "Defines from what the project should be checked out. Required if there are more than one remote configured", - "type": "object", - "properties": { - "remote": { - "description": "The remote name should be used as init. Required if there are more than one remote configured", - "type": "string" - }, - "revision": { - "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.", - "type": "string" - } - }, - "additionalProperties": false - }, - "remotes": { - "description": "The remotes map which should be initialized in the git project. Must have at least one remote configured", - "type": "object", - "additionalProperties": { - "type": "string" - } - } - }, - "additionalProperties": false - }, "name": { "description": "Project name", "type": "string", @@ -1563,11 +1488,6 @@ const JsonSchema210 = `{ "git" ] }, - { - "required": [ - "github" - ] - }, { "required": [ "zip" @@ -1616,51 +1536,12 @@ const JsonSchema210 = `{ }, "additionalProperties": false }, - "github": { - "description": "Project's GitHub source. Deprecated, use 'Git' instead", - "type": "object", - "required": [ - "remotes" - ], - "properties": { - "checkoutFrom": { - "description": "Defines from what the project should be checked out. Required if there are more than one remote configured", - "type": "object", - "properties": { - "remote": { - "description": "The remote name should be used as init. Required if there are more than one remote configured", - "type": "string" - }, - "revision": { - "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.", - "type": "string" - } - }, - "additionalProperties": false - }, - "remotes": { - "description": "The remotes map which should be initialized in the git project. Must have at least one remote configured", - "type": "object", - "additionalProperties": { - "type": "string" - } - } - }, - "additionalProperties": false - }, "name": { "description": "Project name", "type": "string", "maxLength": 63, "pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" }, - "sparseCheckoutDirs": { - "description": "Populate the project sparsely with selected directories.", - "type": "array", - "items": { - "type": "string" - } - }, "zip": { "description": "Project's Zip source", "type": "object", @@ -1695,11 +1576,6 @@ const JsonSchema210 = `{ "git" ] }, - { - "required": [ - "github" - ] - }, { "required": [ "zip" @@ -1748,38 +1624,6 @@ const JsonSchema210 = `{ }, "additionalProperties": false }, - "github": { - "description": "Project's GitHub source. Deprecated, use 'Git' instead", - "type": "object", - "required": [ - "remotes" - ], - "properties": { - "checkoutFrom": { - "description": "Defines from what the project should be checked out. Required if there are more than one remote configured", - "type": "object", - "properties": { - "remote": { - "description": "The remote name should be used as init. Required if there are more than one remote configured", - "type": "string" - }, - "revision": { - "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.", - "type": "string" - } - }, - "additionalProperties": false - }, - "remotes": { - "description": "The remotes map which should be initialized in the git project. Must have at least one remote configured", - "type": "object", - "additionalProperties": { - "type": "string" - } - } - }, - "additionalProperties": false - }, "name": { "description": "Project name", "type": "string", diff --git a/pkg/devfile/parser/data/v2/common/project_helper.go b/pkg/devfile/parser/data/v2/common/project_helper.go index fe2d0859..b8df56e7 100644 --- a/pkg/devfile/parser/data/v2/common/project_helper.go +++ b/pkg/devfile/parser/data/v2/common/project_helper.go @@ -47,8 +47,6 @@ func GetProjectSourceType(projectSrc v1.ProjectSource) (v1.ProjectSourceType, er switch { case projectSrc.Git != nil: return v1.GitProjectSourceType, nil - case projectSrc.Github != nil: - return v1.GitHubProjectSourceType, nil case projectSrc.Zip != nil: return v1.ZipProjectSourceType, nil case projectSrc.Custom != nil: diff --git a/pkg/devfile/parser/data/v2/common/project_helper_test.go b/pkg/devfile/parser/data/v2/common/project_helper_test.go index 484f0381..490def51 100644 --- a/pkg/devfile/parser/data/v2/common/project_helper_test.go +++ b/pkg/devfile/parser/data/v2/common/project_helper_test.go @@ -134,14 +134,6 @@ func TestGetProjectSrcType(t *testing.T) { projectSrcType: v1.GitProjectSourceType, wantErr: false, }, - { - name: "Github project", - projectSrc: v1.ProjectSource{ - Github: &v1.GithubProjectSource{}, - }, - projectSrcType: v1.GitHubProjectSourceType, - wantErr: false, - }, { name: "Zip project", projectSrc: v1.ProjectSource{ diff --git a/pkg/devfile/parser/parse_test.go b/pkg/devfile/parser/parse_test.go index d32976ea..7a147317 100644 --- a/pkg/devfile/parser/parse_test.go +++ b/pkg/devfile/parser/parse_test.go @@ -76,7 +76,7 @@ func Test_parseParentAndPluginFromURI(t *testing.T) { { ClonePath: "/data", ProjectSource: v1.ProjectSource{ - Github: &v1.GithubProjectSource{ + Git: &v1.GitProjectSource{ GitLikeProjectSource: v1.GitLikeProjectSource{ Remotes: map[string]string{ "master": "https://githube.com/somerepo/someproject.git", @@ -248,7 +248,7 @@ func Test_parseParentAndPluginFromURI(t *testing.T) { Attributes: parentOverridesFromMainDevfile, ClonePath: "/projects", ProjectSource: v1.ProjectSource{ - Github: &v1.GithubProjectSource{ + Git: &v1.GitProjectSource{ GitLikeProjectSource: v1.GitLikeProjectSource{ Remotes: map[string]string{ "master": "https://githube.com/somerepo/someproject.git", @@ -379,7 +379,7 @@ func Test_parseParentAndPluginFromURI(t *testing.T) { Attributes: importFromUri1, ClonePath: "/data", ProjectSource: v1.ProjectSource{ - Github: &v1.GithubProjectSource{ + Git: &v1.GitProjectSource{ GitLikeProjectSource: v1.GitLikeProjectSource{ Remotes: map[string]string{ "master": "https://githube.com/somerepo/someproject.git", @@ -766,7 +766,7 @@ func Test_parseParentAndPluginFromURI(t *testing.T) { { ClonePath: "/data", ProjectSource: v1.ProjectSource{ - Github: &v1.GithubProjectSource{ + Git: &v1.GitProjectSource{ GitLikeProjectSource: v1.GitLikeProjectSource{ Remotes: map[string]string{ "master": "https://githube.com/somerepo/someproject.git", @@ -843,7 +843,7 @@ func Test_parseParentAndPluginFromURI(t *testing.T) { Attributes: importFromUri2, ClonePath: "/data", ProjectSource: v1.ProjectSource{ - Github: &v1.GithubProjectSource{ + Git: &v1.GitProjectSource{ GitLikeProjectSource: v1.GitLikeProjectSource{ Remotes: map[string]string{ "master": "https://githube.com/somerepo/someproject.git", @@ -953,7 +953,7 @@ func Test_parseParentAndPluginFromURI(t *testing.T) { { ClonePath: "/data", ProjectSource: v1.ProjectSource{ - Github: &v1.GithubProjectSource{ + Git: &v1.GitProjectSource{ GitLikeProjectSource: v1.GitLikeProjectSource{ Remotes: map[string]string{ "master": "https://githube.com/somerepo/someproject.git", @@ -1056,7 +1056,7 @@ func Test_parseParentAndPluginFromURI(t *testing.T) { Attributes: importFromUri2, ClonePath: "/data", ProjectSource: v1.ProjectSource{ - Github: &v1.GithubProjectSource{ + Git: &v1.GitProjectSource{ GitLikeProjectSource: v1.GitLikeProjectSource{ Remotes: map[string]string{ "master": "https://githube.com/somerepo/someproject.git", @@ -1595,7 +1595,7 @@ func Test_parseParentAndPluginFromURI(t *testing.T) { { ClonePath: "/data", ProjectSource: v1.ProjectSource{ - Github: &v1.GithubProjectSource{ + Git: &v1.GitProjectSource{ GitLikeProjectSource: v1.GitLikeProjectSource{ Remotes: map[string]string{ "master": "https://githube.com/somerepo/someproject.git", @@ -1737,7 +1737,7 @@ func Test_parseParentAndPluginFromURI(t *testing.T) { Attributes: parentOverridesFromMainDevfile, ClonePath: "/projects", ProjectSource: v1.ProjectSource{ - Github: &v1.GithubProjectSource{ + Git: &v1.GitProjectSource{ GitLikeProjectSource: v1.GitLikeProjectSource{ Remotes: map[string]string{ "master": "https://githube.com/somerepo/someproject.git",