Sync Tempo with Advanced Roadmaps
Create a new team in Tempo, as a result, you will get the same team in Advanced Roadmaps.
We append Tempo’s team id in braces, you can change this behavior as you like.
Tempo
Advanced Roadmaps
Implementation
We do that with the fantastic, free, reliable Jira add-on myGroovy.
It will be a listener. First, we need to figure out the class we want to catch.
https://github.com/tempo-io/tempo-events-example/blob/master/README.md
This class belongs to the Tempo plugin. We move to Jira’s admin panel: „Manage Apps”.
Add these two as parameters to a new listener created with myGroovy.
More information regarding the REST API of Advanced Roadmaps: https://docs.atlassian.com/portfolio-for-jira-server/REST/2.13.0/teams/
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.config.properties.APKeys
import groovy.json.JsonBuilder
import org.apache.log4j.Level
import org.apache.log4j.Logger
import com.atlassian.sal.api.net.TrustedRequest
import com.atlassian.sal.api.net.Request.MethodType
import com.atlassian.sal.api.net.TrustedRequestFactory
import javax.ws.rs.core.HttpHeaders
class TeamDTO {
String title
boolean shareable
}
def isCondition(event) {
def myLog = Logger.getLogger("Tempo Team to Advanced Roadmaps Shared Teams")
myLog.setLevel(Level.ALL)
myLog.info("event: " + new JsonBuilder(event).toPrettyString())
def baseUrl = ComponentAccessor.getApplicationProperties().getString(APKeys.JIRA_BASEURL)
def trustedFactory = ComponentAccessor.getOSGiComponentInstanceOfType(TrustedRequestFactory) as TrustedRequestFactory
def request = trustedFactory.createTrustedRequest(MethodType.POST, "${baseUrl}/rest/teams-api/1.0/team")
request.addTrustedTokenAuthentication(new URL(baseUrl).getHost())
request.addHeader(HttpHeaders.ACCEPT, "application/json")
request.addHeader(HttpHeaders.CONTENT_TYPE, "application/json")
def teamDto = new TeamDTO(
title: event.team.name + " (TEMPOID" + event.team.id + ")",
shareable: true
)
def requestString = new JsonBuilder(teamDto).toString()
myLog.info("Team object for Advanced Roadmaps: " + requestString)
request.setRequestBody(requestString)
try {
request.execute()
} catch(Exception ex) {
myLog.info("Exception while adding the team object to Advanced Roadmaps: " + ex.toString())
}
}
isCondition(event)
The two entries in Jira’s log file:
2020-12-12 17:18:34,878+0100 http-nio-127.0.0.1-8180-exec-9 INFO admin 1038x6919x1 7ja5zg 127.0.0.1 /rest/tempo-teams/2/team/ [Tempo Team to Advanced Roadmaps Shared Teams] event: {
"team": {
"summary": "",
"id": 19,
"isPublic": false,
"name": "Tempo Team A",
"lead": {
"active": true,
"key": "JIRAUSER10000",
"username": "admin",
"email": "admin@mail.local",
"displayName": "Your Administrator"
},
"program": null,
"mission": null
}
}
2020-12-12 17:18:34,935+0100 http-nio-127.0.0.1-8180-exec-9 INFO admin 1038x6919x1 7ja5zg 127.0.0.1 /rest/tempo-teams/2/team/ [Tempo Team to Advanced Roadmaps Shared Teams] Team object for Advanced Roadmaps: {"title":"Tempo Team A (TEMPOID19)","shareable":true}
Reach out to me for professional support!