Skip to content

Commit

Permalink
Merge pull request kubernetes#26450 from droslean/bz-groups
Browse files Browse the repository at this point in the history
[bugzilla] allow bugs to hold extra groups than configured
  • Loading branch information
k8s-ci-robot authored May 31, 2022
2 parents 121aa20 + ab4e5df commit a2c8022
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
15 changes: 1 addition & 14 deletions prow/plugins/bugzilla/bugzilla.go
Original file line number Diff line number Diff line change
Expand Up @@ -1251,18 +1251,5 @@ func isBugAllowed(bug *bugzilla.Bug, allowedGroups []string) bool {
if len(allowedGroups) == 0 {
return true
}

for _, group := range bug.Groups {
found := false
for _, allowed := range allowedGroups {
if group == allowed {
found = true
break
}
}
if !found {
return false
}
}
return true
return sets.NewString(bug.Groups...).HasAll(allowedGroups...)
}
10 changes: 9 additions & 1 deletion prow/plugins/bugzilla/bugzilla_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2311,11 +2311,19 @@ func TestIsBugAllowed(t *testing.T) {
expected: true,
},
{
name: "some but not all groups matching is not allowed",
name: "multiple groups in bug but with all allowed included is allowed",
bug: &bugzilla.Bug{
Groups: []string{"whoa", "really", "cool"},
},
groups: []string{"whoa", "really"},
expected: true,
},
{
name: "multiple groups in bug but not all allowed included is not allowed",
bug: &bugzilla.Bug{
Groups: []string{"whoa", "cool"},
},
groups: []string{"whoa", "really"},
expected: false,
},
{
Expand Down

0 comments on commit a2c8022

Please sign in to comment.