How to get the Jira issues for a specific build

Jörg Malter November 9, 2014

For several Reports, i have to fetch the Jira issues for a specific build via CLI.

Currently i use:

java -jar lib/bamboo-cli-3.9.0.jar --server https://xxxxx.xx --user xxxxxx --password xxxxx --action getBuild --build "EBA-TESTING-129"

and Receiving the info:

jiraIssues:
max-result . . . . . . . : 2
size . . . . . . . . . . : 2
start-index . . . . . . . : 0

But i need as output only the list of Jira issues which are in this build. I can't use in this script the rest api via https i need to use the atlassian CLI tool.

Do you have any idea for this?
Best Regards

Joerg

2 answers

1 accepted

0 votes
Answer accepted
Jörg Malter December 1, 2014

Hi,

 

thanks for your answer. In the meantime i found the solution and also a solution for a transition change.

Run this in Bamboo as Job in the last build step.

#!/bin/bash
JAVA_HOME=<your java dir>
JAVA=$JAVA_HOME/bin/java
CLI=<atlassian cli directory>
USER="<userid>"
PASSWORD="<password>"
BAMBOOSERVER="<bamboo url>"
JIRASERVER="<JIRA url>"
TRANSITION="false"
TRANSITIONSTEP="deploy prod"
cd $CLI
TicketList=` \
$JAVA -jar lib/bamboo-cli-3.9.0.jar \
--quiet \
--server $BAMBOOSERVER \
--user $USER \
--password $PASSWORD \
--action getBuild \
--build "${bamboo_planKey}-${bamboo_buildNumber}" \
--expand jiraIssues | \
grep key | grep -E -o "<regexp for your issue keys>"`
echo "Jira issue list:"
echo $TicketList
echo " "
for i in $TicketList
do
$JAVA -jar lib/jira-cli-3.9.0.jar \
--quiet \
--server $JIRASERVER \
--user $USER \
--password $PASSWORD \
--action progressIssue \
--issue $i \
--step "$TRANSITIONSTEP"
done
# A failed transition should never abort the build
exit 0

 

 

0 votes
rsperafico
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 1, 2014

Hello Joerg,

Thank you for your question.

You could run the same command and append '–expand "jiraIssues"' to it. As a result, you would have:

java -jar bamboo-cli-3.9.0.jar --server http(s)://<bamboo-base-url> --user <bamboo-username> --password <bamboo-password> --action getBuild --build "EBA-TESTING-129" --expand "jiraIssues"

If you find this answer useful, I would kindly ask you to accept it so the same will be visible to others who might be facing the same issue you have inquired.

Thank you for your understanding.

Kind regards,
Rafael P. Sperafico
Atlassian Support

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events