Add a new webhooks framework and port over the review request published hook.

Review Request #6014 — Created June 21, 2014 and submitted

Information

Review Board
master
ca756ea...

Reviewers

This change adds a new webhooks framework which obsoletes the rbwebhooks
extension. As more and more web services start integrating with each other,
it's becoming more expected that these sorts of facilities will be in the core
product.

The payloads for events piggy-back on the WebAPI's serialization routines. This
means that we get all the relevant data, as well as the links for each
resource. This makes the payload for the webhook much more useful than it was
in the extension.

Additionally, there's an X-ReviewBoard-Event header which lists the event name,
and an X-ReviewBoard-Signature header which is an HMAC signature of the
payload. If the webhook is configured with a 'secret', that secret is used as
the key for the HMAC digest.

This new framework currently implements the review_request_published event.
Implementation for the others will come once this is approved.

Set up a webhook to point to requestb.in and published a review request.
Checked the request bin and saw the expected JSON payload with valid links, as
well as the correct headers.

Description From Last Updated

"webhook"

chipx86chipx86

These don't seem like things that should be class-level.

chipx86chipx86

This should explicitly call SiteConfiguration.objects.get_current(), to take advantage of caching and invalidation.

chipx86chipx86
chipx86
  1. \o/

  2. reviewboard/notifications/models.py (Diff revision 1)
     
     

    "webhook"

  3. reviewboard/notifications/models.py (Diff revision 1)
     
     

    You know, what would be cool is if this could allow for custom event types that extensions could provide as well.

    Not necessary right now, but food for thought.

  4. reviewboard/notifications/webhooks.py (Diff revision 1)
     
     
     

    These don't seem like things that should be class-level.

    1. I wanted them to be class-level to avoid lots of duplicate work.

  5. reviewboard/notifications/webhooks.py (Diff revision 1)
     
     

    This should explicitly call SiteConfiguration.objects.get_current(), to take advantage of caching and invalidation.

  6. setup.py (Diff revision 1)
     
     

    I wonder if we should just fork that and stick it into Djblets. Otherwise, poor Stephen's got another package he'll have to maintain :)

    At the very least, we should give him a heads up. Want to add him as a reviewer?

    1. Short of doing a clean-room reimplementation, it's hard to stick it into djblets because it's LGPL 3.

  7. 
      
david
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/notifications/webhooks.py
        reviewboard/notifications/models.py
        reviewboard/notifications/__init__.py
        setup.py
        reviewboard/notifications/admin.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/notifications/webhooks.py
        reviewboard/notifications/models.py
        reviewboard/notifications/__init__.py
        setup.py
        reviewboard/notifications/admin.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/notifications/webhooks.py
        reviewboard/notifications/models.py
        reviewboard/notifications/__init__.py
        setup.py
        reviewboard/notifications/admin.py
    
    
    
    Tool: Pyflakes
    Processed Files:
        reviewboard/notifications/webhooks.py
        reviewboard/notifications/models.py
        reviewboard/notifications/__init__.py
        setup.py
        reviewboard/notifications/admin.py
    
    
  2. 
      
chipx86
  1. Ship It!

  2. 
      
david
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to master (e6dc4ab)
Loading...