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

Automatically add a custom hook to post-receive.d in Stash 2.0.x?

Jefferson Ackor January 4, 2013

In the past we have simply defined our custom hooks in <git_install_dir>/share/git-core/templates/hooks in order to have them included in all new repositories created by Stash.

In evaluating Stash 2.0.1, it appears that we need a way to automatically add our post-receive hook to <STASH_HOME>/data/repositories/<REPO_ID>/hooks/post-receive.d. I would really appreciate any suggestions on how to manage this. Thanks.

3 answers

0 votes
Deleted user July 29, 2014

Hi Charles,

I have customized my post-receive hook to get email after every push. I have used atlassian SDK. So I have few java files and a soy template. How do I push them to my stash? Where exactly I have to copy it?

Please note that I want to do this only for one repository.

Thanks,

iihitp

0 votes
Jefferson Ackor January 4, 2013

Fantastic, Charles. Thanks very much for your support!

0 votes
cofarrell
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.
January 4, 2013

Hi Jefferson,

After creating a new repository Stash should be moving your pre/post receive hooks to pre/post-receive.d/10_custom. It is also possible to create post-receive.d/10_your_script in the templates directory directly (only in Stash 2.0.1 though).

Longer term we're planning to manage hooks _in_ Stash as plugins rather than as shell scripts on the filesystem. This is how we implemented branch permissions, and we hope to enhance both the documentation and the APIs in an uncoming release. If you're interested watch/vote on the following issue:

https://jira.atlassian.com/browse/STASH-2521

I hope this helps.

Charles

PS. If you're just trying to do a task asynchronously after every push I have created a simple Stash plugin that demonstrates a Jenkins build hook, as well as mentioning relevant parts of our in-app hooks API as well.

https://answers.atlassian.com/questions/116450/what-are-the-environmental-variables-that-are-available-to-git-post-receive-hook-for-a-repo-managed-by-stash

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events