When you trigger another build job from within a parameterized build job, it is often useful to be able to pass the parameters of the current build job to the new one. Suppose, for example, that you have an application that needs to be tested against several different databases. As we have seen, you could do this by setting up a parameterized build job that accepts the target database as a parameter. You may want to kick of a series of builds, all of which will need this parameter.
If you try to do this using the conventional “Build other projects” option in the Post-Build Actions section, it won’t work. In fact, you can’t trigger a parameterized build in this way.
However, you can do this using the Jenkins Parameterized Trigger plugin. This plugin lets you configure your build jobs to both trigger parameterized builds, and to pass arbitrary parameters to these builds.
Once you install this plugin, you will find the option of “Triggering parameterized builds on other projects” in your build job configuration page (see Figure 10-16). This lets you start another build job in a number of ways. In particular, it lets you kick off a subsequent build job, passing the current parameters to this new build job, which is impossible to do with a normal triggered build. The best way to see how this works is through an example.
In Figure 10-15 we have
an initial build job. This build job takes a single parameter,
DATABASE, which specifies the database to be used for the tests. ...