-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
1 addition
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58809f4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They say that you need a SSL certificate when using the HTTPS protocol - so I don't think that a certificate is needed if using HTTP. :)
I haven't tried this script against the webhook interface yet, mind you.
Bitbucket is deprecating the post hook, so it will need to work against webhook.
https://confluence.atlassian.com/bitbucket/event-payloads-740262817.html
58809f4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is 2 kind of hooks :
I hope it's more clear ;)
I hope BB will still offer a non-secured server hook option ...
58809f4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am trying to tell you that the webhook indeed works with regular http.
I tested it and got a response (payload).
The problem is just that BB is not sending a POST at all, it is a json 'payload'.
I found this: http://pastebin.com/WAuipRYh#
If you put this into it:
Then you can use a json viewer to figure out where to find things.
Here is an example payload as received from the linked to script: http://pastebin.com/mbXVT9uV
Hope that helps :)
I will hopefully return with a solution.
58809f4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HA!
Ok, didn't know that. I'm testing it and it seems to work.
The JSON payload seems easy to parse.
I'm working on it and gonna push it later tonight.
58809f4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So ... the file list is not available from webhooks
https://bitbucket.org/site/master/issues/11703/add-modified-file-list-in-the-repo-push
Too bad 😞
58809f4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know.
However, that is relatively easy enough - in theory - to deal with.
If you look at the payload it will tell you the hash of the commits and then you can ask BB for that commit and get the list of files that changed.
After that, just download them directly from the repository, using the hash (commit id).
If you use http://restbrowser.bitbucket.org/ you can test it before coding it. :)
58809f4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK.
In the payload, you need to find push-changes-commits-hash
And then you call the api
https://bitbucket.org/api/1.0/repositories/jacmoe/webhooktest/changesets/HASH/
That will give you a json response like this:
Then you can fetch them from the repository. Hopefully.
58809f4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The file is then at:
https://bitbucket.org/jacmoe/webhooktest/raw/3138828e2feff32376cab42750f90143220ff1c4/test.txt
I haven't had the time to test any of this :)
58809f4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And for good measure:
58809f4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, that's a huge help.
I'll check that later and implement it. Thanks!