How to I build with parameters?

158 views
Skip to first unread message

marktri...@gmail.com

unread,
Nov 18, 2013, 9:59:56 PM11/18/13
to jenkins_a...@googlegroups.com
I apologize for the newbie post, but I've been trying to figure out how to build with parameters. 
According to the API, i'm supposed to pass in params = {}, but I don't know what to put in there.  I've tried several things and they all failed.  I looked through the source code as well as the specs and wasn't able to see any examples anywhere.  Can someone give me an example how to pass in parameters to my build?

- (String, Integer) build(job_name, params = {}, return_build_number = false)

Build a job given the name of the job You can optionally pass in a list of params for Jenkins to use for parameterized builds

Parameters:

  • job_name (String)

    the name of the job

  • params (Hash) (defaults to: {})

    the parameters for parameterized builds

  • return_build_number (Boolean) (defaults to: false)

    whether to wait and obtain the build number

Returns:

  • (String, Integer)

    the response code from the build POST request if return_build_number is not requested and the build number if the return_build_number is requested. nil will be returned if the build number is requested and not available. This can happen if there is already a job in the queue and concurrent build is disabled.


Kannan Manickam

unread,
Nov 18, 2013, 10:08:14 PM11/18/13
to jenkins_a...@googlegroups.com
Hello,

What version are you using?
The params is a hash that accepts parameter names and values. 
Example:

>> build('job1', {'param1' => 'value1', 'param2' => 'value2'})
Reply all
Reply to author
Forward
0 new messages