submitting a parameterized hudson build via the REST API

匆匆过客 提交于 2019-12-11 06:04:31

问题


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:


Is it possible to pass parameters in the Hudson's job that will be triggered remotely? Check this question. Instead of /build use /buildWithParameters. I'm currently using it with a simple wget




回答2:


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



来源:https://stackoverflow.com/questions/2201843/submitting-a-parameterized-hudson-build-via-the-rest-api

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!