Continuous Integration using Cruise Control

  • 1,955 views
Uploaded on

 

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
1,955
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
85
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Continuous Integration using Cruise Control
    • Presented By
    • Tom Grant
    • PlatinumSolutions, Inc.
    • Thursday, April 14 th , 2005
  • 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 application’s components into working software.
    • Historically done near the end of the project.
    • Very risky! Software modules don’t 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 don’t 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?fn=cifea&id=58
    • Use both .
  • 8. Benefits of Continuous Integration
    • It minimizes integration risk.
    • 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
        • Less need for manual code reviews
  • 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/
    • Feature Comparison Matrix
    • http://docs.codehaus.org/display/DAMAGECONTROL/Continuous+Integration+Server+Feature+Matrix
  • 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. Cruise Control’s Build Loop
    • Executes every “n” seconds or schedulable at particular times.
    • The process:
          • Bootstrap (setup)
          • Check for modifications
          • Run build
          • Publish results
  • 13. The Build Loop CVS Build Artifacts Dir (Samba Share) SMTP Server 1. Bootstrap 2. Check for modifications 3. Get the revision log Cruise Control Your project’s Build file Ant, Maven, Make 2. Run Build 5. Publish Artifacts 6. Send Emails 1. Get the latest source 3. Tag source Cruise Control to project adapter. (build-project.xml) Ant script 4. Run Build
  • 14. 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 3 rd run)
  • 15. Bootstrap
    • Gives the developer a chance to run something before a build.
    • Always runs, regardless of the existence of modifications
    • Usually empty
  • 16. 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.
  • 17. 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 Control’s approach is that it will run your application’s build file. Your build file should know how to do everything to build your project.
  • 18. 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.
  • 19. Demonstrations
    • Mike Clark (Pragmatic Project Automation)
          • http://media.pragprog.com/movies/auto/CruiseControl_MikeClark.html
    • PS Project
  • 20. PS Project with Cruise
    • Checkout the code with cvs.exe
    • build-crs.xml – The project specific adapter between Cruise Control and the CRS build file.
    • config.xml – The Cruise Control configuration file.
  • 21. Cruise Control Setup
    • Install required software
      • Java SDK
      • Ant
      • Tomcat
      • cvs.exe for cvs access
    • Download the Cruise Control software
    • Install the Cruise Control software
    • Install the reporting WAR file
  • 22. Cruise Control Software
    • Getting Started How-to
      • http://cruisecontrol.sourceforge.net/gettingstarted.html
    • Pragmatic Project Automation
      • http://www.pragmaticprogrammer.com/starter_kit/au/scheduled.pdf
    • Installation Directory - C:Program FilesCruiseControl
        • bincruisecontrol.bat
    • Build Directory - C:uilds
        • 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. Installation Tips
    • Remember to do a “cvs login” before your “cvs checkout”. Use the command line cvs.exe.
    • Run your project’s ant script from the command line to test it, not through your IDE.
    • Use a small Ant build script to wrap your project’s actual build script.
    • Share the artifacts directory.
    • Run Cruise Control from the command line before you set it up as a service.
    • Remember to change the user that the Windows service runs under to be the same user that executed the “cvs login”.
    • Plan for having multiple projects.
    • Cruise Control does not make any assumptions about directory structure, but the reporting application does.
  • 24. Reporting Web-application
    • Deploy it to any servlet container on the same machine.
    • Modify two parameters in the web.xml file.
    <context-param> <param-name>logDir</param-name> <param-value> c:uildslogs </param-value> </context-param> <servlet> <servlet-name>ArtifactServlet</servlet-name> <servlet-class>net.sourceforge.cruisecontrol.servlet.FileServlet</servlet-class> <init-param> <param-name>rootDir</param-name> <param-value> c:uildsartifacts </param-value> </init-param> </servlet>
  • 25. 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.
  • 26. 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.
  • 27. 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
  • 28. The Bottom Line
    • It takes practically nothing to set it up.
    • At a minimum, use it for nightly builds.
    • As the number of developers increases, it becomes more valuable.
    • As the number of releases increases, it becomes more valuable.
    • As the number of unit tests increases, it becomes more valuable.
  • 29. Links
    • Article by Jeffrey Fredrick on Continuous Integration using Cruise Control
    • http://www.stickyminds.com/BetterSoftware/magazine.asp?fn=cifea&id=58
    • Continuous Integration Toolkit comparison Matrix
    • http://docs.codehaus.org/display/DAMAGECONTROL/Continuous+Integration+Server+Feature+Matrix
    • 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/