I need to trigger deployment with defining deployment environment variables. Is it possible? I tried this but it does not work for my case. Thanks in advance
curl -X POST 'http://localhost:9087/bamboo/rest/api/latest/queue/deployment/?environmentId=1234567&versionId=12121212&bamboo.variable.myvariablename=value'
Until this moment (Bamboo version 6.8.0) It is not possible to set/update custom variables for a deployment using REST API. We do have a feature request to cover this scenario here:
As a workaround, the inject variables task can be used to consume custom variable values from a file in the build working directory.
I hope that helps.
I know this request is a bit old, but I would like share that this is the right way of doing it.
We would need the Bamboo version and the returned error to investigate why it was failing.
I just run the same test on 6.6.2 (I know it is pretty new) and it works just fine:
curl -u <USER>:<PASSWORD> -X POST '<BAMBOO_URL>/rest/api/latest/queue/deployment/?environmentId=1441793&versionId=1540097&bamboo.community=hello'
Example of successful server answer:
We are using same rest API . But getting below error ,
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<message>null for uri: http://192.168.2.67:8085/rest/api/latest/queue/deployment</message>
Can you please help me?
POst request is working but I am not getting variable value that is passed as query string.Do you know what might be the problem?
I apologize for the confusion I made in this thread. Somehow my test was mistaken. The post will work but the variable will not change its value.
There is a feature request for this [BAM-18838] Custom Variables in /queue/deployment REST call and the workaround is to use the inject variables task or use the UI.
I'll create a new message in this post so other users don't get into this trap. Somehow @ishan_walawalkar also did not notice that this variable update is not working, confirming my wrong conclusion.