Skip to content

Commit

Permalink
fix: removing fix so that it can be included in another PR
Browse files Browse the repository at this point in the history
  • Loading branch information
Claire.Nicholas authored and Claire.Nicholas committed Jan 3, 2024
1 parent a4aa422 commit fe13392
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 20 deletions.
20 changes: 6 additions & 14 deletions library/secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,24 +71,16 @@ func (s *Secret) Match(from *pipeline.Container) bool {
switch from.Environment["VELA_BUILD_EVENT"] {
case constants.EventPush:
eACL = checkEvent(events, constants.EventPush)
case constants.EventPull + ":" + constants.ActionOpened:
eACL = checkEvent(events, constants.EventPull+":"+constants.ActionOpened)
case constants.EventPull + ":" + constants.ActionSynchronize:
eACL = checkEvent(events, constants.EventPull+":"+constants.ActionSynchronize)
case constants.EventPull + ":" + constants.ActionEdited:
eACL = checkEvent(events, constants.EventPull+":"+constants.ActionEdited)
case constants.EventPull:
eACL = checkEvent(events, constants.EventPull)
case constants.EventTag:
eACL = checkEvent(events, constants.EventTag)
case constants.EventDeploy:
eACL = checkEvent(events, constants.EventDeploy)
case constants.EventComment + ":" + constants.ActionCreated:
eACL = checkEvent(events, constants.EventComment+":"+constants.ActionCreated)
case constants.EventComment + ":" + constants.ActionEdited:
eACL = checkEvent(events, constants.EventComment+":"+constants.ActionEdited)
case constants.EventDelete + ":" + constants.ActionBranch:
eACL = checkEvent(events, constants.EventDelete+":"+constants.ActionBranch)
case constants.EventDelete + ":" + constants.ActionTag:
eACL = checkEvent(events, constants.EventDelete+":"+constants.ActionTag)
case constants.EventComment:
eACL = checkEvent(events, constants.EventComment)
case constants.EventDelete:
eACL = checkEvent(events, constants.EventDelete)
case constants.EventSchedule:
eACL = checkEvent(events, constants.EventSchedule)
}
Expand Down
12 changes: 6 additions & 6 deletions library/secret_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ func TestLibrary_Secret_Match(t *testing.T) {
{
step: &pipeline.Container{
Image: "alpine:latest",
Environment: map[string]string{"VELA_BUILD_EVENT": "pull_request:opened"},
Environment: map[string]string{"VELA_BUILD_EVENT": "pull_request"},
},
sec: &Secret{Name: &v, Value: &v, Images: &[]string{}, Events: &[]string{"pull_request:opened"}},
sec: &Secret{Name: &v, Value: &v, Images: &[]string{}, Events: &[]string{"pull_request"}},
want: true,
},
{
Expand All @@ -73,9 +73,9 @@ func TestLibrary_Secret_Match(t *testing.T) {
{
step: &pipeline.Container{
Image: "alpine:latest",
Environment: map[string]string{"VELA_BUILD_EVENT": "comment:created"},
Environment: map[string]string{"VELA_BUILD_EVENT": "comment"},
},
sec: &Secret{Name: &v, Value: &v, Images: &[]string{}, Events: &[]string{"comment:created"}},
sec: &Secret{Name: &v, Value: &v, Images: &[]string{}, Events: &[]string{"comment"}},
want: true,
},
{
Expand Down Expand Up @@ -163,9 +163,9 @@ func TestLibrary_Secret_Match(t *testing.T) {
{
step: &pipeline.Container{
Image: "alpine:latest",
Environment: map[string]string{"VELA_BUILD_EVENT": "pull_request:opened"},
Environment: map[string]string{"VELA_BUILD_EVENT": "pull_request"},
},
sec: &Secret{Name: &v, Value: &v, Images: &[]string{"alpine:latest"}, Events: &[]string{"push:opened"}},
sec: &Secret{Name: &v, Value: &v, Images: &[]string{"alpine:latest"}, Events: &[]string{"push"}},
want: false,
},
{
Expand Down

0 comments on commit fe13392

Please sign in to comment.