-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
POST Hook Is Working But Code Doesn't Update #10
Comments
Tested again this morning, my server access logs looks like this: 131.103.20.165 - - [20/Mar/2015:10:25:29 +0000] "POST /deploy/bitbucket.php HTTP/1.1" 200 - "-" "Bitbucket.org" My deployments.log file looks like this: 2015-03-20 10:25:29+00:00 --- INFO: master So the post hook from Bitbucket is working, it's accessing the correct file and getting a 200 response but the repo isn't updating. Either the payload is incorrect and bitbucket.php is returning the no payload message or the script isn't updating the directory. |
Output the contents of $_POST to a textfile - I assume this object used to be called 'payload' but is no longer by Bitbucket. {"repository": {"website": "", "fork": false, "name": "dyno", "scm": "git", "owner": "jcpeden", "absolute_url": "/jcpeden/dyno/", "slug": "dyno", "is_private": true}, "truncated": false, "commits": [{"node": "c03df3898dd2", "files": [{"type": "modified", "file": "README.md"}], "raw_author": "jcpeden peden.jc@gmail.com", "utctimestamp": "2015-03-20 10:31:42+00:00", "author": "jcpeden", "timestamp": "2015-03-20 11:31:42", "raw_node": "c03df3898dd2826624d92d60ec0666c0d3514e9a", "parents": ["0d5c33bd5bf2"], "branch": "master", "message": "Readme update\n", "revision": null, "size": -1}], "canon_url": "https://bitbucket.org", "user": "jcpeden"} |
Nope...still at a loss as to how to get this working - the documentation on Bitbucket is rubbish. |
Did you select the "POST" hook on the Bitbucket hooks settings page? I just tried the same and I'm getting the payload correctly. Also make sure Apache has the right access to the git folder, otherwise it won't be able to reset and pull. |
I've run into similar problems when the user running the PHP process doesn't have access to the SSH key used to check out the repo. If you know the user, you may need to copy the ssh keys into that .ssh folder. Do this only if it was set up as a deployment SSH key without access to other systems. I've been using this with Bitbucket almost exclusively for the past year or so and deployed yesterday with it, so it does work when configured. The SSH keys are usually the most fragile part. Another place to look is the PHP error log which can sometimes provide more helpful messaging that what ends up in the Deployment log. I've been meaning to try and get better logging together to catch that issue and put it in the log, but so far this script has continued working for my purposes so ends up a lower priority when I have free time. |
Thanks for the reply @lkwdwrd and @DennisDreissen - yes selected POST hook...having spent some time on this I'm pretty sure it was a permissions issue but I ended up using http://drone.io for a 'real' continuous integration setup. |
Hi,
Great little piece of code - I've set it up and have everything (seemingly) running nicely.
I can push/pull code using git pull over SSH without issue and my deployments.log file is being updated whenever I push to my bitbucket repo.
However, the code within my directories on the webserver is not updating...is the post hook returning an empty payload and if so, how do I test?
Thanks
The text was updated successfully, but these errors were encountered: