Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,456,778
Community Members
 
Community Events
176
Community Groups

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

Atlassian Community Events