From 45640689e495e5148b2ed559ce36e28132606251 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Mon, 28 Apr 2025 19:22:06 +0000 Subject: [PATCH 1/3] fix: update README files --- registry/hashicorp/README.md | 8 -------- registry/jfrog/README.md | 8 -------- registry/nataindata/README.md | 2 +- 3 files changed, 1 insertion(+), 17 deletions(-) delete mode 100644 registry/hashicorp/README.md delete mode 100644 registry/jfrog/README.md diff --git a/registry/hashicorp/README.md b/registry/hashicorp/README.md deleted file mode 100644 index 59bbe8a9..00000000 --- a/registry/hashicorp/README.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -display_name: HashiCorp -bio: HashiCorp, an IBM company, empowers organizations to automate and secure multi-cloud and hybrid environments with The Infrastructure Cloud™. Our suite of Infrastructure Lifecycle Management and Security Lifecycle Management solutions are built on projects with source code freely available at their core. The HashiCorp suite underpins the world's most critical applications, helping enterprises achieve efficiency, security, and scalability at any stage of their cloud journey. -github: hashicorp -linkedin: https://www.linkedin.com/company/hashicorp -website: https://www.hashicorp.com/ -status: partner ---- diff --git a/registry/jfrog/README.md b/registry/jfrog/README.md deleted file mode 100644 index 8dea6701..00000000 --- a/registry/jfrog/README.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -display_name: Jfrog -bio: At JFrog, we are making endless software versions a thing of the past, with liquid software that flows continuously and automatically from build all the way through to production. -github: jfrog -linkedin: https://www.linkedin.com/company/jfrog-ltd -website: https://jfrog.com/ -status: partner ---- diff --git a/registry/nataindata/README.md b/registry/nataindata/README.md index ddc5095f..5f291817 100644 --- a/registry/nataindata/README.md +++ b/registry/nataindata/README.md @@ -3,5 +3,5 @@ display_name: Nataindata bio: Data engineer github: nataindata website: https://www.nataindata.com -status: community +status: partner --- From c731a5c64ebd28c5e034a79a65032a01ed8c29e7 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Mon, 28 Apr 2025 19:24:34 +0000 Subject: [PATCH 2/3] fix: remove employer field entirely --- cmd/readmevalidation/contributors.go | 51 +++------------------------- 1 file changed, 5 insertions(+), 46 deletions(-) diff --git a/cmd/readmevalidation/contributors.go b/cmd/readmevalidation/contributors.go index 85a95f0c..b27e1a8a 100644 --- a/cmd/readmevalidation/contributors.go +++ b/cmd/readmevalidation/contributors.go @@ -21,12 +21,11 @@ type contributorProfileFrontmatter struct { GithubUsername string `yaml:"github"` // Script assumes that if value is nil, the Registry site build step will // backfill the value with the user's GitHub avatar URL - AvatarURL *string `yaml:"avatar"` - LinkedinURL *string `yaml:"linkedin"` - WebsiteURL *string `yaml:"website"` - SupportEmail *string `yaml:"support_email"` - EmployerGithubUsername *string `yaml:"employer_github"` - ContributorStatus *string `yaml:"status"` + AvatarURL *string `yaml:"avatar"` + LinkedinURL *string `yaml:"linkedin"` + WebsiteURL *string `yaml:"website"` + SupportEmail *string `yaml:"support_email"` + ContributorStatus *string `yaml:"status"` } type contributorProfile struct { @@ -47,29 +46,6 @@ func validateContributorGithubUsername(githubUsername string) error { return nil } -func validateContributorEmployerGithubUsername(employerGithubUsername *string, githubUsername string) []error { - if employerGithubUsername == nil { - return nil - } - - errs := []error{} - if *employerGithubUsername == "" { - errs = append(errs, errors.New("company_github field is defined but has empty value")) - return errs - } - - lower := strings.ToLower(*employerGithubUsername) - if uriSafe := url.PathEscape(lower); uriSafe != lower { - errs = append(errs, fmt.Errorf("gitHub company username %q is not a valid URL path segment", *employerGithubUsername)) - } - - if *employerGithubUsername == githubUsername { - errs = append(errs, fmt.Errorf("cannot list own GitHub name (%q) as employer", githubUsername)) - } - - return errs -} - func validateContributorDisplayName(displayName string) error { if displayName == "" { return fmt.Errorf("missing display_name") @@ -211,9 +187,6 @@ func validateContributorYaml(yml contributorProfile) []error { allErrs = append(allErrs, addFilePathToError(yml.filePath, err)) } - for _, err := range validateContributorEmployerGithubUsername(yml.frontmatter.EmployerGithubUsername, yml.frontmatter.GithubUsername) { - allErrs = append(allErrs, addFilePathToError(yml.filePath, err)) - } for _, err := range validateContributorSupportEmail(yml.frontmatter.SupportEmail) { allErrs = append(allErrs, addFilePathToError(yml.filePath, err)) } @@ -264,7 +237,6 @@ func parseContributorFiles(readmeEntries []readme) (map[string]contributorProfil } } - employeeGithubGroups := map[string][]string{} yamlValidationErrors := []error{} for _, p := range profilesByUsername { errors := validateContributorYaml(p) @@ -272,19 +244,6 @@ func parseContributorFiles(readmeEntries []readme) (map[string]contributorProfil yamlValidationErrors = append(yamlValidationErrors, errors...) continue } - - if p.frontmatter.EmployerGithubUsername != nil { - employeeGithubGroups[*p.frontmatter.EmployerGithubUsername] = append( - employeeGithubGroups[*p.frontmatter.EmployerGithubUsername], - p.frontmatter.GithubUsername, - ) - } - } - for companyName, group := range employeeGithubGroups { - if _, found := profilesByUsername[companyName]; found { - continue - } - yamlValidationErrors = append(yamlValidationErrors, fmt.Errorf("%q: company %q does not exist but is referenced by these profiles: [%s]", rootRegistryPath, companyName, strings.Join(group, ", "))) } if len(yamlValidationErrors) != 0 { return nil, validationPhaseError{ From 7e8d4b7f27249570573ba7699f38989c9514eec5 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Mon, 28 Apr 2025 19:37:06 +0000 Subject: [PATCH 3/3] fix: make Github field optional --- cmd/readmevalidation/contributors.go | 35 ++++++++-------------------- 1 file changed, 10 insertions(+), 25 deletions(-) diff --git a/cmd/readmevalidation/contributors.go b/cmd/readmevalidation/contributors.go index b27e1a8a..89a2b1af 100644 --- a/cmd/readmevalidation/contributors.go +++ b/cmd/readmevalidation/contributors.go @@ -16,9 +16,8 @@ import ( var validContributorStatuses = []string{"official", "partner", "community"} type contributorProfileFrontmatter struct { - DisplayName string `yaml:"display_name"` - Bio string `yaml:"bio"` - GithubUsername string `yaml:"github"` + DisplayName string `yaml:"display_name"` + Bio string `yaml:"bio"` // Script assumes that if value is nil, the Registry site build step will // backfill the value with the user's GitHub avatar URL AvatarURL *string `yaml:"avatar"` @@ -30,22 +29,10 @@ type contributorProfileFrontmatter struct { type contributorProfile struct { frontmatter contributorProfileFrontmatter + namespace string filePath string } -func validateContributorGithubUsername(githubUsername string) error { - if githubUsername == "" { - return errors.New("missing GitHub username") - } - - lower := strings.ToLower(githubUsername) - if uriSafe := url.PathEscape(lower); uriSafe != lower { - return fmt.Errorf("gitHub username %q is not a valid URL path segment", githubUsername) - } - - return nil -} - func validateContributorDisplayName(displayName string) error { if displayName == "" { return fmt.Errorf("missing display_name") @@ -171,9 +158,6 @@ func validateContributorAvatarURL(avatarURL *string) []error { func validateContributorYaml(yml contributorProfile) []error { allErrs := []error{} - if err := validateContributorGithubUsername(yml.frontmatter.GithubUsername); err != nil { - allErrs = append(allErrs, addFilePathToError(yml.filePath, err)) - } if err := validateContributorDisplayName(yml.frontmatter.DisplayName); err != nil { allErrs = append(allErrs, addFilePathToError(yml.filePath, err)) } @@ -211,11 +195,12 @@ func parseContributorProfile(rm readme) (contributorProfile, error) { return contributorProfile{ filePath: rm.filePath, frontmatter: yml, + namespace: strings.TrimSuffix(strings.TrimPrefix(rm.filePath, "registry/"), "/README.md"), }, nil } func parseContributorFiles(readmeEntries []readme) (map[string]contributorProfile, error) { - profilesByUsername := map[string]contributorProfile{} + profilesByNamespace := map[string]contributorProfile{} yamlParsingErrors := []error{} for _, rm := range readmeEntries { p, err := parseContributorProfile(rm) @@ -224,11 +209,11 @@ func parseContributorFiles(readmeEntries []readme) (map[string]contributorProfil continue } - if prev, alreadyExists := profilesByUsername[p.frontmatter.GithubUsername]; alreadyExists { - yamlParsingErrors = append(yamlParsingErrors, fmt.Errorf("%q: GitHub name %s conflicts with field defined in %q", p.filePath, p.frontmatter.GithubUsername, prev.filePath)) + if prev, alreadyExists := profilesByNamespace[p.namespace]; alreadyExists { + yamlParsingErrors = append(yamlParsingErrors, fmt.Errorf("%q: namespace %q conflicts with namespace from %q", p.filePath, p.namespace, prev.filePath)) continue } - profilesByUsername[p.frontmatter.GithubUsername] = p + profilesByNamespace[p.namespace] = p } if len(yamlParsingErrors) != 0 { return nil, validationPhaseError{ @@ -238,7 +223,7 @@ func parseContributorFiles(readmeEntries []readme) (map[string]contributorProfil } yamlValidationErrors := []error{} - for _, p := range profilesByUsername { + for _, p := range profilesByNamespace { errors := validateContributorYaml(p) if len(errors) > 0 { yamlValidationErrors = append(yamlValidationErrors, errors...) @@ -252,7 +237,7 @@ func parseContributorFiles(readmeEntries []readme) (map[string]contributorProfil } } - return profilesByUsername, nil + return profilesByNamespace, nil } func aggregateContributorReadmeFiles() ([]readme, error) {