CI-Hudson

39 pages
79 views

Please download to get full document.

View again

of 39
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Share
Description
Spot defects early with Continuous Integration Your complete guide to creating a best-of-breed CI environment Skill Level: Intermediate Andrew Glover (aglover@stelligent.com) President Stelligent Incorporated 20 Nov 2007 Continuous Integration (or CI) is a process that consists of continuously compiling, testing, inspecting, and deploying source code. In many Continuous Integration environments, this means running a new build anytime code within a source code management repository changes. The
Tags
Transcript
  Spot defects early with Continuous Integration Your complete guide to creating a best-of-breed CI environment Skill Level: IntermediateAndrew Glover(aglover@stelligent.com) PresidentStelligent Incorporated20 Nov 2007Continuous Integration (or CI) is a process that consists of continuously compiling,testing, inspecting, and deploying source code. In many Continuous Integrationenvironments, this means running a new build anytime code within a source codemanagement repository changes. The benefit of CI is simple: assembling softwareoften greatly increases the likelihood that you will spot defects early, when they stillare relatively manageable. In this tutorial, a companion to his series In pursuit of code quality  , Andrew Glover introduces the fundamental aspects of ContinuousIntegration and steps you through how to set up a CI process using best-of-breedopen source technologies. Section 1. Before you start Learn what to expect from this tutorial and how to get the most out of it. About this tutorial This tutorial discusses the fundamental aspects of Continuous Integration: what it is,why you need it, how it works, even the pace of development in a CI environment. Itshows you how to set up a CI process that delivers a repeatable and reliable buildprocess.You'll learn how to properly configure a CI server to poll an SCM repository and runan Ant build process anytime a change is detected in your source code. You'll alsolearn how to run automated JUnit tests and how to make the most of both PMD andFindBugs for software inspection. Finally, you'll see for yourself how Hudson, truly a Spot defects early with Continuous Integration © Copyright IBM Corporation 1994, 2007. All rights reserved.Page 1 of 39  best-of-breed CI server, informs you of issues as they arise, ultimately enabling youto build reliable software more quickly. Objectives This tutorial guides you step-by-step through the fundamental concepts ofContinuous Integration using Hudson, Ant, and Subversion as your framework.When you are done with this one-hour tutorial, you will understand the benefits ofContinuous Integration as well as how to set up and properly configure Hudson, Ant,and Subversion to work together. The resulting build process will run both tests andsoftware inspections and will report back violations almost as quickly as they occur. Prerequisites To get the most from this tutorial, you should be familiar with Java™ development ingeneral. This tutorial also assumes that you understand the value of buildingsoftware with an acceptable level of quality and that you are familiar with JUnit. System requirements A Continuous Integration environment requires an automated build tool, a coderepository, and a CI server. To follow along and try out the code for this tutorial,you'll need a working installation of the Java platform as well as Hudson 1.150, Ant1.7, JUnit 3.8.1, and Subversion 1.4.x.The recommended system configuration for this tutorial is as follows:ã A system supporting either the Sun JDK 1.5.0_09 (or later) or the IBMDeveloper Kit forJava technology 1.5.0 SR3 with at least 500 MB of mainmemoryã At least 20MB of disk space to install the software components andexamples coveredThe instructions in the tutorial are based on a Microsoft® Windows® operatingsystem. All the tools covered in the tutorial also work on Linux® and Unix® systems. Section 2. Continuous Integration in a nutshell The process of CI is about building software components often, which, in manyinstances, means any time code within a repository (such as Subversion orClearCase) changes. The benefit of CI is simple: building software often ensures developerWorks® ibm.com/developerWorksSpot defects early with Continuous IntegrationPage 2 of 39© Copyright IBM Corporation 1994, 2007. All rights reserved.  that you will encounter issues (such as code defects) early, as opposed to later inthe software development life cycle when they are more expensive to address. Tools versus process While CI is actually a process, the term Continuous Integration  often is associatedwith one or more particular tools. In this tutorial, I show you how to install, configure,and use Hudson as a CI server, but keep in mind that CI is much more than a tool.In fact, the tool you use is probably the least important aspect of CI because all itdoes is run your build when it detects a change within a code repository. The builditself is far more important than the tool you use to run it. Getting started with CI Getting started with CI requires three things:ã An automated build process with a platform like Ant or Mavenã A code repository like CVS or Subversionã A CI server such as Hudson, although a cron job could sufficeLet's consider each of these components in detail. Automated builds The process of CI is about integrating software often, which is accomplished throughthe use of a build. In the Java world, Ant stands as the ubiquitous build platform.With Ant, you can reliably perform (in an automated fashion) otherwise manual taskslike compilation, testing, and even more interesting things like software inspectionand deployment. As you'll see once everything has been wired together, your buildstrategy is by far the most important aspect of a successful CI process. In theabsence of a solid build that does more than compile your code, CI withers. Source code management For CI to properly take shape, you need a source code management (SCM) systemor repository such as Subversion or CVS. A CI server polls the SCM repository forchanges. On finding changes, the CI server performs a checkout (or an update ofthe local sandbox) and executes a build. More often than not, this is the same buildyou would execute in your local environment. The CI server For a successful CI process, it's also mighty helpful to have an automated processthat monitors your SCM repository and runs builds when changes are detected. Ahost of CI servers are available for the Java platform, both open source andcommercial. All are similar in their basic configuration and are optimized to monitor aparticular SCM and run builds when changes are detected. All CI servers come with ibm.com/developerWorks developerWorks® Spot defects early with Continuous Integration © Copyright IBM Corporation 1994, 2007. All rights reserved.Page 3 of 39  their own bells and whistles. Hudson is particularly interesting because of its ease ofconfiguration and compelling plug-ins, which make aspects like test result trendsparticularly visible. Section 3. Hudson explained Hudson is an innovative open source CI server that arguably builds on lessonslearned from previous CI servers. One of the most compelling features of Hudson isits ease of configuration: you would be hard-pressed to find an easier CI server toset up, or one that offers half as many features out of the box. Second to ease ofuse is Hudson's impressive plug-in framework, which makes it easy to add features.For instance, Hudson has a plug-in for tracking FindBugs issues over time as well ascode coverage. It also trends test results (from either JUnit or TestNG), as well asbuild results and corresponding execution times.As I'll show you, Hudson requires Java 5 to run — you only need a Servlet 2.4container if you want to use something other than the embedded container Hudsonships with, which is Winstone. Winstone is adequate for most needs. Section 4. Starting out with CI This section looks at how the various components of a CI process fit together andwhy they fit together that way. After that, you'll be ready to start coding! Prerequisite: A build system! A repeatable and reliable build is the cornerstone of a predictable software process.As previously noted, Ant is a popular build tool for the Java platform, whose primarypurpose is to automate common tasks like compilation and deployment. Ant alsofacilitates unit testing with test frameworks like JUnit and TestNG, and it integrateswell with a myriad of other tools like PMD and FindBugs, which automate static codeanalysis. Compiling source files using Ant is as easy as issuing an ant compile command at a command prompt. Reliable versus repeatable While Ant facilitates repeatability, reliability  is up to you. When it comes to softwarebuilds, reliability means that Joe and Fran will experience the same behavior whenissuing commands like compile or test. If for some reason, Fran cannot compilebecause of a required library that is not explicitly referenced in the build itself (which developerWorks® ibm.com/developerWorksSpot defects early with Continuous IntegrationPage 4 of 39© Copyright IBM Corporation 1994, 2007. All rights reserved.
Related Search
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks
SAVE OUR EARTH

We need your sign to support Project to invent "SMART AND CONTROLLABLE REFLECTIVE BALLOONS" to cover the Sun and Save Our Earth.

More details...

Sign Now!

We are very appreciated for your Prompt Action!

x