ShareShare on LinkedIn.Share on Facebook.Share on Twitter.Share via email.

The ScriptRunner Rundown

May 4, 2021
<div class="is-layout-flex wp-container-3 wp-block-columns"> <div class="is-layout-flow wp-block-column" style="flex-basis:66.66%"> <p>Using <a href="" target="_blank" rel="noreferrer noopener">Adaptavist ScriptRunner for Jira Server</a> is much like souping-up a car. Sometimes, it can even seem as magical as Dr. Brown’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> </div> <div class="is-layout-flow wp-block-column" style="flex-basis:33.33%"> <figure class="wp-block-image size-large"><img decoding="async" loading="lazy" width="570" height="329" src="" alt="" class="wp-image-78" srcset=" 570w, 300w" sizes="(max-width: 570px) 100vw, 570px"></figure> </div> </div> <p>There are significant differences between how add-ons can integrate with Atlassian Cloud versus Server. The server versions of Atlassian’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’ 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> <h2>ScriptRunner for Atlassian Cloud Limitations</h2> <div class="is-layout-flex wp-container-6 wp-block-columns"> <div class="is-layout-flow wp-block-column" style="flex-basis:33.33%"> <figure class="wp-block-image size-large"><img decoding="async" loading="lazy" width="672" height="1024" src="" alt="" class="wp-image-79" srcset=" 672w, 197w, 768w, 1008w, 1344w, 1680w" sizes="(max-width: 672px) 100vw, 672px"></figure> </div> <div class="is-layout-flow wp-block-column" style="flex-basis:66.66%"> <p>We have grouped the differences between Server and Cloud into the following categories:</p> <ul><li>System Level</li><li>User Related Actions</li><li>JQL Function Limitations</li><li>ScriptRunner Features</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="is-layout-flex wp-container-9 wp-block-columns"> <div class="is-layout-flow wp-block-column" style="flex-basis:66.66%"> <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> </div> <div class="is-layout-flow wp-block-column" style="flex-basis:33.33%"> <figure class="wp-block-image size-large"><img decoding="async" loading="lazy" width="1024" height="1024" src="" alt="" class="wp-image-80" srcset=" 1024w, 300w, 150w, 768w, 1536w, 2048w" sizes="(max-width: 1024px) 100vw, 1024px"></figure> </div> </div> <div class="is-layout-flex wp-container-13 wp-block-columns"> <div class="is-layout-flow wp-block-column"> <ul><li>Resources: Database Connection</li><li>Resources: Local Database Connection</li><li>Code Insights</li><li>Script Fields: Database picker</li><li>Script Fields: Remote issue(s) picker</li></ul> </div> <div class="is-layout-flow wp-block-column"> <ul><li>Re-index Issues</li><li>Built-In: View Server Log Files</li><li>Built-In: Configuration Exporter</li><li>Built-In: Copy Project</li><li>Built-In: Config Exporter</li></ul> </div> <div class="is-layout-flow wp-block-column"> <ul><li>Built-In: Copy Project</li><li>Built-In: Config Exporter</li><li>Built-In: Clear Groovy Classloader or Jira Internal Caches</li><li>Built-In: Configuration Exporter</li><li>Built-In: View Server Log Files</li></ul> </div> </div> <h3>User Related Actions</h3> <div class="is-layout-flex wp-container-16 wp-block-columns"> <div class="is-layout-flow wp-block-column" style="flex-basis:33.33%"> <figure class="wp-block-image size-large"><img decoding="async" loading="lazy" width="738" height="738" src="" alt="" class="wp-image-81" srcset=" 738w, 300w, 150w" sizes="(max-width: 738px) 100vw, 738px"></figure> </div> <div class="is-layout-flow wp-block-column" style="flex-basis:66.66%"> <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> <ul><li>Interact with LDAP connection resources</li><li>Connect picker fields to LDAP details (e.g. to select from a list of users)</li><li>Switch to a different user</li></ul> </div> </div> <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="is-layout-flex wp-container-19 wp-block-columns"> <div class="is-layout-flow wp-block-column" style="flex-basis:66.66%"> <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> </div> <div class="is-layout-flow wp-block-column" style="flex-basis:33.33%"> <figure class="wp-block-image size-large"><img decoding="async" loading="lazy" width="624" height="682" src="" alt="" class="wp-image-82" srcset=" 624w, 274w" sizes="(max-width: 624px) 100vw, 624px"></figure> </div> </div> <p>The following are the JQL functions that are not currently available via the Jira Cloud REST API:</p> <div class="is-layout-flex wp-container-23 wp-block-columns"> <div class="is-layout-flow wp-block-column"> <ul><li>aggregateExpression</li><li>completeInSprint</li><li>earliestUnreleasedVersionByReleaseDate</li><li>hasRemoteLinks</li><li>inactiveUsers</li><li>incompleteInSprint</li></ul> </div> <div class="is-layout-flow wp-block-column"> <ul><li>jiraUserPropertyEquals</li><li>lastUpdated</li><li>linkedIssuesOfAll</li><li>linkedIssuesOfAllRecursive</li><li>linkedIssuesOfAllRecursiveLimited</li><li>linkedIssuesOfRemote</li></ul> </div> <div class="is-layout-flow wp-block-column"> <ul><li>myProjects</li><li>overdue</li><li>recentProjects</li><li>releaseDate</li><li>removedAfterSprintStart</li><li>startDate</li></ul> </div> </div> <h3>ScriptRunner Behaviours and Fragments</h3> <div class="is-layout-flex wp-container-26 wp-block-columns"> <div class="is-layout-flow wp-block-column" style="flex-basis:33.33%"> <figure class="wp-block-image size-large"><img decoding="async" loading="lazy" width="472" height="512" src="" alt="" class="wp-image-83" srcset=" 472w, 277w" sizes="(max-width: 472px) 100vw, 472px"></figure> </div> <div class="is-layout-flow wp-block-column" style="flex-basis:66.66%"> <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> </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> <h2>Conclusion</h2> <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 class="wp-block-quote is-style-h3-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="is-layout-flex wp-container-29 wp-block-columns"> <div class="is-layout-flow wp-block-column" style="flex-basis:66.66%"> <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> </div> <div class="is-layout-flow wp-block-column" style="flex-basis:33.33%"> <figure class="wp-block-image size-large"><img decoding="async" loading="lazy" width="1024" height="757" src="" alt="" class="wp-image-84" srcset=" 1024w, 300w, 768w" sizes="(max-width: 1024px) 100vw, 1024px"></figure> </div> </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 – if you need support then contact us.</p> <p>If you would like to learn more about ScriptRunner, visit Adaptavist’s&nbsp;<a href="">new documentation site</a>&nbsp;or take a look at their&nbsp;<a href="">previous location for documentation</a>&nbsp;for ScriptRunner up to version 6.20.0.</p>