Skip to content

Commit 3793734

Browse files
authored
Add attributes free-form map field for tool-specific fields in a number of places (#214)
* Implementation of Attributes (#169) * Use the Yaml language services on all subfolder of the samples folder * Fix the order of the module deps * Update the `vendor` additions * Apply go formatting * Rework attributes API and format * Add documentation * Fix the usage of `Attributes` in `DevfileMetadata` * Renaming some methods * Add a comment about returning only the last error * Fix a pointer error * upgrade version of the `setup-go` github action * In `DevfileMetadata`, Move additional free-form metadata fields one level down in the new `attributes` field * Implement primitive type implicit conversion * Do not change passed value when decoding into a value from a `nil` `Attributes` value * Change errorHolder from optional to nullable as explained in the following comment: #214 (comment) Signed-off-by: David Festal <[email protected]>
1 parent ad9cf1a commit 3793734

File tree

66 files changed

+17174
-2518
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+17174
-2518
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- uses: actions/checkout@v2
1616

1717
- name: Setup Go environment
18-
uses: actions/[email protected].2
18+
uses: actions/[email protected].3
1919
with:
2020
# The Go version to download (if necessary) and use. Supports semver spec and ranges.
2121
go-version: 1.13

.theia/settings.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
"go.lintFlags": ["--fast"],
44
"go.useLanguageServer": true,
55
"yaml.schemas": {
6-
"./schemas/latest/ide-targeted/devfile.json": [ "samples/devfiles/*devfile.yaml", "samples/devfile-registry/*.yaml" ],
7-
"./schemas/latest/ide-targeted/dev-workspace.json": [ "samples/devworkspaces/*.yaml" ],
8-
"./schemas/latest/ide-targeted/dev-workspace-template.json": [ "samples/devworkspace-templates/*.yaml" ],
6+
"./schemas/latest/ide-targeted/devfile.json": [ "samples/*/*devfile.yaml", "samples/devfile-registry/*.yaml" ],
7+
"./schemas/latest/ide-targeted/dev-workspace.json": [ "samples/*/*devworkspace.yaml" ],
8+
"./schemas/latest/ide-targeted/dev-workspace-template.json": [ "samples/*/*devworkspacetemplate.yaml" ],
99
"./schemas/latest/ide-targeted/dev-workspace-template-spec.json": [ "pkg/utils/overriding/test-fixtures/patches/**/original.yaml", "pkg/utils/overriding/test-fixtures/patches/**/result.yaml", "pkg/utils/overriding/test-fixtures/merges/*.yaml" ],
1010
"./schemas/latest/ide-targeted/parent-overrides.json": [ "pkg/utils/overriding/test-fixtures/**/patch.yaml" ]
1111
}

crds/workspace.devfile.io_devworkspaces.v1beta1.yaml

Lines changed: 32 additions & 150 deletions
Large diffs are not rendered by default.

crds/workspace.devfile.io_devworkspaces.yaml

Lines changed: 32 additions & 150 deletions
Large diffs are not rendered by default.

crds/workspace.devfile.io_devworkspacetemplates.v1beta1.yaml

Lines changed: 28 additions & 150 deletions
Large diffs are not rendered by default.

crds/workspace.devfile.io_devworkspacetemplates.yaml

Lines changed: 32 additions & 150 deletions
Large diffs are not rendered by default.

devfile.api.code-workspace

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
},
1919
"go.autocompleteUnimportedPackages": true,
2020
"yaml.schemas": {
21-
"./schemas/latest/ide-targeted/devfile.json": [ "samples/devfiles/*devfile.yaml", "samples/devfile-registry/*.yaml" ],
22-
"./schemas/latest/ide-targeted/dev-workspace.json": [ "samples/devworkspaces/*.yaml" ],
23-
"./schemas/latest/ide-targeted/dev-workspace-template.json": [ "samples/devworkspace-templates/*.yaml" ],
21+
"./schemas/latest/ide-targeted/devfile.json": [ "samples/*/*devfile.yaml", "samples/devfile-registry/*.yaml" ],
22+
"./schemas/latest/ide-targeted/dev-workspace.json": [ "samples/*/*devworkspace.yaml" ],
23+
"./schemas/latest/ide-targeted/dev-workspace-template.json": [ "samples/*/*devworkspacetemplate.yaml" ],
2424
"./schemas/latest/ide-targeted/dev-workspace-template-spec.json": [ "pkg/utils/overriding/test-fixtures/patches/**/original.yaml", "pkg/utils/overriding/test-fixtures/patches/**/result.yaml", "pkg/utils/overriding/test-fixtures/merges/*.yaml" ],
2525
"./schemas/latest/ide-targeted/parent-overrides.json": [ "pkg/utils/overriding/test-fixtures/**/patch.yaml" ]
2626
}

generator/overrides/gen.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,12 @@ func (g Generator) Generate(ctx *genall.GenerationContext) error {
125125
}
126126

127127
genutils.WriteFormattedSourceFile(fileNamePart, ctx, root, func(buf *bytes.Buffer) {
128+
buf.WriteString(`
129+
import (
130+
attributes "github.com/devfile/api/pkg/attributes"
131+
)
132+
133+
`)
128134
config.Fprint(buf, root.Fset, overrides)
129135
buf.WriteString(`
130136
func (overrides ` + g.rootTypeToProcess.OverrideTypeName + `) isOverride() {}
@@ -349,7 +355,9 @@ func (g Generator) createOverride(newTypeToProcess typeToProcess, packageTypes m
349355
`.*`,
350356
` *`+regexp.QuoteMeta("+kubebuilder:validation:Enum=")+`.*`,
351357
kubebuilderAnnotation)
352-
fieldTypeToProcess.DropEnumAnnotation = true
358+
if fieldTypeToProcess != nil {
359+
fieldTypeToProcess.DropEnumAnnotation = true
360+
}
353361
}
354362
case *ast.StarExpr:
355363
switch elementType := fieldType.X.(type) {

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ require (
1111
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b // indirect
1212
golang.org/x/sys v0.0.0-20200122134326-e047566fdf82 // indirect
1313
k8s.io/api v0.18.2
14+
k8s.io/apiextensions-apiserver v0.18.2
1415
k8s.io/apimachinery v0.18.2
1516
sigs.k8s.io/controller-runtime v0.5.2
1617
sigs.k8s.io/yaml v1.2.0

go.sum

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24
2828
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
2929
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
3030
github.com/blang/semver v3.5.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
31+
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
3132
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
3233
github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8=
3334
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
@@ -57,6 +58,8 @@ github.com/elazarl/goproxy v0.0.0-20170405201442-c4fc26588b6e/go.mod h1:/Zj4wYkg
5758
github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc=
5859
github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
5960
github.com/emicklei/go-restful v2.9.5+incompatible/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
61+
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
62+
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
6063
github.com/evanphx/json-patch v4.2.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
6164
github.com/evanphx/json-patch v4.5.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
6265
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
@@ -236,6 +239,8 @@ github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXP
236239
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
237240
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
238241
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
242+
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
243+
github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
239244
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
240245
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
241246
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
@@ -291,6 +296,7 @@ golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8U
291296
golang.org/x/crypto v0.0.0-20190617133340-57b3e21c3d56/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
292297
golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
293298
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
299+
golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
294300
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
295301
golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
296302
golang.org/x/exp v0.0.0-20190312203227-4b39c73a6495/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
@@ -327,6 +333,7 @@ golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJ
327333
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
328334
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
329335
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
336+
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
330337
golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
331338
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
332339
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@@ -384,8 +391,11 @@ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoA
384391
google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
385392
google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
386393
google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
394+
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
387395
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
396+
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
388397
google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
398+
google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
389399
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
390400
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
391401
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
@@ -416,15 +426,22 @@ k8s.io/api v0.17.2/go.mod h1:BS9fjjLc4CMuqfSO8vgbHPKMt5+SF0ET6u/RVDihTo4=
416426
k8s.io/api v0.18.2 h1:wG5g5ZmSVgm5B+eHMIbI9EGATS2L8Z72rda19RIEgY8=
417427
k8s.io/api v0.18.2/go.mod h1:SJCWI7OLzhZSvbY7U8zwNl9UA4o1fizoug34OV/2r78=
418428
k8s.io/apiextensions-apiserver v0.17.2/go.mod h1:4KdMpjkEjjDI2pPfBA15OscyNldHWdBCfsWMDWAmSTs=
429+
k8s.io/apiextensions-apiserver v0.18.2 h1:I4v3/jAuQC+89L3Z7dDgAiN4EOjN6sbm6iBqQwHTah8=
430+
k8s.io/apiextensions-apiserver v0.18.2/go.mod h1:q3faSnRGmYimiocj6cHQ1I3WpLqmDgJFlKL37fC4ZvY=
419431
k8s.io/apimachinery v0.17.2/go.mod h1:b9qmWdKlLuU9EBh+06BtLcSf/Mu89rWL33naRxs1uZg=
420432
k8s.io/apimachinery v0.18.2 h1:44CmtbmkzVDAhCpRVSiP2R5PPrC2RtlIv/MoB8xpdRA=
421433
k8s.io/apimachinery v0.18.2/go.mod h1:9SnR/e11v5IbyPCGbvJViimtJ0SwHG4nfZFjU77ftcA=
422434
k8s.io/apiserver v0.17.2/go.mod h1:lBmw/TtQdtxvrTk0e2cgtOxHizXI+d0mmGQURIHQZlo=
435+
k8s.io/apiserver v0.18.2/go.mod h1:Xbh066NqrZO8cbsoenCwyDJ1OSi8Ag8I2lezeHxzwzw=
423436
k8s.io/client-go v0.17.2/go.mod h1:QAzRgsa0C2xl4/eVpeVAZMvikCn8Nm81yqVx3Kk9XYI=
437+
k8s.io/client-go v0.18.2/go.mod h1:Xcm5wVGXX9HAA2JJ2sSBUn3tCJ+4SVlCbl2MNNv+CIU=
424438
k8s.io/code-generator v0.17.2/go.mod h1:DVmfPQgxQENqDIzVR2ddLXMH34qeszkKSdH/N+s+38s=
439+
k8s.io/code-generator v0.18.2/go.mod h1:+UHX5rSbxmR8kzS+FAv7um6dtYrZokQvjHpDSYRVkTc=
425440
k8s.io/component-base v0.17.2/go.mod h1:zMPW3g5aH7cHJpKYQ/ZsGMcgbsA/VyhEugF3QT1awLs=
441+
k8s.io/component-base v0.18.2/go.mod h1:kqLlMuhJNHQ9lz8Z7V5bxUUtjFZnrypArGl58gmDfUM=
426442
k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
427443
k8s.io/gengo v0.0.0-20190822140433-26a664648505/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
444+
k8s.io/gengo v0.0.0-20200114144118-36b2048a9120/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
428445
k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
429446
k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
430447
k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8=
@@ -433,11 +450,14 @@ k8s.io/kube-openapi v0.0.0-20191107075043-30be4d16710a/go.mod h1:1TqjTSzOxsLGIKf
433450
k8s.io/kube-openapi v0.0.0-20200121204235-bf4fb3bd569c h1:/KUFqjjqAcY4Us6luF5RDNZ16KJtb49HfR3ZHB9qYXM=
434451
k8s.io/kube-openapi v0.0.0-20200121204235-bf4fb3bd569c/go.mod h1:GRQhZsXIAJ1xR0C9bd8UpWHZ5plfAS9fzPjJuQ6JL3E=
435452
k8s.io/utils v0.0.0-20191114184206-e782cd3c129f/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew=
453+
k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89 h1:d4vVOjXm687F1iLSP2q3lyPPuyvTUt3aVoBpi2DqRsU=
454+
k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew=
436455
modernc.org/cc v1.0.0/go.mod h1:1Sk4//wdnYJiUIxnW8ddKpaOJCF37yAdqYnkxUpaYxw=
437456
modernc.org/golex v1.0.0/go.mod h1:b/QX9oBD/LhixY6NDh+IdGv17hgB+51fET1i2kPSmvk=
438457
modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03k=
439458
modernc.org/strutil v1.0.0/go.mod h1:lstksw84oURvj9y3tn8lGvRxyRC1S2+g5uuIzNfIOBs=
440459
modernc.org/xc v1.0.0/go.mod h1:mRNCo0bvLjGhHO9WsyuKVU4q0ceiDDDoEeWDJHrNx8I=
460+
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.7/go.mod h1:PHgbrJT7lCHcxMU+mDHEm+nx46H4zuuHZkDP6icnhu0=
441461
sigs.k8s.io/controller-runtime v0.5.2 h1:pyXbUfoTo+HA3jeIfr0vgi+1WtmNh0CwlcnQGLXwsSw=
442462
sigs.k8s.io/controller-runtime v0.5.2/go.mod h1:JZUwSMVbxDupo0lTJSSFP5pimEyxGynROImSsqIOx1A=
443463
sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI=

pkg/apis/workspaces/v1alpha2/commands.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
package v1alpha2
22

3-
import runtime "k8s.io/apimachinery/pkg/runtime"
3+
import (
4+
attributes "github.com/devfile/api/pkg/attributes"
5+
runtime "k8s.io/apimachinery/pkg/runtime"
6+
)
47

58
// CommandType describes the type of command.
69
// Only one of the following command type may be specified.
@@ -40,9 +43,6 @@ type BaseCommand struct {
4043
// +optional
4144
// Defines the group this command is part of
4245
Group *CommandGroup `json:"group,omitempty"`
43-
44-
// Optional map of free-form additional command attributes
45-
Attributes map[string]string `json:"attributes,omitempty"`
4646
}
4747

4848
type LabeledCommand struct {
@@ -58,7 +58,11 @@ type Command struct {
5858
// Mandatory identifier that allows referencing
5959
// this command in composite commands, from
6060
// a parent, or in events.
61-
Id string `json:"id"`
61+
Id string `json:"id"`
62+
// Map of implementation-dependant free-form YAML attributes.
63+
// +optional
64+
// +devfile:overrides:include:omit=true
65+
Attributes attributes.Attributes `json:"attributes,omitempty"`
6266
CommandUnion `json:",inline"`
6367
}
6468

pkg/apis/workspaces/v1alpha2/components.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
package v1alpha2
22

3-
import runtime "k8s.io/apimachinery/pkg/runtime"
3+
import (
4+
attributes "github.com/devfile/api/pkg/attributes"
5+
runtime "k8s.io/apimachinery/pkg/runtime"
6+
)
47

58
// ComponentType describes the type of component.
69
// Only one of the following component type may be specified.
@@ -26,7 +29,11 @@ type Component struct {
2629
// Mandatory name that allows referencing the component
2730
// from other elements (such as commands) or from an external
2831
// devfile that may reference this component through a parent or a plugin.
29-
Name string `json:"name"`
32+
Name string `json:"name"`
33+
// Map of implementation-dependant free-form YAML attributes.
34+
// +optional
35+
// +devfile:overrides:include:omit=true
36+
Attributes attributes.Attributes `json:"attributes,omitempty"`
3037
ComponentUnion `json:",inline"`
3138
}
3239

pkg/apis/workspaces/v1alpha2/devfile.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
)
66

77
// Devfile describes the structure of a cloud-native workspace and development environment.
8+
// +k8s:deepcopy-gen=false
89
// +devfile:jsonschema:generate:omitCustomUnionMembers=true
910
type Devfile struct {
1011
devfile.DevfileHeader `json:",inline"`

pkg/apis/workspaces/v1alpha2/endpoint.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
package v1alpha2
22

3+
import (
4+
attributes "github.com/devfile/api/pkg/attributes"
5+
)
6+
37
// EndpointProtocol defines the application and transport protocols of the traffic that will go through this endpoint.
48
// Only one of the following protocols may be specified: http, ws, tcp, udp.
59
// +kubebuilder:validation:Enum=http;ws;tcp;udp
@@ -102,5 +106,5 @@ type Endpoint struct {
102106
//
103107
// - type: "terminal" / "ide" / "ide-dev",
104108
// +optional
105-
Attributes map[string]string `json:"attributes,omitempty"`
109+
Attributes attributes.Attributes `json:"attributes,omitempty"`
106110
}

pkg/apis/workspaces/v1alpha2/projects.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
package v1alpha2
22

3-
import runtime "k8s.io/apimachinery/pkg/runtime"
3+
import (
4+
attributes "github.com/devfile/api/pkg/attributes"
5+
runtime "k8s.io/apimachinery/pkg/runtime"
6+
)
47

58
type Project struct {
69
// Project name
710
Name string `json:"name"`
811

12+
// Map of implementation-dependant free-form YAML attributes.
13+
// +optional
14+
// +devfile:overrides:include:omit=true
15+
Attributes attributes.Attributes `json:"attributes,omitempty"`
16+
917
// Path relative to the root of the projects to which this project should be cloned into. This is a unix-style relative path (i.e. uses forward slashes). The path is invalid if it is absolute or tries to escape the project root through the usage of '..'. If not specified, defaults to the project name.
1018
// +optional
1119
ClonePath string `json:"clonePath,omitempty"`
@@ -21,6 +29,11 @@ type StarterProject struct {
2129
// Project name
2230
Name string `json:"name"`
2331

32+
// Map of implementation-dependant free-form YAML attributes.
33+
// +optional
34+
// +devfile:overrides:include:omit=true
35+
Attributes attributes.Attributes `json:"attributes,omitempty"`
36+
2437
// Description of a starter project
2538
// +optional
2639
Description string `json:"description,omitempty"`

pkg/apis/workspaces/v1alpha2/register.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,7 @@ var (
1616

1717
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
1818
SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion}
19+
20+
// AddToScheme adds the types in this group-version to the given scheme.
21+
AddToScheme = SchemeBuilder.AddToScheme
1922
)

0 commit comments

Comments
 (0)