reconquest / atlassian-external-hooks

External Hooks plugin for Atlassian Bitbucket
https://external-hooks.reconquest.io
Other
44 stars 37 forks source link

WIndows post recieve hook #38

Closed puc-covelli closed 4 years ago

puc-covelli commented 8 years ago

Hi,

I am getting no joy setting this up in windows. I am trying to set up a hook to checkout files from a bare repo into a specific folder when I push to the repo so that I can produce a filesystem of branches for the webserver to use.

I am calling the file deploy.cmd which contains

cmd.exe /c ""C:\Program Files\Git\bin\sh.exe" --login -i -- "G:\programs\atlassian\home\bitbucket\external-hooks\deploy.sh"

and calls the actual hook containing:

!/bin/bash

echo "Starting copy from repository to work tree..." pwd hostname git --work-tree=/g/appservers/webapps/$STASH_REPO_NAME/test/$STASH_PROJECT_NAME checkout -f

Nothing is happening and I have no idea where to start on this. I tried calling the .sh script directly but logs kept saying

Cannot run program "G:\programs\atlassian\home\bitbucket\external-hooks\deploy.sh" (in directory "G:\programs\atlassian\home\bitbucket\shared\data\repositories\51"): CreateProcess error=193, %1 is not a valid Win32 application

Do you have an example of how to do this on the windows platform? Also how do I get the branch name as a folder???

jdunne525 commented 8 years ago

I'm having the same problem. Did you ever get it figured out?

It appears I could probably write the whole script in the windows batch file, but I really don't want to do that. If the plugin could just run the bash script .sh file on windows it would be immensely better.

jdunne525 commented 8 years ago

Never mind.. I figured it out. I just set it up to run sh.exe as the executable.

executable: C:\Program Files\Git\bin\sh.exe

Safe Mode must be OFF!

Parameters (specify script to run here): C:\Atlassian\ApplicationData\Bitbucket\external-hooks\script.sh