Skip to content

Commit 77521a2

Browse files
committed
Link to working groups from SIG readmes
1 parent f1bee96 commit 77521a2

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

generator/app.go

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ type Group struct {
163163
Name string
164164
MissionStatement FoldedString `yaml:"mission_statement,omitempty"`
165165
CharterLink string `yaml:"charter_link,omitempty"`
166+
ReportingWGs []WGName `yaml:"-"` // populated by Context#Complete()
166167
StakeholderSIGs []SIGName `yaml:"stakeholder_sigs,omitempty"`
167168
Label string
168169
Leadership LeadershipGroup `yaml:"leadership"`
@@ -171,6 +172,12 @@ type Group struct {
171172
Subprojects []Subproject `yaml:",omitempty"`
172173
}
173174

175+
type WGName string
176+
177+
func (n WGName) DirName() string {
178+
return DirName("wg", string(n))
179+
}
180+
174181
type SIGName string
175182

176183
func (n SIGName) DirName() string {
@@ -220,13 +227,30 @@ func (c *Context) PrefixToGroupMap() map[string][]Group {
220227
}
221228
}
222229

230+
// Complete populates derived portions of the Context struct
231+
func (c *Context) Complete() {
232+
// Copy working group names into ReportingWGs list of their stakeholder sigs
233+
for _, wg := range c.WorkingGroups {
234+
for _, stakeholderSIG := range wg.StakeholderSIGs {
235+
for i, sig := range c.Sigs {
236+
if sig.Name == string(stakeholderSIG) {
237+
c.Sigs[i].ReportingWGs = append(c.Sigs[i].ReportingWGs, WGName(wg.Name))
238+
}
239+
}
240+
}
241+
}
242+
}
243+
223244
// Sort sorts all lists within the Context struct
224245
func (c *Context) Sort() {
225246
for _, groups := range c.PrefixToGroupMap() {
226247
sort.Slice(groups, func(i, j int) bool {
227248
return groups[i].Dir < groups[j].Dir
228249
})
229250
for _, group := range groups {
251+
sort.Slice(group.ReportingWGs, func(i, j int) bool {
252+
return group.ReportingWGs[i] < group.ReportingWGs[j]
253+
})
230254
sort.Slice(group.StakeholderSIGs, func(i, j int) bool {
231255
return group.StakeholderSIGs[i] < group.StakeholderSIGs[j]
232256
})
@@ -294,6 +318,17 @@ func (c *Context) Validate() []error {
294318
}
295319
}
296320
}
321+
if len(group.ReportingWGs) != 0 {
322+
if prefix == "sig" {
323+
for _, name := range group.ReportingWGs {
324+
if index(c.WorkingGroups, func(g Group) bool { return g.Name == string(name) }) == -1 {
325+
errors = append(errors, fmt.Errorf("%s: invalid reporting working group name %s", group.Dir, name))
326+
}
327+
}
328+
} else {
329+
errors = append(errors, fmt.Errorf("%s: only SIGs may have reporting WGs", group.Dir))
330+
}
331+
}
297332
if len(group.StakeholderSIGs) != 0 {
298333
if prefix == "wg" {
299334
for _, name := range group.StakeholderSIGs {
@@ -304,6 +339,10 @@ func (c *Context) Validate() []error {
304339
} else {
305340
errors = append(errors, fmt.Errorf("%s: only WGs may have stakeholder_sigs", group.Dir))
306341
}
342+
} else {
343+
if prefix == "wg" {
344+
errors = append(errors, fmt.Errorf("%s: WGs must have stakeholder_sigs", group.Dir))
345+
}
307346
}
308347
if prefix == "sig" {
309348
if group.CharterLink == "" {
@@ -655,6 +694,8 @@ func main() {
655694
log.Fatal(err)
656695
}
657696

697+
ctx.Complete()
698+
658699
ctx.Sort()
659700

660701
fmt.Printf("Validating %s\n", yamlPath)

generator/sig_readme.tmpl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,17 @@ subprojects, and resolve cross-subproject technical issues and decisions.
6868
- Steering Committee Liaison: {{.Contact.Liaison.Name}} (**[@{{.Contact.Liaison.GitHub}}](https://github.com/{{.Contact.Liaison.GitHub}})**)
6969
{{- end }}
7070

71+
{{- if .ReportingWGs }}
72+
73+
## Working Groups
74+
75+
The following [working groups][working-group-definition] are sponsored by sig-{{.Label}}:
76+
77+
{{- range .ReportingWGs }}
78+
* [WG {{.}}](/{{.DirName}})
79+
{{- end }}
80+
{{ end }}
81+
7182
{{- if .Subprojects }}
7283

7384
## Subprojects
@@ -114,3 +125,4 @@ The following [subprojects][subproject-definition] are owned by sig-{{.Label}}:
114125
{{- end }}
115126

116127
[subproject-definition]: https://github.com/kubernetes/community/blob/master/governance.md#subprojects
128+
[working-group-definition]: https://github.com/kubernetes/community/blob/master/governance.md#working-groups

0 commit comments

Comments
 (0)