mirror of
https://github.com/fluxcd/flagger.git
synced 2026-04-15 06:57:34 +00:00
add custom metadata in event webhook
Signed-off-by: Prajith Ndz <prajithpalakkuda@gmail.com>
This commit is contained in:
@@ -99,7 +99,7 @@ func CallWebhook(name string, namespace string, phase flaggerv1.CanaryPhase, w f
|
||||
return callWebhook(w.URL, payload, w.Timeout)
|
||||
}
|
||||
|
||||
func CallEventWebhook(r *flaggerv1.Canary, webhook, message, eventtype string) error {
|
||||
func CallEventWebhook(r *flaggerv1.Canary, w flaggerv1.CanaryWebhook, message, eventtype string) error {
|
||||
t := time.Now()
|
||||
|
||||
payload := flaggerv1.CanaryWebhookPayload{
|
||||
@@ -113,5 +113,13 @@ func CallEventWebhook(r *flaggerv1.Canary, webhook, message, eventtype string) e
|
||||
},
|
||||
}
|
||||
|
||||
return callWebhook(webhook, payload, "5s")
|
||||
if w.Metadata != nil {
|
||||
for key, value := range *w.Metadata {
|
||||
if _, ok := payload.Metadata[key]; ok {
|
||||
continue
|
||||
}
|
||||
payload.Metadata[key] = value
|
||||
}
|
||||
}
|
||||
return callWebhook(w.URL, payload, "5s")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user