summaryrefslogtreecommitdiff
path: root/generator
diff options
context:
space:
mode:
authorJordan Liggitt <liggitt@google.com>2022-01-27 15:57:17 -0500
committerJordan Liggitt <liggitt@google.com>2022-01-27 15:58:10 -0500
commit77521a2706f11fe2199eaa28f79068b9b1f53f09 (patch)
treeef3835a7971017fecb1312dd7e4fd201ea699adf /generator
parentf1bee9603aaee0b1438c76cc98b86f7529856132 (diff)
Link to working groups from SIG readmes
Diffstat (limited to 'generator')
-rw-r--r--generator/app.go41
-rw-r--r--generator/sig_readme.tmpl12
2 files changed, 53 insertions, 0 deletions
diff --git a/generator/app.go b/generator/app.go
index 04f37fa3..901a6d28 100644
--- a/generator/app.go
+++ b/generator/app.go
@@ -163,6 +163,7 @@ type Group struct {
Name string
MissionStatement FoldedString `yaml:"mission_statement,omitempty"`
CharterLink string `yaml:"charter_link,omitempty"`
+ ReportingWGs []WGName `yaml:"-"` // populated by Context#Complete()
StakeholderSIGs []SIGName `yaml:"stakeholder_sigs,omitempty"`
Label string
Leadership LeadershipGroup `yaml:"leadership"`
@@ -171,6 +172,12 @@ type Group struct {
Subprojects []Subproject `yaml:",omitempty"`
}
+type WGName string
+
+func (n WGName) DirName() string {
+ return DirName("wg", string(n))
+}
+
type SIGName string
func (n SIGName) DirName() string {
@@ -220,6 +227,20 @@ func (c *Context) PrefixToGroupMap() map[string][]Group {
}
}
+// Complete populates derived portions of the Context struct
+func (c *Context) Complete() {
+ // Copy working group names into ReportingWGs list of their stakeholder sigs
+ for _, wg := range c.WorkingGroups {
+ for _, stakeholderSIG := range wg.StakeholderSIGs {
+ for i, sig := range c.Sigs {
+ if sig.Name == string(stakeholderSIG) {
+ c.Sigs[i].ReportingWGs = append(c.Sigs[i].ReportingWGs, WGName(wg.Name))
+ }
+ }
+ }
+ }
+}
+
// Sort sorts all lists within the Context struct
func (c *Context) Sort() {
for _, groups := range c.PrefixToGroupMap() {
@@ -227,6 +248,9 @@ func (c *Context) Sort() {
return groups[i].Dir < groups[j].Dir
})
for _, group := range groups {
+ sort.Slice(group.ReportingWGs, func(i, j int) bool {
+ return group.ReportingWGs[i] < group.ReportingWGs[j]
+ })
sort.Slice(group.StakeholderSIGs, func(i, j int) bool {
return group.StakeholderSIGs[i] < group.StakeholderSIGs[j]
})
@@ -294,6 +318,17 @@ func (c *Context) Validate() []error {
}
}
}
+ if len(group.ReportingWGs) != 0 {
+ if prefix == "sig" {
+ for _, name := range group.ReportingWGs {
+ if index(c.WorkingGroups, func(g Group) bool { return g.Name == string(name) }) == -1 {
+ errors = append(errors, fmt.Errorf("%s: invalid reporting working group name %s", group.Dir, name))
+ }
+ }
+ } else {
+ errors = append(errors, fmt.Errorf("%s: only SIGs may have reporting WGs", group.Dir))
+ }
+ }
if len(group.StakeholderSIGs) != 0 {
if prefix == "wg" {
for _, name := range group.StakeholderSIGs {
@@ -304,6 +339,10 @@ func (c *Context) Validate() []error {
} else {
errors = append(errors, fmt.Errorf("%s: only WGs may have stakeholder_sigs", group.Dir))
}
+ } else {
+ if prefix == "wg" {
+ errors = append(errors, fmt.Errorf("%s: WGs must have stakeholder_sigs", group.Dir))
+ }
}
if prefix == "sig" {
if group.CharterLink == "" {
@@ -655,6 +694,8 @@ func main() {
log.Fatal(err)
}
+ ctx.Complete()
+
ctx.Sort()
fmt.Printf("Validating %s\n", yamlPath)
diff --git a/generator/sig_readme.tmpl b/generator/sig_readme.tmpl
index 4bb61997..2d7d123b 100644
--- a/generator/sig_readme.tmpl
+++ b/generator/sig_readme.tmpl
@@ -68,6 +68,17 @@ subprojects, and resolve cross-subproject technical issues and decisions.
- Steering Committee Liaison: {{.Contact.Liaison.Name}} (**[@{{.Contact.Liaison.GitHub}}](https://github.com/{{.Contact.Liaison.GitHub}})**)
{{- end }}
+{{- if .ReportingWGs }}
+
+## Working Groups
+
+The following [working groups][working-group-definition] are sponsored by sig-{{.Label}}:
+
+{{- range .ReportingWGs }}
+* [WG {{.}}](/{{.DirName}})
+{{- end }}
+{{ end }}
+
{{- if .Subprojects }}
## Subprojects
@@ -114,3 +125,4 @@ The following [subprojects][subproject-definition] are owned by sig-{{.Label}}:
{{- end }}
[subproject-definition]: https://github.com/kubernetes/community/blob/master/governance.md#subprojects
+[working-group-definition]: https://github.com/kubernetes/community/blob/master/governance.md#working-groups