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

Query Bamboo for the version number

Hello,

Is it possible to query Bamboo for the version number and import it automatically in Confluence? Thanks

2 answers

1 accepted

0 votes
Answer accepted
rsperafico Atlassian Team Apr 12, 2018

Hi @Darko Cvetkovic,

You could make use of Bamboo's REST API to get the information you are looking for, however, it will require some effort from your end on parsing the information:

  • http://localhost:8085/rest/api/latest/deploy/project/forPlan?planKey=PROJ-PLAN (require authentication and permission)
    This endpoint will list all deployment project in which PROJ-PLAN is associated with, e.g:
    [{"id":1310721,"name":"My Deployment","description":""}]
  • http://localhost:8085/rest/api/latest/deploy/project/{deploymentProjectId}
    e.g: deploymentProjectId = 1310721
    (require authentication and permission)
    Find deployment project by id.
    {"id":1310721,"oid":"riqmph3qr9q9","key":{"key":"1310721"},"name":"My Deployment","planKey":{"key":"PROJ-PLAN"},"description":"","environments":[{"id":1409025,"key":{"key":"1310721-1409025"},"name":"Staging","description":"","deploymentProjectId":1310721,"operations":{"canView":true,"canEdit":true,"canDelete":true,"allowedToExecute":true,"canExecute":true,"allowedToCreateVersion":false,"allowedToSetVersionStatus":false},"position":0,"configurationState":"TASKED"}],"operations":{"canView":true,"canEdit":true,"canDelete":true,"allowedToExecute":false,"canExecute":false,"allowedToCreateVersion":true,"allowedToSetVersionStatus":false}}
  • http://localhost:8085/rest/api/latest/deploy/environment/{environmentId}/results?expand
    e.g: environmentId = 1409025
    (require authentication and permission)
    Provide list of versions deployed to environment
    {"expand":"results","size":1,"results":[{"deploymentVersion":{"id":1736705,"name":"release-2","creationDate":1523283725441,"creatorUserName":"admin","items":[{"id":1802241,"name":"TXT","planResultKey":{"key":"PROJ-PLAN-2","entityKey":{"key":"PROJ-PLAN"},"resultNumber":2},"type":"BAM_ARTIFACT","label":"TXT","location":"","copyPattern":"*.txt","size":5,"artifact":{"id":1671169,"label":"TXT","size":5,"isSharedArtifact":true,"isGloballyStored":false,"linkType":"com.atlassian.bamboo.plugin.artifact.handler.local:ServerLocalArtifactHandler","planResultKey":{"key":"PROJ-PLAN-2","entityKey":{"key":"PROJ-PLAN"},"resultNumber":2},"archiverType":"NONE"}}],"operations":{"canView":true,"canEdit":true,"canDelete":true,"allowedToExecute":false,"canExecute":false,"allowedToCreateVersion":true,"allowedToSetVersionStatus":true},"creatorDisplayName":"Admin Istrator","creatorGravatarUrl":"https://secure.gravatar.com/avatar/8bfb4e64c3987633d445e438bc6c5240.jpg?r=g&s=24&d=mm","planBranchName":"master","ageZeroPoint":1523283872697},"deploymentVersionName":"release-2","id":1966081,"deploymentState":"SUCCESS","lifeCycleState":"FINISHED","startedDate":1523283872694,"queuedDate":1523283872795,"executedDate":1523283873246,"finishedDate":1523283873434,"reasonSummary":"Manual run by <a href=\"http://localhost:8085/browse/user/admin\">Admin Istrator</a>","key":{"key":"1310721-1409025-1966081","entityKey":{"key":"1310721-1409025"},"resultNumber":1966081},"agent":{"id":196609,"name":"Default Agent","type":"LOCAL","active":true,"enabled":true,"busy":false},"operations":{"canView":true,"canEdit":true,"canDelete":true,"allowedToExecute":true,"canExecute":true,"allowedToCreateVersion":false,"allowedToSetVersionStatus":false}}],"start-index":0,"max-result":1}

In the example above "release-2" is what you are expecting in your latest inquire.

As my colleague mentioned, the trick is getting that output into a Confluence page. However, with the information already provided you should be good to go.

Hope it helps :)

Kind regards,

Rafael

Thank you both for your help and level of details on this issue.

All the best, 

Darko

Hey Darko,

Assuming you mean the version number of Bamboo (or did you mean version numbers for certain builds and deploys in your Bamboo?); it's certainly is possible.

Here's a few examples of API's that return the Bamboo version:

  • http://bamboo:8085/bamboo/rest/applinks/1.0/manifest.json (can be access anonymously)
  • http://bamboo:8085/rest/api/latest/info (must be an authenticated request)

Now the trick is getting that output into a Confluence page. There's another community post which I've included below that has a few options which include some add-on suggestions for embedding REST API content in a page:

Or you could also use some AJAX in a custom HTML Macro like the below example:

<p id="bamVersion">Bamboo Version: </p>
<script type="text/javascript">
    $.get('http://bamboo:8085/rest/applinks/1.0/manifest.json', function(data, status){
        $('#bamVersion').append(data['version']);
 });
</script>

Hope this helps. :)

Hello Jeremy and thanks for your answer,
Sorry I did not provide more information about my question.

What I wanted to say, is there a way to query Bamboo for some project that was build and to recive a version number of that project and on which production environment is deployed and later pull that information to the Confluence page?

Thanks for your time

rsperafico Atlassian Team Apr 12, 2018

I would like to thank my colleague @Jeremy Owen for taking the time and replying to this inquire by up voting this thread.

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 ...

179 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