Move webhook triggering to async worker

What does this MR do?

This MR moves build webhook triggering from an after_create callback to an async Sidekiq worker (Ci::ExecutePipelineBuildHooksWorker).

This is prep work for #588748. When we implement bulk insert using insert_all, callbacks will not fire. By moving webhook logic to an async worker now, we ensure webhooks continue to work correctly when bulk insert is implemented.

Current behavior: after_create callback triggers N ExecuteBuildHooksWorker jobs (one per build) with pre-constructed payloads during pipeline creation.

New behavior: One ExecutePipelineBuildHooksWorker job enqueued with pipeline_id, fetches all builds and constructs payloads asyn c.

Cleanup opportunity

Once this is fully rolled out and the feature flag is removed, we can delete the old Ci::ExecuteBuildHooksWorker entirely. 🔪 :knife::knife::knife:

This is part of a sequence of MRs to fix long-running transactions:

  1. !222881 (merged) - Move build tracking callbacks to Chain::Metrics
    1. Follow-up: Move tracking to a worker: !224351 (merged) - in review
  2. Move webhook triggering to async worker 👈 YOU ARE HERE
  3. Extract build_attributes_for_bulk_insert helper - in dev
  4. Implement bulk insert with insert_all
Edited by Laura Montemayor

Merge request reports

Loading