Highway Three Solutions
ShareShare on LinkedIn.Share on Facebook.Share on Twitter.Share via email.

The ScriptRunner Rundown

May 4, 2021
#Add-Ons#Cloud Migration#ScriptRunner
<div class="column-2" style="grid-template-columns: 1fr 0.5fr; margin: 0;"> <p> Using <a class="h3-inline-link" title="https://www.adaptavist.com/products/atlassian-apps/scriptrunner-for-jira" href="https://www.adaptavist.com/products/atlassian-apps/scriptrunner-for-jira">Adaptavist ScriptRunner for Jira Server</a> is much like souping-up a car. Sometimes, it can even seem as magical as Dr. Brown&#8217;s DeLorean from Back to the Future. With the announcement from Atlassian to move away from server and focus solely on cloud, we have to wonder if ScriptRunner for Jira Cloud is going to match up to its predecessor. </p> <img style="align-self: center" src="https://i0.wp.com/highwaythreesolutionsdotcom.wpcomstaging.com/wp-content/uploads/2021/04/YTM5YmY0NGMtYmUyMS00ZmM5LWFmOWEtZTAwZjFiYzk0ODkz_supercharge-your-customer-support-portal-with-scriptrunner.png?ssl=1" alt="ScriptRunner" data-recalc-dims="1" /> </div> <p style="margin-top: 0;"> There are significant differences between how add-ons can integrate with Atlassian Cloud versus Server. The server versions of Atlassian&#8217;s products allow apps (i.e. add-ons) to run on the same machines, create databases specific to the app instance, and interact with the lowest level API. With Atlassian Cloud, add-on developers are limited to running code within the users&#8217; browser (via Javascript) or on their own servers; the only integration points are through the Atlassian Cloud REST APIs. </p> <p> While some ScriptRunner for Jira Server functionality can be re-written to interact with the Cloud REST API rather than the low-level Java API, porting to Cloud is more than simply translating from one API to another. The shift from Server to Cloud is also a change in the fundamental architecture, where the key characteristics of state and synchronicity shift. In the server environment, API requests were synchronous (i.e. requests wait for a response) and state was maintained. In the cloud environment, REST APIs, are asynchronous and stateless. Put another way: the results of script execution may not be visible or evident within the UI immediately. </p> <p> As a result of the shift to cloud, an app is no longer able to fully integrate with all aspects of the Atlassian product. This change in architecture has forced ScriptRunner to drastically alter what they provide for Atlassian Cloud products. </p> <p> The remainder of this article summarizes the limitations of ScriptRunner for Jira Cloud. </p> <h3>ScriptRunner for Atlassian Cloud Limitations</h3> <div class="column-2" style="grid-template-columns: 0.5fr 1fr; margin: 0;"> <img style="align-self: center; max-height: 20rem;" src="https://i2.wp.com/highwaythreesolutionsdotcom.wpcomstaging.com/wp-content/uploads/2021/04/shutterstock_264365357.jpg?ssl=1" alt="Stop Sign" data-recalc-dims="1" /> <div> <p> We have grouped the differences between Server and Cloud into the following categories: </p> <ul> <li> <p>System Level</p> </li> <li> <p>User Related Actions</p> </li> <li> <p>JQL Function Limitations</p> </li> <li> <p>ScriptRunner Features</p> </li> </ul> <p> For each category we will outline the features that are not currently supported in ScriptRunner for Atlassian Cloud. </p> </div> </div> <h3>System Level</h3> <div class="column-2" style="grid-template-columns: 1fr 0.5fr; margin: 0;"> <p> System Level features are related to database connections, mail handlers, server logs, and system configurations. At this time the Jira Cloud API does not offer the same low-level access as Jira Server and this limitation affects the following ScriptRunner system level features: </p> <img style="max-height: 12rem;" src="https://i0.wp.com/highwaythreesolutionsdotcom.wpcomstaging.com/wp-content/uploads/2021/04/shutterstock_1645966345.png?ssl=1" alt="" data-recalc-dims="1" /> </div> <div class="column-3"> <ul> <li> <p>Resources: Database Connection</p> </li> <li> <p>Resources: Local Database Connection</p> </li> <li> <p>Code Insights</p> </li> <li> <p>Script Fields: Database picker</p> </li> <li> <p>Script Fields: Remote issue(s) picker</p> </li> </ul> <ul> <li> <p>Re-index Issues</p> </li> <li> <p>Built-In: View Server Log Files</p> </li> <li> <p>Built-In: Configuration Exporter</p> </li> <li> <p>Built-In: Copy Project</p> </li> <li> <p>Built-In: Config Exporter</p> </li> </ul> <ul> <li> <p>Built-In: Copy Project</p> </li> <li> <p>Built-In: Config Exporter</p> </li> <li> <p>Built-In: Clear Groovy Classloader or Jira Internal Caches</p> </li> <li> <p>Built-In: Configuration Exporter</p> </li> <li> <p>Built-In: View Server Log Files</p> </li> </ul> </div> <h3>User Related Actions</h3> <div class="column-2" style="grid-template-columns: 0.5fr 1fr; margin: 0;"> <img style="max-height: 12rem; align-self: center; justify-self: center;" src="https://i2.wp.com/highwaythreesolutionsdotcom.wpcomstaging.com/wp-content/uploads/2021/04/shutterstock_266711807.png?ssl=1" alt="" data-recalc-dims="1" /> <p> Systems with managed accounts can connect to a User Directory (LDAP, etc.); however, functionality available for scripting user management in Cloud is very different than on Server. ScriptRunner for Server can interact with these types of integrations (LDAP integration points). Specifically, ScriptRunner for Server can: </p> </div> <ul> <li> <p>Interact with LDAP connection resources</p> </li> <li> <p>Connect picker fields to LDAP details (e.g. to select from a list of users)</p> </li> <li> <p> Switch to a different user </p> </li> </ul> <p> None of the above is possible with ScriptRunner for Cloud. It is possible for a user to masquerade as another user if you have the right system permissions, but this is not something you can programatically do with ScriptRunner for Cloud. </p> <h3>JQL Functions</h3> <div class="column-2" style="grid-template-columns: 1fr 0.5fr; margin: 0;"> <p> ScriptRunner for Server can interact directly with JQL queries. This is NOT possible for Cloud. As a result, many of the custom JQL functions previously possible for Server cannot be replicated for Cloud. However, ScriptRunner (in the background) can augment Jira issues with extra attributes that you can query within JQL. For example, when sprint information is updated for a project, a ScriptRunner script can update issues asynchronously with a keyword nextSprint. </p> <img style="max-height: 10rem; place-self: center;" src="https://i0.wp.com/highwaythreesolutionsdotcom.wpcomstaging.com/wp-content/uploads/2021/04/shutterstock_748886182.png?ssl=1" alt="" data-recalc-dims="1" /> </div> <p style="margin: 0;"> The following are the JQL functions that are not currently available via the Jira Cloud REST API: </p> <div class="column-3" style="word-break: break-all;"> <ul> <li> <p>aggregateExpression</p> </li> <li> <p>completeInSprint</p> </li> <li> <p>earliestUnreleasedVersionByReleaseDate</p> </li> <li> <p>hasRemoteLinks</p> </li> <li> <p>inactiveUsers</p> </li> <li> <p>incompleteInSprint</p> </li> </ul> <ul> <li> <p>jiraUserPropertyEquals</p> </li> <li> <p>lastUpdated</p> </li> <li> <p>linkedIssuesOfAll</p> </li> <li> <p>linkedIssuesOfAllRecursive</p> </li> <li> <p>linkedIssuesOfAllRecursiveLimited</p> </li> <li> <p>linkedIssuesOfRemote</p> </li> </ul> <ul> <li> <p>myProjects</p> </li> <li> <p>overdue</p> </li> <li> <p>recentProjects</p> </li> <li> <p>releaseDate</p> </li> <li> <p>removedAfterSprintStart</p> </li> <li> <p>startDate</p> </li> </ul> </div> <h3>ScriptRunner Behaviours and Fragments</h3> <div class="column-2" style="grid-template-columns: 0.5fr 1fr; margin: 0;"> <img style="max-height: 8rem; place-self: center;" src="https://i2.wp.com/highwaythreesolutionsdotcom.wpcomstaging.com/wp-content/uploads/2021/04/innovation.png?ssl=1" alt="" data-recalc-dims="1" /> <p> The Behaviours feature included in ScriptRunner for Jira Server Behaviours provides more control over fields and their behaviours. This feature is not available for Cloud given the change in architecture and developer framework. It is not possible to interact and modify the UI in the same manner as with Jira Server, and this directly impacts manipulation of the Jira fields. </p> </div> <p> The ScriptRunner for Server Fragments feature allowed scripts to inject UI components within specific places. In Jira Cloud, the Atlassian developer framework provides specific areas of the page (i.e. screen) where add-ons can present data (UI components). Script Fragments in ScriptRunner for Cloud can only inject html in the web panels. </p> <h3>Conclusion</h3> <p> This may sound like it’s all bad news. It isn’t. The changes that come with the shift to Atlassian Cloud provide many advantages and new opportunities for add-on app developers. Adaptavist, the developers of ScriptRunner, have summarized this best: </p> <blockquote> <p><em> As with most programming situations there are trade offs when writing scripts for both Cloud and Server and the limitations of Cloud are at the expense of stability and performance of the Atlassian application. </em></p> </blockquote> <div class="column-2" style="grid-template-columns: 1fr 0.5fr; margin: 0;"> <p> The good news is that Adaptavist is continuing to develop ScriptRunner for Atlassian Cloud products. At present, just over half of the features in ScriptRunner for Jira Server are supported in some capacity in ScriptRunner for Jira Cloud. Their status page suggests they aren’t finished with this work yet and more changes are expected. </p> <img src="https://i0.wp.com/highwaythreesolutionsdotcom.wpcomstaging.com/wp-content/uploads/2021/04/shutterstock_1515834812.png?ssl=1" alt="" data-recalc-dims="1" /> </div> <p> Furthermore, the lack of supported features from the server version does not mean you will lose half of your functionality by moving to the cloud. The missing features may not be ones you currently use. We recommend you take stock of your existing ScriptRunner scripts in use and review them with the functionality supported in ScriptRunner for Cloud to identify the impact on your team. As an Atlassian solutions partner, we are here to support you with this analysis &#8211; if you need support then contact us. </p> <p>If you would like to learn more about ScriptRunner, visit Adaptavist’s <a href="https://docs.adaptavist.com/?_ga=2.101774657.1335031310.1620160332-430693690.1618503562">new documentation site</a> or take a look at their <a href="https://scriptrunner.adaptavist.com/latest/jira/quickstart.html">previous location for documentation</a> for ScriptRunner up to version 6.20.0.</p>