From 53645d2945687de3fda0b10122f6d4738b0d9f81 Mon Sep 17 00:00:00 2001 From: Stephanie Date: Fri, 7 May 2021 14:53:15 -0400 Subject: [PATCH] update source attribute to imported from devfile/api Signed-off-by: Stephanie --- go.mod | 2 +- go.sum | 4 ++-- .../parser/data/v2/2.1.0/devfileJsonSchema210.go | 3 ++- pkg/devfile/parser/sourceAttribute.go | 13 +++++++------ 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/go.mod b/go.mod index 0016f79f..c2ac4bb9 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-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 diff --git a/go.sum b/go.sum index f6c4a3ac..9ef7274b 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-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= 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 3628e0a4..57c734a8 100644 --- a/pkg/devfile/parser/data/v2/2.1.0/devfileJsonSchema210.go +++ b/pkg/devfile/parser/data/v2/2.1.0/devfileJsonSchema210.go @@ -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": { @@ -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": { diff --git a/pkg/devfile/parser/sourceAttribute.go b/pkg/devfile/parser/sourceAttribute.go index a92d3093..dd7608fc 100644 --- a/pkg/devfile/parser/sourceAttribute.go +++ b/pkg/devfile/parser/sourceAttribute.go @@ -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=' +// addSourceAttributesForParentOverride adds an attribute 'api.devfile.io/imported-from=' // to all elements of template spec content that support attributes. func addSourceAttributesForTemplateSpecContent(sourceImportReference v1.ImportReference, template *v1.DevWorkspaceTemplateSpecContent) { for idx, component := range template.Components { @@ -41,7 +42,7 @@ func addSourceAttributesForTemplateSpecContent(sourceImportReference v1.ImportRe } } -// addSourceAttributesForParentOverride adds an attribute 'library.devfile.io/parent-override-from=' +// addSourceAttributesForParentOverride adds an attribute 'api.devfile.io/parent-override-from=' // to all elements of parent override that support attributes. func addSourceAttributesForParentOverride(sourceImportReference v1.ImportReference, parentOverrides *v1.ParentOverrides) { for idx, component := range parentOverrides.Components { @@ -71,7 +72,7 @@ func addSourceAttributesForParentOverride(sourceImportReference v1.ImportReferen } -// addSourceAttributesForPluginOverride adds an attribute 'library.devfile.io/plugin-override-from=' +// addSourceAttributesForPluginOverride adds an attribute 'api.devfile.io/plugin-override-from=' // to all elements of plugin override that support attributes. func addSourceAttributesForPluginOverride(sourceImportReference v1.ImportReference, pluginOverrides *v1.PluginOverrides) { for idx, component := range pluginOverrides.Components {