[TEP-0137] Activate formats field in config-events#9776
[TEP-0137] Activate formats field in config-events#9776
Conversation
5757238 to
def5911
Compare
def5911 to
176da7a
Compare
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
twoGiants
left a comment
There was a problem hiding this comment.
Just a first question so far. Tests review is pending ... ⌚ 😺
| // | ||
| // Note: this function bypasses the L1 object-level cache check performed by | ||
| // EmitCloudEvents. Callers that want full deduplication should use EmitCloudEvents | ||
| // instead. This function is retained for callers that manage their own gating |
There was a problem hiding this comment.
`This function is retained for callers that manage their own gating (e.g. EmitCloudEventsWhenConditionChange).
Will this function also be remove once EmitCloudEventsWhenConditionChange will be removed?
There was a problem hiding this comment.
Good catch, I should deprecate this function as well, so it will be removed once EmitCloudEventsWhenConditionChangeis removed.
Refactor EmitCloudEvents to read cfg.Events.Formats and dispatch to per-format senders, with a single L1 cache check before the format loop. Extract dispatchCloudEvent as the shared delivery core (L2 cache, goroutine dispatch, retries, k8s Event recording) reused by all formats. Slim SendCloudEventWithRetries to a thin wrapper. Add sendTektonV1Event as the first format-specific sender. EmitCloudEventsWhenConditionChange is unchanged (calls SendCloudEventWithRetries directly, remains deprecated). Adding a future format (tektonv2, cdevents) requires only a new eventForRunObject variant, a sendFormat function, and a case in the EmitCloudEvents switch — no changes to dispatchCloudEvent or ReconcileRunObject. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Andrea Frittoli <andrea.frittoli@uk.ibm.com>
176da7a to
8144b6b
Compare
Merging this branch will increase overall coverage
Coverage by fileChanged files (no unit tests)
Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code. Changed unit test files
|
|
/retest |
Dependencies (stacked):
Once the dependencies are merged, the PR will contain 1 commit only.
Future PRs
Changes
Activate the
formatsfield inconfig-eventsby makingEmitCloudEventsformat-aware.EmitCloudEventsto readcfg.Events.Formatsfrom context and iterate over configured formats, dispatching to per-format senders. The L1 object-level cache check runs once before the format loop, not once per format.dispatchCloudEventas the shared delivery core for all formats: L2 event-level cache check, goroutine dispatch, exponential-backoff retries, and Kubernetes Event recording (CloudEventSent/CloudEventFailed). PR7 format senders will call this without duplicating any delivery logic.sendTektonV1Eventas the first format-specific sender; it builds thetektonv1event and delegates todispatchCloudEvent.SendCloudEventWithRetriesto a thin wrapper overdispatchCloudEvent; its public contract is unchanged.EmitCloudEventsWhenConditionChangeis unchanged (callsSendCloudEventWithRetriesdirectly; remains deprecated).validFormatsinpkg/apis/config/events.go.docs/events.md; add one clarifying sentence todocs/additional-configs.md.Adding a future format (tektonv2, cdevents) requires only a new
eventForRunObjectvariant, asendFormatfunction, and acasein theEmitCloudEventsswitch — no changes todispatchCloudEventorReconcileRunObject.Submitter Checklist
As the author of this PR, please check off the items in this checklist:
/kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tepRelease Notes
/kind feature