How to get the Jira issues for a specific build

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

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

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 Join to answer
Community showcase
Renan Battaglin
Published May 18, 2017 in Bamboo

FAQ: How to Upgrade Bamboo Server

Bamboo 5.9 will no longer be supported after June 12, 2017. What does this mean? As part of our End of Life policy, Atlassian supports major versions for two years after the first major iteratio...

1,081 views 0 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot