[Cruisecontrol] Build Loop

Source: Internet
Author: User

 

One build Loop

Build loop is the core component of cruisecontrol. It is used to run a daemon (background) process to regularly check the modifications on your source control tool, determine whether to build based on your settings and check results. After the build, notify all listeners of the results.

 

How does build loop work?

Cruisecontrol defines a Build cycle that determines whether a build is required. Build, create a log, and send a notification. The background process tries to start a Build cycle at a user-defined interval. The configuration file is reloaded every time so that the configuration changes can take effect without the need to restart the cruisecontrol. However, for newly added projects, you still need to restart the cruisecontrol to make changes to the new project take effect. At the end of the build, the log is generated and used for displaying the build result JSP.

 

Configuration of three build Loop

When you start cruisecontrol, you can specify the command line parameters (also known as system parameters) to configure the build loop, available parameters-jmxport/-rmiport/-configfile/-your path/-user/-Password/-agentutil/-Debug/-log4jconfig/-Port/-dashboardurl/-postinterval/ -postenabled/-lib.

 

Iv. plugins

1) plugin Summary

It is hard to imagine all the methods used by cruisecontrol. Different teams use different tools and other subtle differences, which makes it impossible for us to develop a solution suitable for all situations. Cruisecontrol is designed as the core of the High-level Implementation of continous integration and the plugins that implement all the details. In this way, we can easily create new functions, modify existing functions, and delete unnecessary functions. The plugins mechanism makes it easier to learn the codebase of cruisecontrol, because all functions are organized by module. For example, you can assume that all CVS functions are in one place. The plugin mechanism also makes testing easier.

Plugin class through registrationProgramThe plugins mapped to the corresponding configuration XML element are registrated by default.

2) plugin Execution Process

Projectxmlhelper class initializes configuration, processes plugin in ins, and initializes plugins to the corresponding pluginxmlhelper. Once the Initialization Configuration is complete, plugins will be validated and run when the Build cycle is appropriate. The execution time of plugin depends on the type of plugin.

 

Plugin initialization:

Under normal initialization, pluginxmlhelper calls the Set Method of the attribute corresponding to the tag in the config file, for example, the settarget method of antbuilder corresponding to the target attribute of the <ANT/> element. The parser is case sensitive and must be case-sensitive.

In the config file, allow the plug-in to nest other elements. In this case, cruisecontrol will require your plug-in to implement the Add or create method for each nested element:

* If the nested element itself is plugin, pluginxmlhelper does not know which type of element should be mapped. Therefore, you need to configure this element in projectxmlhelper;

* For simple nested elements (non-plugin), plugin knows the name of the element to be mapped. Return to the instance antbuilder. We can see the createjvmarg () method and nested jvmarg type. The createjvmarg () method is used to create a jvmarg instance and keep the instance reference available elsewhere in antbuilder. Createjvmarg () returns the newly created jvmarg object, so that pluginxmlhelper can configure nested elements in the same way as the parent element. Theoretically, there is no limit on the number of nested layers of elements, as long as there is a suitable create method.

 

Plugin Verification:
After the parser configures plugin, we immediately use the plugin's validate () method to verify the plugin. Through validate () verification, we can detect the configuration problems of plugin as early as possible.

Plugin execution:
After plugins configuration and verification, we will start to execute them according to their type. Each plugin has an "action" method called by cruisecontrol to execute plugin. For example, the bootstrappers type plugin is executed before the Build cycle starts. After they are configured and verified that the configuration is correct, we can call their "action" method Bootstrap () in sequence ().

 

3) plugin configuration
Plugin registration:

The registration of plugin is simple and direct. You can directly add <plugin name = "" classname = ""/> under the <cruisecontrol> element or <project> element, the name attribute in the <plugin/> element indicates the name to be used when this plugin is used in the config file. The classname attribute indicates the actual Java class of the plugin.

If plugins is directly specified under the root element, plugins are available for all projects. If plugins are only included in the project, plugins can only be used in this project. You can also overwrite the global plugins definition in a project. For example, you can use labelincrementer plugin for a project separately.

To keep the config file as small as possible, all plugins released with cruisecontrol are automatically registered by default. If you want some default registered plugins names to point to other plugins you want, you just need to use these names to re-register the new plugins, the registered plugins will be overwritten by default.

 

Plug-in pre-configuration/default value:

When registering plugins, you can specify the default value for some attributes of plugin or nested plugin. Simple use of attributes or child elements to define the default value. The default value of plugin can also be overwritten during actual use in the project. Note: When nested elements have a multiple cardinality, overriding an already pre-configured child element might accumulate them.

 

For example, define some default attribute values for htmlemail publisher Plugin:

< Plugin Name = "Htmlemail"
Mailhost = "Smtp.example.com"
Returnaddress = "Buildmaster@example.com"
Subjectprefix = "[CC]"
Export dir = "C: Java \ cruisecontrol-2.2.1 \ report \ JSP \ webcontent \ XSL"
CSS = "C: \ Java \ cruisecontrol-2.2.1 \ report \ JSP \ webcontent \ CSS \ cruisecontrol.css" >
< Always Address = "Project-dev@domain.com" />
< Plugin />

 

To keep the config file as small as possible, you can create a template project to avoid repeated settings of common attributes. For example, you only need to set the project name for the following project:

< Cruisecontrol >
< Plugin Name = "Project" >
< Bootstrappers >
< Cvsbootstrapper Localworkingcopy = "Projects/$ {project. name }" />
</ Bootstrappers >
...
</ Plugin >

<ProjectName= "Foo" />
<ProjectName= "Bar" />
...
</Cruisecontrol>

 

 

4) plugin type

Currently, cruisecontrol supports different plug-in types in six, each of which has different roles, but their design is similar. Type 6 is as follows:

* Bootstrapper: Run before build;

* Sourcecontrol: Check the code repository to determine whether the code has been changed;

* Builder: Implements building and testing;

* Labelincrementer: process the addition of labels, which can be used for tag code;

* Publisher: release build results, for example, by email;

* Listener: process project events;

 

5) default plugins

Bootstrapper

Plugin name Class Name
Accurevbootstrapper Net. SourceForge. cruisecontrol. bootstrappers. accurevbootstrapper
Alienbrainbootstrapper Net. SourceForge. cruisecontrol. bootstrappers. alienbrainbootstrapper
Antbootstrapper Net. SourceForge. cruisecontrol. bootstrappers. antbootstrapper
Clearcasebootstrapper Net. SourceForge. cruisecontrol. bootstrappers. clearcasebootstrapper
Clearcaseviewstrapper Net. SourceForge. cruisecontrol. bootstrappers. clearcaseviewstrapper
Cmsynergybootstrapper Net. SourceForge. cruisecontrol. bootstrappers. cmsynergybootstrapper
Cvsbootstrapper Net. SourceForge. cruisecontrol. bootstrappers. cvsbootstrapper
Execbootstrapper Net. SourceForge. cruisecontrol. bootstrappers. execbootstrapper
Gitbootstrapper Net. SourceForge. cruisecontrol. bootstrappers. gitbootstrapper
Harvestbootstrapper Net. SourceForge. cruisecontrol. bootstrappers. allfusionharvestbootstrapper
Lockfilebootstrapper Net. SourceForge. cruisecontrol. bootstrappers. lockfilebootstrapper
Mercurialbootstrapper Net. SourceForge. cruisecontrol. bootstrappers. mercurialbootstrapper
P4bootstrapper Net. SourceForge. cruisecontrol. bootstrappers. p4bootstrapper
Plasticscmbootstrapper Net. SourceForge. cruisecontrol. bootstrappers. plasticscmbootstrapper
Snapshotcmbootstrapper Net. SourceForge. cruisecontrol. bootstrappers. snapshotcmbootstrapper
Starteambootstrapper Net. SourceForge. cruisecontrol. bootstrappers. starteambootstrapper
Surroundbootstrapper Net. SourceForge. cruisecontrol. bootstrappers. sscmbootstrapper
Svnbootstrapper Net. SourceForge. cruisecontrol. bootstrappers. svnbootstrapper
Tfsbootstrapper Net. SourceForge. cruisecontrol. bootstrappers. tfsbootstrapper
Vssbootstrapper Net. SourceForge. cruisecontrol. bootstrappers. vssbootstrapper

Source Control

Plugin name Class Name
Accurev Net. SourceForge. cruisecontrol. sourcecontrols. accurev
Alienbrain Net. SourceForge. cruisecontrol. sourcecontrols. alienbrain
Alwaysbuild Net. SourceForge. cruisecontrol. sourcecontrols. alwaysbuild
Buildstatus Net. SourceForge. cruisecontrol. sourcecontrols. buildstatus
Clearcase Net. SourceForge. cruisecontrol. sourcecontrols. clearcase
Cmsynergy Net. SourceForge. cruisecontrol. sourcecontrols. cmsynergy
Compound Net. SourceForge. cruisecontrol. sourcecontrols. Compound
CVS Net. SourceForge. cruisecontrol. sourcecontrols. concurrentversionssystem
Darcs Net. SourceForge. cruisecontrol. sourcecontrols. darcs
Filesystem Net. SourceForge. cruisecontrol. sourcecontrols. filesystem
Forceonly Net. SourceForge. cruisecontrol. sourcecontrols. forceonly
Git Net. SourceForge. cruisecontrol. sourcecontrols. Git
Harvest Net. SourceForge. cruisecontrol. sourcecontrols. allfusionharvest
Httpfile Net. SourceForge. cruisecontrol. sourcecontrols. httpfile
Mavensnapshotdependency Net. SourceForge. cruisecontrol. sourcecontrols. mavensnapshotdependency
Maven2snapshotdependency Net. SourceForge. cruisecontrol. sourcecontrols. maven2snapshotdependency
Mks Net. SourceForge. cruisecontrol. sourcecontrols. mks
P4 Net. SourceForge. cruisecontrol. sourcecontrols. p4
Plasticscm Net. SourceForge. cruisecontrol. sourcecontrols. plasticscm
PVCs Net. SourceForge. cruisecontrol. sourcecontrols. PVCs
Snapshotcm Net. SourceForge. cruisecontrol. sourcecontrols. snapshotcm
Starteam Net. SourceForge. cruisecontrol. sourcecontrols. starteam
Store Net. SourceForge. cruisecontrol. sourcecontrols. Store
Surround Net. SourceForge. cruisecontrol. sourcecontrols. sscm
SVN Net. SourceForge. cruisecontrol. sourcecontrols. SVN
TFS Net. SourceForge. cruisecontrol. sourcecontrols. teamfoundationserver
Timebuild Net. SourceForge. cruisecontrol. sourcecontrols. timebuild
UCM Net. SourceForge. cruisecontrol. sourcecontrols. UCM
Veto Net. SourceForge. cruisecontrol. sourcecontrols. Veto
VSS Net. SourceForge. cruisecontrol. sourcecontrols. vss
Vssjournal Net. SourceForge. cruisecontrol. sourcecontrols. vssjournal

Builder

Plugin name Class Name
Ant Net. SourceForge. cruisecontrol. builders. antbuilder
Composite Net. SourceForge. cruisecontrol. builders. compositebuilder
Exec Net. SourceForge. cruisecontrol. builders. execbuilder
Maven Net. SourceForge. cruisecontrol. builders. mavenbuilder
Maven2 Net. SourceForge. cruisecontrol. builders. maven2builder
Nant Net. SourceForge. cruisecontrol. builders. nantbuilder
Pause Net. SourceForge. cruisecontrol. pausebuilder
Phing Net. SourceForge. cruisecontrol. phingbuilder
Rake Net. SourceForge. cruisecontrol. rakebuilder

Label incrementer

Plugin name Class Name
Labelincrementer Net. SourceForge. cruisecontrol. labelincrementers. defaultlabelincrementer

Publisher

Plugin name Class Name
Antpublisher Net. SourceForge. cruisecontrol. Publishers. antpublisher
Artifactspublisher Net. SourceForge. cruisecontrol. Publishers. artifactspublisher
Clearcasebaselinepublisher Net. SourceForge. cruisecontrol. Publishers. clearcasebaselinepublisher
Cmsynergybaselinepublisher Net. SourceForge. cruisecontrol. Publishers. cmsynergybaselinepublisher
Cmsynergytaskpublisher Net. SourceForge. cruisecontrol. Publishers. cmsynergytaskpublisher
Compoundpublisher Net. SourceForge. cruisecontrol. Publishers. compoundpublisher
Email Net. SourceForge. cruisecontrol. Publishers. linkemailpublisher
Execute Net. SourceForge. cruisecontrol. Publishers. executepublisher
Ftppublisher Net. SourceForge. cruisecontrol. Publishers. ftppublisher
Htmlemail Net. SourceForge. cruisecontrol. Publishers. htmlemailpublisher
HTTP Net. SourceForge. cruisecontrol. Publishers. httppublisher
Jabber Net. SourceForge. cruisecontrol. Publishers. linkjabberpublisher
Onfailure Net. SourceForge. cruisecontrol. Publishers. onfailurepublisher
Onsuccess Net. SourceForge. cruisecontrol. Publishers. onsuccesspublisher
Origo Net. SourceForge. cruisecontrol. Publishers. origopublisher
RSS Net. SourceForge. cruisecontrol. Publishers. rsspublisher
Sametimeannouncement Net. SourceForge. cruisecontrol. Publishers. sametimeannouncementpublisher
SCP Net. SourceForge. cruisecontrol. Publishers. scppublisher
Sfeefr Net. SourceForge. cruisecontrol. Publishers. sfee. sfeefrspublisher
Sfeetracker Net. SourceForge. cruisecontrol. Publishers. sfee. sfeetrackerpublisher
Sfeedocman Net. SourceForge. cruisecontrol. Publishers. sfee. sfeedocumentmanagerpublisher
Socket Net. SourceForge. cruisecontrol. Publishers. socketpublisher
Weblog Net. SourceForge. cruisecontrol. Publishers. weblogpublisher
X10 Net. SourceForge. cruisecontrol. Publishers. x10publisher
Xsltlogpublisher Net. SourceForge. cruisecontrol. Publishers. ttlogpublisher
Yahoopublisher Net. SourceForge. cruisecontrol. Publishers. yahoopublisher

Listener

Plugin name Class Name
Lockfilelistener Net. SourceForge. cruisecontrol. listeners. lockfilelistener
Cmsynergysessionmonitor Net. SourceForge. cruisecontrol. listeners. cmsynergysessionmonitor
Currentbuildstatuslistener Net. SourceForge. cruisecontrol. listeners. currentbuildstatuslistener
Currentbuildstatusftplistener Net. SourceForge. cruisecontrol. listeners. currentbuildstatusftplistener
Currentbuildstatuspagelistener Net. SourceForge. cruisecontrol. listeners. currentbuildstatuspagelistener

 

Complete!

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.