03 - Continuous Integration

66
CONTINUOUS INTEGRATION

description

 

Transcript of 03 - Continuous Integration

Page 1: 03 - Continuous Integration

CONTINUOUS INTEGRATION

Page 2: 03 - Continuous Integration

2

TRAINING GOALS

Show that there is no way present-day project could be successful without usage of

continuous integration practice

Establish connection between CMMI product

integration process area and continuous integration

practice

Page 3: 03 - Continuous Integration

3

TRAINING PLAN

1. What is continuous integration?2. Why do we need continuous integration?3. Prerequisites for continuous integration

process4. General CI workflow5. How does continuous integration affect our

development process?6. Tools and their features7. When CI is not effective?8. We have "true CI". What next?9. CI and CMMI product integration process

area

Page 4: 03 - Continuous Integration

4

INTRODUCTION TO CONTINUOUS INTEGRATIONBasic ideas

Page 5: 03 - Continuous Integration

5

WHAT IS CONTINUOUS INTEGRATION?

Page 6: 03 - Continuous Integration

6

WHAT IS CONTINUOUS INTEGRATION?

• Integration is when you make everything work together• Continuous is when you make everything work together very

often• You would go mad if you had to do it manually• That’s why it is not about manual actions, it is about

automation

Page 7: 03 - Continuous Integration

7

WHAT IS CONTINUOUS INTEGRATION?

Software engineering

practice

Approach helping to

reduce risks

Another step to the

development process

automation

Page 8: 03 - Continuous Integration

8

WHY DO WE NEED CONTINUOUS INTEGRATION?

Martin Fowler: … team integrate their work frequently,… leading to multiple integrations per day. … this approach leads to significantly reduced integration problems and allows a team to

develop cohesive software more rapidly. CI is the one of the XP practicesAllows to have fresh latest build

Page 9: 03 - Continuous Integration

9

PREREQUISITES FOR CONTINUOUS INTEGRATION

Not everything

continuously integrate

you can

Page 10: 03 - Continuous Integration

10

PREREQUISITES FOR CONTINUOUS INTEGRATION

Single source code repo (VCS system)

Build automation

Self-testing app (unit-

tests)

Separate server

(usually)

CI tool

Page 11: 03 - Continuous Integration

11

GENERAL CI WORKFLOW

Committing latest

changes

Update by scheduler

(on CI server)

Build (compilation,

unit-testing, db integration,

etc)

Application is ready

Page 13: 03 - Continuous Integration

13

GENERAL CI WORKFLOW

Check modificatio

n

Buildapplication

Page 14: 03 - Continuous Integration

14

TOOLSInstruments for continuous integration and their features

Page 15: 03 - Continuous Integration

15

TOOLS CLASSIFICATION

CI tools

• Code coverage analysis• Static analysis (syntax check, code dependencies)• Copy/paste detectors

Build management tools

Unit testing tools

Inspection tools

Documentation generation tools

Page 16: 03 - Continuous Integration

16

CI TOOLS CruiseControl CruiseControl.NET CruiseControl.rb JetBrains TeamCity Apache Hudson Apache Continuum Atlassian Bamboo FinalBuilder phpUnderControl XInc

Page 17: 03 - Continuous Integration

17

CI TOOLS CruiseControl CruiseControl.NET CruiseControl.rb JetBrains TeamCity Apache Hudson Apache Continuum Atlassian Bamboo FinalBuilder phpUnderControl XInc

Most common, flexible, configurable, easy to use, de facto choice for Java projects

Page 18: 03 - Continuous Integration

18

CI TOOLS CruiseControl CruiseControl.NET CruiseControl.rb JetBrains TeamCity Apache Hudson Apache Continuum Atlassian Bamboo FinalBuilder phpUnderControl XInc

Most common, flexible, configurable, easy to use, de facto choice for .NET projects

Page 19: 03 - Continuous Integration

19

CI TOOLS CruiseControl CruiseControl.NET CruiseControl.rb JetBrains TeamCity Apache Hudson Apache Continuum Atlassian Bamboo FinalBuilder phpUnderControl XInc

Most successful adaptation of CI principle for the interpreted language (Ruby)

Page 20: 03 - Continuous Integration

20

CI TOOLS CruiseControl CruiseControl.NET CruiseControl.rb JetBrains TeamCity Apache Hudson Apache Continuum Atlassian Bamboo FinalBuilder phpUnderControl XInc

One of the best CI tools: • pre-tested commit• build agents• multi-platform builds• build dependencies• comprehensive statistics and reporting

Page 21: 03 - Continuous Integration

21

CI TOOLS CruiseControl CruiseControl.NET CruiseControl.rb JetBrains TeamCity Apache Hudson Apache Continuum Atlassian Bamboo FinalBuilder phpUnderControl XInc

Tagging after successful build, distributed builds

