Skip to content

Commit 4d98368

Browse files
Add owner.type field to create package and docs (#1460)
- Add prompt for owner.type field - Add section to breaking changes docs for now required owner.type field
1 parent f8835ac commit 4d98368

File tree

6 files changed

+53
-0
lines changed

6 files changed

+53
-0
lines changed

cmd/create_package.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ type newPackageAnswers struct {
3636
KibanaVersion string `survey:"kibana_version"`
3737
ElasticSubscription string `survey:"elastic_subscription"`
3838
GithubOwner string `survey:"github_owner"`
39+
OwnerType string `survey:"owner_type"`
3940
DataStreamType string `survey:"datastream_type"`
4041
}
4142

@@ -149,6 +150,27 @@ func createPackageCommandAction(cmd *cobra.Command, args []string) error {
149150
},
150151
Validate: survey.ComposeValidators(survey.Required, surveyext.GithubOwnerValidator),
151152
},
153+
{
154+
Name: "owner_type",
155+
Prompt: &survey.Select{
156+
Message: "Owner type:",
157+
Options: []string{"elastic", "partner", "community"},
158+
Description: func(value string, _ int) string {
159+
switch value {
160+
case "elastic":
161+
return "Owned and supported by Elastic"
162+
case "partner":
163+
return "Vendor-owned with support from Elastic"
164+
case "community":
165+
return "Supported by the community"
166+
}
167+
168+
return ""
169+
},
170+
Default: "elastic",
171+
},
172+
Validate: survey.Required,
173+
},
152174
}
153175

154176
if answers.Type == "input" {
@@ -217,6 +239,7 @@ func createPackageDescriptorFromAnswers(answers newPackageAnswers) archetype.Pac
217239
},
218240
Owner: packages.Owner{
219241
Github: answers.GithubOwner,
242+
Type: answers.OwnerType,
220243
},
221244
License: answers.ElasticSubscription,
222245
Description: answers.Description,

cmd/status_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ func fooPackage(version, kibanaVersion string) packages.PackageManifest {
2828
Description: "Foo integration",
2929
Owner: packages.Owner{
3030
Github: "team",
31+
Type: "elastic",
3132
},
3233
Conditions: packages.Conditions{
3334
Kibana: packages.KibanaConditions{Version: kibanaVersion},

docs/howto/update_major_package_spec.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,32 @@ routing rules.
7676
If you find this error while trying to use a new processor, please open an issue
7777
in the Package Spec repository so we can add support for it.
7878

79+
### field owner: type is required
80+
81+
Package Spec 3.0.0 now requires the owner type field to be set. This field
82+
describes who owns the package and the level of support that is provided.
83+
The 'elastic' value indicates that the package is built and maintained by
84+
Elastic. The 'partner' value indicates that the package is built and
85+
maintained by a partner vendor and may include involvement from Elastic.
86+
The 'community' value indicates the package is built and maintained by
87+
non-Elastic community members.
88+
89+
The field was initially introduced in Package Spec `2.11.0` and prior to this
90+
version assumed an implicit default of `elastic`. In `2.11.0`, the implicit
91+
default changed to `community`. To avoid accidentally tagging an integration
92+
with the wrong owner type, the field is now required.
93+
94+
The value must be one of the following:
95+
96+
- `elastic`
97+
- `partner`
98+
- `community`
99+
100+
```
101+
owner:
102+
type: elastic
103+
```
104+
79105
## Troubleshooting upgrades to Package Spec v2
80106

81107
### field (root): Additional property license is not allowed

internal/packages/archetype/_static/package-manifest.yml.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,4 @@ policy_templates:
7474
{{ end -}}
7575
owner:
7676
github: {{.Manifest.Owner.Github}}
77+
type: {{.Manifest.Owner.Type}}

internal/packages/archetype/package_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ func createPackageDescriptorForTest(packageType, kibanaVersion string) PackageDe
7373
},
7474
Owner: packages.Owner{
7575
Github: "mtojek",
76+
Type: "elastic",
7677
},
7778
Description: "This package has been generated by a Go unit test.",
7879
Categories: []string{"aws", "custom"},

internal/packages/packages.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ type PolicyTemplate struct {
112112
// Owner defines package owners, either a single person or a team.
113113
type Owner struct {
114114
Github string `config:"github" json:"github" yaml:"github"`
115+
Type string `config:"type" json:"type" yaml:"type"`
115116
}
116117

117118
// PackageManifest represents the basic structure of a package's manifest

0 commit comments

Comments
 (0)