Help - Hook not working.

Issue #6 resolved
Antonio Pinto created an issue

Hello. Your script is amazing. Thank you. I've setup the script correctly and done a initial Full deploy, it worked (and works) perfectly.

But I cannot seem to setup the Pull Request Hook.

Whats the url? I'm using mysite.com/gitsync/gateway.php shall I use a different url (I tried to call all files honestly :) ... ) Is there a possibility my shared host doesnt allow POST requests?

Can you please try to help me troubleshoot the problem? I've been with this for the full evening today without any luck :(

Thank you for your time.

Comments (6)

  1. Alexandru Lixandru repo owner

    Hello,

    Well, first thing to check is your own URL. The POST hook needs to post to the 'gateway.php' script, so if the gateway.php script resides in a folder named 'gitsync', yes, the URL is mysite.com/gitsync/gateway.php. You can access this URL in your browser to make sure you don't get 404 not found, or 500 server error or any other error message.

    Then, you need to make sure the POST hook is defined in the project settings on bitbucket.org. Step-by-step instructions on how to create the hook can be found here: https://confluence.atlassian.com/display/BITBUCKET/POST+hook+management The URL should be the one you identified at previous step.

    Lastly you need to check with your hosting company if the firewall in front of your site allows incoming connections from bitbucket. It is less likely that this is an issue, but if nothing else works you can go this path. See the IPs here: https://confluence.atlassian.com/display/BITBUCKET/What+are+the+Bitbucket+IP+addresses+I+should+use+to+configure+my+corporate+firewall

    You can also read more on troubleshooting POST hooks on this page https://confluence.atlassian.com/display/BITBUCKET/Troubleshoot+Bitbucket+hooks

    I hope this helps.

    Good luck! Alex

  2. Antonio Pinto reporter

    Thank you for your help. I tested the POST here www.hurl.it my url is http://rbprint.pt/gitsync/gateway.php and it returns 200 OK

    HEADERS
    
    Connection: close
    Content-Length: 0
    Content-Type: text/html
    Date: Wed, 04 Jun 2014 12:37:17 GMT
    Server: Apache
    X-Powered-By: PHP/5.4.29
    BODY view raw
    
    (empty)
    

    Yesterday I did the troubleshout on the url you provided and still no luck, but It seems that bitbucket is Posting correctly. My server firewall is not blocking the ip. I cleared the .htaccess files so they would not interfer.

    If I push the repo and than access deploy.php it does correctly update only changed files, but If I direct the POST hook to use deply.php instead of gateway.php it doesnt update. However the hurl.it post test does trigger the repo push...

    I'm totally helpless and confused.

  3. Alexandru Lixandru repo owner

    OK, I see what you mean. You want the changes to be automatically deployed after the push without manually accessing deploy.php in your browser.

    For this, you need to change automaticDeployment to true in config.php (See this line).

    This way the deployment will be started automatically when Bitbucket POST hook invokes gateway.php.

  4. Alexandru Lixandru repo owner

    I updated the config.php file so that this configuration is true by default to avoid such issues in the future. See latest commit.

  5. Antonio Pinto reporter

    Thank you!! worked :) So this basically means I'm really distracted. Honestly I spent more than 8h on this issue...

    Thank you :)

  6. Log in to comment