CruiseControl Plugins
It's tough to imagine all of the ways that CruiseControl can be used. Different tools and subtle nuances in team style make it difficult to code a "one-size-fits-all" solution. As a result, CruiseControl has been designed as a small core with a very high-level implementation of continuous integration, with most of the implementation details delegated to plugins. This makes it easy to create new functionality, modify existing functionality, or remove unwanted functionality. Plugins also create a shallower learning curve when digging in the codebase, as you can be assured that all of the cvs functionality, for example, exists in one place. Encapsulating all of the functionality into plugins also makes testing easier.
There are currently six different types of plugins that CruiseControl supports. Each has a slightly different role, but all are designed similarly. While they all implement different interfaces and have slightly different method names, we will refer to them collectively as plugins when discussing their similarities. The plugin types are:
Bootstrapper: run before the buildSourceControl: poll a code repository and determine if anything has changedBuilder: perform the actual building and testing of your codeLabelIncrementer: handles incrementing the label for you to use to tag your sourcePublisher: publish the results of your build, via email for exampleListener: handles project events
Plugin Initialization
The PluginXMLHelper will use introspection to call setter
methods that correspond to attributes on your xml tag in the config file.
For example, the method setTarget(String target) on the
AntBuilder class corresponds to the attribute
target on the <ant/> element in the
config file. The parser is case insensitive, so the case need not match
from your attributes to your method names, so the standard
capitalization rules should apply.
It is possible for you to declare nested elements within your
plugin's declaration in the config file. In this case, CruiseControl
will expect your plugin class to implement a create method for each
nested element. Returning to our example AntBuilder class,
we will see a createJVMArg() method. We'll also see that
AntBuilder has a nested JVMArg class. This create method
is responsible for creating an instance of JVMArg and
keeping a reference to that object for AntBuilder to use
later. It returns a reference to the newly created JVMArg
object, so that PluginXMLHelper can configure the nested
element in the same way as the parent element. In theory, there is no
limit to the depth of your nesting, as long as the appropriate create
methods have been written.
Immediately after the parser has configured your plugin, we will
validate the plugin using it's own validate() method.
This will enable us to fail quickly if your plugin has been incorrectly
configured, saving you the time of waiting for your plugin to execute to
determine whether your CruiseControl installation has been
successful.
Plugin Execution
After we have configured and validated all of the plugins, we will
begin executing them according to their type. Each plugin has an
"action" method that is the one method that CruiseControl will call when
executing your plugin. Let's take the example of the bootstrappers. At
the beginning of the build cycle, the first thing that we need to do is
to run the bootstrappers. We've already initialized and validated each
of these, so now we will just call the bootstrap() method
as we iterate over the list of registered bootstrappers. It's fairly
similar for each of the other types of plugins.
Plugin Registration
The registration of plugins is a simple and straightforward task.
Directly under the <cruisecontrol> element, or
within a <project> element, simply add a
<plugin name="" classname=""/> element,
where the name corresponds to the name you wish to use within the config
file, and the classname corresponds to the actual plugin Java class.
Plugins specified directly under the root element will be available to all your projects, plugins under a project element will be only available within that project. This is useful to override a plugin like the labelincrementer for a single project.
In the interest of keeping config file sizes to a minimum, all plugins that ship with CruiseControl will be automatically registered. Should you wish to use one of the registered plugin names with your own custom plugin class, you can just explicitly register the plugin name and that will override the default registration.
The following tables outlines the default plugin registry:
Bootstrappers
| Plugin Name | Class Name |
|---|---|
| clearcasebootstrapper | net.sourceforge.cruisecontrol.bootstrappers.ClearCaseBootstrapper |
| currentbuildstatusbootstrapper | net.sourceforge.cruisecontrol.bootstrappers.CurrentBuildStatusBootstrapper |
| cvsbootstrapper | net.sourceforge.cruisecontrol.bootstrappers.CVSBootstrapper |
| p4bootstrapper | net.sourceforge.cruisecontrol.bootstrappers.P4Bootstrapper |
| snapshotcmbootstrapper | net.sourceforge.cruisecontrol.sourcecontrols.SnapshotCMBootstrapper |
| surroundbootstrapper | net.sourceforge.cruisecontrol.sourcecontrols.SSCMBootstrapper |
| svnbootstrapper | net.sourceforge.cruisecontrol.bootstrappers.SVNBootstrapper |
| vssbootstrapper | net.sourceforge.cruisecontrol.bootstrappers.VssBootstrapper |
| starteambootstrapper | net.sourceforge.cruisecontrol.bootstrappers.StarTeamBootstrapper |
Source Controls
| Plugin Name | Class Name |
|---|---|
| alwaysbuild | net.sourceforge.cruisecontrol.sourcecontrols.AlwaysBuild |
| buildstatus | net.sourceforge.cruisecontrol.sourcecontrols.BuildStatus |
| clearcase | net.sourceforge.cruisecontrol.sourcecontrols.ClearCase |
| compound | net.sourceforge.cruisecontrol.sourcecontrols.Compound |
| cvs | net.sourceforge.cruisecontrol.sourcecontrols.CVS |
| filesystem | net.sourceforge.cruisecontrol.sourcecontrols.FileSystem |
| httpfile | net.sourceforge.cruisecontrol.sourcecontrols.HttpFile |
| mks | net.sourceforge.cruisecontrol.sourcecontrols.MKS |
| p4 | net.sourceforge.cruisecontrol.sourcecontrols.P4 |
| pvcs | net.sourceforge.cruisecontrol.sourcecontrols.PVCS |
| snapshotcm | net.sourceforge.cruisecontrol.sourcecontrols.SnapshotCM |
| starteam | net.sourceforge.cruisecontrol.sourcecontrols.StarTeam |
| surround | net.sourceforge.cruisecontrol.sourcecontrols.SSCM |
| svn | net.sourceforge.cruisecontrol.sourcecontrols.SVN |
| vss | net.sourceforge.cruisecontrol.sourcecontrols.Vss |
| vssjournal | net.sourceforge.cruisecontrol.sourcecontrols.VssJournal |
Builders
| Plugin Name | Class Name |
|---|---|
| ant | net.sourceforge.cruisecontrol.builders.AntBuilder |
| maven | net.sourceforge.cruisecontrol.builders.MavenBuilder |
| pause | net.sourceforge.cruisecontrol.builders.PauseBuilder |
Label Incrementers
| Plugin Name | Class Name |
|---|---|
| labelincrementer | net.sourceforge.cruisecontrol.labelincrementers.DefaultLabelIncrementer |
Publishers
| Plugin Name | Class Name |
|---|---|
| artifactspublisher | net.sourceforge.cruisecontrol.publishers.ArtifactsPublisher |
| currentbuildstatuspublisher | net.sourceforge.cruisecontrol.publishers.CurrentBuildStatusPublisher |
| net.sourceforge.cruisecontrol.publishers.LinkEmailPublisher | |
| execute | net.sourceforge.cruisecontrol.publishers.ExecutePublisher |
| htmlemail | net.sourceforge.cruisecontrol.publishers.HTMLEmailPublisher |
| jabber | net.sourceforge.cruisecontrol.publishers.LinkJabberPublisher |
| scp | net.sourceforge.cruisecontrol.publishers.SCPPublisher |
| x10 | net.sourceforge.cruisecontrol.publishers.X10Publisher |
| xsltlogpublisher | net.sourceforge.cruisecontrol.publishers.XSLTLogPublisher |
| weblogpublisher | net.sourceforge.cruisecontrol.publishers.WeblogPublisher |
Listeners
| Plugin Name | Class Name |
|---|---|
| currentbuildstatuslistener | net.sourceforge.cruisecontrol.listeners.CurrentBuildStatusListener |