If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2014-05-29
Originally by: *anonymous
Please consider that even something very minimal — containing just the repo URL, only on push events — would be enough to allow continuous integration services like Travis CI or Drone.io to work with sourceforge.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
thresholds (e.g. max hooks per project/repo) and rate limits
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2014-10-06
Originally by: nathanaeljones
This enables integration with CI services like drone.io and AppVeyor. Without support for webhooks, it's a bit more difficult to follow modern software development structure.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It's promising, but I don't think it is very useful for our use case in the state it is now. I skimmed through code and it seems like this package focuses more on providing different kind of senders (sync, async via redis, etc), which we probably won't need, since we using our own async jobs system. At the same time it misses some essential parts of functionality, like hmac signature of a payload.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
add log.info(r.content) to send_webhook task, after requests.post call
http://httpbin.org/post will simply return your request's POST data, headers, etc, so you can see what payload actually sent.
But test with something like Travis CI also :)
Also:
make sure it works for git, svn, mercurial
test with big pushes (hundreds of commits?)
Some optional areas for future improvements (inspired by GitHub mostly):
thresholds (already have a ticket for it on 42cc side)
send "ping" event to hook url after configuration, like github does. It's useful to ensure that webhook configured properly, without triggering event by repo push
add "ignore insecure ssl" option, it's useful for testing
support payload with application/x-www-form-urlencoded mime type
show response/error in UI for webhooks fired (last 5 maybe?)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Any ideas of services to test against? I haven't had much luck yet
HipChat
No generic commit webhook. Can't re-use GitHub or Bitbucket integrations since setups requires authenticating to those sites, presumably to configure the hook for you
We can piggy-back on Google Code v1 api but that doesn't come through good: "Dave Brondsema committed r of : "
Slack
Using their BitBucket integration: 500 error, body "No payload received from bitbucket"
Using their GitHub integration with manual configuration: our webhook submits successfully, but nothing shows up.
Travis-CI
Only works with GitHub
We may need to more closely emulate the GitHub format of a webhook, so that Allura webhooks can work with existing services more easily.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I think we should make the payload format more like bitbucket and github. In my testing so far I tried to piggy-back on 3rd parties' existing github or bitbucket integration but couldn't get it to work. A big differnce is in using "commits" instead of "revisions" (which Google Code and this branch so far use). I'd say match as much of the github payload as we can. There's a ton in there though that we won't be able to match, but the more the better. Bitbucket's payload is a bit more reasonably small. The closer we match, the more likely it is that Allura webhooks can work out-of-the-box with more 3rd party services.
A big feature like this certainly needs docs. I made a separate ticket for that [#7829]
I haven't fully evaluated the way hooks are set up (entry points) vs having them be per-tool. My initial thought is that this doesn't need to be on admin sidebar, but could be less prominent in the per-tool admin links. Again, not fully thought through.. but I am thinking that when a user creates a webhook, they have to associate it with a specific tool anyway, so why not have it be a per-tool setting. Different tools could still use a common controller/template for that.
It's weird to me to have the edit link of a webhook be a (different) URL. I think a link that just says "edit" would be better.
Created #723 to change payload format and tweak error handling for now.
I'm not sure what you mean by edit link of a webhook, could you elaborate on that?
Regarding entry points vs. per-tool my thought process was this:
it seems natural to have one place where you can see and configure all available types of hooks
it should be extensible by third-party apps. In theory with entry points you can create a new type of webhook and assign it to existing app without modifying the app itself.
Don't sure if it's a big deal, though
Last edit: Igor Bondarenko 2015-02-10
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I think you can keep the entry points and Webhook model exactly how it is now. I am thinking of just changing the admin form so that instead of one page to manage all your webhooks, you go to a Webhook admin form per app. You would still be able to have 3rd-party webhooks associated with any app.
Changing the admin pages as I described I think would actual be more natural, at least for now. We only have one type of webhook currently so a page to manage all of them isn't too useful. (We could add/restore it later). Since a user creates a webhook and associates it with a specific app, I think a per-app configuration page would be fine. Lastly, while webhooks are very cool I don't think they warrant the prominence of a left-nav menu item on the admin pages. A little more "hidden" under the tool config area would be just fine.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
MingOneOf seems like it it might be duplicative of the OneOf class in ming.schema Perhaps MingOneOf could be removed. Or if it has some unique functionality, could you add a docstring to explain that?
If a rate limit is configured and reached, it just skips the event and logs it in the server logs. That's not a good UX for the project developers, but I'm not sure of a better option without adding a lot of complexity (like allowing a several fast events in a row, but if they persist for a long time then block; or delay and retry but somehow avoid backlogging taskd with tons of events)
"You have exceeded the maximum number of projects" should say "... of webhooks"
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Fix message: "You have exceeded the maximum number of projects" should say "... of webhooks"
.
Tested with Slack (GitHub with manual configuration), Flowdock (the same) and HipChat (Google Code API hook url).
Slack works.
Flowdock: submit successful, but nothing shows up. It requires to configure GitHub hook as "send everything", so I guess it checks X-GitHub-Event header to distinguish between events, and we do not provide that. And if I add this header, webhook submit fails with:
HipChat: webhook submit fails due to incompatible payload format:
10:16:08,659ERROR[taskd:allura.webhooks.send_webhook:54db2be604687d449b51b8b3:allura.webhooks]Webhooksenderror:repo-pushhttps://api.hipchat.com/v1/webhooks/googlecode/?auth_token=155a45b4e6176b2c06e51c333b4658&room_id=1215273 /p/test/git/ 400 {"error":{"code":400,"type":"Bad Request","message":"Bad POST data format"}} CaseInsensitiveDict({'x-ratelimit-remaining': '99', 'content-length': '76', 'server': 'nginx', 'x-hipchat-jobs': 'Want to help make HipChat better? Apply at hipchat.com/jobs and mention this header.', 'connection': 'keep-alive', 'x-ratelimit-limit': '100', 'date': 'Wed, 11 Feb 2015 10:16:08 GMT', 'content-type': 'application/json', 'x-ratelimit-reset': '1423649820'})
Last edit: Igor Bondarenko 2015-02-11
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Nice that the admin form change made for cleaner code too :)
Yay for creating the admin_url helper. There's a lot of places that would be a little cleaner with it. Should Webhook.url() use it too?
For the payload:
I think we should include the ref like "ref":"refs/heads/master" Slack for example renders [repo-name:branch] at the beginning of the message, and it currently comes through like [Code:] Not sure what value to put there when it's SVN, maybe don't include it for SVN.
Again with slack, if multiple commits are pushed it shows <|3 new commits> compared to a github commit which is 3 new commits linked to the "compare" payload URL. Including that would be nice. Might as well include "before" and "after" hash too.
The _diff helper is nice. I might be a bit biased (since I wrote it) but give datadiff.tools.assert_equals a try. It'll do a diff of the data structure, aware of the semantics of dicts, lists, and how far down they are nested.
For SVN, can you change the "id" attribute to have a value like "r1" instead of "54dd2fc2d8be35744298ee3d:1".
Mercurial appears to work well (same payload recommendations as above for git).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Google code supports it too. Their docs are at http://code.google.com/p/support/wiki/PostCommitWebHooks
Github: https://developer.github.com/v3/activity/events/types/#pushevent
Bitbucket: https://confluence.atlassian.com/display/BITBUCKET/POST+hook+management
Last edit: Dave Brondsema 2015-02-05
Originally by: *anonymous
Please consider that even something very minimal — containing just the repo URL, only on push events — would be enough to allow continuous integration services like Travis CI or Drone.io to work with sourceforge.
We'll need to include some controls including:
Originally by: nathanaeljones
This enables integration with CI services like drone.io and AppVeyor. Without support for webhooks, it's a bit more difficult to follow modern software development structure.
What do you think about this webhooks package from pydanny?
It's promising, but I don't think it is very useful for our use case in the state it is now. I skimmed through code and it seems like this package focuses more on providing different kind of senders (sync, async via redis, etc), which we probably won't need, since we using our own async jobs system. At the same time it misses some essential parts of functionality, like hmac signature of a payload.
Closed #714.
ib/4542
(It's in my fork https://forge-allura.apache.org/u/jetmind/allura/ci/master/tree/). Can't push it to main repo somehow:To QA:
To test without any external service I've used http://httpbin.org
log.info(r.content)
tosend_webhook
task, afterrequests.post
callhttp://httpbin.org/post will simply return your request's POST data, headers, etc, so you can see what payload actually sent.
But test with something like Travis CI also :)
Also:
Some optional areas for future improvements (inspired by GitHub mostly):
application/x-www-form-urlencoded
mime typeI'm finishing #715 now, so if you wanna review this you better wait an ~hour to review all at once :)
Closed #715. Latest code in
ib/4542
(main repo, it works now)Any ideas of services to test against? I haven't had much luck yet
We may need to more closely emulate the GitHub format of a webhook, so that Allura webhooks can work with existing services more easily.
Feedback so far. More to come, probably:
Need a tweak like this for better error handling:
Related
Tickets:
#7829Last edit: Dave Brondsema 2015-02-09
Created #723 to change payload format and tweak error handling for now.
I'm not sure what you mean by edit link of a webhook, could you elaborate on that?
Regarding entry points vs. per-tool my thought process was this:
Don't sure if it's a big deal, though
Last edit: Igor Bondarenko 2015-02-10
Here's a screenshot of the webhook admin page. To edit one, you have to click on the webhook destination URL.
I think you can keep the entry points and Webhook model exactly how it is now. I am thinking of just changing the admin form so that instead of one page to manage all your webhooks, you go to a Webhook admin form per app. You would still be able to have 3rd-party webhooks associated with any app.
Changing the admin pages as I described I think would actual be more natural, at least for now. We only have one type of webhook currently so a page to manage all of them isn't too useful. (We could add/restore it later). Since a user creates a webhook and associates it with a specific app, I think a per-app configuration page would be fine. Lastly, while webhooks are very cool I don't think they warrant the prominence of a left-nav menu item on the admin pages. A little more "hidden" under the tool config area would be just fine.
MingOneOf
seems like it it might be duplicative of theOneOf
class inming.schema
PerhapsMingOneOf
could be removed. Or if it has some unique functionality, could you add a docstring to explain that?If a rate limit is configured and reached, it just skips the event and logs it in the server logs. That's not a good UX for the project developers, but I'm not sure of a better option without adding a lot of complexity (like allowing a several fast events in a row, but if they persist for a long time then block; or delay and retry but somehow avoid backlogging taskd with tons of events)
"You have exceeded the maximum number of projects" should say "... of webhooks"
Closed #723. Updated
ib/4542
with the following:.
Created #726 for the following:
.
Tested with Slack (GitHub with manual configuration), Flowdock (the same) and HipChat (Google Code API hook url).
Slack works.
Flowdock: submit successful, but nothing shows up. It requires to configure GitHub hook as "send everything", so I guess it checks
X-GitHub-Event
header to distinguish between events, and we do not provide that. And if I add this header, webhook submit fails with:.
HipChat: webhook submit fails due to incompatible payload format:
Last edit: Igor Bondarenko 2015-02-11
Closed #726. Updated
ib/4542
.Moving 'webhooks' link to app admin menu has allowed to remove quite a bit of not very straightforward code, including
MingOneOf
. :)Nice that the admin form change made for cleaner code too :)
Yay for creating the admin_url helper. There's a lot of places that would be a little cleaner with it. Should Webhook.url() use it too?
For the payload:
"ref":"refs/heads/master"
Slack for example renders[repo-name:branch]
at the beginning of the message, and it currently comes through like[Code:]
Not sure what value to put there when it's SVN, maybe don't include it for SVN.<|3 new commits>
compared to a github commit which is3 new commits
linked to the"compare"
payload URL. Including that would be nice. Might as well include"before"
and"after"
hash too.The
_diff
helper is nice. I might be a bit biased (since I wrote it) but givedatadiff.tools.assert_equals
a try. It'll do a diff of the data structure, aware of the semantics of dicts, lists, and how far down they are nested.For SVN, can you change the "id" attribute to have a value like "r1" instead of "54dd2fc2d8be35744298ee3d:1".
Mercurial appears to work well (same payload recommendations as above for git).