Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Get issue keys in bamboo build with scriptrunner

Krishnanand Nayak
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 1, 2018

we are currently experimenting with Script runner for Bamboo and would like to know how to get the issue keys that are part of the build.

2 answers

Suggest an answer

Log in or Sign up to answer
0 votes
adammarkham
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 9, 2018

Apologies for the delay in responding.

I've assumed that the Jira issue keys your talking about appear in the "Issues" tab as "Linked Issues" on your build?

If so you'll need to replace the planKey in the example below and run the script below in the Script Console:

import com.atlassian.bamboo.build.JiraIssueResultsManager
import com.atlassian.bamboo.plan.PlanKey
import com.atlassian.sal.api.component.ComponentLocator

def jiraIssueResultsManager = ComponentLocator.getComponent(JiraIssueResultsManager)

def planKey = "KEY"

def issues = jiraIssueResultsManager.findJiraIssuesForPlanKey(new PlanKey(planKey))

issues.collect { issue ->
"$issue.issueKey, $issue.issueType.linkDescription, $issue.issueType.linkType"
}

That will show you the issue key, link description and link type.

Let us know how that goes.

Adam

Krishnanand Nayak
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 16, 2018

Thanks Adam this help. One more this, how do i pass the plan key as parameter.

adammarkham
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 17, 2018

The example I posted should show you how that's done. The line your interested in is:

def issues = jiraIssueResultsManager.findJiraIssuesForPlanKey(new PlanKey(planKey))

Or do you mean how we put the plan key into the output along with the link types?

0 votes
Krishnanand Nayak
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 9, 2018

@Adaptavist Supp : any resonse?

TAGS
AUG Leaders

Atlassian Community Events