jenkins the definitive guide

(Jeff_L) #1

job. For example, an upstream build job may tag a particular revision. Alternatively, you might use the
standard Maven release process (see Section 10.7.1, “Managing Maven Releases with the M2Release
Plugin”) to generate a new release. In this case, a tag with the Maven release number will automatically
be generated in Subversion.


This approach is useful for projects that need to be partially or entirely rebuilt before they can be
deployed to a given platform. For example, you may need to run the Ant or Maven build using
different properties or profiles for different platforms, so that platform-specific configuration files can
be embedded in the deployed WAR or EAR files.


You can configure a Jenkins build to run against a selected tag by using the “List Subversion Tag”
parameter type (see Figure 10.10, “Adding a parameter to build from a Subversion tag”). You just need
to provide the Subversion repository URL pointing to the tags directory of your project.


Figure 10.10. Adding a parameter to build from a Subversion tag


When you run this build, Jenkins will propose a list of tags to choose from (see Figure 10.11, “Building
from a Subversion tag”).


Figure 10.11. Building from a Subversion tag


10.2.5. Building from a Git Tag


Building from a Git tag is not as simple as doing so from a Subversion tag, though you can still use a
parameter to indicate which tag to use. Indeed, because of the very nature of Git, when Jenkins obtains
a copy of the source code from Git, it clones the Git repository, including all of the tags. Once you have
the latest version of the repository on your Jenkins server, you can then proceed to checkout a tagged
version using git checkout .

Free download pdf