开发者

Dreamhost subversion post-commit hooks not working

I have looked at many many articles online but none have seemed to yield an answer. I run a setup where:

I have a website that will run a copy of trunk files This website has an svn folder associated with it I have a local testing environment of wampserver/mamp on my mac, tortoise svn on my pc

So i have a checkout of the repository, i make my changes and when I have a release - I commit the files.

I would like an automatic update on commit to the svn repository - this wiki explains how to do it: http://wiki.dreamhost.com/Subversion#Automatic_Post-commit_Checkout

unfortunately it is fraught with problems. Once i had my cgi folders and my updated post-commit hook sortedm i was recieving the exit code of 255. After i converted the cgi and the hook to unix and re-uploaded i had an exit code of 1.

I changed the chmod again, and no i recieve no errors. And unfortunately dreamhost does not update the files into my live site.

My hook file looks like this:

post commit:

        #!/bin/bash
        wget --http-user=username --http-passwd=password -qO - http://website.com/cgi-bin/pri/do_update.cgi     

and my do_update.cgi: #!/bin/sh

    # disable filename globbing
    set -f

    echo "Content-type: text/plain; charset=iso-8859-1"
    echo

    echo /usr/bin/svn update /home/username/website.com

Google returns many many pages with this problem, and unless i suddenly learn how to compile a program in C, i wont be able to make this work.

Any help appreciated, and would finally put a good answer out on the internet for ever开发者_高级运维yone else...


after much trouble like yourself, i have finally gotten svn post-commit hook working on Dreamhost. Both of my files are identical to yours, except it looks like you've got an extra 'echo' in your cgi script.

The permissions on my cgi file are: -rwxr-xr-x (that's 755 if i remember correctly)

Don't forget about the .htaccess/.htpasswd setup for your /cgi-bin/ directory:

Here's what my .htaccess in the /cgi-bin/ directory looks like:

AuthName "Dialog prompt"

AuthType Basic

AuthUserFile /home/username/x.com/cgi-bin/.htpasswd

Require valid-user

Keep in mind, the username/password for your 'wget' in the cgi-script file is NOT your svn user/pass, but the user/pass you setup for the cgi-bin directory specifically through that .htaccess file (also NOT your DH username/pass). I'm not sure where the svn user/pass comes into play, perhaps only on the initial checkout (through bash).

I was researching SO last night to find out how to 'reset' my SVN (it stopped running the post-commit hook, but didn't report any errors). For fixing this issue, I had to log-in to DH via bash, then manually run an svn up. Upon running that command in my X.com site directory, SVN finally reported back an error (a 'file already existed', and svn wasn't overwriting it). To remedy this, i simply re-did my update command to: svn up --force. Whammy!, my svn ran a full update in my web directory and finally i had my latest files ON my webserver. Whew!

If i recall correctly (having had this post-commit-hook working properly for months), i had to INITIALLY do an svn checkout into my web directory via bash. Once that initial checkout was done, the hook's svn update worked properly. (FYI, i use tortoise for all my usual commits)

Good luck to everyone trying to run post-commit-hooks on DH. It may be hard to setup, but in the end, totally worth it!

:-P


Here is what I do, it isn't on a linux machine, but it seems to work for me to just call svn directly on the post-commit. If you have a large export it does delay your checkin a little bit, but is super simple. Should be very similar for linux machines.

The hook:

svn.exe export https://myhostname/svn/project/trunk %WEBSITEDIR%\httpdocs\store --quiet --non-interactive --force --username user --password pass
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