Sometimes, it is useful/necessary to have your builds take several "parameters." Consider the following use case:
Defining ParametersFirst, you need to define parameters for your job by selecting "This build is parameterized", then using the drop-down button to add as many parameters as you need. There are different parameter types available, and it is extensible, too. The way parameters take effect is also different depending on the parameter type you choose. String parameterString parameters are exposed as environment variables of the same name. Therefore, a builder, like Ant and Shell, can use the parameters. Continuing the above example, the following is a simple example:
Ant works equally well. In the Properties section of the Ant builder, define a build property like:
my.prop=${env.BAR}
Note that because of the case sensitivity difference of environment variables in Windows and Unix, all the environment variables added by parameters are in upper case. File parameterFile parameter allows a build to accept a file, to be submitted by the user when scheduling a new build. The file will be placed inside the workspace at the known location after the check-out/update is done, so that your build scripts can use this file. Define Custom Parameter TypesA plugin can define custom parameter types. See ParameterDefinition for the starting point. LimitationsCurrently the following are the known problems:
|



Comments (5)
Aug 19
Cees Bos says:
How can I trigger a build based on a url? This is the url without a parameter:How can I trigger a build based on a url?
This is the url without a parameter: http://localhost/hudson/job/jobname/build?delay=0sec (http://localhost/hudson/job/jobname/build)
Can I add parametername=value? I tried it, but it didn't work. In this example http://localhost/hudson/job/jobname/build?delay=0sec&BAR=FOO\\
Sep 15
Gregoire Henry says:
Windows Users : use my.prop=%BAR% in ant properties as value expansion see...Windows Users : use my.prop=%BAR% in ant properties as value expansion seems to be made by the OS ......
Sep 17
Joel F says:
It seems that if a parameter is in a downstream job, the parameter is not set. I...It seems that if a parameter is in a downstream job, the parameter is not set.
It would be useful to pass parameters to downstream jobs, if they share the same named parameters.
Oct 13
Yoon Kyung Koo says:
I also think so. I need to build each svn branches, and there's no easy way to b...I also think so.
I need to build each svn branches, and there's no easy way to build downstream the branched modules.
Sep 18
Lukas Rytz says:
A question related to the one by Cees Bos: is it possible to specify build param...A question related to the one by Cees Bos: is it possible to specify build parameters when using the "build periodically" feature?
There is no other way to parametrize a build, right?