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?
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.
It looks like you're new here. Sign in or register to get started.