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.
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:
What we could be doing is raising enable/disable events so that such actions can be performed.
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.
I thought it might be something like that. You might be intested in:
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.
Hi awesome community! In this article, I would like to describe the one of the toolset (service) for the analyze some problems on different Java-based instances, of course, as Atlassian admini...
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!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG