31
Continuous Integration at scale Vivek Singh, ThoughtWorks

Continuous integration at scale

Embed Size (px)

Citation preview

Page 1: Continuous integration at scale

Continuous Integration at scale

Vivek Singh, ThoughtWorks

Page 2: Continuous integration at scale

CI Design, more than technology

• application architecture• development process• human behavior• art of compromise

Page 3: Continuous integration at scale

What’s creates scale for CI?

• number of committers• frequency of commit• size of codebase• frequency of release

Page 4: Continuous integration at scale

Experience from a project

• 100 committers• ~ 2 commits a day pet commiter• distributed• 45 days release cycle

Page 5: Continuous integration at scale

Some context

• C#, .NET• inherited (non-buildable) codebase• one of the busiest website in UK and its

complete backend• distributed team (Bangalore, London, Pune)• used Go (formerly Cruise)

Page 6: Continuous integration at scale

Best way to understand

• starting point• witness the evolution• what worked and didn’t

Page 7: Continuous integration at scale

Server under the desk

• small team• lot of external dependencies• carefully and painfully setup environment

Page 8: Continuous integration at scale

And soon long build times

• but before that……

Page 9: Continuous integration at scale

CI Users

• developers• analysts• project manager

Page 10: Continuous integration at scale

Developers want

• fast• reliable• and it always passes

Page 11: Continuous integration at scale

QA

• want it to provide good builds

…so that they can test new things and verify known issues

Page 12: Continuous integration at scale

Project Manager

• should catch important bugs…so that software is closer to be shipped

Page 13: Continuous integration at scale

CI can be quick, cheap and useful

pick two

Page 14: Continuous integration at scale

Continuous…

• …integration• …(automated) testing• …deployment

Page 15: Continuous integration at scale

Continuous Integration

• meaningful handover to next stage of delivery process

• running only unit tests misses the point

Page 16: Continuous integration at scale

back to, Long build times

• lot of code and tests• multiple teams working on different part of

codebase

Page 17: Continuous integration at scale

Multiple Single Jobs Build?

Source Control(s)

Job B

Output

Job C

Output

Job A

Output

MaterialsMaterials

Materials

e.g. Hudson Slaves

Page 18: Continuous integration at scale

Which is green build?

• material (x,y) => (a, b) Green• material (x) => (c) Green• material (y) => (c) Red

Page 19: Continuous integration at scale

Multiple Single Jobs Build

• provides wrong build to downstream (e.g. QA)• reason: no synchronization on materials

Page 20: Continuous integration at scale

Pipelined Builds

Pipeline 2

Pipeline 11

Pipeline 1

Source Control

Job BJob A

Output(s)

Job D Job E

Output(s)

MaterialsMaterials

Materials

Page 21: Continuous integration at scale

Pipelined Builds, Why

• mimics component dependency, hence feels right

• no unnecessary builds, optimum use of resources

Page 22: Continuous integration at scale

Pipelined Builds, Why Not?

• material sync issue• complex to understand• longer build time• difficult to track material flow• different from developer build

Page 23: Continuous integration at scale

Staged Team Commit

Continuous IntegrationContinuous Integration

SourceControl

Local Source Control

Release DeliverableLocal Output

Commiters

Local testing

Continuous Integration

Local Output

Commiters

Local testing

Local Source Control

ManualPeriodicMerge

ManualPeriodicMerge

Page 24: Continuous integration at scale

Staged Team Commit, Why?

• provides isolation• no need to build everything

Page 25: Continuous integration at scale

Staged Team Commit, Why Not?

• huge merge problems• increase in testing effort

(we tried with SVN it might be better with GIT)

Page 26: Continuous integration at scale

Parallel Jobs Build

Developer

Source Control(s)

Job B Job CJob A

Material Synchronizer

Materials

Materials

Materials Materials

Regression Firefox Chrome

Page 27: Continuous integration at scale

A

B C

E F

A => a.compile, a.testB => a.compile, b.compile, b.testE => a.compile, b.compile, e.compile, e.testF => a.compile, b.compile, c.compile, f.compile, f.testSmoke => all.compile, smoke

Dependency Build

Page 28: Continuous integration at scale

Parallel Jobs Build

• all CI issues cannot be solved without changing architecture– modularization– testability without external dependencies

• cannot do this with any other tool than Go

Page 29: Continuous integration at scale

Continuous integration and virtualization

• clean build• Subversion• Git

Page 30: Continuous integration at scale

I am a developer

• want to do the right thing• I don’t understand the CI design• I also forget to check the build status before

commiting/pushing• I don’t want delay fixing of build

Page 31: Continuous integration at scale

Commit Gate

Continuous Integration

Source Control

Commiters

Pre Commit Hook

CheckStatus

GreenYellow