Page 22: 03 - Continuous Integration

22

CI TOOLS CruiseControl CruiseControl.NET CruiseControl.rb JetBrains TeamCity Apache Hudson Apache Continuum Atlassian Bamboo FinalBuilder phpUnderControl XInc

Distributed builds

Page 23: 03 - Continuous Integration

23

CI TOOLS CruiseControl CruiseControl.NET CruiseControl.rb JetBrains TeamCity Apache Hudson Apache Continuum Atlassian Bamboo FinalBuilder phpUnderControl XInc

Focused on process of building, CI is just a feature

Page 24: 03 - Continuous Integration

24

CI TOOLS CruiseControl CruiseControl.NET CruiseControl.rb JetBrains TeamCity Apache Hudson Apache Continuum Atlassian Bamboo FinalBuilder phpUnderControl XInc

CI tools written in PHP for PHP projects

Page 25: 03 - Continuous Integration

25

CI TOOLS CruiseControl CruiseControl.NET CruiseControl.rb JetBrains TeamCity Apache Hudson Apache Continuum Atlassian Bamboo FinalBuilder phpUnderControl XInc

Yet another CI tool written in PHP for PHP projects

Page 26: 03 - Continuous Integration

26

CI TOOLS Too many tools All are great All have the same principle But each has specific features

Diagrams, metrics, reporting

Integration with SCM

tools

Notification

Interface, usability

Page 27: 03 - Continuous Integration

27

CI TOOLS. ALM APPROACH

InitiationRequirements

development & management

DesignImplementation

Integration Testing

Deployment

Maintenance & support

Utilization

Page 28: 03 - Continuous Integration

28

InitiationRequirements

development & management

DesignImplementation

Integration Testing

Deployment

Maintenance & support

Utilization

CI TOOLS. ALM APPROACH

Basic continuous integration

Page 29: 03 - Continuous Integration

29

InitiationRequirements

development & management

DesignImplementation

Integration Testing

Deployment

Maintenance & support

Utilization

CI TOOLS. ALM APPROACH

Basic continuous integration

Extended build management

Page 30: 03 - Continuous Integration

30

BUILD TOOLS

Ant NAnt MSBuild Maven Make Phing Rake …

Page 31: 03 - Continuous Integration

31

BUILD TOOLS

Ant NAnt MSBuild Maven Make Phing Rake …

Most common, flexible, configurable, easy to use, de facto choice for Java projects

Page 32: 03 - Continuous Integration

32

BUILD TOOLS

Ant NAnt MSBuild Maven Make Phing Rake …

Most common, flexible, configurable, easy to use, de facto choice for .NET projects

Page 33: 03 - Continuous Integration

33

BUILD TOOLS

Ant NAnt MSBuild Maven Make Phing Rake …

de facto case for Visual Studio and TFS users

Page 34: 03 - Continuous Integration

34

BUILD TOOLS

Ant NAnt MSBuild Maven Make Phing Rake …

Build management + dependencies management for Java projects. Introduced

POM concept.

Page 35: 03 - Continuous Integration

35

BUILD TOOLS

Ant NAnt MSBuild Maven Make Phing Rake …

Standard de facto for UNIX applications

Page 36: 03 - Continuous Integration

36

BUILD TOOLS

Ant NAnt MSBuild Maven Make Phing Rake …

Implementation of build management tool in PHP for PHP projects

Page 37: 03 - Continuous Integration

37

BUILD TOOLS

Ant NAnt MSBuild Maven Make Phing Rake …

Implementation of build management tool in Ruby for Ruby projects

Page 38: 03 - Continuous Integration

38

UNIT TESTING TOOLS

Junit NUnit CppUnit PHPUnit SimpleTest JSUnit J3Unit

Page 39: 03 - Continuous Integration

39

INSPECTIONS TOOLS.TEST COVERAGE

Cobertura Atlassian Clover jTest JCoverage CodeCover EMMA Parasoft Insure+

+ Ncover Xdebug Coverage.py

Page 40: 03 - Continuous Integration

40

INSPECTIONS TOOLS.TEST COVERAGE

C++C#

PHPPython

Java

Cobertura Atlassian Clover jTest JCoverage CodeCover EMMA Parasoft Insure+

+ Ncover Xdebug Coverage.py

Page 41: 03 - Continuous Integration

41

INSPECTIONS TOOLS.STATIC ANALYSIS

PMDFindBugsJLint FxCopCheckstyleReSharperPHP_CodeSnifferYascaNDepend

Page 42: 03 - Continuous Integration

42

INSPECTIONS TOOLS.COPY/PASTE DETECTORS

CPD (Copy paste detector)CheckstyleSimianJplagAtomiqClone diggerPBA

Page 43: 03 - Continuous Integration

43

DOCUMENTATION GENERATIONTOOLS

Doxygen

