How to sync sprints

Originally asked by Francis Martens (Exalate) on 10 June 2020 (original question)


Piotr Kurpik

Your question was deleted by accident - recovering it from notification(。-_- 。)

I follow https://docs.idalko.com/exalate/pages/viewpage.action?pageId=46203325 to sync sprints from one Cloud Jira instance to another and I have a questions: 1. My incoming sync rules start with “if(entityType == “sprint”){” but unfortunatelly I’ve got error - “Script error for issue 433. Details: No such property: issue for class: Script2. Error line: Script2.groovy:1” Could someone advise? 2. I have issues already synchronized, is there any way to sync information which issues belong to which sprints? Thanks in advance for all help.


Answer by Piotr Kurpik on 16 June 2020

Francis Martens (Exalate) I just realized you asked for incoming/outgoing scripts.

Outgoing script looks like:

def boardIds = ["366"] //Boards which sprints will get synced
if(entityType == "sprint" && boardIds.find{it == sprint.originBoardId}){
    replica.name = sprint.name
    replica.goal = sprint.goal
    replica.state = sprint.state
    replica.startDate = sprint.startDate
    replica.endDate = sprint.endDate
    replica.originBoardId = sprint.originBoardId
}
if(entityType == "issue"){
    return
}

Incoming script is

if(entityType == "sprint"){
    //Executed when receiving a sprint sync from the remote side
    def sprintMap = ["366":"521"] //[remoteBoardId: localBoardId]
     
    sprint.name = replica.name
    sprint.goal = replica.goal
    sprint.state = replica.state
    sprint.startDate = replica.startDate
    sprint.endDate = replica.endDate
    def localBoardId = sprintMap[replica.originBoardId]
    if(localBoardId == null){
       throw new com.exalate.api.exception.IssueTrackerException("No board mapping for remote board id "+replica.originBoardId)
    }
    sprint.originBoardId = localBoardId //Set the board ID where the sprint will be created
}
if(entityType == "issue"){
    return
}

Comments:

Francis Martens (Exalate) commented on 16 June 2020

Do you still have the problem?

There is no ‘issue’ on line 1 in either script

Piotr Kurpik commented on 17 June 2020

I see where the issue was. What I pasted was outgoing script from one Jira Cloud instance (let’s call it A for now) and incoming script from second one (let’s call it B). I do have “issue” in line 1, but in outgoing script on B. But the only trigger I have for this connection is on A, so I believed there won’t be any outgoing action from B to A and no need to edit that. But apparently outgoing script for B is parsed anyway, so I replaced whole it with single “return” and it looks like it works now.

That leaves us only with second question - I asked “is there any way to sync information which issues belong to which sprints?”.

Francis Martens (Exalate) commented on 17 June 2020

> is there any way to sync information which issues belong to which sprints?

Can you clarify what you would like to achieve?

Piotr Kurpik commented on 17 June 2020

Issues in Jira can be assigned to sprints. For example I have project AB with issue AB-1 and board 100 and create “sprint 1” on this board. Then I create project XY with board 101 and enable issues synchronization from AB to XY and sprint synchronization from board 100 to 101. So I have XY-1 which is replica of AB-1 and “sprint 1” on board 101. When I assign issue AB-1 to “sprint 1” on board 100 I’d like to somehow have XY-1 assigned to “sprint 1” on board 101.

I can imagine two ways of doing that:

  1. sprint information could be send during issue synchronization and some helper could be used to match sprint on target board
  2. list of issues could be send during sprint synchronization. Also helper would be required to match issues from target project

I couldn’t find information if any of that is possible

Piotr Kurpik commented on 25 June 2020

Francis Martens (Exalate) any advise on that?

Answer by Piotr Kurpik on 12 June 2020

there was one answer on that from Juan Grases:

Hi! Are you running exalate 5.0.0 on Jira Server ? If that’s the case, please downgrade back to 4.7.9 (just uninstall current version and install 4.79) You can find it here: JIra 8: http://artifactory.idalko.com/artifactory/all/com/exalate/jiranode/4.7.9-j8/jiranode-4.7.9-j8.jar http://artifactory.idalko.com/artifactory/all/com/exalate/jiranode/4.7.9-j8/jiranode-4.7.9-j8.jar Jira 7: http://artifactory.idalko.com/artifactory/all/com/exalate/jiranode/4.7.9-j7/jiranode-4.7.9-j7.jar http://artifactory.idalko.com/artifactory/all/com/exalate/jiranode/4.7.9-j7/jiranode-4.7.9-j7.jar

Unfortunately I’m not using Jira Server, but Jira Cloud (Exalate plugin indeed >5.0.0)