Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

pre-receive-hook declined

Conn August 21, 2015

Hi,

I'm trying to setup some hooks so that when I push from my local machine to Stash, it then pushes from stash to the repo we have over the web directory, so that we can use the same server for Stash and for testing/demos.

So I've setup a repo over our web directory "/var/www/html/projectname"

And I've create a repo in Stash.

I can push from my local machine to Stash, that's fine.

So I installed this plugin: https://marketplace.atlassian.com/plugins/com.ngs.stash.externalhooks.external-hooks

And I followed the example script and set up an "External Pre Receive Hook". I've pointed it to a file I create called "test", which literally just says:

#!/bin/bash
echo "Hello"

For testing purposes. It accepts that file as an executable file in the plugin.

However when I then try to push up from my local machine again, i get the "pre-receive-hook declined".

When I go into the actual error logs it says:

2015-08-21 11:04:03,009 ERROR [threadpool:thread-2] conn @1IHSO9Px664x1924x0 10.16.140.19 "POST /scm/mdl/moodle.git/git-receive-pack HTTP/1.1" c.n.s.e.hook.ExternalPreReceiveHook Error running [/var/atlassian/application-data/stash/external-hooks/test, ] in /var/atlassian/application-data/stash/shared/data/repositories/2
java.io.IOException: Cannot run program "/var/atlassian/application-data/stash/external-hooks/test" (in directory "/var/atlassian/application-data/stash/shared/data/repositories/2"): error=2, No such file or directory

So it's saying it can't find that "test" file. But it is defintitely in the correct location and it's executable to everyone, and the Hooks plugin accepts it as valid..

Is this something wrong with the plugin itself? Or am I doing something wrong?

Or is there a better way to do this?

 

Thanks.

 

Edit:

I've also tried this plugin: https://marketplace.atlassian.com/plugins/com.englishtown.stash-hook-mirror

But in this case, firstly I wasn't sure exactly what to put as the path, since it's on the same linux server, so we wouldn't want to use http or ssh. I just put the file path "/var/www/html/projectname", but I get an error about there being insifficient permissions to add objects, even though the directory (and its contents) has the correct stash group, and it has the correct permissions.

 

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Mark McCormack (Adaptavist)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 21, 2015

Conn,

Are you trying to achieve this essentially: https://scriptrunner.adaptavist.com/stash/latest/docs/post_receive_hooks/#update-static-site

This Add-on might help.

Conn August 21, 2015

Possibly, but we don't do anything with git TAGs, so I'm not sure if that would work for us. I also have no real experience with java, so was hoping one of the marketplace plugins would work, but I can't seem to get any of them to, I just keep getting various errors :(

TAGS
AUG Leaders

Atlassian Community Events