0

I'm doing a post-receive hook for a Git deployment to delete the directory completely, git pull and replace a Git repo. I have a node server running to listen for the webhook. After it hears the webhook, it would execute the following script.

#!/bin/bash

REPO="git@bitbucket.org:git_repo/my_project.git";
RELEASE_DIR="/var/www/my_project";

echo "deleting " $RELEASE_DIR;
rm -rf $RELEASE_DIR;

echo "making new replease dir"
mkdir $RELEASE_DIR;

echo "changing path into release dir"

cd $RELEASE_DIR;
git clone -b master $REPO $RELEASE_DIR;

chgrp -h www-data $RELEASE_DIR;

I can execute this bash script independent from the service and it runs fine, but I can't get this to run live with the server. Can someone help?

I can get the server up and running and echo the message up until the script runs. I am using Advanced Rest Client extension with Chrome to post the message. But when I run it with bitbucket, i cannot get it the script to run.

huynle
  • 53
  • 1
  • 7
  • What happens when you try to run it with the server? Do you get an error? Please [edit] any additional details into your post. – Scott Weldon Oct 20 '16 at 18:46
  • Scott! thank you for helping, i went back and rechecked the post address on bitbucket and it was incorrect. I was testing the pull using Advanced Rest Client and kept the wrong URL on bitbucket! – huynle Oct 20 '16 at 19:24

1 Answers1

0

Bitbucket webhook url was set incorrectly! I had the wrong message URL set initially, debugged using ARC and never updated the URL

If anyone is interested, my original url was

http://example.com:1234/git_message

this was then debugged and the proxy server was set to accept a CNAME url instead to port 80 and rerouted internally to http://localhost:1234. This is the address that the node server was listening too.

huynle
  • 53
  • 1
  • 7