Jenkins : Dynamic Parameter Plug-in

Plugin Information

Distribution of this plugin has been suspended due to unresolved security vulnerabilities, see below.

The current version of this plugin may not be safe to use. Please review the following warnings before use:

This plugin allows dynamic generation of default build parameter values.

Description

What Does the Plugin Do?

The plugin allows creating a build parameters, which default value(s) are generated by a Groovy script. The Groovy script is executed each time the build is triggered and allows generating default value(s) according to the current build context (e.g. current user-name, current date/time, etc. or more complex Groovy scripts). The Groovy script can be executed either on the master or on the slave where the build is executed. This can be configured from the build configuration page.

The plugin provides two types of parameters: simple text-field parameter and a choice (drop-down) parameter. If the parameter is a text-field, the corresponding Groovy script must return a single string value. If the parameter is a choice parameter, then the script must return a list of string values.

Examples
Current Date and Time

This is a simple example shows how to create a build parameter which has the current date and time. Create a new build job and choose "This build is parameterized". From the "Add Parameter" drop-down menu, choose "Dynamic Parameter".

Fill in the parameter "Name" and optional "Description". In the field "Default Value Script" write the Groovy script which returns the current date:

Note: if the "Remote Script" check-box is checked, then the script will be executed on the slave where the build is started.

Save the current job and click "Build Now". The build configuration page with the current date and time should show up:

Simple Choice List

This is a simple example which shows how to create a choice parameter. Similar to the previous example, create a new build job and choose "This build is parameterized". From the "Add Parameter" drop-down menu, choose "Dynamic Choice Parameter". Fill in the parameter "Name" and optional "Description". In the field "Choices Script" write the Groovy script which returns a list with some values:

Save the current job and click "Build Now". The build configuration page with a drop-down to choose from one of the generated values should show up:

Version History

0.1.1 (Apr 03, 2012)
  • Safe use of anonymous classes
  • Fixes in POM to allow release with maven release plugin
0.1.0 (Mar 20, 2012)
  • Initial release

Attachments:

string-param-01.png (image/png)
string-param-02.png (image/png)
string-param-03.png (image/png)
choice-param-01.png (image/png)
choice-param-02.png (image/png)
choice-param-03.png (image/png)