Backstory - Origin

Inspiration - take the ubiquitous ScriptRunner for JIRA platform and port it to the Atlassian Connect Framework

ScriptRunner for JIRA is the 3rd on the Atlassian Marketplace list of top selling JIRA add-ons (inside of 1 year). Due to sheer customer demand, Adaptavist wanted to offer the same functionality through JIRA Cloud. ScriptRunner for JIRA Cloud started off as a ShipIt project last year where we achieved a proof of concept. We extended beyond the ShipIt work during the Atlassian Connect week in Amsterdam this year. Now we're ready to launch our fully fledged Cloud add-on.

Why it's special

ScriptRunner for JIRA Cloud allows you to extend the functionality of JIRA Cloud, executing scripts to interact with JIRA as Post Functions or Event Listeners. Scripts can take actions such as updating an issue during a transition or performing a calculation and storing the result in a custom field on the issue. Administrators have the power of the Groovy programming language at their disposal to respond to events and transitions, manipulating JIRA using the REST API.

It also allows admins and power users to quickly extend JIRA Cloud functionality to support your business processes in your workflows by scripting post functions without the hassle of writing a fully-fledged Connect Add-on.

Features include:

  • Run your own customised Groovy scripts from the Script Console in your JIRA Cloud instance
    • Built-in Script
    • Copy Custom Field Values
  • Built-in Workflow Post Functions like
    • Clone Issue
    • Create Subtask
    • Conditionally Fast-Track Transition an Issue
    • Transition Parent Issue
    • Modify Issue
  • Examples
    • Do a calculation using existing custom fields and update a calculated field
    • Post a message to HipChat room based on a specific updated issue event
  • Script Listeners
    • Calculated Custom Field
    • Post to HipChat based on a Version Release event
    • Create Issues whenever a project is created (automatically)
    • Extend the JIRA notifications based on specific fields changing in an issue

Challenges we ran into

Scripts in ScriptRunner Cloud do not execute within the same process as JIRA and so must interact with JIRA using the REST APIs rather than the JAVA APIs. Atlassian Connect is also inherently asynchronous which means that when a script executes the user may see the page load before the script has completed.

Asynchronous execution is at the heart of the Atlassian Connect Framework that ScriptRunner must use to extend JIRA Cloud. JIRA fires webhooks when events and transitions occur and any user interface elements are loaded in iframes. It is not possible to veto, cancel or otherwise prevent JIRA performing an action using ScriptRunner. Scripts themselves are written synchronously, that is REST API calls are made in a blocking style (although async methods are provided too).

All user provided code is executed in an isolated container. ScriptRunner for JIRA Cloud is a service that is shared by many customers so isolation is very important that when executing scripts. Isolation is a goal that has been core to the design of ScriptRunner for JIRA from its inception. Each customer has a container that is theirs and theirs only. It is not possible for the code of one customer to have been run in the container of another. Containers are also designed to be single use, however it is possible that containers will be re-used for execution on occasion, but script writers should not rely on this. Disk storage in these containers is ephemeral, any changes written to the disk will be discarded.

What's next for ScriptRunner for JIRA Cloud

We will be looking at all of the functionality available in JIRA Server and working out whether it can be achieved in the Connect Framework and via the REST API.

  • More built-in scripts
  • Add advanced JQL Functions like hasComments, hasAttachments, hasSubtasks, hasLinks, myProjects, recentProjects and more
  • Ability to customise the JIRA User Interface with buttons of your choosing
  • Scheduled jobs like an escalation service

Built With

+ 7 more
Share this project: