- How do I create a parameterized build?
- Cloudbees Jenkins Enterprise
A project has the option to have a build be parameterized. What this means is that the job can execute with specific parameters (like version number, server url, node name, etc.).
To add parameters to a freestyle project (this can apply to any other project type, but in this example I will be using freestyle project):
- Create a freestyle project.
- In the job configuration page is the option “Add Parameters”.
- There is a drop-down option to configure parameterized build options (like a boolean attribute, or a string attribute).
- Save the project.
You will notice that the “Build Now” text has changed to “Build Now with Parameters”, and clicking on the link provides you the option to set those parameters for the build.
The next step would be to make sure that the configuration is usable within your project. To do that you can encapsulate the name of the variable in
name is the name of the parameter name.
To verify that the configuration works I would recommend creating a shell step which has the following:
This will output the contents of the
name parameterized option. Once you confirm that is the correct output, then you can use that parameterized build variable anywhere in the build.