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,556,170
Community Members
 
Community Events
184
Community Groups

How do I get the build number used for a deployment release using REST API?

I am trying to use the Bamboo REST API to get the build number used for a specific deployment release. Using "/deploy/projectVersioning/{deploymentProjectId}/variables" returns the variables defined for the project but not the runtime variables for a specific version such as the build number. I thought using "/deploy/version/{deploymentVersionId}/status" would return the build number but it did not. Is there another API (or sequence of API calls) that can provide this information?

1 answer

1 accepted

0 votes
Answer accepted
Omar Herrera
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Jan 04, 2019

Hi @Shaun Chung, you can try  {bamboo instance}/rest/api/latest/deploy/project/{deploymentProjectID}/versions

The result is a list of releases for the deployment proyect and each release is related to a build plankey.

Cheers,

Omar H.

Thanks for the suggestion but when I try that, all that is returned is an array of version information that does not contain anything about the build plan (other than the branch name). I would like to get the build result number the release is related to. Here is what I get back for each version:

{
"id": 28344360,
"name": "1.0.121",
"creationDate": 1543871749566,
"items": [],
"operations": {
"canView": false,
"canEdit": false,
"canDelete": false,
"allowedToExecute": false,
"canExecute": false,
"allowedToCreateVersion": false,
"allowedToSetVersionStatus": false
},
"planBranchName": "release/Sprint15",
"ageZeroPoint": 1543871749847
},

Should I be seeing something in the items array? I am running Bamboo 6.5.1 if that makes a difference. Ultimately I am looking to programmatically  get the same commit and issue information that is displayed on the release screen.

Omar Herrera
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Jan 04, 2019

@Shaun Chung I understood your question, I had the same needs and I implemented a workaround, on the build pland I created an artifact (.txt file) with general build information and with this item (artifact) the rest end point above, show the items array in this array I get build result key that I needed.

I hope that can help you

 

"items":[

{
"id":14647303,
"name":"buildVariables",
"planResultKey":{
"key":"OM-EO2-2",
"entityKey":{
"key":"OM-EO2"
},
"resultNumber":2
},
"type":"BAM_ARTIFACT",
"label":"buildVariables",
"location":"",
"copyPattern":"**/buildvariables.txt",
"size":290,
"artifact":{
"id":13893675,
"label":"buildVariables",
"size":290,
"isSharedArtifact":true,
"isGloballyStored":true,
"linkType":"com.atlassian.bamboo.plugin.artifact.handler.remote:BambooRemoteArtifactHandler",
"planResultKey":{
"key":"OM-EO2-2",
"entityKey":{
"key":"OM-EO2"
},
"resultNumber":2
},
"archiverType":"NONE"
}
}
]

Thanks for the workaround. I'll try using it. We use Artifactory to store our artifacts so nothing is shared between the builds and deploys that is why I never saw anything in items. It seems strange that the data would only be in the artifact info and not part of the release/version information.

Like talleym likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events