Sync Jira Sprints from Data Center to Cloud

Hello,

We are currently synchronizing sprints from DC to Cloud.
The goal is to simplify the whole process, therefore we want to create one mapping in DC which is doing all the rest.

Unfortunately there seems to be no filter to only sync specific sprints: Triggering a sprint sync will migrate all sprints, exhausting the sync queue and only filter later for relevant sprints.
Is there any way to limit the outgoing sprints?

Question 1: Is there any chance to filter outgoing sprint syncs?
Question 2: Is the following appraoch feasible?

Outgoing script in DC:

Map<String, String> sprintMap = [:]
sprintMap << [“111”:“222”,“333”:“444”]

replica.sprintMap = sprintMap
def boardIds = replica.sprintMap.keySet()

if(entityType == “sprint” && boardIds.find{it == sprint.originBoardId}){
replica.name = sprint.name
[…]
}

Incoming script in Cloud:

if(entityType == “sprint”){
def sprintMap = replica.sprintMap ?: null
if (!sprintMap) throw new com.exalate.api.exception.IssueTrackerException(“sprintMapping missing” )
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 == “skip”){
return
}
if(localBoardId == null){
throw new com.exalate.api.exception.IssueTrackerException("No board mapping for remote board id "+replica.originBoardId)
}
sprint.originBoardId = localBoardId // Where the sprint will be created
}

Hi @Kuenstlah

Welcome to the Community!

Apologies for the late response, but let me update you that we are looking into this issue and will post an update soon.

Thanks,

Sonal

Hi @Kuenstlah

In case you are still looking for the solution:

Outgoing (Jira DC):

if (entityType != "sprint") {
// ... your normal issue outgoing logic ...
return
}

replica.originBoardId = sprint.originBoardId 
replica.name          = sprint.name
replica.goal          = sprint.goal
replica.state         = sprint.state
replica.startDate     = sprint.startDate
replica.endDate       = sprint.endDate

Incoming (Jira Cloud):

if (entityType != "sprint") {
// ... your normal issue incoming logic ...
return
}

// DC board id -> Cloud board id. Use "skip" to explicitly drop a board.
def boardMapping = [
"111": "222",
// "999": "skip",
]

def targetBoardId = boardMapping[replica.originBoardId]

// Not mapped, or explicitly "skip" -> drop silently (no sprint created, no error)
if (targetBoardId == null || targetBoardId == "skip") {
return
}

sprint.originBoardId = targetBoardId          // must be a valid Cloud board
sprint.name      = replica.name
sprint.goal      = replica.goal
sprint.state     = replica.state
sprint.startDate = replica.startDate
sprint.endDate   = replica.endDate

Thanks,

Sonal

Hi Sonal,
Thanks for your advice, but adding replica information for every sprint is exactly what we need to prevent, since this will create a synced entitiy for each sprint. In case of 60.000 sprints, this means usually around 59.900 unnecessary syncs which do nothing..

Instead, the solution was simply adding replica information only within the “if(entityType == “sprint” && boardIds.find{it == sprint.originBoardId}){” block.

Best regards,
Kevin

Hi Kevin,

Good catch — guarding the replica assignment inside the entityType == “sprint” && boardIds.find{…} block is the right call, and cleaner than populating unconditionally. That correctly stops a Cloud twin from being created for the sprints you don’t care about.

Let me know if you still need any kind of assistance.

Thanks,

Sonal