Stash Hook - create or delete file on enable or disable of Hook

Is there a way to write file persistance code on when a hook is disabled or enabled? I have created a post recieve Hook to get parameters from the user but need to persist the values to a file when the hook is enabled and file deleted when the hook is disabled.

Cheers,

Sameer Jaffer

2 answers

Hi Sameer,

I'm afraid to say there really isn't any way you can do this at the moment. Do you mind me asking what you're planning to write to file? In any case you may want to raise a feature request in JIRA so we can track the issue further:

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

What we could be doing is raising enable/disable events so that such actions can be performed.

Charles

Hi Charles,

We're attempting to allow git to execute a hook from the .../[repoid]/hooks/post-receive.d folder. Its a python script (now installed system wide on the server) which executes when called (see: https://github.com/ezyang/git-ftp ). We also need to write the configuration file this script needs to .../[repoid]/ftpdata which is input from the user. The actual input is coming from the plugin, which is currently set up as a post-receive-hook plugin in stash. This is for contextual purposes of being able to control this on a per-repository basis and only by users who have sufficient privileges. So essentially, we don't want the post-receive plugin to execute any post-receive stuff as git all ready does this. We just want to be able to enable/disable the plugin and take the needed input from the user from within stash, rather than manipulating the file system manually.

Hi Matthew,

I thought it might be something like that. You might be intested in:

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

Although it sounds like you're already doing some of the leg-work yourselves.

One alternative would be to execute the script manually from within a post-receive hook just using Java's Runtime.exec() instead of relying on Git. You could tweak the git-ftp scripts slight to take arguments in (from the Settings object) rather than from the configuration file. Not necessarily ideal but would have the desired outcome. Another suggestion would be to FTP in pure Java, but I can understand that would mean rewriting the handy git-ftp scripts.

Sorry I can't be more help.

Charles

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
Published yesterday in Off-topic

Get to know our Atlassian User Group Leaders from Bengaluru, India

Meet @Dinesh Dhinakaran, @Vishnu Vasudeva, @Rajeev Verma, and Jamshid Nalakath: Our extraordinary AUG leaders from Bengaluru, India. These four work together to strengthen the bonds of their local co...

157 views 0 4
Read article

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