Continuous Integration & Build Systems

Transcription

Continuous Integration &Build SystemsRyan TidwellSpring 2010CSCI 5828

Continuous Integration &Build SystemsIntroduction Automated Build Tools Source Repositories Continuous Integration Organizing The Source Tree Automated Tests & Continuous Integration Continuous Integration Platforms Continuous Integration In Action

IntroductionContinuous build systems are also referred to as“continuous integration” or CI systems. CI systems enable the continuous integrationprocess Let's discuss some some fundamentals ofcontinuous integration before looking at Hudson(a CI system)

Automated Build ToolsThis class of tools provides developers a way toscript the compilation of source code, therebyremoving the complexity of compiling andpackaging. Common build automation toolsinclude make and ant.

Automated Build ToolsAs with all processes that we put in place todevelop software, the process for building thesystem from source should be repeatable. Scripting builds with tools like make or ant willproduce a build process that is easily repeated byindividual developers.

Automated Build ToolsThis is great! We have a way to removecomplexity from compiling large software systems. But how do we distribute the build script todevelopers? What if it changes? Where dodevelopers even obtain the source that our buildscript will compile?

Source RepositoriesTo solve these problems, we want to keep asingle copy of the source code and build script sothat we have a single repository for developers towork from. What if a large number of people need to makechanges to the source in this repository? Howshould we handle conflicting changes in therepository?

Source RepositoriesWe can manage access to the repositorythrough systems such as CVS, SVN, andClearCase. These systems allow developers to “check out”copies of the repository and manage modificationsto the repository so that conflicts are avoided. Now we can ensure that everyone is seeing thesame source and that any changes made to thesource don't get lost. A single source repository is a key aspect ofcontinuous integration. We want our CI system to build what is in thesource repository. Builds can be triggered bycheck-ins or scheduled for regular execution.

Organizing The Source TreeWe want our builds to run quickly. Instead ofbuilding one giant executable, it is a bestpractice to organize the source so that theapplication is composed of smallermodules/sub-systems. This allows us to makechanges to modules and sub-systems and buildthem quickly instead of waiting for the entiresystem to build in a developer sandbox everytime we make a change

Continuous IntegrationRepeatable processes are easily automated bycomputers! We have a single repository for our source and ascript for executing the build We now have the ability to introduce softwarethat is capable of building our source as often aswe want and publishing our final product as oftenas we want!

Continuous Integration PlatformsEnter the CI system! CI systems provide a more sophisticated way ofmanaging builds from our source repository These systems are more sophisticated thansimple cron jobs CI systems provide us an environment forcompiling, executing unit tests, and publishing thefinished product Builds can be scheduled or done on-demand byresponding to changes in the source repository All of this could theoretically be done fromsomebody's sandbox, so why bother?

Continuous Integration PlatformsProcesses that require a significant amount of humanintervention are error prone. We need to have the buildrun perfectly EVERY time. In short, we need perfection! Using a CI system removes the human element fromour build process and moves our process that muchcloser to perfection The CI system should be a part of our life-cycle

What Is a Continuous BuildSystem?Continuous build systems, also referred to ascontinuous integration systems (CI) automatethe process of compiling and packaging sourcecode. CI systems allow builds to happen in asingle place where the whole team can getquick feedback on whether the code in therepository builds and unit tests are passing. CIsystems also provide a way for the system to beinstalled after being built.

Examples Of Continuous BuildSystemsCruise ControlCruise Control .NETHudsonBambooBeeboxApache Continuum

Tying It All TogetherNow that we have a single source repository,modularized our system appropriately, and haveintroduced a CI system to build our code andexecute test suites regularly, we now have thefoundations of continuous integration in place.

Continuous Build Systems In ActionWhile there are many other powerful CIplatforms such as Cruise Control, as a casestudy we will now look at Hudson in actionwithin HP. Within HP's ESS Software divisionwe employ Hudson as our continuousintegration platform.

Continuous Build Systems In ActionThe software we develop (Insight Dynamics) isdelivered as a suite composed of smallerproducts. We have decomposed our sourcetree into small modules that can be builtindividually.Hudson builds each project in the suite usingAnt and allows us to manage our builddependencies with Ivy.Not only does Hudson build our source and runour test suites, it notifies us when builds fail andpublishes the test results.

Continuous Build Systems In ActionOur build environment makes use of the distributed build managementcapabilities of Hudson. We run builds on Windows, HP-UX, and Linux Hudsonslaves so that we can build customized executables for Windows, HP-UX,and Linux.

Continuous Build Systems In ActionHere are some screenshots from Hudson. Hudson installs easily on Windows,Linux, HP-UX, and a variety of other operating systems. It is implemented inJava and is therefore platform independent. There are hundreds of pluginsavailable for Hudson. By default, Hudson comes with Ant, Maven, and CVSplugins installed. Hudson can build projects written in virtually any language.Development teams also have the flexibility to develop their own customHudson plugins for further customizing their build process.

Continuous Build Systems In Action

Continuous Build Systems In Action

Continuous Build Systems In Action

Other ResourcesMartin Fowler on continuous nuousIntegration.htmlHudson Home (Allows you to take Hudson for a test drive before /en.wikipedia.org/wiki/Continuous integration“Continuous Integration in the cloud with s/gen hudson.jspOfficial Hudon blog:http://blog.hudson-ci.org/

Continuous Build Systems In Action Here are some screenshots from Hudson. Hudson installs easily on Windows, Linux, HP-UX, and a variety of other operating systems. It is implemented in Java and is therefore platform independent. There are hundreds of plugins available for Hudson. By default, Hudson comes with Ant, Maven, and CVS plugins installed.