Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Create custom report to track status of plan branches

I'm looking to create a customer report but I can't find any documentation or examples on how to do this. Any guidance would be appreciated!

1 answer

0 votes

Hello @christok

Please tell me that you can use a bash script for that!
Otherwise, you will need to transcript the script I just did for you.

It uses the following rest APIs:

  • /rest/api/latest/project
    Get the list of projects
  • /rest/api/latest/project/$PROJECT?expand=plans
    Get the plans from a given project
  • /rest/api/latest/plan/$PLAN/branch
    Get the plan branches from a given plan
  • /rest/api/latest/result/$PLAN_BRANCH
    Get the plan branches status

Reference: Bamboo REST API documentation 6.9.2

It also uses ./jq command-line JSON processor to filter the results.

#!/bin/bash

USER=admin
PASSWORD=admin
BAMBOO_URL=http://localhost:8085/bamboo

PROJECTS=`curl -s -u $USER:$PASSWORD \
-H 'Accept: application/json' \
-X GET "$BAMBOO_URL/rest/api/latest/project" \
| jq -r '.projects.project[] | .key'`

PLANS=""
for PROJECT in $PROJECTS
do
    PROJECT_PLANS=`curl -s -u $USER:$PASSWORD \
    -H 'Accept: application/json' \
    -X GET "$BAMBOO_URL/rest/api/latest/project/$PROJECT?expand=plans" \
    | jq -r '.plans.plan[] | .key'`
    PLANS+=" $PROJECT_PLANS"
done

PLANS_AND_BRANCHES=""
for PLAN in $PLANS
do
    PLANS_AND_BRANCHES+=" $PLAN"
    BRANCHES=`curl -s -u $USER:$PASSWORD \
    -H 'Accept: application/json' \
    -X GET "$BAMBOO_URL/rest/api/latest/plan/$PLAN/branch" \
    | jq -r '.branches.branch[] | .key'`
    PLANS_AND_BRANCHES+=" $BRANCHES"
done

for PLAN_BRANCH in $PLANS_AND_BRANCHES
do 
    curl -s -u $USER:$PASSWORD \
    -H 'Accept: application/json' \
    -X GET "$BAMBOO_URL/rest/api/latest/result/$PLAN_BRANCH" \
    | jq -r '.results.result[0] | "Plan:" + .key + " Name:\"" + .plan.name + "\" lifeCycleState:" + .lifeCycleState + " buildState:" + .buildState'
done


Another option is to build a Bamboo plugin for that. If you decide on this approach I suggest you follow this document:

I hope that helps.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bamboo

Bamboo 101 Video

G’day Community! As we gear up to introduce Bamboo Data Center to the world, we wanted to make sure that we shared a bit more about Bamboo, the product. Our team has put together an overview video ...

190 views 4 6
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you