Hello,
Im trying to get two things
1 - Jira Status to update the Tag on the DevOps ticket
when Jira status is Dev In Progress then DevOps tag should be Ready for Sprint
2- DevOps Tag to update Jira status
when Tag in Devops is Ready for UAT Testing then Jira Status to change to UAT Testing
And
when Tag in DevOps is Deployed to PRD then Jira status to change to Deployed in Prod
My code is as follows:
Outgoing Jira:
// let DevOps know which JIRA key this came from
replica.key = issue.key
// basic fields
replica.summary = issue.summary
replica.priority = issue.priority
//This line below, transforms description from Markdown to HTML to transfer over
replica.description = nodeHelper.getHtmlField(issue, âdescriptionâ)
replica.attachments = issue.attachments
replica.status = issue.status
// custom-field mappings (make sure the names match exactly what you use in Azure incoming)
replica.customFields.âDevOpsProjectâ = issue.customFields.âDevOps Projectâ
replica.customFields.âCustomerRequestTypeâ = issue.customFields.âCustomer Request Typeâ
replica.customFields.âEstimateâ = issue.customFields.âEstimated Effortâ
Incoming Jira
if (firstSync) {
issue.projectKey = âITSâ
issue.typeName = âCIâ
}
if(!firstSync && syncRequest.remoteSyncEventNumber==1){
issue.customFields.âRemote URLâ.value = issueUrl
}
// Map DevOps tags to Jira statuses
// If tag in DevOps is âReady for UAT Testingâ then Jira status should change to âUAT Testingâ
// If tag in DevOps is âDeployed to PRDâ then Jira status should change to âDeployed to Prodâ
def tagToStatusMap = [
âReady for UAT Testingâ: âUAT Testingâ,
âDeployed to PRDâ : âDeployed to Prodâ
]
def devopsTags = replica.tags ?:
// Find the first tag that matches our mapping
for (tag in devopsTags) {
if (tagToStatusMap.containsKey(tag)) {
issue.setStatus(tagToStatusMap[tag])
break
}
}
Outgoing DevOps
// Outgoing script (Azure DevOps â Jira)
replica.key = workItem.key
replica.summary = workItem.summary
replica.description = workItem.description
replica.tags = issue.labels
Incoming DevOps
if (firstSync) {
workItem.projectKey = replica.customFields.âDevOpsProjectâ?.value?.value ?: âDEFAULT_PROJECTâ
workItem.typeName = âUser Storyâ
workItem.summary = replica.summary
syncHelper.syncBackAfterProcessing()
}
workItem.description = replica.description
workItem.attachments = replica.attachments
workItem.priority = replica.priority
if (firstSync) {
store()
workItem.customFields.âJIRAâ.value = issueUrl
workItem.customFields.âEstimateâ.value = replica.Estimate
} else {
workItem.customFields.âJIRAâ.value = issueUrl
}
// Add tag âReady for Sprintâ if Jira status is âDev In Progressâ.
// Only set the tags field if the status is exactly âDev In Progressâ.
if (replica.status?.name == âDev In Progressâ) {
workItem.tags = [âReady for Sprintâ]
}
Any ideas? (This code was suggested by the AI in the Exalate screens)
Thanks
