-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sigs,generate: improve validation, update sig-list generation (#350)
* sigs,validator: update validator code Update validator code to take into account new sigs.yaml fields. Add validation for chairs, leads, labels and directories. Signed-off-by: Daniel Hiller <[email protected]> * update sig-list md template - missing values Signed-off-by: Daniel Hiller <[email protected]> * generate: add sig validator call Signed-off-by: Daniel Hiller <[email protected]> * sigs.yaml: remove non existing dirs and OWNERS Signed-off-by: Daniel Hiller <[email protected]> * sigs.yaml,wg-arch,wg-code-quality: correct labels Update labels to future correct ones. Signed-off-by: Daniel Hiller <[email protected]> * sigs.yaml,chairs: add kubevirt community chair Add aburdenthehand as community chair. Note: this is only stating the obvious Signed-off-by: Daniel Hiller <[email protected]> * sigs.yaml,sig-list: run make generate Updates yaml formatting and regenerates the sig-list markdown. Signed-off-by: Daniel Hiller <[email protected]> --------- Signed-off-by: Daniel Hiller <[email protected]>
- Loading branch information
Showing
12 changed files
with
735 additions
and
285 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* 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 "strings" | ||
|
||
type Org struct { | ||
Admins []string | ||
Members []string | ||
} | ||
|
||
func (receiver Org) HasMember(githubHandle string) bool { | ||
lowerCaseHandle := strings.ToLower(githubHandle) | ||
for _, admin := range receiver.Admins { | ||
if strings.ToLower(admin) == lowerCaseHandle { | ||
return true | ||
} | ||
} | ||
for _, member := range receiver.Members { | ||
if strings.ToLower(member) == lowerCaseHandle { | ||
return true | ||
} | ||
} | ||
return false | ||
} | ||
|
||
type Orgs struct { | ||
Orgs map[string]Org | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,164 @@ | ||
/* | ||
* 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 "testing" | ||
|
||
func TestOrg_HasMember(t *testing.T) { | ||
type fields struct { | ||
Admins []string | ||
Members []string | ||
} | ||
type args struct { | ||
githubHandle string | ||
} | ||
tests := []struct { | ||
name string | ||
fields fields | ||
args args | ||
want bool | ||
}{ | ||
{ | ||
name: "has member", | ||
fields: fields{ | ||
Admins: []string{ | ||
"admin1", | ||
"admin2", | ||
"admin3", | ||
}, | ||
Members: []string{ | ||
"member1", | ||
"member2", | ||
"member3", | ||
}, | ||
}, | ||
args: args{ | ||
"member1", | ||
}, | ||
want: true, | ||
}, | ||
{ | ||
name: "has admin", | ||
fields: fields{ | ||
Admins: []string{ | ||
"admin1", | ||
"admin2", | ||
"admin3", | ||
}, | ||
Members: []string{ | ||
"member1", | ||
"member2", | ||
"member3", | ||
}, | ||
}, | ||
args: args{ | ||
"admin3", | ||
}, | ||
want: true, | ||
}, | ||
{ | ||
name: "has member (lowercase)", | ||
fields: fields{ | ||
Admins: []string{ | ||
"admin1", | ||
"admin2", | ||
"admin3", | ||
}, | ||
Members: []string{ | ||
"member1", | ||
"member2", | ||
"member3", | ||
}, | ||
}, | ||
args: args{ | ||
"Member1", | ||
}, | ||
want: true, | ||
}, | ||
{ | ||
name: "has admin (lowercase)", | ||
fields: fields{ | ||
Admins: []string{ | ||
"admin1", | ||
"admin2", | ||
"admin3", | ||
}, | ||
Members: []string{ | ||
"member1", | ||
"member2", | ||
"member3", | ||
}, | ||
}, | ||
args: args{ | ||
"Admin1", | ||
}, | ||
want: true, | ||
}, | ||
{ | ||
name: "has member (uppercase)", | ||
fields: fields{ | ||
Admins: []string{ | ||
"admin1", | ||
"admin2", | ||
"admin3", | ||
}, | ||
Members: []string{ | ||
"Member1", | ||
"member2", | ||
"member3", | ||
}, | ||
}, | ||
args: args{ | ||
"member1", | ||
}, | ||
want: true, | ||
}, | ||
{ | ||
name: "has admin (uppercase)", | ||
fields: fields{ | ||
Admins: []string{ | ||
"Admin1", | ||
"admin2", | ||
"admin3", | ||
}, | ||
Members: []string{ | ||
"member1", | ||
"member2", | ||
"member3", | ||
}, | ||
}, | ||
args: args{ | ||
"admin1", | ||
}, | ||
want: true, | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
receiver := Org{ | ||
Admins: tt.fields.Admins, | ||
Members: tt.fields.Members, | ||
} | ||
if got := receiver.HasMember(tt.args.githubHandle); got != tt.want { | ||
t.Errorf("HasMember() = %v, want %v", got, tt.want) | ||
} | ||
}) | ||
} | ||
} |
File renamed without changes.
Oops, something went wrong.