diff options
| author | Kubernetes Prow Robot <k8s-ci-robot@users.noreply.github.com> | 2019-05-06 13:09:43 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-05-06 13:09:43 -0700 |
| commit | 56a4fad9f53c452f2c63bbdeb9543b9032cb6cf0 (patch) | |
| tree | 971e5913050a497fd03afbde9d39b029498a17e6 /generator | |
| parent | 08281a417f3b964aa63755f4353ec204c94bcef9 (diff) | |
| parent | 32999dfb77ac37dd16a93e198a9e748ced50c920 (diff) | |
Merge pull request #3680 from spiffxp/fix-some-sigs-yaml-validations
Fix most sigs.yaml validation errors
Diffstat (limited to 'generator')
| -rw-r--r-- | generator/app.go | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/generator/app.go b/generator/app.go index e6e302e9..371add2a 100644 --- a/generator/app.go +++ b/generator/app.go @@ -113,6 +113,15 @@ type LeadershipGroup struct { EmeritusLeads []Person `yaml:"emeritus_leads,omitempty"` } +// PrefixToPersonMap returns a map of prefix to persons, useful for iteration over all persons +func (g *LeadershipGroup) PrefixToPersonMap() map[string][]Person { + return map[string][]Person{ + "chair": g.Chairs, + "tech_lead": g.TechnicalLeads, + "emeritus_lead": g.EmeritusLeads, + } +} + // Group represents either a Special Interest Group (SIG) or a Working Group (WG) type Group struct { Dir string @@ -210,6 +219,7 @@ func (c *Context) Sort() { // Validate returns a list of errors encountered while validating a Context func (c *Context) Validate() []error { errors := []error{} + people := make(map[string]Person) for prefix, groups := range c.PrefixToGroupMap() { for _, group := range groups { expectedDir := group.DirName(prefix) @@ -220,6 +230,17 @@ func (c *Context) Validate() []error { if expectedLabel != group.Label { errors = append(errors, fmt.Errorf("%s: expected label: %s, got: %s", group.Dir, expectedLabel, group.Label)) } + for prefix, persons := range group.Leadership.PrefixToPersonMap() { + for _, person := range persons { + if val, ok := people[person.GitHub]; ok { + if val.Name != person.Name || val.Company != person.Company { + errors = append(errors, fmt.Errorf("%s: %ss: expected person: %v, got: %v", group.Dir, prefix, val, person)) + } + } else { + people[person.GitHub] = person + } + } + } if len(group.StakeholderSIGs) != 0 { if prefix == "wg" { for _, name := range group.StakeholderSIGs { @@ -243,7 +264,6 @@ func (c *Context) Validate() []error { errors = append(errors, fmt.Errorf("%s: has no subprojects", group.Dir)) } } - } } return errors |
