Skip to content

Commit

Permalink
fix: merge events
Browse files Browse the repository at this point in the history
Signed-off-by: Vladislav Sukhin <[email protected]>
  • Loading branch information
vsukhin committed Dec 24, 2024
1 parent f5933aa commit a4b76bb
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion pkg/event/kind/webhook/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,21 @@ func mergeWebhooks(dst, src executorv1.Webhook) executorv1.Webhook {
}
}

// events
srcEventTypes := make(map[executorv1.EventType]struct{})
for _, eventType := range src.Spec.Events {
srcEventTypes[eventType] = struct{}{}
}

dstEventTypes := make(map[executorv1.EventType]struct{})
for _, eventType := range dst.Spec.Events {
dstEventTypes[eventType] = struct{}{}
}

for evenType := range srcEventTypes {
if _, ok := dstEventTypes[evenType]; !ok {
dst.Spec.Events = append(dst.Spec.Events, evenType)
}
}

if !dst.Spec.Disabled && src.Spec.Disabled {
dst.Spec.Disabled = src.Spec.Disabled
Expand Down

0 comments on commit a4b76bb

Please sign in to comment.