Continuous integration

72
CONTINUOUS INTEGRATION

Transcript of Continuous integration

Page 1: Continuous integration

CONTINUOUS INTEGRATION

Page 2: Continuous integration

INTRODUCTIONS

Brendan Jennings

Alexandre Morot

Intuit

Any opinions are our own

Page 3: Continuous integration

OVERVIEW OF PRESENTATION

What Is Continuous Integration Previous System Pain Points Build Server Unit Tests Automated Deployment Verdict Questions

Page 4: Continuous integration

WHAT IS CONTINUOUS INTEGRATION

Page 5: Continuous integration

PREVIOUS SYSTEM PAIN POINTS

Page 6: Continuous integration

SOURCE CONTROL/BROKEN BUILDS

Page 7: Continuous integration

SOURCE CONTROL/BROKEN BUILDS

Issues Encountered (It works on my machine) Incorrect DLL references

DLL is in a different location to hard coded path DLL does not exist on machine DLL reference is to output directory

Page 8: Continuous integration

SOURCE CONTROL/BROKEN BUILDS

Issues Encountered (It works on my machine) Incorrect DLL references Incomplete check-ins

Files without project Project without new files

Page 9: Continuous integration

SOURCE CONTROL/BROKEN BUILDS

Issues Encountered (It works on my machine) Incorrect DLL references Incomplete check-ins Overwritten changes Check in timing (end of day check-ins) Staying on old version to avoid build errors

Fairly Frequent Downtime for Entire Team Resolving Build Errors

Page 10: Continuous integration

MANUAL TESTING OF CHANGES

Page 11: Continuous integration

MANUAL TESTING OF CHANGES

Time Intensive No Full Regression Test Testing Time Reduced When Running

Late

Page 12: Continuous integration

MANUAL PUSH TO PRODUCTION

Page 13: Continuous integration

MANUAL PUSH TO PRODUCTION

Requires Observer to Reduce Risk of Errors

Page 14: Continuous integration

STEPS INVOLVED

Page 15: Continuous integration

STEPS INVOLVED

Build

Page 16: Continuous integration

STEPS INVOLVED

Zip

Page 17: Continuous integration

STEPS INVOLVED

Push to Datacenter

Page 18: Continuous integration

STEPS INVOLVED

Pull to Pre-Production

Page 19: Continuous integration

STEPS INVOLVED

Extract and Replace Build

Page 20: Continuous integration

STEPS INVOLVED

QA

Page 21: Continuous integration

STEPS INVOLVED

QA Restart if Failed

Page 22: Continuous integration

STEPS INVOLVED

For Each Server

Page 23: Continuous integration

STEPS INVOLVED

For Each Server Pull from Rotation

Page 24: Continuous integration

STEPS INVOLVED

For Each Server Extract and Replace Build

Page 25: Continuous integration

STEPS INVOLVED

For Each Server Warm Up Server

Page 26: Continuous integration

STEPS INVOLVED

For Each Server Put Back In Rotation

Page 27: Continuous integration

STEPS INVOLVED

Pray

Page 28: Continuous integration

STEPS INVOLVED

Release Complete Typically 2 Hours Later

Page 29: Continuous integration

SERVERS NOT ALL PUSHED TOGETHER

Leaves Site in Inconsistent State

Page 30: Continuous integration

SERVERS NOT ALL PUSHED TOGETHER

Leaves Site in Inconsistent State If inconsistency is severe, site needs to be

taken down during push

Page 31: Continuous integration

BUILD SERVER

Page 32: Continuous integration

BUILD SERVER

Continuous Build of Every Check-In

Page 33: Continuous integration

BUILD SERVER

Continuous Build of Every Check-In Used Hudson, later switched to Jenkins

Page 34: Continuous integration

BUILD SERVER

Continuous Build of Every Check-In Immediate Notification of Build Errors

Names and shames guilty party Notifications come through to phone Encourages pride in build quality Only check-in working code Immediate action must be taken for build errors Notification sent for every check-in that is still broken Final notification sent when problem resolved

Page 35: Continuous integration

UNIT TESTS

Page 36: Continuous integration

UNIT TESTS

Gradually Adding Unit Tests for Existing Code Focus on coverage for most critical areas

first

Page 37: Continuous integration

UNIT TESTS

Gradually Adding Unit Tests for Existing Code

Default to Unit Tests for New/Updated Code

Add Test Execution to Build Server Failed unit tests also send notifications to

team History maintained; can track fixes to tests

Page 38: Continuous integration

UNIT TESTS

