diff --git a/docs/events.md b/docs/events.md index d4a4eb52fca..8c2a60e030d 100644 --- a/docs/events.md +++ b/docs/events.md @@ -51,6 +51,11 @@ retrieving those events using the `kubectl describe` command. Tekton can also em When you [configure a sink](install.md#configuring-cloudevents-notifications), Tekton emits events as described in the table below. +Tekton sends cloud events in a parallel routine to allow for retries without blocking the +reconciler. A routine is started every time the `Succeeded` condition changes - either state, +reason or message. Retries are sent using an exponential back-off strategy. +Because of retries, events are not guaranteed to be sent to the target sink in the order they happened. + Resource |Event |Event Type :-------------|:-------:|:---------------------------------------------------------- `TaskRun` | `Started` | `dev.tekton.event.taskrun.started.v1` diff --git a/pkg/reconciler/events/event.go b/pkg/reconciler/events/event.go index 54d0d1ede9c..05d7b1f65e7 100644 --- a/pkg/reconciler/events/event.go +++ b/pkg/reconciler/events/event.go @@ -58,9 +58,12 @@ func Emit(ctx context.Context, beforeCondition *apis.Condition, afterCondition * sendKubernetesEvents(recorder, beforeCondition, afterCondition, object) if sendCloudEvents { - err := cloudevent.SendCloudEventWithRetries(ctx, object) - if err != nil { - logger.Warnf("Failed to emit cloud events %v", err.Error()) + // Only send events if the new condition represents a change + if !equality.Semantic.DeepEqual(beforeCondition, afterCondition) { + err := cloudevent.SendCloudEventWithRetries(ctx, object) + if err != nil { + logger.Warnf("Failed to emit cloud events %v", err.Error()) + } } } }