Does ScriptRunner Cloud guarantee script execution order?

Say on a Post Function list I have 3 different scripts that do different things based on different execution conditionals, and would ideally be kept separately due to their use elsewhere in the system (if someone commits to the master backups its more work to merge into one megascript)

Lets call these Scripts A, B and C (in that order in the Post Function operation list)

 - Are they guaranteed to execute in that order (A->B->C)?

 - Will B execute before A is finished? Can/should B rely on possible changes made by A or assume randomness?

 - If B was to Transition an issue (thereby triggering other automation on a different Post Function routine) will C be run? If C was to run, will it fail due to outdated Transition data passed to the script?

 

The joys of an async environment smile 

1 answer

1 accepted

Hi Andrew,

The short answer is no. You can't rely on any ordering for post functions and scripts will be executed in parallel. JIRA fires off the webhooks that cause the scripts to be executed in the order they appear in, but it does not wait for the webhook to complete before sending the next.

We have some ideas around guaranteed ordering of post functions, such as having a list of scripts that execute as one post function, but nothing concrete as yet.

Regards, Jon

So;

Are they guaranteed to execute in that order (A->B->C)? => Yes, JIRA respects the Post Function ordering

Will B execute before A is finished? Can/should B rely on possible changes made by A or assume randomness? => No; guarantees aren't there. Assume unreliable states if multiple scripts are modifying the same fields

If B was to Transition an issue (thereby triggering other automation on a different Post Function routine) will C be run? If C was to run, will it fail due to outdated Transition data passed to the script? => Yes, C will be run as its part of the Post Function op routine. Again assume unreliable states

Correct? Its basically what I expected, but good to confirm. 

Is this also true for script listeners? That is, they run in parallel?

Andrew: Yes if I understand correctly your scenario you're correct.

Aristedes: Yes they are run in parallel

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Fadoua M. Boualem
Published Monday in Trello

Using Trello to manage events

As a Jira power user, I was at first doubtful that Trello could benefit my workflow. Jira already uses boards (ones you can customize!), so why would I even need to use Trello?! In this post you will...

476 views 7 8
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you