Another useful feature of Power Scripts for Jira is the ability to randomly run SIL scripts on demand using the SIL Runner Gadget. This enables you to configure a list of scripts that can be run at any time directly from your Dashboard.
Important!
Note that scripts run this way do not have an issue context. Therefore, constructs and keywords like "key" do not have a meaning here (they are undefined). You need to first select the issues to work with, and prefix any standard variables with the issue key.
Configuring SIL Runner Gadget
The configuration screen is only available to Jira Administrators and System Administrators and allows them to manage the list of available SIL scripts. They can add, configure security and delete scripts or edit the parameters of a runnable SIL script.
To add a script to the runner, give it a name, description, and select a file containing the script.
You can also select a security option in the Gadget to restrict script usage to specific users or groups:
- Public - the script will be available for any user
- Group - the script will be available only if the currently logged in user is a member of the specified group (will display a group picker)
- User - the script will be available only if the currently logged in user is the same as the specified one (will display a user picker)
- Project role - the script will available only if the currently logged in user is in a specific role on a specific project (will display a project picker)
Info
To edit the actual scripts, please use the SIL Manager.
Using SIL Runner Gadget
When you select a script from the list, the Description field will automatically be filled in.
The Parameters field is used to pass values into your SIL program. To add a parameter click the Add Parameter button.
Notes
- Parameter names must be unique, otherwise the most recent definition will overwrite the previous ones. This includes parameters with no name.
- You can customize the gadget to be more user friendly, by asking parameters in a different way. You can find more details here.
The parameters will be passed into the program using the argv variable. The values will be available using a construct like argv["parameter_name"] or argv[position]. For the above example, the number of rockets can be retrieved using argv["rockets"] or argv[2]. You can reorder the parameters using drag and drop.
Once you run the script, the program console will be displayed.
You can use the runnerLog routine to print info in the console as the program runs. Note that the console buffer is limited to 512 lines every ~0.5 sec and the console will only display the latest 512 lines.
runnerLog("Preparing to start a war..."); runnerLog("Building tanks..."); runnerLog("Built " + argv["tanks"] + " tanks."); runnerLog("Gathering infantry..."); runnerLog("Gathered " + argv["infantry"] + " brave men."); runnerLog("Fueling rockets..."); runnerLog(argv["rockets"] + " ready."); runnerLog("Dispatching orders..."); return "Good job! The world is now at war!";
Tip
You can return as many values as you need, regardless of their type.