Answer by Francis Martens (Exalate) on 21 September 2019
It took a while to resolve this one. The script listener API of Script Runner for Jira Cloud can be improved. If you want to have the details of the research check the Atlassian development community article here.
It boils down to testing if the event is a jira:issue_updated event, and then test that the update has been performed by Exalate (using the available User object). All other events can pass as they will not create the dreaded loop.
The snippet has been updated
here
Let me know how it goes
Comments:
Hung Nguyen commented on 26 September 2019
Hi Francis,
I have successfully tested the simple connection with 2 separate listeners, one for Comments and another for Issue Created/Updated. And things seemed to work.
I will need to try your suggestion too to consolidate the listeners. But it least the solution works and I have demo-ed to the team about this. I think they like it.
Of course, if Exalate can have something to simplify this then it would be even better.
Thanks for your help.
Francis Martens (Exalate) commented on 26 September 2019
We are thinking of delivering a docker image containing the logic for configuring multiple âchannelsâ, each channel acting as a tunnel to connect a pair of nodes.
The container can be deployed anywhere where 2 instances can meet.
Hung Nguyen commented on 02 November 2019
Hi Francis,
After we tested more on this, there are some unexpected results occurred from this setup:
- If both end-sides are updating on different fields of the same issues (corresponding issue for that site), then the middle site will eventually clear out the updated field by the non-updated value from the other side
Hung Nguyen commented on 02 November 2019
Francis,
This approach has shown a loop back to the originator site and caused error.
A does a transition from Status 1 to Status 2, sync-ing to B to do the same thing.
While itâs doing it, A continues to transition from Status 2 to Status 3,
But at that time B is just finishing the first transition from Status 1 to Status 2, it triggers a Time update by Script runner, which then send back Status 2 back to A, forcing A to move back from Status 3 to Status 2. Which is NOT what we want
Francis Martens (Exalate) commented on 07 November 2019
Back to the drawing board.
Need to do some head-scratching there.
Francis Martens (Exalate) commented on 15 November 2019
Sorry for the delay here. We have been had a number of debates how to solve this one. It seems we have something workable, which still needs to be spiked out.
Hopefully, I can come back to it in the course of next week.
Hung Nguyen commented on 18 November 2019
We are looking forward to a solution for this problem.
Right now, I had to temporarily keep a flag to say which side is changing the status last. Then prevent that side from updating the Status by exalate.
I hope that you can have a more fool-proof solution.
Francis Martens (Exalate) commented on 18 November 2019
It is the same concept but then based on the change history.
The replica has a time stamp, and you can test if the field changed.
We are delivering an externalised script with a method ifNoConflict
to be used as
ifNoConflict(issue, replica,"status") {
// put your status logic here
}
Would this fit?
Hung Nguyen commented on 12 December 2019
Hello Francis,
I am not sure I understand the solution here.
What status logic should I put into the function. And how the function is used?
Francis Martens (Exalate) commented on 15 December 2019
Hung Nguyen
I published a small piece regarding conflict handling on the documentation site
âHow to avoid conflictsâ This conflict avoidance approach is based on an update map which is calculated from the change history.
To port this solution to your specific situation, additional steps need to be taken, where the change history needs to be copied over from one side to the other.
A POC has been established. Please reach out at your convenience, and we can discuss the details during a demo.
Hung Nguyen commented on 16 December 2019
Yes, Iâd like to see how the PoC works and how we can incorporate that into our case.
Please let us know what would be the next steps?
Hung Nguyen commented on 28 October 2020
Just for the sake of others who need the similar solution, Exalate has helped to configure such a 3-node system to synchronize 2 private Jira instances. So if you need this type of setup, Exalate should be a good choice
Francis Martens (Exalate) commented on 28 October 2020
Thanks Hung Nguyen
We are currently working on the exalate gateway which will allow to connect two private instances in a secure way. The Jira cloud approach has a couple drawbacks which will be addressed in the exalate gateway. If interested - send a mail to earlyaccess@exalate.com for getting more information on the feature. We are looking for early adopters to kick the tires.