jenkins the definitive guide

(Jeff_L) #1

To set this up in Jenkins, you first need to add a String parameter to your build job (called RELEASE
in this example—see Figure 10.12, “Configuring a parameter for a Git tag”). Unlike the Subversion
support, there is no way to list the available Git tags in a drop-down list, so users will need to know
the name of the tag they want to release.


Figure 10.12. Configuring a parameter for a Git tag


Once you have added this parameter, you need to checkout the corresponding tag once the repository
has been cloned locally. So if you have a freestyle build, the first build step would be a command-line
call to Git to check out the tag referenced by the RELEASE parameter (see Figure 10.13, “Building from
a Git tag”). Of course a more portable way to do this would be to write a simple Ant or Groovy script
to do the same thing in a more OS-neutral way.


Figure 10.13. Building from a Git tag


10.2.6. Starting a Parameterized Build Job Remotely


You can also start a parameterized build job remotely, by invoking the URL of the build job. The typical
form of a parameterized build job URL is illustrated here:

Free download pdf