Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
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

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

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.

@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
Community showcase
Published in Bamboo

Bamboo Data Center 8.1 is now available

G’day Bamboo customers, Bamboo DC 8.1 is now available with it the following features and programs: SAML 2.0, OpenID Connect, and Crowd SSO In order to help admins with a simplified user manage...

167 views 0 4
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