Continuous Integration Using Cruise Control - PowerPoint PPT Presentation

1 / 32
About This Presentation
Title:

Continuous Integration Using Cruise Control

Description:

... pragprog.com/movies/auto/CruiseControl_MikeClark.html (Local ... were detected. ... runs if modifications were detected. Most publishers can be disabled ... – PowerPoint PPT presentation

Number of Views:1138
Avg rating:3.0/5.0
Slides: 33
Provided by: tomg54
Category:

less

Transcript and Presenter's Notes

Title: Continuous Integration Using Cruise Control


1
Continuous Integration Using Cruise Control
  • Presented By
  • Tom Grant
  • PlatinumSolutions, Inc.
  • Tuesday, May 24th, 2005
  • Northern VA Java Users Group
  • Core SIG

2
What is Integration?
  • Definition the act of combining into an
    integral whole
  • In software development, integration includes
  • Combining source files
  • Combining software and environment
  • Combining software and data
  • Combining software and requirements (tests)
  • Combining developers

3
Integration Testing in the SDLC
  • Combine the applications components into working
    software.
  • Historically done near the end of the project.
  • Very risky! Software modules dont always work
    together as expected
  • Best case Time to fix, time to retest that
    module
  • Worst case Time to determine why, time to
    redesign, time to fix, time to test all of the
    modules affected by the redesign.

4
Nightly Builds
  • Practice became popular in the late 90s after
    Microsoft published its development practices
  • Integrate all of the software on a nightly basis.
  • Smoke Test run the application and conduct a
    minimal set of tests to see if it catches fire.

5
Take it to the Extreme
  • Extreme Programming says
  • if testing is good, test all the time
  • if integration testing is important, integrate
    and test all the time
  • if short iterations are good, make the iterations
    really, really short (minutes and hours, not
    weeks and months)
  • Continuous Integration is born.

6
What is Continuous Integration?
  • Integrates source code and runs tests after each
    commit of code to the source repository.
  • Near-immediate feedback to the developer from the
    authoritative source, the system itself.

7
Nightly vs. Continuous Builds
  • Nightly builds generate deliverables. They result
    in something tangible something for QA to test,
    something for product managers to review, and
    something to reassure team members that they are
    in fact building a product. Because of the
    external audience, the nightly build is a formal
    event, a mini-milestone that your team should hit
    without fail. Breaking the nightly build is
    something that generates blame and often
    consequences, such as becoming the build mother
    or being awarded a dunce cap.
  • Continuous Integration builds dont need durable
    build products to be beneficial. They are a way
    for a developer to have a conversation with the
    system to gain reassurance that they have done
    their part.
  • Source http//www.stickyminds.com/BetterSoftware/
    magazine.asp?fncifeaid58
  • Use both.

8
Benefits of Continuous Integration
  • It minimizes integration risk.
  • It supports easier defect diagnosis.
  • It saves time creating releases.
  • Encourages good testing habits
  • It enables other good development practices

9
C.I. Enables other Practices
  • Test Driven Development
  • Fewer bugs, less time debugging
  • Confidence to refactor
  • Executable Documentation
  • Validation that you are complete
  • Release Management
  • Builds are centralized
  • Builds are repeatable/re-creatable
  • Modifications are clearly mapped to releases
  • Issues are clearly mapped to releases and thus to
    modifications
  • Releases are only created with committed code
  • Digitally signed code
  • Enforcement of Company Development Policy
  • Automate policy tests with Checkstyle
  • Manual code reviews can focus on design not
    syntax

10
Continuous Integration Toolkits
  • Cruise Control
  • http//cruisecontrol.sourceforge.net
  • Damage Control
  • http//damagecontrol.codehaus.org/
  • Anthill
  • http//www.urbancode.com/projects/anthill/default.
    jsp
  • Gump
  • http//jakarta.apache.org/gump/
  • Luntbuild
  • http//luntbuild.sourceforge.net/
  • Feature Comparison Matrix
  • http//docs.codehaus.org/display/DAMAGECONTROL/Con
    tinuousIntegrationServerFeatureMatrix (Local
    Copy)

11
Cruise Control
  • Think of it as Cron for Ant.
  • Simple design. Full featured, but not bloated.
  • Adapts to your project, not the other way around.
  • Can be completely customized.

12
Mike Clarks 2 Minute Demo
  • Mike Clark, author of Pragmatic Project
    Automation
  • http//media.pragprog.com/movies/auto/CruiseContro
    l_MikeClark.html (Local Copy)

13
The Build Loop
1. Bootstrap
2. Check for modifications
CVS
Cruise Control
3. Get the revision log
Build Artifacts Dir (Samba Share)
5. Publish Artifacts
SMTP Server
6. Send Emails
1. Get the latest source
4. Run Build
3. Tag source (optional)
Project Specific Adapter - Ant Script
Your projects Build file Ant, Maven, Make
2. Run Build
14
Cruise Controls Build Loop
  • Executes every n seconds or schedulable at
    particular times.
  • The process
  • Bootstrap (setup)
  • Check for modifications
  • Run build
  • Publish results

15
Scheduling
  • You can schedule continuous builds
  • You can schedule builds at particular times
    (nightly builds)
  • You can schedule builds at particular intervals
    (hourly, weekly)
  • You can omit certain times or days (no builds on
    Sunday)
  • You can run different targets for each iteration.
    (do a complete test every 3rd run)

16
Bootstrap
  • Gives the developer a chance to run something
    before a build.
  • Always runs, regardless of the existence of
    modifications
  • Usually empty

17
Check for Modifications
  • Checks for the existence of modifications, and
    retrieves the list of those modifications.
  • Version Control Systems
  • cvs, pvcs, clearcase,
  • visual source safe, subversion,
  • Local files
  • Http files
  • Always or Force only
  • Combinations of multiple types
  • Custom
  • Quiet Period Makes sure that the repository is
    quiet for n seconds to prevent builds from
    kicking off in the middle of a multi step code
    commit.

18
Run The Build
  • Only runs if modifications were detected.
  • It can run an ant script, maven or any other
    system executable such as make.
  • Cruise Controls approach is that it will run
    your applications build file. Your build file
    should know how to do everything to build your
    project.

19
Publish Results
  • Only runs if modifications were detected. Most
    publishers can be disabled on a failure.
  • Build artifacts
  • Copies files to a labeled release directory
  • SCP, FTP
  • Email
  • Reports generated via XSL transforms
  • XSL transforms exist for HTML, Email
  • You can add your own
  • Execute scripts or applications
  • X10
  • Sirens, lamps. Notification using your other
    senses.

20
The Build Loop
1. Bootstrap
2. Check for modifications
CVS
Cruise Control
3. Get the revision log
Build Artifacts Dir (Samba Share)
5. Publish Artifacts
SMTP Server
6. Send Emails
1. Get the latest source
4. Run Build
3. Tag source (optional)
Project Specific Adapter - Ant Script
Your projects Build file Ant, Maven, Make
2. Run Build
21
Demonstrations
  • Mike Clarks demonstration
  • Developer failed to run tests before check-in
  • novajug Project
  • Developer failed to check in a file
  • Developer failed to Javadoc his class
  • Developer hard coded a path in the build file
  • Other scenarios
  • Long running tests
  • Multiple OS Testing
  • Massive Refactoring

22
Setting Up Cruise Control
  • Getting Started How-to
  • http//cruisecontrol.sourceforge.net/gettingstarte
    d.html (Local Copy)
  • Pragmatic Project Automation
  • http//www.pragmaticprogrammer.com/starter_kit/au/
    scheduled.pdf (Local Copy)
  • Installation Directory - C\Program
    Files\CruiseControl\
  • bin\cruisecontrol.bat
  • Build Directory - C\builds\
  • artifacts\ - files to be delivered
  • checkout\ - the source to build
  • logs\ - the details about each build
  • config.xml the config file for Cruise Control

23
Setting Up Cruise Control
  • Install required software
  • Java SDK
  • Ant
  • cvs.exe for cvs access
  • Tomcat (optional)
  • Download the Cruise Control software
  • Install the Cruise Control software
  • Install the reporting WAR file (optional)

24
Configuring Your Project
  • Checkout the code with cvs.exe
  • build-novajug.xml The project specific adapter
    between Cruise Control and our project.
  • config.xml The Cruise Control configuration
    file.

25
JMX Interface
  • http//localhost8000/
  • For administrators and build masters, not for all
    users.
  • Cruise Control was intended to interact with
    developers strictly through email.

26
Installation Tips
  • Remember to do a cvs login before your cvs
    checkout. Use the command line cvs.exe.
  • Remember to change the user that the Windows
    service runs under to be the same user that
    executed the cvs login.
  • Run your projects ant script from the command
    line to test it, not through your IDE.
  • Run Cruise Control from the command line before
    you set it up as a service.
  • Share the artifacts directory.
  • Plan for having multiple projects.
  • Cruise Control server does not make any
    assumptions about directory structure, but the
    reporting application does.
  • Keep your project wrapper simple
  • Copy the xsl and css files into your build
    directory if you are going to customize them. It
    will make it easier for you to upgrade the Cruise
    Control installation.

27
Reporting Web-application
  • http//localhost8080/cruisecontrol/
  • Deploy it to any servlet container on the same
    machine.
  • Modify two parameters in the web.xml file.

ltcontext-paramgt ltparam-namegtlogDirlt/param-na
megt ltparam-valuegtc\builds\logslt/param-value
gt lt/context-paramgt ltservletgt
ltservlet-namegtArtifactServletlt/servlet-namegt
ltservlet-classgtnet.sourceforge.cruisecontrol.se
rvlet.FileServletlt/servlet-classgt
ltinit-paramgt ltparam-namegtrootDirlt/para
m-namegt ltparam-valuegtc\builds\artifac
ts\lt/param-valuegt lt/init-paramgt lt/servletgt
28
Cruise Control does
  • It runs your build script whenever you commit a
    change to your source repository.
  • It allows you to schedule nightly builds.
  • It allows you to run on-demand builds.
  • It notifies you of the results of those builds.
  • It simplifies release management.

29
Cruise Control does not
  • It does not write your build script for you.
  • It does not write your unit tests for you.
  • It does not automatically resolve project
    dependencies.

30
What does it cost?
  • Free, Open Source Software
  • One time costs
  • 500 for a dedicated build machine
  • 4 hours configuration time for a first-timer, 2
    hours for an experienced Cruise Control user.
  • Recurring costs
  • 20 minutes to set up a new project
  • Electricity
  • Disk space

31
The Bottom Line
  • It takes practically nothing to set it up.
  • At a minimum, use it for nightly builds.
  • It becomes more valuable whenever the following
    factors increase
  • the number of developers
  • the number of releases
  • the number of unit tests

32
Links
  • Article by Jeffrey Fredrick on Continuous
    Integration using Cruise Control
  • http//www.stickyminds.com/BetterSoftware/magazine
    .asp?fncifeaid58
  • Continuous Integration Toolkit comparison Matrix
  • http//docs.codehaus.org/display/DAMAGECONTROL/Con
    tinuousIntegrationServerFeatureMatrix
  • Cruise Control Website
  • http//cruisecontrol.sourceforge.net
  • Ant Website
  • http//ant.apache.org
  • Pragmatic Project Automation by Mike Clark
  • http//www.pragmaticprogrammer.com/sk/auto/
  • This presentation is available at
  • http//www.platinumsolutions.com/resources/
Write a Comment
User Comments (0)
About PowerShow.com