Enabling webhooks to close review-requests after commits
Review Request #9585 — Created Feb. 4, 2018 and updated — Latest diff uploaded
Review request for feature of rb-gateway to support webhooks on git events. The workflow is
1) Once rb-gateway runs, it installs hookscripts in the repos' it manages. It will install the hookscript under:path/to/repo/.git/hooks/<event-type>.d/99-rb-gateway.shin addition to a<event-type>script underpath/to/repo/.git/hooks/that runs any pre-existing<event-type>scripts in the repo. We only support thepost-commitevent for now.
2) Make a commit in the repo hosted on rb-gateway. This will run the hookscript installed in Step 1
3) Hookscript will run which will pipe the commit data from Step 2 to rb-gateway and rb-gateway will make an HTTP request to the reviewboard instance (assuming this is properly configured inconfig.json)
4) Reviewboard will receive this HTTP request, and close the corresponding reviewBetween the first diff and the latest one, there's been a lot of file movement since I was working off a patch link r/9402 but there was a non-trivial rewrite of rb-gateway in between on master.
Changes include:
1) Updating README on how to run rbgateway
2) Adding API calls for changing the config through http requests rather than having to change the file itself(i.e.DeleteWebhookDisableWebhookRegisterWebhook)
3) Default hookscripts included in rb-gateway, rb-gateway will automatically install them based on ./config/post-commit.sh (or whatever future event-type we will support)
4) Rb-gateway sending an HTTPPOSTto the webhook urlsCorresponding review for reviewboard side of the code:
https://reviews.reviewboard.org/r/9700/
Ran tests
Manual test:
1) Make review request on locally running reviewboard instance of repo rb-gateway will be managing
2) Run rb-gateway with config pointing to a local repo and a webhook
3) Make commit in local repoReview request in Step 1 is closed after Step 3 has completed.