mozilla / code-review

Automated static analysis & linting bot for Mozilla repositories
Mozilla Public License 2.0
56 stars 42 forks source link

Don't wait for Phabricator events in the 'events' service, wait through a Taskcluster hook instead #2518

Open marco-c opened 1 week ago

marco-c commented 1 week ago

Taskcluster now supports triggering a webhook through a unique url (with a token). We could build a new hook that is triggered by each Phabricator diff (same config as currently), creating a task associated to the diff. That task would run the same workflow as events:

This would resolve the issues around disk space that we have on Heroku, allowing us to do things like #2004 and #2204. This would also allow us to make the 'events' service slimmer. If we do both this and #945, we could get rid of the 'events' service altogether.

La0 commented 3 days ago

The overall workflow would be :

  1. Phabricator triggers a webhook on Taskcluster

  2. The hook triggers a new task with the request from the caller (in payload

    {
    firedBy: "triggerHookWithToken",
    taskId: 'IgfFQSAqQwysozyeB7udBw',
    payload: {..}               // API call payload
    }

    We know from our libmozevent implementation that Phabricator is able to send

    • diff ID (that's the only required info)
    • target PHID (required to send messages back to Phabricator
    • repo PHID
    • revision ID
  3. From there we can reuse code from libmozevent, without using the Bus (used on events to run continously). Internal wokflow is the one mentionned by @marco-c above:

I suggest we implement this in a new sub-project in this repo, named trigger. It would depend on libmozevent and only implement glue-code to retrieve infos from the Taskcluster payload (or from local CLI arguments to debug/develop)