Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sigs,generate: improve validation, update sig-list generation #350

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
generate:
go run ./validators/cmd/sigs --dry-run=false
go run ./generators/cmd/sigs

validate-sigs:
Expand Down
2 changes: 1 addition & 1 deletion generators/cmd/sigs/sig-list.gomd
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
-}}
{{- /* gotype: kubevirt.io/community/generators/cmd/sigs.SigListTemplateData */ -}}
{{ define "group" }}|[{{ .Name }}]({{ .Dir }}/charter.md) |{{ if .Label }}[{{ .Label }}](https://github.com/kubevirt/kubevirt/labels/{{ .Label }}){{ end }} | {{ if .Leadership }}<ol>{{ range $index2, $chair := .Leadership.Chairs }}<li>[{{ $chair.Name }}](https://github.com/{{ $chair.Github }}), {{ $chair.Company }}</li>{{ end }}</ol>{{ end }} |{{ if .Contact }}[Slack]({{ .Contact.Slack}})<br/> [Mailing List]({{ .Contact.MailingList }}){{ end }} |<ul>{{ range $index3, $meeting := .Meetings }}<li>{{ $meeting.Description }}: [ {{ $meeting.Day }} at {{ $meeting.Time }} {{ $meeting.TZ }} ({{ $meeting.Frequency }}) ]({{ $meeting.URL }})</li>{{ end }}</ul> |{{ end }}
{{ define "group" }}|{{ if .Dir }}[{{ end }}{{ .Name }}{{ if .Dir }}]({{ .Dir }}/charter.md){{ end }} |{{ if .Label }}[{{ .Label }}](https://github.com/kubevirt/kubevirt/labels/{{ .Label }}){{ end }} |{{ if .Leadership }}<ol>{{ range $index2, $chair := .Leadership.Chairs }}<li>[{{ $chair.Name }}](https://github.com/{{ $chair.Github }}), {{ $chair.Company }}</li>{{ end }}</ol>{{ end }} |{{ if .Contact }}[Slack]({{ .Contact.Slack}})<br/> [Mailing List]({{ .Contact.MailingList }}){{ end }} |<ul>{{ range $index3, $meeting := .Meetings }}<li>{{ $meeting.Description }}: [ {{ $meeting.Day }} at {{ $meeting.Time }} {{ $meeting.TZ }} ({{ $meeting.Frequency }}) ]({{ $meeting.URL }})</li>{{ end }}</ul> |{{ end }}
<!---
This is an autogenerated file!

Expand Down
40 changes: 40 additions & 0 deletions pkg/labels/file.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* This file is part of the KubeVirt project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Copyright the KubeVirt Authors.
*
*/

package labels

import (
"fmt"
"gopkg.in/yaml.v3"
"os"
)

func ReadFile(path string) (*LabelsYAML, error) {
buf, err := os.ReadFile(path)
if err != nil {
return nil, fmt.Errorf("error reading %s: %v", path, err)
}

labelsYAML := &LabelsYAML{}
err = yaml.Unmarshal(buf, labelsYAML)
if err != nil {
return nil, fmt.Errorf("in file %q: %v", path, err)
}
return labelsYAML, err
}
43 changes: 43 additions & 0 deletions pkg/labels/types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* This file is part of the KubeVirt project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Copyright the KubeVirt Authors.
*
*/

package labels

type PreviousLabel struct {
Name string
Color string `yaml:",omitempty"`
}
type Label struct {
Name string
Color string `yaml:",omitempty"`
Description string `yaml:",omitempty"`
Target string `yaml:",omitempty"`
ProwPlugin string `yaml:",omitempty"`
AddedBy string `yaml:",omitempty"`
Previously []*PreviousLabel `yaml:",omitempty"`
}

type Repo struct {
Labels []*Label
}

type LabelsYAML struct {
Default *Repo
Repos map[string]*Repo
}
40 changes: 40 additions & 0 deletions pkg/orgs/file.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* This file is part of the KubeVirt project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Copyright the KubeVirt Authors.
*
*/

package orgs

import (
"fmt"
"gopkg.in/yaml.v3"
"os"
)

func ReadFile(path string) (*Orgs, error) {
buf, err := os.ReadFile(path)
if err != nil {
return nil, fmt.Errorf("error reading %s: %v", path, err)
}

orgs := &Orgs{}
err = yaml.Unmarshal(buf, orgs)
if err != nil {
return nil, fmt.Errorf("in file %q: %v", path, err)
}
return orgs, err
}
43 changes: 43 additions & 0 deletions pkg/orgs/types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* This file is part of the KubeVirt project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Copyright the KubeVirt Authors.
*
*/

package orgs

type Org struct {
Admins []string
Members []string
}

func (receiver Org) HasMember(githubHandle string) bool {
for _, admin := range receiver.Admins {
if admin == githubHandle {
return true
}
}
for _, member := range receiver.Members {
if member == githubHandle {
return true
}
}
return false
}

type Orgs struct {
Orgs map[string]Org
}
File renamed without changes.
21 changes: 13 additions & 8 deletions pkg/sigs/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@ type Sigs struct {
}

type Group struct {
Dir string
Name string
Dir string `yaml:",omitempty"`
Description string `yaml:",omitempty"`
MissionStatement string `yaml:"mission_statement,omitempty"`
Label string `yaml:",omitempty"`
Leads []*Lead `yaml:",omitempty"`
Leadership *Leadership `yaml:",omitempty"`
Meetings []*Meeting `yaml:",omitempty"`
Contact *Contact `yaml:",omitempty"`
Expand All @@ -40,8 +42,8 @@ type Group struct {
type Contact struct {
Slack string `yaml:"slack"`
MailingList string `yaml:"mailing_list"`
Teams []*Team `yaml:"teams"`
Liaison *OrgMember `yaml:"liaison"`
Teams []*Team `yaml:"teams,omitempty"`
Liaison *OrgMember `yaml:"liaison,omitempty"`
}

type Team struct {
Expand All @@ -56,23 +58,26 @@ type Meeting struct {
TZ string
Frequency string
URL string
ArchiveURL string `yaml:"archive_url"`
RecordingsURL string `yaml:"recordings_url"`
ArchiveURL string `yaml:"archive_url,omitempty"`
RecordingsURL string `yaml:"recordings_url,omitempty"`
}

type Leadership struct {
Chairs []*OrgMember
Chairs []*Chair `yaml:",omitempty"`
}

type OrgMember struct {
Github string
Name string
Name string `yaml:",omitempty"`
Company string `yaml:",omitempty"`
}

type Chair OrgMember
type Lead OrgMember

type SubProject struct {
Name string
Description string `yaml:",omitempty"`
Owners []string
Leads []*OrgMember `yaml:",omitempty"`
Leads []*Lead `yaml:",omitempty"`
}
14 changes: 5 additions & 9 deletions sigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ sigs:
- https://raw.githubusercontent.com/kubevirt/node-labeller/master/OWNERS
- https://raw.githubusercontent.com/kubevirt/kubevirt-template-validator/master/OWNERS
- https://raw.githubusercontent.com/kubevirt/hyperconverged-cluster-operator/main/OWNERS
- https://raw.githubusercontent.com/kubevirt/kvm-info-nfd-plugin/master/OWNERS
- https://raw.githubusercontent.com/kubevirt/cluster-network-addons-operator/main/OWNERS
- https://raw.githubusercontent.com/kubevirt/node-maintenance-operator/master/OWNERS
- https://raw.githubusercontent.com/kubevirt/kubectl-virt-plugin/main/OWNERS
Expand Down Expand Up @@ -61,8 +60,7 @@ sigs:
- https://raw.githubusercontent.com/kubevirt/kubevirt/main/staging/src/kubevirt.io/api/instancetype/OWNERS
- https://raw.githubusercontent.com/kubevirt/kubevirt/main/pkg/virtctl/create/instancetype/OWNERS
- https://raw.githubusercontent.com/kubevirt/kubevirt/main/pkg/virtctl/create/preference/OWNERS
- dir: sig-documentation
label: sig/documentation
- label: sig/documentation
name: documentation
subprojects:
- name: documentation
Expand All @@ -78,8 +76,7 @@ sigs:
- name: containerized-data-importer
owners:
- https://raw.githubusercontent.com/kubevirt/containerized-data-importer/main/OWNERS
- dir: sig-testing
label: sig/testing
- label: sig/testing
name: testing
subprojects:
- name: kubevirtci
Expand Down Expand Up @@ -270,7 +267,7 @@ workinggroups:
mission_statement: |
WG ARCH s390x takes care of all things related to supporting s390x architecture on KubeVirt clusters.
This includes all build processes, also support of failing builds or test lanes.
label: wg-arch-s390x
label: wg/arch-s390x
leadership:
chairs:
- github: jschintag
Expand All @@ -287,15 +284,14 @@ workinggroups:
mission_statement: |
WG ARCH ARM takes care of all things related to supporting ARM architecture on KubeVirt clusters.
This includes all build processes, also support of failing builds or test lanes.
label: wg-arch-arm
label: wg/arch-arm
leadership:
chairs:
- github: zhlhahaha
name: "Howard Zhang"
company: ARM
usergroups:
- dir: kubevirt-community
name: KubeVirt Community
- name: KubeVirt Community
mission_statement: |
Lorem Ipsum.
leadership:
Expand Down
Loading