Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion pkg/subscriptions/annotations.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ func (a Annotations) iterate(callback func(trigger string, service string, recip
trigger := parts[0]
service := ""
if len(parts) >= 2 {
service = parts[1]
// Join the remaining segments so named services (e.g. "github.orgb",
// registered as service.github.orgb in the config) resolve correctly.
// Using only parts[1] dropped the name and broke the lookup.
service = strings.Join(parts[1:], ".")
} else {
service = parts[0]
trigger = ""
Expand Down
11 changes: 11 additions & 0 deletions pkg/subscriptions/annotations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,17 @@ func TestIterate(t *testing.T) {
recipients: []string{"my-channel"},
key: "notifications.argoproj.io/subscribe.slack",
},
{
// Named service (e.g. service.github.orgb in the config) must resolve from
// the subscription annotation; the name segment was previously dropped (#346).
annotations: map[string]string{
"notifications.argoproj.io/subscribe.on-sync.github.orgb": "my-recipient",
},
triggers: []string{"on-sync"},
service: []string{"github.orgb"},
recipients: []string{"my-recipient"},
key: "notifications.argoproj.io/subscribe.on-sync.github.orgb",
},
{
annotations: map[string]string{
"notifications.argoproj.io/subscriptions": data,
Expand Down
Loading