Gradually Adding Unit Tests for Existing Code

Default to Unit Tests for New/Updated Code

Add Test Execution to Build Server All Tests Must Pass

If the test has found a bug, the code must be fixed

If the test has failed incorrectly, the test must be fixed

Page 39: Continuous integration

DEPLOYMENT

Page 40: Continuous integration

DEPLOYMENT

Latest Build Added server to run latest development

version All successful builds pushed automatically

Page 41: Continuous integration

DEPLOYMENT

Latest Build Data Center

Use source control labels Precise control of what is included in each build History of all prior builds; can recreate prior

versions of site

Page 42: Continuous integration

DEPLOYMENT

Page 43: Continuous integration

SCRIPT TO AUTOMATE PUSHES

Page 44: Continuous integration

SCRIPT TO AUTOMATE PUSHES

Push to Different Environments

Page 45: Continuous integration

SCRIPT PROCESSING

Take One Server Out Of Rotation

Page 46: Continuous integration

SCRIPT PROCESSING

Updates Server with Differential Push

Page 47: Continuous integration

SCRIPT PROCESSING

Checks For Deployment Errors

Page 48: Continuous integration

SCRIPT PROCESSING

Manual Final Verification Step

Page 49: Continuous integration

SCRIPT PROCESSING

Takes Half of the Servers Out of Rotation

Page 50: Continuous integration

SCRIPT PROCESSING

Pushes New Code to these Servers in Parallel with Differential Pushes

Page 51: Continuous integration

SCRIPT PROCESSING

Warms Up Servers

Page 52: Continuous integration

SCRIPT PROCESSING

Checks for Deployment Errors

Page 53: Continuous integration

SCRIPT PROCESSING

Swaps All Servers In/Out of Rotation Site is now effectively upgraded

Page 54: Continuous integration

SCRIPT PROCESSING

Updates Remaining Servers with Differential Pushes

Page 55: Continuous integration

SCRIPT PROCESSING

Warms Up Servers

Page 56: Continuous integration

SCRIPT PROCESSING

Check for Deployment Errors

Page 57: Continuous integration

SCRIPT PROCESSING

Puts Servers Back into Rotation

Page 58: Continuous integration

SCRIPT PROCESSING

Final Verification that All Servers are In Rotation

Page 59: Continuous integration

TECHNOLOGIES USED

Page 60: Continuous integration

MICROSOFT WEB DEPLOY

Web Deploy simplifies the migration, management and

deployment of IIS Web servers, Web applications and Web sites.

Page 61: Continuous integration

CYGWIN BASH AND SSH SERVER

Linux-like environment for Windows making it possible to port software running on POSIX systems (such as Linux, BSD, and Unix systems) to

Windows.

Page 62: Continuous integration

JENKINS

Jenkins is an open-source continuous integration server

with 300+ plugins to support all kinds of software

Page 63: Continuous integration

PLUGINS FOR TFS AND MSBUILD

TFS plugin customized to handle labeling strategy

CustomizedTFS Plugin

MSBUILD Plugin

Deployment ScriptCalled from Jenkins

Page 64: Continuous integration

VERDICT

Page 65: Continuous integration

QUALITY

Page 66: Continuous integration

QUALITY

Build Issues Typically Identified Rapidly No longer have the ‘Monday morning blues’ where

nobody can build

Page 67: Continuous integration

QUALITY

Build Issues Typically Identified Rapidly Automated Regression Tests provide Higher

Levels of Confidence Issues are uncovered that we believe we would have

missed in the past Analytics bugs were extremely unlikely to be seen

until someone complained

Page 68: Continuous integration

DEPLOYMENT

Page 69: Continuous integration

DEPLOYMENT

Can Be Deployed by One Person No Downtime Required in Most Updates Time to Deploy Reduced to 6 Minutes

Team more productive Enables rapid deployment of small

changes Multiple deployments per day 2 hour window can be hard to find between

meetings

Page 70: Continuous integration

DEPLOYMENT

Can Be Deployed by One Person No Downtime Required in Most Updates Time to Deploy Reduced to 6 Minutes Can Rollback Quickly if Necessary Deployment can be Unattended

If something fails, deployment aborts automatically

Failure notification sent including failure reason

Page 71: Continuous integration

DEPLOYMENT

Can Be Deployed by One Person No Downtime Required in Most Updates Time to Deploy Reduced to 6 Minutes Can Rollback Quickly if Necessary Deployment can be Unattended Team Do Not Need Production Server

Login Removes temptation to perform fix directly

on server

Page 72: Continuous integration

QUESTIONS