Hi all
We have a lot of Scriptrunner scripts.
I want a history for those scripts and thought of git. Is there any change to push the whole script to git when I save the script?
Is there an event I can fire or any listener for this?
Thanks for any ideas.
Regards, Dominic
So, there are a couple of different approaches that you could take with this one. Unfortunately, there aren't any ScriptRunner events associated with scripts or the saving/editing of them, so most of making this happen will probably have to be done outside of ScriptRunner.
1. If you're using the script editor for your scripts, you could use something to watch file system events and when changes occur to the scripts, a shell script is run which commits and pushes the updated files. I understand that this may not be ideal as you may not currently be using the script editor for all of your scripts, but it may be worthwhile to have users move those scripts which don't use the script editor.
2. You could have users PR their scripts into a branch on a repo which is a copy of your script root, and you could create a cron job that pulls the changes from the remote repo to the script root on the server every so often.
As you create your solution, it'll probably be helpful to refer to this section of the docs on script version control best practices (this is currently only in our docs for ScriptRunner for Jira but applies to ScriptRunner for Confluence as well): https://scriptrunner.adaptavist.com/latest/jira/script-version-control.html
Also, here's our documentation on script roots: https://scriptrunner.adaptavist.com/6.16.0/confluence/_script_roots.html
Thank you for your answer. I appreciate it!
Both options aren't the perfect match for my wish.
I wished, there was a "Save" Event for ScriptRunner scripts. With the save event, I would then create a REST-call to my existing git project and pull the new content of the script.
Regards, Dominic
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Tiffany Wortham Has there been any update on this?
It seems quite strange to not be able to use version control to host the scripts.
@Dominic Lagger Were you able to find any better solutions?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sadly, no
I copy the scripts to git once I think i'm finished :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.