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

update source attribute to use the one imported from devfile/api #85

Merged
merged 1 commit into from
May 7, 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-20210420202853-ff3c01bf8292
github.com/devfile/api/v2 v2.0.0-20210507143755-39103b31c0f3
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-20210420202853-ff3c01bf8292 h1:XNtHHNf041XmYSbz8u4ZhLbebjhdoY79wDW0HT3Y9UI=
github.com/devfile/api/v2 v2.0.0-20210420202853-ff3c01bf8292/go.mod h1:Cot4snybn3qhIh48oIFi9McocnIx7zY5fFbjfrIpPvg=
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/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
3 changes: 2 additions & 1 deletion pkg/devfile/parser/data/v2/2.1.0/devfileJsonSchema210.go
Original file line number Diff line number Diff line change
Expand Up @@ -1414,6 +1414,7 @@ const JsonSchema210 = `{
}
},
"registryUrl": {
"description": "Registry URL to pull the parent devfile from when using id in the parent reference. To ensure the parent devfile gets resolved consistently in different environments, it is recommended to always specify the 'regsitryURL' when 'Id' is used.",
"type": "string"
},
"starterProjects": {
Expand Down Expand Up @@ -1535,7 +1536,7 @@ const JsonSchema210 = `{
}
},
"uri": {
"description": "Uri of a Devfile yaml file",
"description": "URI Reference of a parent devfile YAML file. It can be a full URL or a relative URI with the current devfile as the base URI.",
"type": "string"
},
"variables": {
Expand Down
13 changes: 7 additions & 6 deletions pkg/devfile/parser/sourceAttribute.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ import (
"fmt"
v1 "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
"github.com/devfile/api/v2/pkg/attributes"
"github.com/devfile/api/v2/pkg/validation"
)

const (
importSourceAttribute = "library.devfile.io/imported-from"
parentOverrideAttribute = "library.devfile.io/parent-override-from"
pluginOverrideAttribute = "library.devfile.io/plugin-override-from"
importSourceAttribute = validation.ImportSourceAttribute
parentOverrideAttribute = validation.ParentOverrideAttribute
pluginOverrideAttribute = validation.PluginOverrideAttribute
)

// addSourceAttributesForParentOverride adds an attribute 'library.devfile.io/imported-from=<source reference>'
// addSourceAttributesForParentOverride adds an attribute 'api.devfile.io/imported-from=<source reference>'
// to all elements of template spec content that support attributes.
func addSourceAttributesForTemplateSpecContent(sourceImportReference v1.ImportReference, template *v1.DevWorkspaceTemplateSpecContent) {
for idx, component := range template.Components {
Expand Down Expand Up @@ -41,7 +42,7 @@ func addSourceAttributesForTemplateSpecContent(sourceImportReference v1.ImportRe
}
}

// addSourceAttributesForParentOverride adds an attribute 'library.devfile.io/parent-override-from=<source reference>'
// addSourceAttributesForParentOverride adds an attribute 'api.devfile.io/parent-override-from=<source reference>'
// to all elements of parent override that support attributes.
func addSourceAttributesForParentOverride(sourceImportReference v1.ImportReference, parentOverrides *v1.ParentOverrides) {
for idx, component := range parentOverrides.Components {
Expand Down Expand Up @@ -71,7 +72,7 @@ func addSourceAttributesForParentOverride(sourceImportReference v1.ImportReferen

}

// addSourceAttributesForPluginOverride adds an attribute 'library.devfile.io/plugin-override-from=<source reference>'
// addSourceAttributesForPluginOverride adds an attribute 'api.devfile.io/plugin-override-from=<source reference>'
// to all elements of plugin override that support attributes.
func addSourceAttributesForPluginOverride(sourceImportReference v1.ImportReference, pluginOverrides *v1.PluginOverrides) {
for idx, component := range pluginOverrides.Components {
Expand Down