Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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

Trigger Bamboo deployment with environment variable via REST API?

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'

2 answers

1 vote

Hello folks,

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.

0 votes

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:

{"deploymentResultId":1671170,"link":{"href":"<BAMBOO_URL>/rest/api/latest/deploy/result/1671170","rel":"self"}}

Hi Daniel,

We are using same rest API . But getting below error ,

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<status>
<status-code>404</status-code>
<message>null for uri: http://192.168.2.67:8085/rest/api/latest/queue/deployment</message>
</status>

Can you please help me?

Hey @ishan_walawalkar,


Can you share the full URL used including its parameters?
The 404 error might happen when the request is malformed.

Can you also share what version of Bamboo is this?
Are you using Curl for your request as shared above?

Hi Daniel,

Thanks for your quick response . I was using older version of bamboo hence getting error. I have upgraded now . Its working.

HI Daniel/Ishan,

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?

http://localhost:8085/rest/api/latest/queue/deployment?environmentId=9437188&versionId=9732100&bamboo.testVariable=fromrest1

Regards

Kishore

Hi @musei_ki

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.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bamboo

Bamboo 101 Video

G’day Community! As we gear up to introduce Bamboo Data Center to the world, we wanted to make sure that we shared a bit more about Bamboo, the product. Our team has put together an overview video ...

223 views 4 6
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