JavaDoc

NDoc

CppDoc

phpDocumentor

pyDoc

RDoc

Page 44: 03 - Continuous Integration

44

OTHER TOOLS

Source code metrics (loc)

Dead code detectors

Profiling …

Page 45: 03 - Continuous Integration

CI IN EPAM MICROSOFT TECHNOLOGIES DIVISIONProject Project Product Primary

LanguageCCNET Code Analysis

toolsUnit testing

Test coverage tools

Copy & Paste detectors

Automate build delivery

Automate deployment

ACT-INT C# x - x (Unit) - - - -

ACT-LVI C# x x (FxCop, PBA) x - - - -

CON-GEN C#, ASP.NET - - - - - - -

EPM-UTIL C#, ASP.NET x x (FxCop,PBA) x (NUnit) x (NCover) x (Simian) + +

ESS-MSFT   - - - - - - -

FSTIDX C#, ASP.NET x x (PBA) x - - - -

ICPDP C# x - - - - - -

LOGIDEX Java, J#, C#, ASP.NET - - - - - - -

LSEEC C# x x (FxCop, PBA) x (NUnit) - x (Simian) - +

MIS-OPC C# x x x - - - -

MIS-SPR C# x x x (Nunit) x - - -

MultAPI VBScript - - - - - - -

MultCons C# x x (FxCop, PBA) - - x (Simian) - -

MultData C#, C++, HTML, VB x - x - - - -

MultEDG C++, C# - x (FxCop) x - - x -

Mult-IPAS C#, C++ x x (FxCop) - - - - -

MultRIN C# - - x - - - x

Mult-Torn C++ - - x - - - -

Page 46: 03 - Continuous Integration

Project Project Product Primary Language

CCNET Code Analysis tools

Unit testing

Test coverage tools

Copy & Paste detectors

Automate build delivery

Automate deployment

RTRS-AAAM C# - - - - - - -

RTRS-MTST C#, ASP.NET - x (FxCop) - - - - -

RTRS-RKSD C# x x - - x (Simian) - -

RTRS-RKWM C# - x - - - - -

TAK-PBLD C# - x (FxCop) x (Nunit) - - - -

TRR-ODC (O2I) C#, ASP.NET x x (FxCop,PBA) x (Nunit) - x (Simian) - -

TRR-ODC (SapSn) C# x x (FxCop,PBA) - - x (Simian) - -

CI IN EPAM MICROSOFT TECHNOLOGIES DIVISION

46

Page 47: 03 - Continuous Integration

MOST TYPICAL QUESTIONS

All the above-described info sounds cool. I feel that it might be useful in my project. But I am not sure I can find enough resources to start and support this activity.

EPM-BET project is started long time ago for this purpose. It provides corresponding resources and support

There are too many different tools. They are all different. How could I use them both independently and all at once?

I recommend to use AgileSCM approach. It uses unified versions numbering which could be used by any mentioned tool.

Q

A

Q

A47

Page 48: 03 - Continuous Integration

48

ADVANCED CONTINUOUS INTEGRATIONMore complex issues related to the continuous integration

Page 49: 03 - Continuous Integration

49

HOW DOES CI AFFECT DEVELOPMENT PROCESS?

Commit policy (mainlines are on the watch)

Don't break the build rule (make local build)

Everyone commits to the mainline everyday

Keeping the build fast Run fast tests first

We can automate deploymentBuild is primary, deployment is

secondary Continuous design

Page 50: 03 - Continuous Integration

50

“DON’T BREAK THE BUILD” RULE Test code properly before

checking in Avoid depending on a local

resource that is not under version control or does not exist on the target computer.

Write tests to cover common problems

Make sure local inspections were run successfully

Broken build in most cases means that it is impossible or not recommended to use corresponding codebase until it has been fixed

Page 51: 03 - Continuous Integration

51

“DON’T BREAK THE BUILD” OBSESSION It is often impossible to

reproduce integration problem without checking in.

You might spend A LOT of time looking for a failure reason in someone’s else module

During that time you will be the one WHO FAILED THE BUILD

If you want to avoid such situations, every checking in becomes a nightmare

Attitude to the “don’t break the build” rule may be a detector of how mature the team is.

Page 52: 03 - Continuous Integration

52

“DON’T BREAK THE BUILD” OBSESSION. SOLUTION Nightly builds instead of

builds ‘on commit’ Team needs more strict and

less strict variations of the “don’t break the build” rule during different SDLC phases

There are architectural issues to pay attention to

Sometimes several small projects should be started instead of one large

Build policy is to be developed

Page 53: 03 - Continuous Integration

53

WHEN CI IS NOT EFFECTIVE?

DVCS Experimental development Small projects Interpreted languages without unit-tests When database is being changed too

often Types of projects

Documentation (BA, etc)DBSupport & maintenance

