Cruise control


Published on

>>Automation of build and release
>>Continuous Integration using ANT and Cruise Control
>>Features of Cruise Control
Using Cruise Control to achieve automation of build and release
>>Metrics, reports and data analysis using Cruise Control
Automated test case execution using EMMA
>>Automated code reviews using PMD

File Can be downloaded from:

Published in: Technology
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • sdfsdfsdf
  • Cruise control

    1. 1. scmGalaxy Author: Rajesh Kumar [email_address]
    2. 2. Agenda <ul><li>Automation of build and release </li></ul><ul><li>Continuous Integration using ANT and Cruise Control </li></ul><ul><li>Features of Cruise Control </li></ul><ul><li>Using Cruise Control to achieve automation of build and release </li></ul><ul><li>Metrics, reports and data analysis using Cruise Control </li></ul><ul><li>Automated test case execution using EMMA </li></ul><ul><li>Automated code reviews using PMD </li></ul>
    3. 3. Expectations <ul><li>My expectations </li></ul><ul><ul><li>Ensure that you understand the usage of CruiseControl </li></ul></ul><ul><ul><li>Ensure that you are able to setup and configure CruiseControl and schedule an automated build process </li></ul></ul><ul><ul><li>Ensure you are able to view metrics and test reports on CruiseControl for the automated build </li></ul></ul><ul><ul><li>Ensure you understand the possibilities of running code coverage tools such as EMMA and code review tools such as PMD using ANT and CruiseControl </li></ul></ul><ul><ul><li>Ensure you understand how to continuously integrate using ANT scripts and CruiseControl </li></ul></ul><ul><li>Your expectations ? </li></ul>
    4. 4. Automated build <ul><li>A build script itself is a good start point for automation. </li></ul><ul><li>A build script automates the sequence of steps to be executed per build. </li></ul><ul><li>However, with increasing need for integration and maintenance of multiple environments, one needs to worry about the availability of bandwidth to perform such tasks </li></ul>
    5. 5. Automated build (contd) <ul><li>Automating builds by scheduling builds helps answer the following questions </li></ul><ul><ul><li>How often should the build be executed? </li></ul></ul><ul><ul><li>What event should trigger off a build? </li></ul></ul><ul><ul><li>If a build breaks, how should the cause of build break be routed to the team / individuals? </li></ul></ul><ul><ul><li>How can a deployment be automated ? </li></ul></ul><ul><ul><li>Can I avoid the manual work of starting a build ? </li></ul></ul><ul><ul><li>Can I integrate generation of various metrics, reports after each build ? </li></ul></ul>
    6. 6. Automated build (contd) <ul><li>Traditional Automation </li></ul><ul><ul><li>Build scripts can be automated using any continuous running process on an OS. The process can execute the build scripts at a scheduled time and do other support tasks as well. </li></ul></ul>
    7. 7. Automated build (contd) <ul><li>For example, to automate a build script on a UNIX OS: </li></ul><ul><ul><li>Write a build script that does the normal build </li></ul></ul><ul><ul><li>Write a batch file to invoke the build script </li></ul></ul><ul><ul><li>Write shell scripts to run the batch file </li></ul></ul><ul><ul><li>Write a CRON job to run the shell script </li></ul></ul><ul><ul><li>Put these tasks in the shell script or the CRON job </li></ul></ul><ul><ul><ul><li>Send out build results through email </li></ul></ul></ul><ul><ul><ul><li>Log build progress and output </li></ul></ul></ul><ul><ul><ul><li>Generate reports for future reference </li></ul></ul></ul>
    8. 8. Automated build (contd) <ul><li>There may be a couple of drawbacks in this method of automation </li></ul><ul><ul><li>Knowledge of scripting required for each OS </li></ul></ul><ul><ul><li>Non-standard reports across projects </li></ul></ul><ul><ul><li>Repetitive work for each project </li></ul></ul><ul><ul><li>More work to code all these standard activities by yourself </li></ul></ul><ul><ul><li>Tools provide wider variety of options in terms of integration with source control, report generation </li></ul></ul>
    9. 9. Automated build (contd) <ul><li>Different method of automation using tools </li></ul><ul><ul><li>Schedule existing build scripts </li></ul></ul><ul><ul><ul><li>Tools such as cruise control, bamboo etc. provide us the ability to define an automated build. </li></ul></ul></ul><ul><ul><li>Monitor builds using web consoles provided on these tools </li></ul></ul><ul><ul><li>Provide effective feedback on build breaks and code quality using the data reported from such tools </li></ul></ul><ul><ul><li>Multiple builds can be defined to ensure that a full build and a full application build are automated and kicked off based on different events </li></ul></ul>
    10. 10. Continuous Integration (CI) <ul><li>Continuous integration is a term used to describe the process of triggering a build for each incremental code modification </li></ul><ul><li>The integration is a continuous process and not a big bang approach </li></ul><ul><li>The term &quot;continuous integration,&quot; commonly attributed to Martin Fowler, who first wrote about the software development practice back in 2000 is one of the pillars of modern programming techniques. </li></ul>
    11. 11. Continuous Integration (contd) <ul><li>It advices the following rules </li></ul><ul><ul><li>single repository </li></ul></ul><ul><ul><li>Event triggered build </li></ul></ul><ul><ul><li>Self-testing code </li></ul></ul><ul><ul><li>Commit code continuously (every day at least) </li></ul></ul><ul><ul><li>Use a production like machine and deploy the integrated build </li></ul></ul><ul><ul><li>Execute a fast build (take only modified code) </li></ul></ul><ul><ul><li>Use these builds to tag and monitor the best version of the day </li></ul></ul><ul><ul><li>Send feedback of breakages, test coverage reports , code reviews etc </li></ul></ul>
    12. 12. Benefits of continuous integration <ul><li>The key is to identify bugs early because the cost of fixing a bug early in the project is less than doing the same at a later stage in the project. </li></ul><ul><li>CI helps in doing this on an incremental basis </li></ul><ul><li>Ability to use automated builds to monitor build breaks and code coverage on a continuous basis helps in tracking quality </li></ul><ul><li>Long integration phases are eliminated </li></ul><ul><li>Customer gets to see new features faster because integration is continuous and faster. </li></ul><ul><li>Getting (or creating) an executable from the source is so easy. </li></ul><ul><li>You know when you will be done </li></ul><ul><li>Project delivery risk is reduced </li></ul>
    13. 13. Introduction to CruiseControl <ul><li>CruiseControl is a framework for a continuous build process </li></ul><ul><li>A web interface is provided to view the details of the current and previous builds </li></ul><ul><li>CruiseControl is an open-source continuous integration toolkit </li></ul><ul><li>Originally it was developed by ThoughtWorks </li></ul><ul><li>It is free for use. </li></ul><ul><li>Latest version is 2.6.1 </li></ul>
    14. 14. Introduction to CruiseControl (contd) <ul><li>CruiseControl is a mature tool and enjoys a strong user base in the industry </li></ul><ul><li>It supports many source control tools such as CVS, Subversion, Clearcase, PVCS, VSS, Perforce and many more </li></ul><ul><li>It also supports many build tools such as ANT, Maven. </li></ul><ul><li>Tools such as PMD, JUNIT integrate well with CruiseControl </li></ul><ul><li>CruiseControl is fairly sophisticated when it comes to running automated builds by detecting changes in the repository </li></ul><ul><li>Also, it is fairly well built to send out notifications after a build in the form of emails, RSS feeds, Blogs. </li></ul>
    15. 15. CruiseControl components (contd) <ul><li>Architecture </li></ul>
    16. 16. CruiseControl components <ul><li>Build Loop </li></ul><ul><ul><li>This component executes the build cycles and is the core to CruiseControl </li></ul></ul><ul><ul><li>A configuration XML stores all details of a build cycle </li></ul></ul><ul><ul><li>Inputs to the “build loop” are the config.xml and the source code </li></ul></ul><ul><ul><li>Outputs of the “build loop” are logs, build artifacts and published reports through email etc. </li></ul></ul><ul><ul><li>Build cycles are executed based on a trigger such as CVS check in, scheduled time, source code change </li></ul></ul>
    17. 17. CruiseControl components (contd) <ul><li>Schedules can be defined on build scripts written using various builder tools such as ANT, MAVEN . </li></ul><ul><li>A status file is maintained that helps keep track of the next build time </li></ul><ul><li>A log file is stored for each build that is started which will be read by the reporting component. </li></ul><ul><li>After the build completes, build reports can be published using various techniques such as email, log, FTP, HTML Email </li></ul>
    18. 18. CruiseControl components (contd) <ul><li>Reporting </li></ul><ul><ul><li>Reports is a web application that runs in a web container such as Jetty (inbuilt) when CruiseControl starts. </li></ul></ul><ul><ul><li>Inputs to the “reports” component are the build artifacts and XML logs </li></ul></ul><ul><ul><li>The “reports” component has a web application hosted in a web container through which build details can be viewed </li></ul></ul><ul><ul><li>These build reports can be accessed through HTTP </li></ul></ul>
    19. 19. CruiseControl components (contd) <ul><li>A build results JSP will display the log of the build loop. </li></ul><ul><li>Left panel of the JSP will display links to details of the completed builds and current builds. </li></ul><ul><li>Right panel will display details for a build such as build results, test results, changed files since last build </li></ul><ul><li>The build details right panel is created by applying XSL on XML log files to generate HTML that is displayed on the JSP. This lends to easy customization of this panel to include your own reports. </li></ul>
    20. 20. DEMO <ul><li>Demo 1– Display a build Results JSP live </li></ul><ul><li>http://localhost:8080/ </li></ul>
    21. 21. EXERCISE <ul><li>Exercise 1 – Setup CruiseControl, View Results </li></ul>
    22. 22. CruiseControl Terminologies <ul><li>Project </li></ul><ul><li>Listener </li></ul><ul><li>Publisher </li></ul><ul><li>Schedule </li></ul><ul><li>Triggers </li></ul>
    23. 23. CruiseControl Terminologies (contd) <ul><li>Project </li></ul><ul><ul><li>Is a basic unit of work for a build loop </li></ul></ul><ul><ul><li>It will primarily handle the job of arriving at a set of modifications in a project, building the project and publishing results of the project </li></ul></ul><ul><ul><li>One configuration XML can contain multiple projects </li></ul></ul><ul><ul><ul><li>For e.g.: </li></ul></ul></ul><ul><ul><ul><li>2 projects can be defined on the same source code. </li></ul></ul></ul><ul><ul><ul><li>One project will build only when a file in CVS changes. </li></ul></ul></ul><ul><ul><ul><li>The other project will build only on weekends at 4 p.m. </li></ul></ul></ul>
    24. 24. CruiseControl Terminologies (contd) <ul><li>Listener </li></ul><ul><ul><li>Listeners are plug-ins that handle specific events. </li></ul></ul><ul><ul><li>For e.g.:”currentBuildStatusListener” writes the last built time into a file on the disk. </li></ul></ul><ul><ul><li>Let’s look at status.txt file </li></ul></ul>
    25. 25. CruiseControl Terminologies (contd) <ul><li>Publisher </li></ul><ul><ul><li>Publisher publishes the build output to a log, through email ,through FTP and through many more ways. </li></ul></ul><ul><ul><li>Publishing is done after a build has completed. </li></ul></ul><ul><ul><li>It will be run regardless of whether the build was successful or not. </li></ul></ul><ul><ul><li>For e.g: </li></ul></ul><ul><ul><ul><li>xsltlogpublisher : Performs a transformation of the XML log file to HTML </li></ul></ul></ul><ul><ul><ul><li>htmlemail : Sends an email with the build results embedded as HTML </li></ul></ul></ul>
    26. 26. CruiseControl Terminologies (contd) <ul><li>Schedule </li></ul><ul><ul><li>A build can be scheduled to occur at specific times </li></ul></ul><ul><ul><li>Alternately, a build can be triggered from an event such as CVS check-in, source code change. </li></ul></ul><ul><li>Triggers </li></ul><ul><ul><li>Changes to files in repositories such as PVCS, CVS can act as triggers </li></ul></ul><ul><ul><li>Changes in a file system can return a set of modified files that can trigger a build </li></ul></ul>
    27. 27. CruiseControl plug-ins <ul><li>CruiseControl provides continuous integration as it’s core functionality. </li></ul><ul><li>All other functionality like publishing, building using builders etc are implemented through plug-ins </li></ul><ul><li>Plug-ins are represented by beans </li></ul><ul><li>Plug-in classes are mapped to element names in the XML config file through a process known as registration. </li></ul><ul><li>Plug-ins distributed with CruiseControl are all registered by default. </li></ul>
    28. 28. CruiseControl plug-ins (contd) <ul><li>You can also write your own plug-in and register it with CruiseControl </li></ul><ul><li>To register your own plug-in class: </li></ul><ul><ul><li>Directly under the <cruisecontrol> element or within a <project> element, add this: <plugin name=&quot;&quot; classname=&quot;&quot;/> </li></ul></ul><ul><ul><li>Here “name” attribute corresponds to the name you wish to use within the config file </li></ul></ul><ul><ul><li>The “classname” attribute corresponds to the actual plug-in Java class. </li></ul></ul>
    29. 29. CruiseControl plug-ins (contd) <ul><li>There are currently six different types of plug-ins that CruiseControl supports. </li></ul><ul><ul><li>Bootstrapper: run before the build </li></ul></ul><ul><ul><li>SourceControl: poll a code repository and determine if anything has changed </li></ul></ul><ul><ul><li>Builder: perform the actual building and testing of your code </li></ul></ul><ul><ul><li>LabelIncrementer: handles incrementing the label for you to use to tag your source </li></ul></ul><ul><ul><li>Publisher: publish the results of your build, via email for example </li></ul></ul><ul><ul><li>Listener: handles project events </li></ul></ul>
    30. 30. CruiseControl configuration <ul><li>A configuration XML is defined in CruiseControl to configure multiple projects. </li></ul><ul><li>Configuration XML file is reloaded every time CruiseControl wakes up to check if a build needs to be done. This way CruiseControl need not be restarted every time. </li></ul><ul><li>However, new projects added to the config XML will be reflected only if CruiseControl is restarted. </li></ul><ul><li>Several configuration files can be included in one config XML. </li></ul>
    31. 31. Config XML
    32. 32. CruiseControl configuration (contd) <ul><li>One can define the following elements in a config XML under the root <cruisecontrol> element: </li></ul><ul><ul><li>Properties - <property> </li></ul></ul><ul><ul><li>Other config XML’s - <include.projects> </li></ul></ul><ul><ul><li>New plugins - <plugin> </li></ul></ul><ul><ul><li>Projects - <project> </li></ul></ul><ul><li>Note on <property> : It’s just like ANT properties. But it's not entirely first come, first set. Properties set at the global level can be eclipsed within the scope of a project by simply resetting the property. </li></ul>
    33. 33. CruiseControl configuration (contd) <ul><li><project> element can have these sub-elements : </li></ul><ul><ul><li>Properties - <property> </li></ul></ul><ul><ul><li>plugins - <plugin> </li></ul></ul><ul><ul><li>Listeners - <listeners> </li></ul></ul><ul><ul><li>triggers - <modificationset> </li></ul></ul><ul><ul><li>Schedule - <schedule> </li></ul></ul><ul><ul><li>Log file manipulations - <log> </li></ul></ul><ul><ul><li>Publishers - <publishers> </li></ul></ul>
    34. 34. DEMO <ul><li>Demo 2– Run through a sample config XML </li></ul>
    35. 35. EXERCISE <ul><li>Exercise 2 – write a config XML </li></ul><ul><ul><li>Publisher </li></ul></ul><ul><ul><li>Listener </li></ul></ul><ul><ul><li>Schedule </li></ul></ul><ul><ul><li>Log </li></ul></ul><ul><ul><li>Modification set </li></ul></ul>
    36. 36. Scheduling <ul><li>Most common scheduling pattern : </li></ul><ul><ul><li><modificationset> </li></ul></ul><ul><ul><li><cvs localworkingcopy=&quot;C:Sourcesproject&quot;> </li></ul></ul><ul><ul><li></modificationset> </li></ul></ul><ul><ul><li><schedule interval=&quot;1200&quot;> </li></ul></ul><ul><ul><ul><li><ant antscript=&quot;${dir.javatools}antbinant.bat&quot; antWorkingDir=&quot;${dir.project}&quot; buildfile=&quot;${dir.project}build.xml&quot; target=&quot;integration&quot;/> </li></ul></ul></ul><ul><ul><li></schedule> </li></ul></ul><ul><li>This schedule will execute a build every 1200 seconds if something has been checked into CVS. </li></ul>
    37. 37. Scheduling (contd) <ul><li>More scheduling scenarios: </li></ul><ul><ul><li>The nightly build </li></ul></ul><ul><ul><ul><li>This will execute a nightly build at 11PM or 2300 hrs only if something has been committed during the day. </li></ul></ul></ul><ul><ul><ul><li>The “time” attribute determines the time of the build </li></ul></ul></ul><ul><ul><ul><li><modificationset> </li></ul></ul></ul><ul><ul><ul><ul><li><cvs localworkingcopy=&quot;C:cvsSourceproject&quot;> </li></ul></ul></ul></ul><ul><ul><ul><ul><li></modificationset> </li></ul></ul></ul></ul><ul><ul><ul><li><schedule> </li></ul></ul></ul><ul><ul><ul><ul><li><ant antscript=&quot;${dir.javatools}antbinant.bat&quot; antWorkingDir=&quot;${dir.project}&quot; buildfile=&quot;${dir.project}build.xml&quot; time=&quot;2300&quot; target=“build&quot;/> </li></ul></ul></ul></ul><ul><ul><ul><li></schedule> </li></ul></ul></ul>
    38. 38. Scheduling (contd) <ul><li>Force Builds: </li></ul><ul><ul><li>To force a build even if no modifications have been made, you can set the requiremodification attribute to “false” in the modificationset element </li></ul></ul><ul><li><modificationset requiremodification=“false”> </li></ul><ul><li><cvs localworkingcopy=&quot;C:cvsSourceproject&quot;> </li></ul><ul><li></modificationset> </li></ul><ul><li><schedule> </li></ul><ul><li><ant antscript=&quot;${dir.javatools}antbinant.bat&quot; antWorkingDir=&quot;${dir.project}&quot; buildfile=&quot;${dir.project}build.xml&quot; time=&quot;2300&quot; target=“build&quot;/> </li></ul><ul><li></schedule> </li></ul>
    39. 39. Scheduling (contd) <ul><li>Different Builds on different Days </li></ul><ul><ul><li>For e.g.: There are ways to schedule a build for Mondays, Wednesdays and Fridays . A different build can be scheduled for Tuesdays and Thursdays. </li></ul></ul><ul><li>Pause build </li></ul><ul><ul><li>There is a plug-in that can help pause a build during a certain period while backing up a server , during server restarts etc. </li></ul></ul>
    40. 40. DEMO <ul><li>Demo 3 - Schedule a build if a file on the local file system changes </li></ul>
    41. 41. EXERCISE <ul><li>Exercise 3 - Schedule a forced build – even if there is no modification </li></ul>
    42. 42. Metrics, Reports in CruiseControl <ul><li>CruiseControl has the option of merging other tool’s reports into it’s log so it can be displayed on it’s reporting JSP. </li></ul><ul><li>The config XML can be configured to do this using these elements : </li></ul><ul><li><log> </li></ul><ul><ul><li>This element helps configure the location where the CruiseControl log files are stored. </li></ul></ul><ul><li><merge> </li></ul><ul><ul><li>This element is put inside the <log> tag. XML artifacts to merge with the CruiseControl log can be specified here. </li></ul></ul><ul><ul><li>The most common XML to merge is JUNIT test results that the ANT <junit> task creates. </li></ul></ul>
    43. 43. DEMO <ul><li>Demo 4 – </li></ul><ul><ul><li>Integrating test reports (JUNIT) with CruiseControl web application </li></ul></ul><ul><ul><li>Integrating PMD reports with CruiseControl </li></ul></ul>
    44. 44. EXERCISE <ul><li>Exercise 4 - Integrating CruiseControl with EMMA Reports </li></ul>
    45. 45. Triggers in CruiseControl <ul><li>The <modificationset> element under a <project> element contains the triggers for a build to occur. </li></ul><ul><li>These triggers can be classified into many types: </li></ul><ul><ul><li>Source Control tool based: These triggers will detect modifications in a source control tool </li></ul></ul><ul><ul><ul><li>For e.g.: </li></ul></ul></ul><ul><ul><ul><ul><li><cvs/> </li></ul></ul></ul></ul><ul><ul><ul><ul><li><clearcase/> </li></ul></ul></ul></ul>
    46. 46. Triggers in CruiseControl (contd) <ul><li>File based: These triggers detect changes in the file system based on last modified time. </li></ul><ul><ul><li>For e.g.: </li></ul></ul><ul><ul><ul><li><filesystem> </li></ul></ul></ul><ul><li>Forced : These triggers force a build irrespective of whether modifications have occurred or not </li></ul><ul><ul><li><alwaysbuild> </li></ul></ul><ul><ul><li><forceonly/> </li></ul></ul><ul><ul><li><timebuild> </li></ul></ul><ul><li>Other-build-status-based: These triggers are based on the status of another build which will be read from a log file </li></ul><ul><ul><li><buildstatus/> </li></ul></ul>
    47. 47. Triggers in CruiseControl (contd) <ul><li>Optimized triggers: </li></ul><ul><ul><li>These triggers help optimize searching for modifications </li></ul></ul><ul><ul><li>Sample : Here CVS is searched only of the text file is modified by CVS </li></ul></ul><ul><ul><li><modificationset quietperiod=&quot;1&quot; > </li></ul></ul><ul><ul><li><compound includeTriggerChanges=&quot;false&quot;> </li></ul></ul><ul><ul><li><triggers> </li></ul></ul><ul><ul><li><filesystem folder=&quot;./mod_file.txt&quot; /> </li></ul></ul><ul><ul><li></triggers> </li></ul></ul><ul><ul><li><targets> </li></ul></ul><ul><ul><li><cvs cvsroot=&quot;; /> </li></ul></ul><ul><ul><li></targets> </li></ul></ul><ul><ul><li></compound> </li></ul></ul><ul><ul><li></modificationset> </li></ul></ul>
    48. 48. DEMO <ul><li>Demo 5 - Use different triggers to trigger the same build </li></ul>
    49. 49. Handling multiple projects <ul><li>Using CruiseControl, multiple projects can be handled. </li></ul><ul><li>They are configured in the config XML </li></ul><ul><li>There are multiple strategies to do this. </li></ul><ul><ul><li>Define multiple configuration XML’s with projects in each and include them all in one master config XML </li></ul></ul><ul><ul><li>Define multiple projects in one config XML </li></ul></ul><ul><ul><li>Use a combination of both strategies. </li></ul></ul><ul><li>Project names must still remain unique. Else, the first project with a given name will be loaded and any subsequent projects attempting to use the same name will be skipped </li></ul><ul><li>Properties and plug-ins in the master config XML are global and will be available to all included config XML’s on a per instance basis </li></ul>
    50. 50. Handling multiple projects (contd) <ul><li>The projects in a config XML are run on a shared build queue. </li></ul><ul><li>The number of projects that can be executed simultaneously can be configured using a <threads> element in the config XML. </li></ul><ul><li>If the number of simultaneous projects crosses this number, they will be queued. </li></ul>
    51. 51. Scheduling multiple projects <ul><li>Day-and-night builds : </li></ul><ul><ul><li>Multiple projects can be created to do regular quick CI builds during the day and then a complete build at night </li></ul></ul><ul><ul><li>Same repository location will be used. </li></ul></ul><ul><ul><li>Different build targets will be used </li></ul></ul>
    52. 52. Scheduling multiple projects (contd) <ul><li><project name=“CI&quot;> </li></ul><ul><li><modificationset> </li></ul><ul><li><cvs localworkingcopy=&quot;C:Sourcesproject&quot;> </li></ul><ul><li></modificationset> </li></ul><ul><li><schedule interval=&quot;1200&quot;> </li></ul><ul><li><ant antWorkingDir=&quot;${dir.project2}&quot; buildfile=&quot;${dir.project}build.xml&quot; target=“CI-Build&quot;/> </li></ul><ul><li></schedule> </li></ul><ul><li></project> </li></ul><ul><li><project name=“nightlyBuild&quot;> </li></ul><ul><li><modificationset requiremodification=&quot;false&quot;> </li></ul><ul><li><cvs localworkingcopy=&quot;C:Sourcesproject&quot;> </li></ul><ul><li></modificationset> </li></ul><ul><li><schedule> </li></ul><ul><li><ant antscript=&quot;${dir.javatools}antbinant.bat&quot; antWorkingDir=&quot;${dir.project}&quot; buildfile=&quot;${dir.project}build.xml&quot; time=&quot;2300&quot; target=&quot;complete-build&quot;/> </li></ul><ul><li></schedule> </li></ul><ul><li></project> </li></ul>
    53. 53. DEMO <ul><li>Demo 6 – Handling multiple projects in CC </li></ul>
    54. 54. Advantages of using CruiseControl <ul><li>Use CruiseControl as your CI tool if you want a reactive build that will poll repository for changes and build thereafter </li></ul><ul><li>Use CruiseControl if you want excellent notification options. </li></ul><ul><li>More importantly, use CruiseControl if you don’t want to be pigeon-holed as the “Build Guru” of your project for life doing “building and notifying”  </li></ul>
    55. 55. Some things to watch out for in CC <ul><li>Checking out code from source control repositories has to be coded by the user (this is configurable in other tools such as Continuum) </li></ul><ul><li>Does not provide much for build management and inter-project dependencies </li></ul><ul><li>Visit the link for known issues w.r.t threads, multiple projects </li></ul>
    56. 56. CruiseControl Best practices <ul><li>Setup a different CruiseControl project for every branch you create in your CM system. </li></ul><ul><li>Communicate build results through email to all developers </li></ul><ul><li>Automate running of minimum bunch of tests after a build to ensure sanity. </li></ul><ul><li>Put a build label into the build artifacts. For instance, put a build version into the file of your jar </li></ul><ul><li>Version your CC config.xml </li></ul>
    57. 57. Continuous Integration – other tools <ul><li>Most tools support ANT and MAVEN </li></ul><ul><li>Most tools support commonly used source control repositories. </li></ul><ul><li>Some tools are : </li></ul><ul><ul><li>Apache Continuum </li></ul></ul><ul><ul><ul><li>Apache origin, created by the Maven team </li></ul></ul></ul><ul><ul><ul><li>Provides pretty much the same features as CC </li></ul></ul></ul><ul><ul><ul><li>One advantage here is that you do not need to write any script to check out the latest source code from a repository. All you need to do instead is supply the SCM repository details and the build script, and Continuum will do the rest. </li></ul></ul></ul><ul><ul><ul><li>Uses Cron type expression to schedule builds </li></ul></ul></ul>
    58. 58. Continuous Integration – other tools (contd) <ul><li>CCNet – CruiseControl for .net by ThoughtWorks </li></ul><ul><ul><li>This is a continuous integration server </li></ul></ul><ul><ul><li>It is a C# equivalent for Cruise Control (which is a Java solution) </li></ul></ul><ul><ul><li>Supports integration with Nunit, NANT, Visual Studio </li></ul></ul><ul><ul><li>Remote management and reporting is built-in and well supported by tools such as “Web Dashboard” and “CCTray” </li></ul></ul>
    59. 59. Continuous Integration – other tools (contd) <ul><li>AntHill Pro – By UrbanCode </li></ul><ul><ul><li>This is a continuous integration server as well </li></ul></ul><ul><ul><li>Ideal for distributed and multi-platform builds </li></ul></ul><ul><ul><li>Handles dependencies between projects while building </li></ul></ul><ul><ul><li>Handles automated deployments on multiple environments </li></ul></ul><ul><ul><li>Handles multiple builds such as CI build, nightly builds, release builds through workflows </li></ul></ul><ul><ul><li>Handles automated promotion of a build which may involve repackaging build artifacts, deploying build artifacts, creating a baseline on the repository </li></ul></ul>
    60. 60. Continuous Integration – other tools (contd) <ul><li>Other tools : </li></ul><ul><ul><li>CruiseControl.rb - CruiseControl for Ruby </li></ul></ul><ul><ul><li>Build Forge - IBM Rational software </li></ul></ul><ul><ul><li>Apache Gump - Apache Origin </li></ul></ul><ul><ul><li>DamageControl – Thoughtworks origin </li></ul></ul><ul><ul><li>Tinderbox – by Mozilla </li></ul></ul><ul><ul><li>LuntBuild – Available on SourceForge, Built by PMEase </li></ul></ul>
    61. 61. Integration strategies <ul><li>When defining an integration strategy while building your application’s code, you may want to think about these: </li></ul><ul><ul><li>Phase-wise integration </li></ul></ul><ul><ul><li>Incremental integration </li></ul></ul>
    62. 62. Integration strategies (contd) <ul><li>Phase-wise integration </li></ul><ul><ul><li>wait till the system integration phase to actually integrate </li></ul></ul><ul><ul><li>This is more of a traditional approach and has a number of drawbacks </li></ul></ul><ul><ul><ul><li>Problems are identified very late and this makes it expensive to fix them </li></ul></ul></ul><ul><ul><ul><li>Different types of issues may come in at this stage such as compilation issues, incompatible methods, classes and interfaces, runtime issues, unhandled exceptions, missing functionality. Prioritizing become difficult. </li></ul></ul></ul><ul><ul><ul><li>Project appears too risky at this point </li></ul></ul></ul><ul><ul><ul><li>Difficult to predict end of project </li></ul></ul></ul>
    63. 63. Integration strategies (contd) <ul><li>Incremental integration </li></ul><ul><ul><li>This has evolved as a learning from the phase-wise integration approach </li></ul></ul><ul><ul><li>Integrate while you code </li></ul></ul><ul><ul><li>build and test daily </li></ul></ul><ul><ul><li>use “Continuous Integration” approach </li></ul></ul>
    64. 64. Integration strategies (contd) <ul><li>You may need to integrate all of these. So decide when you want to integrate what </li></ul><ul><ul><li>Portals – websites, integration with intranet </li></ul></ul><ul><ul><li>Databases </li></ul></ul><ul><ul><li>Web services </li></ul></ul><ul><ul><li>Third party applications </li></ul></ul><ul><li>Broadly integration can be thought of at multiple levels: </li></ul><ul><ul><li>Module – intra application </li></ul></ul><ul><ul><li>Application – across multiple applications in a project </li></ul></ul><ul><ul><li>Project- across multiple projects </li></ul></ul><ul><ul><li>Versions/Releases – across multiple versions of a project </li></ul></ul>
    65. 65. Good reads <ul><li>Integration with PMD : </li></ul><ul><ul><li> </li></ul></ul><ul><li> </li></ul><ul><li> </li></ul><ul><li> </li></ul><ul><li> </li></ul>
    66. 66. Summary <ul><li>We explored : </li></ul><ul><ul><li>CruiseControl Features </li></ul></ul><ul><ul><li>Automation of build process using CruiseControl </li></ul></ul><ul><ul><li>Tools integration with automated build – EMMA, PMD </li></ul></ul><ul><ul><li>Continuous integration using ANT and CruiseControl </li></ul></ul>
    67. 67. Thank You ! Author: Rajesh Kumar [email_address]