tags:

views:

357

answers:

2

hudson supports submitting a build by doing an HTTP GET to an API. I need to pass some parameters to such a build. Just adding them as additional URL parameters doesn't work for me. Is this supposed to work? Is there some other mechanism?

+1  A: 

Based on the HTML source on the web interface for starting a parameterized build, you need to do a POST to http://hudson/job/NAME/build with the parameters.

Update: It's a little more complicated. There's a hidden input with name "name" and value "MyParameter", then the input you actually fill in with name "value" and value "MyInput". (Where MyParameter if your parameter name and MyInput is whatever you need to fill in.) I haven't checked to see how this works with more than one parameter.

the POST works with just the json url parameter that contains a JSON list of the build parameters: json=%7B%22parameter%22%3A+%5B%7B%22name%22%3A+%22Input%22%2C+%22value%22%3A+%22data1%22%7D%2C+%7B%22name%22%3A+%22Input2%22%2C+%22value%22%3A+%22data2%22%7D%5D%2C+%7D

Dave Bacher
Worse yet. The json param seems to be required.
bmargulies
Agreed. It's not pretty. For me the POST works with just the json url parameter that contains a JSON list of the build parameters: `json=%7B%22parameter%22%3A+%5B%7B%22name%22%3A+%22Input%22%2C+%22value%22%3A+%22data1%22%7D%2C+%7B%22name%22%3A+%22Input2%22%2C+%22value%22%3A+%22data2%22%7D%5D%2C+%7D`
Dave Bacher
+1  A: 

http://stackoverflow.com/questions/2198895/is-it-possible-to-pass-parameters-in-the-hudsons-job-that-will-be-triggered-remo Check this question. Instead of /build use /buildWithParameters. I'm currently using it with a simple wget

prestomation

related questions