Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

library for devfile 2.1.0 cut off #90

Merged
merged 3 commits into from
May 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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.1.0
github.com/fatih/color v1.7.0
github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32
github.com/gobwas/glob v0.2.3
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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.1.0 h1:hodMaQpa9onnx8uG5NBxIuzBjC7AUkLTGCcuvZyED7g=
github.com/devfile/api/v2 v2.1.0/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=
Expand Down
12 changes: 1 addition & 11 deletions pkg/devfile/generator/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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]},
},
Expand Down
162 changes: 3 additions & 159 deletions pkg/devfile/parser/data/v2/2.1.0/devfileJsonSchema210.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package version210

// https://raw.githubusercontent.com/devfile/api/main/schemas/latest/devfile.json
// https://raw.githubusercontent.com/devfile/api/2.1.x/schemas/latest/devfile.json
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"
],
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -1306,11 +1306,6 @@ const JsonSchema210 = `{
"git"
]
},
{
"required": [
"github"
]
},
{
"required": [
"zip"
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -1431,11 +1390,6 @@ const JsonSchema210 = `{
"git"
]
},
{
"required": [
"github"
]
},
{
"required": [
"zip"
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -1563,11 +1488,6 @@ const JsonSchema210 = `{
"git"
]
},
{
"required": [
"github"
]
},
{
"required": [
"zip"
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -1695,11 +1576,6 @@ const JsonSchema210 = `{
"git"
]
},
{
"required": [
"github"
]
},
{
"required": [
"zip"
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 0 additions & 2 deletions pkg/devfile/parser/data/v2/common/project_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 0 additions & 8 deletions pkg/devfile/parser/data/v2/common/project_helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
18 changes: 9 additions & 9 deletions pkg/devfile/parser/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down