-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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]>
- Loading branch information
Showing
7 changed files
with
322 additions
and
18 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 |
---|---|---|
@@ -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,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.
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
Oops, something went wrong.