Beautiful Builds by Roy Osherove

37
Beautiful Builds @RoyOsherove Bouvet

description

more info at http://beautifulbuilds.com . Roy Osherove from Bouvet discussed patterns for maintainable, coherent build processes.

Transcript of Beautiful Builds by Roy Osherove

Page 1: Beautiful Builds by Roy Osherove

BeautifulBuilds

@RoyOsheroveBouvet

Page 2: Beautiful Builds by Roy Osherove

[email protected]

consulting

beautifulbuilds.com

Page 3: Beautiful Builds by Roy Osherove

Why do we have builds?

Page 4: Beautiful Builds by Roy Osherove

Builds and tests are made to be broken

Page 5: Beautiful Builds by Roy Osherove

What’s beautiful?

• See flow• Ease of change• Coherent

Page 6: Beautiful Builds by Roy Osherove

Recommendations

• Use the right tools for build and CI• Use the right patterns to allow extra benefits

Page 7: Beautiful Builds by Roy Osherove

Part of a Build Process

• Build Script/editor• Build Server / CI Server• Build Environments

Page 8: Beautiful Builds by Roy Osherove

What’s the difference?

• Automated Build (what to do)• Continuous Integration (when to do it)

Page 9: Beautiful Builds by Roy Osherove

Build Scripts (Bat)Procedural

Page 10: Beautiful Builds by Roy Osherove

Xml Build Scripts (Ant) - declarative

Page 11: Beautiful Builds by Roy Osherove

Domain Specific Language Build Scripts (Rake)

declarative

Page 12: Beautiful Builds by Roy Osherove

Declarative• [Ant, nant,msbuild] (http://ant.apache.org/)• [Automake] (http://www.gnu.org/software/automake/)• [Boost Build] (http://www.boost.org/doc/tools/build/index.html)• [Cmake] (http://www.cmake.org/)• [Make] (http://www.gnu.org/software/make/)• [Ocamlbuild] (http://gallium.inria.fr/~pouillar/)• [Omake] (http://omake.metaprl.org/index.html)• [Qmake] (http://doc.trolltech.com/4.2/qmake-manual.html)• [Rake] (http://rake.rubyforge.org/)• [SCons] (http://www.scons.org/)• [Waf] (http://code.google.com/p/waf/)

Page 13: Beautiful Builds by Roy Osherove

Procedural

• FinalBuilder• Visual build pro• Batch files• Powersell scripts

Page 14: Beautiful Builds by Roy Osherove

Visual Build Scripts (FinalBuilder)

Page 15: Beautiful Builds by Roy Osherove

Which one?

• Visual editing allows seeing FLOW• Easy to update and change by newbies• Easy to debug

• FinalBuilder or Visual Build Pro on windows• Rake on linux or mac

Page 16: Beautiful Builds by Roy Osherove

The Right CI Tools

Page 17: Beautiful Builds by Roy Osherove

TeamCity

Page 18: Beautiful Builds by Roy Osherove

Jenkins

Page 19: Beautiful Builds by Roy Osherove

CruiseControl

Page 20: Beautiful Builds by Roy Osherove

Hudson

Page 21: Beautiful Builds by Roy Osherove

Many others. Which one?

• Support build agents• Support amazon ec2 auto scaling agents• Easy to setup and maintain• Free for a small team

• TeamCity is awesome

Page 22: Beautiful Builds by Roy Osherove

But some CI servers support build actions too!

Page 23: Beautiful Builds by Roy Osherove

Hardware

• Build Machine (with teamcity)– + agent machines (optional)

• Test Machine• Staging Machine• Production Machine

• This can all be in the cloud (EC2 is wonderful)

Page 24: Beautiful Builds by Roy Osherove

Build Configurations

• Continuous Integration Build• Slow Build (nightly, optional)• Deploy to test servers• Deploy to staging servers (optional)• Deploy to production

Page 25: Beautiful Builds by Roy Osherove
Page 26: Beautiful Builds by Roy Osherove

Build Script Injection

• Allow version aware builds• Build scripts are part of source control• Build configurations on the CI server are dumb

triggers

Page 27: Beautiful Builds by Roy Osherove

Fill In The Blanks

• Build Script uses placeholders for system related knowledge

• Placeholders are filled from environment variables or other types of parameters to the command line

• These variables are SET by the Build Configuration on the CI server

Page 28: Beautiful Builds by Roy Osherove
Page 29: Beautiful Builds by Roy Osherove

Location Agnostic Scripts

Page 30: Beautiful Builds by Roy Osherove

Extract Script

Page 31: Beautiful Builds by Roy Osherove

Build Chain Triggers

Triggered by checkin

Triggered by end of previous

Manual

Manual

Page 32: Beautiful Builds by Roy Osherove

Slow Builds

Do X

Do X + Y

Do X + Y + Z

Do X + y + Z + N

Page 33: Beautiful Builds by Roy Osherove

Cumulative, Fast Builds

Page 34: Beautiful Builds by Roy Osherove

How Fast?

Page 35: Beautiful Builds by Roy Osherove

Shipping Skeleton

• Start by releasing• Deploy a hello world empty skeleton• Then fill out the product• Continue adding small build features as you go

along

Page 36: Beautiful Builds by Roy Osherove

[email protected]

consulting

beautifulbuilds.com

Page 37: Beautiful Builds by Roy Osherove

@RoyOsheroveBouvet