diff --git a/.gitignore b/.gitignore index 5e438b15c..6f84f8170 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ +# this file contains information that we don't want to further surface for +# scraping but do generate locally +maintainers.txt + # OSX leaves these everywhere on SMB shares ._* diff --git a/generator/README.md b/generator/README.md index d79980ece..381c487c3 100644 --- a/generator/README.md +++ b/generator/README.md @@ -84,6 +84,19 @@ for i in $(ls -1 generator/generated/*.md); do gh issue create --repo kubernetes You may run into rate limiting issues, which is why this command removes the files after an issue has been successfully created. + +To generate the maintainers.txt file for updating with the CNCF re: +https://github.com/kubernetes/steering/issues/281 + +```bash +make MAINTAINERS_LIST=true +``` + +This will generate an untracked (not saved in git) maintainers.txt file with a +table in the format requested by the CNCF. +Most contributors will never need to do this. +For more details see the linked steering issue. + ## Adding custom content diff --git a/generator/app.go b/generator/app.go index 3b2eb8c1d..cdb8c4394 100644 --- a/generator/app.go +++ b/generator/app.go @@ -1100,6 +1100,58 @@ func prepForAnnualReportGeneration() error { return nil } +func generateCNCFMaintainersList(ctx *Context) error { + maintainers := map[string]Person{} + serviceDesk := map[string]bool{} + for _, group := range ctx.Committees { + if group.Name == "Steering" { + for _, member := range group.Leadership.Chairs { + maintainers[member.GitHub] = member + serviceDesk[member.GitHub] = true + } + } + } + for _, sig := range ctx.Sigs { + // these groups retain service desk access in addition to steering + // as outlined in https://github.com/kubernetes/steering/issues/281 + isServiceDesk := sig.Name == "Contributor Experience" || sig.Name == "K8s Infra" || sig.Name == "Release" + for _, chair := range sig.Leadership.Chairs { + maintainers[chair.GitHub] = chair + // only set service desk true as needed, do not override to false + // in case of maintainers spanning groups + if isServiceDesk { + serviceDesk[chair.Name] = true + } + } + for _, tl := range sig.Leadership.TechnicalLeads { + maintainers[tl.GitHub] = tl + // only set service desk true as needed, do not override to false + // in case of maintainers spanning groups + if isServiceDesk { + serviceDesk[tl.Name] = true + } + } + } + outputPath := filepath.Join(baseGeneratorDir, "maintainers.txt") + f, err := os.Create(outputPath) + if err != nil { + return err + } + defer f.Close() + fmt.Fprintln(f, "name | company | github | email | service-desk?") + fmt.Fprintln(f, "===============================================") + keys := []string{} + for gh := range maintainers { + keys = append(keys, gh) + } + sort.Strings(keys) + for _, gh := range keys { + m := maintainers[gh] + fmt.Fprintf(f, "%s | %s | %s | %s | %t\n", m.Name, m.Company, m.GitHub, m.Email, serviceDesk[m.GitHub]) + } + return nil +} + func main() { yamlPath := filepath.Join(baseGeneratorDir, sigsYamlFile) var ctx Context @@ -1153,6 +1205,11 @@ func main() { } } + if envVal, ok := os.LookupEnv("MAINTAINERS_LIST"); ok && envVal == "true" { + fmt.Println("Generating CNCF maintainers list") + generateCNCFMaintainersList(&ctx) + } + fmt.Println("Generating sig-list.md") outputPath := filepath.Join(baseGeneratorDir, sigListOutput) err = writeTemplate(filepath.Join(baseGeneratorDir, templateDir, listTemplate), outputPath, "markdown", ctx)