Find the flow run resource from webhook payloads

What does this MR do and why?

This is MR 2 of 5 for https://gitlab.com/gitlab-org/gitlab/-/work_items/642267.

It depends on !274364 (merged), which must merge first. Until then, this MR targets that branch.

Ai::FlowTriggers::EventTriggerService now finds the resource for a run from the webhook payload of the new event types:

  • merge_request_hooks: the merge request.
  • issue_hooks: the issue.
  • note_hooks: the merge request or issue the note is on. Notes on commits or snippets get no resource.
  • wiki_page_hooks: no resource.

RunService uses the resource for its progress note and to link the session to the merge request or issue. All lookups go through the project, so a payload can't point at an object in another project. The pipeline_hooks lookup does not change.

Nothing calls the service with these event types yet, so nothing changes for users.

The next MRs add the worker, the dispatch from EE::Project#execute_hooks, and the GraphQL event types.

How to set up and validate locally

Nothing changes in the UI, and nothing calls the new code paths yet, so there is no manual test. The specs cover the lookups.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Merge request reports

Loading
Loading