Page 54: 03 - Continuous Integration

54

WE HAVE "TRUE CI". WHAT'S NEXT?

Building tags Separate builds having different

maturity levels Codebase structure filtering

Triggering build only for changes in specified list of folders

Integration with issue tracking systems Different approach for different SDLC

phases

Page 55: 03 - Continuous Integration

56

/1.x.x

/1.0.x

1.x.x 2.x.x

1.x.0

1.x.1

1.x.2

1.x.3

1.x.4

2.x.0

2.x.1

1.x.5 2.x.2

/trunk

PA

A

Bbuilds

AR

BR

RC

ST

releases

1.0.0

1.0.1

1.0.2 1.0.3

1.0.4

WE HAVE "TRUE CI". WHAT’S NEXT?

Page 56: 03 - Continuous Integration

57

builds

integration (dev)

integration (dev)

WE HAVE "TRUE CI". WHAT’S NEXT?

/1.x.x

/1.0.x

1.x.x 2.x.x

1.x.0 1.x.1 1.x.2 1.x.3 1.x.4

2.x.0 2.x.1

1.x.5

2.x.2

/trunk

1.0.0 1.0.1 1.0.2 1.0.3 1.0.4

CI server

1.x.0.0 1.x.0.1 1.x.1.0 1.x.1.1 1.x.2.0 2.x.x.0 2.x.x.1 2.x.x.2 2.x.x.3 2.x.x.4 …

1.x.2.1 … 1.x.3.0 1.x.3.1 1.x.4.0 1.x.4.1 1.x.4.2 1.x.4.3

2.x.0.0 2.x.0.1 2.x.1.0 2.x.1.1

builds

CI server

1.0.x.0 1.0.0.0 1.0.0.1 1.0.1.0 1.0.1.1 1.0.2.0 1.0.2.1 1.0.3.0 1.0.3.1integration (rel)

releases

Page 57: 03 - Continuous Integration

58

N. ?. ?.L

N .x.x .L

N .x.K.L

N .M. x.L

N .M. K.L

WHAT NEXT? VERSIONS NUMBERING PATTERNS

1.x.2

1.x.3 1.x.4

2.x.0

1.x.2.1 1.x.3.0 1.x.3.1

1.x.1.0 1.x.1.1

1.x.2.0

2.x.x.0 2.x.x.1 2.x.x.2 2.x.x.3 2.x.x.4 …

1.0.0 1.0.11.0.x.0 1.0.0.0 1.0.0.1

2.0.02.0.x.0 2.0.x.1

1.1.01.1.x.0

N.x N.Mdev rel

integrationpilot integration

development integration

pre-release integration

release integration

Page 58: 03 - Continuous Integration

59

Page 59: 03 - Continuous Integration

CONCLUSION

There is a lot of possibilities to make your continuous integration better:Several integration streamlines (not only

trunk)Development and release integration

streamlinesIntroduce version number consisting of

four symbolsProper version number inheritanceIntegration of builds and releases…

Page 60: 03 - Continuous Integration

CONCLUSION

CI is another SCM tool (practice)Middle size project should

definitely have it.It is used mostly in agile worldAgile SCM is the result of attempt

to understand what version should have artifacts which are being built by CI server

Page 61: 03 - Continuous Integration

62

AFTERWORD

Page 62: 03 - Continuous Integration

63

RECOMMENDED READING1. Continuous Integration: Improving Software

Quality and Reducing Risk by Paul M. Duvall, Steve Matyas, Andrew Glover

Page 63: 03 - Continuous Integration

64

RECOMMENDED READING2. Continuous Delivery: Reliable Software Releases

through Build, Test, and Deployment Automation by By Jez Humble, David Farley

Page 64: 03 - Continuous Integration

65

RECOMMENDED READING3. Release It!: Design and Deploy Production-

Ready Software by Michael T. Nygard

Page 65: 03 - Continuous Integration

66

RECOMMENDED READING4. Pragmatic Project Automation: How to Build,

Deploy, and Monitor Java Applications by Mark Clark

Page 66: 03 - Continuous Integration

67

USEFUL LINKS http://

martinfowler.com/articles/continuousIntegration.html - the main article about CI from Martin Fowler

http://www.infoq.com/news/2009/03/Continuous-Deployment - Beyond Continuous Integration: Continuous Deployment

http://radar.oreilly.com/2009/03/continuous-deployment-5-eas.html - Continuous Deployment in 5 easy steps

http://www.proudlyserving.com/archives/2007/10/fear_of_a_broke.html - ‘fear of the broken build’ effect

http://lib.custis.ru/Continuous_Integration - wiki about Continuous Integration in Russian

http://habrahabr.ru/blogs/php/91777/ - Providing quality for web applications (rus)

http://www.youbrokethebuild.com/ - great posters created with the purpose of motivation people avoid breaking the build