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

0 votes
Accepted answer

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 Sign up to answer
Community showcase
Posted Jan 15, 2019 in Statuspage

Introducing Statuspage Getting Started guides! First up: What is Statuspage?

Over the next several weeks we'll be sharing some of our Getting Started guides here in the community. Throughout this series of posts, we'd love to hear from customers and non-customers ab...

277 views 5 2
Join discussion

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