jenkins the definitive guide

(Jeff_L) #1

In this case, we are simple passing through the current build parameters. This second build job will
automatically be started after the first one, with the DATABASE parameter value provided by the user.
You can also fine-tune the triggering policy, by telling Jenkins when the build should be triggered.
Typically, you would only trigger a downstream build after your build has completed successfully, but
with the Parameterized Trigger plugin you can also configure builds to be triggered even if the build is
unstable, only when the build fails or ask for it to be triggered no matter what the outcome of the first
build. You can even set up multiple triggers for the same build job.


Naturally, the build job that you trigger must be a parameterized build job (as illustrated in Figure 10.17,
“The build job you trigger must also be a parameterized build job”), and you must pass through all of
the parameters it requires.


Figure 10.17. The build job you trigger must also be a parameterized build job


This feature actually has much broader applications than simply passing through the current build
parameters. You can also trigger a parameterized build job with an arbitrary set of parameters, or use
a combination of parameters that were passed to the current build, and your own additional ones. Or,
if you have a lot of parameters, you can load them from a properties file. In Figure 10.18, “Passing a
predefined parameter to a parameterized build job”, we are passing both the current build parameters
(the DATABASE variable in this case), and an additional parameter called TARGET_PLATFORM.

Free download pdf