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

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

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

Fantastic, Charles. Thanks very much for your support!

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

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

174 views 20 8
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you