I see deployment version variables on this UI page - https://bamboo.customer.com/deploy/viewDeploymentVersionVariables.action?versionId=369999999&deploymentProjectId=79699999. How do I get these variables via the bamboo REST API? I can't find an endpoint that returns them consistently. This API returns them some of the time: https://bamboo.customer.com/rest/api/latest/result/MYPLAN-269, but for older deploys that endpoint gets a 404 sometimes. Since I see the variables I need on the UI for older deploys it must be in the API somewhere
hey @Chris Hankey
This might be related to Bamboo's build expiry. Atlassian confirms that historical deployment records can remain available even after the original build results have expired
https://support.atlassian.com/bamboo/kb/how-to-find-historical-deployment-records-in-bamboo/
You could check the associated build using:
GET /rest/api/latest/deploy/version/{versionId}/build-result
Best,
Arek🤠🧙♂️
Thanks & I just tried that, I get a response but the response does not include all the variables. For example, the following call does return the variables but that url returns a 404 for older depoys. I tried adding expand=variables to "GET /rest/api/latest/deploy/version/{versionId}/build-result" but that did not add any additional variables https://bamboo.customer.com/rest/api/latest/result/MYPLAN-269?expand=variables
Are you limited to REST, or do you also have database access?
At the moment I only have the REST api, and I think that would be preferred if we could get that to work. If you have a SQL example I can ask the team administers bamboo & see if they could grant me access or create an API for me.
I know you already ran build-result. Did you look at deploymentVersion.variableContext in there specifically? That's the version's own snapshot, a list of key, value and variableType, and it's a different set from the plan result's variables. Easy to miss.
Rest of it fits the spec. build-result has no expand parameter at all, so expand=variables gets ignored. And the /result/ call reads the plan result itself, which is gone once it expires. Hence the 404 on older deploys, while the version endpoints keep working. GET /rest/api/latest/deploy/project/{deploymentProjectId}/version gives the same variableContext per version.
Haven't run it against a live Bamboo though. Which list were you comparing against? If variableContext is short too, the SQL in the KB Arek linked is the fallback.
It looks like you're new here. Sign in or register to get started.