O'Reilly logo

Jenkins: The Definitive Guide by John Ferguson Smart

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Parameterized Build Jobs

Parameterized builds are a powerful concept that enable you to add another dimension to your build jobs.

The Parameterized Build plugin lets you configure parameters for your build job, that can be either entered by the user when the build job is triggered, or (as we will see later) from another build job.

For example, you might have a deployment build job, where you want to choose the target environment in a drop-down list when you start the build job. Or you may want to specify the version of the application you want to deploy. Or, when running a build job involving web tests, you might want to specify the browser to run your Selenium or WebDriver tests in. You can even upload a file to be used by the build job.

Note that it is the job of the build script to analyze and process the parameter values correctly—Jenkins simply provides a user interface for users to enter values for the parameters, and passes these parameters to the build script.

Creating a Parameterized Build Job

You install the Parameterized Build plugin as usual, via the Plugin Manager screen. Once you have done this, configuring a parameterized build job is straightforward. Just tick the “This build is parameterized” option and click Add Parameter to add a new build job parameter (see Figure 10-1). You can add parameters to any sort of build, and you can add as many parameters as you want for a given build job.

Figure 10-1. Creating a parameterized build job

To add a parameter to your build job, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required