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

This widget could not be displayed.

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

This widget could not be displayed.

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
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in Teamwork

What teamwork quotes inspire you?

Hey everyone! My name is Natalie and I'm an editor of the Atlassian Blog and I've got a question for you: What's your favorite quote about teamwork?  We've compiled a list here, along with...

178 views 18 7
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