Continuous Delivery
05 - 09 - 2013
David Funaro
CTO@Dnsee
@ingdavidino davidfunaro.com
Overview
STARTUP
STARTUP
STARTUP
Testo?
STARTUP
Testo?
Implementation
• is the only phase ?
• it’s really sufficient to release software
Implementation
Implementation
Progettazione
Implementation
Progettazione
Implementation
Analisi
Collaudo
Progettazione
Implementation
Analisi
Collaudo
Progettazione
Implementation
Analisi
Manutezione
Collaudo
Progettazione
Implementation
Analisi
Manutezione
Collaudo
Progettazione
Implementation
Analisi
Manutezione
Software Development
Life Cycle
SW - LC
Feedback
SW - LC
Feedback
• New Features
• Bug fixing
• System specification Changes
• Web services changes
• Customer support tips
Software
Evolution
RELEASE
SoftwareComponents
‣Layout
‣Frontend
‣Backend
‣Api
‣Webservices
‣...
‣...
‣...
‣Librerie
Changes
RELEASE
FEEDBACK
new features monetize bug
performance layout
RELEASE
? Miss Release Price ?
€
Reaction Metrics
Change
RELEASE
Reaction Metrics
Change
RELEASE
Time interval ...
Security
Skills
Cost
Predictable
Stress
Repeatability
• How many time you need to release
software
Time interval ...
• Everything will be ok ?
• Can i be sure that every needed step will
be done ?
• Exceptions, are managed ?
• Data migration goes well ?
• Can i go back (rollback) ?
Security
• Have, the selected person, all the skill
needed to terminate the procedure ?
• What about his behavior in some
exception flow case
Skills
• How many people you need ?
• For how many time ?
• Other Resources ?
Cost
• are able to indicate how much time will
care ?
Predictable
• What about the stress
• stress => error-prone
Stress
• Just finish a deploy. Software released.A bug
is found.You have to re-start
Repeatability
Reaction Metrics
RELEASE
Time interval ...
Security
Skills
Cost
Predictable
Stress
Repeatability
Production
Reaction Metrics
RELEASE
Time interval ...
Security
Skills
Cost
Predictable
Stress
Repeatability
Production
Staging
Reaction Metrics
RELEASE
Time interval ...
Security
Skills
Cost
Predictable
Stress
Repeatability
Production
Testing
Staging
No Automation
Process ?
Lots of things to
consider
• Code dependency management
• System evolution management
• Data management and architecture
• Component management
Software Release
• Low Risk
• Cheap
• Frequent
• Rapid
• Predictable
... should be
Continuous Delivery
What we need
• Source Code Management
• Continuous Integration Server
• Automated Deploy
• Real Time Alerting
• Root Cause Analysis
Deploy Pipeline
Commit Stage
Compile
UnitTest
Analysis
Build Installers
Release
Automated
acceptance
testign
Automated
capacity
testing
Manual Testing
Showcases
Explorarory
testing
Overview
Commit /push Testing
FAIL
SUCCESS Automated
Deploy
Procedure
dev team
Continuous
Delivery
Tools
MethodologiesPractices
Cautions
Anti-patterns
• Deploy software manually
• Manual Configuration
• Deploy to a production-like Env Only after
development is complete
Benefits
• Empower Team
• Reducing Errors
• Lowering Stress
• Deployment Flexibility
• Practice Make Perfect
Keep Everything in version control
Automate Almost Everything
Keys
PAUSE
SECTION I
Source Code Management
i sent you a mail with
the last change
... are you
shure ?
i can’t find the new file ?!?
The problem
SCM :What is it ?
3
5
7
10
Repository
SCM :What it does ?
•Keeping multiple file version
•Collaboration
CHECK POINT
Application Evolution
Sharing
isn’t just for source code
Cautions
you need everything required to re-create your
application’s binaries and the environments in
which they run.
How it works
Trunk/Master
Check-in
Push
Local
3
Check-in
Push
Local
34
Local
Check-out
Pull
8
29
Local
Check-out
Pull
8
2
9
Local
Conflict/Resolve
Pull
!
3
5
Conflict/Resolve
!
Branching & Merging
Tag
Best Practice
• Little Commit
• Frequent Commit
• Consistent commit
• User Meaningful Commit message
Different Products
DEMO
PAUSE
SECTION II
Continuous Integration
After your commit
nothing works anymore
But ...“was working on my computer”
Ops
INTEGRATION PROBLEM
(dopo un commit )
It was working on the stage environment !!!
Ops(dopo un deploy in produzione)
INTEGRATION PROBLEM
sleepless nights before demo ... bug just after release
Cost
Analysis Design Implementation Testing Maintenance
Changes
DEFECT BUG
≠
Glossary
http://agitar.com/solutions/why_unit_testing.html
t
integrazione
Regressione
Working
Broken
t
integrazione
Regressione
Working
Broken
Effort
In software development the components
integration need to be tested continuosly...
in order to find inconsistencies
as soon as possible
Good Solution
Continuous Integration
Continuous Integration is a software
development practice where members of a team
integrate their work frequently, usually each
person integrates at least daily - leading to
multiple integrations per day.
Each integration is verified by an automated
build (including test) to detect integration errors
as quickly as possible.
Martin Fowler
Requirements
Source Code Management
Requirements
Test Scopes
Agile-Testing-Quadrants
CI Flow
F
CI Flow
F
Checkout last Commit
CI Flow
Build andTests Process
F
Checkout last Commit
CI Flow
Build andTests Process
F
F
F
Checkout last Commit
CI Flow
Build andTests Process
F
F
F
F
F
F
Checkout last Commit
CI Flow
Build andTests Process
F
F
F
F
F
FF
F
Checkout last Commit
CI Flow
Build andTests Process
F
F
F
F
F
FF
F
Checkout last Commit
CI Flow
Build andTests Process
Github Jenkins Hooks
Build & Test
✓Process creating executable code
✓Unit test
✓Quality criteria
✓FunctionalTest
✓Non FunctionalTest
Valid Syntax Compile
Code behavior
Code coverage, Mass detector
Business Acceptance Criteria
Application performance
PASS
CI - Reduce Risk
• Say goodbye to long and tense integrations
• Increase visibility which enables greater communication
• Catch issues fast and nip them in the bud
• Spend less time debugging and more time adding features
• Proceed in the confidence you’re building on a solid foundation
• Stop waiting to find out if your code’s going to work
• Reduce integration problems allowing you to deliver software
more rapidly
CI - Output
System Status Documentation/Artifacts Quality Check
“Continuous Integration doesn’t get rid of bugs, but it
does make them dramatically easier to find and
remove.”
Martin Fowler
Immediate feedback on the health of the system
DEMO
Team Responsibilities
• Check in frequently
• Don’t check in broken code
• Don’t check in untested code
• Don’t check in when the build is broken
• Repair the build as soon as possible
Ci - Best practice
• CI server === Production Server
• Integrate it from the first commit
• Find best way to get notified
Ci - software
... more and more
PAUSA
PARTE III
Automated Deploy
Deployment
“is all the activities that make a software
system available for use”
Wikipedia
A Critical part of the application
life-cycle
Deployment
RELEASE
Real ?
RELEASE
Real ?
RELEASERELEASERELEASERELEASERELEASERELEASERELEASERELEASERELEASERELEASERELEASE
feedback
Deployment
• Low Risk
• Cheap
• Frequent
• Rapid
• Predictable
Low Risk
• Exception catched
• Rollback
• Data on secure
Cheap
• no more than one click
• no more than one person
• no skilled person
Frequent
• to get feedback
Rapid
Predictable
Incomplete ways
Ftp is a deploy procedure ?
Rsync
Rsync is a deploy procedure ?
TeamViewer
Teamviewer is a deploy procedure ?
SCM
$ git pull origin master
$ svn update
Versioning checkout is a deploy procedure ?
• Incomplete
• Manual procedure
• Slow
• Server Downtime
• No data migration
• No Rollback
Problems
Automated Deployment Goals
one click deploy
Deploy
Automated Deployment Goals
AnyTime AnyWhere AnyOne
Automated Deployment Goals
Rollback
Automated Deployment Goals
no downtime
Automated Deployment Goals
Scalable
Frontend 1 Frontend 1I Frontend III
Balancer
Automated Deployment Goals
Deployment Elements
• Executable Code
• Dependency Management
• Software configuration
• Environment Management
• Data Migrations
• Manage Cache
• Manage Assets
Executable code (SCM)
Dependency Management
How you keep updated your libraries
dependencies ?
to get the feature 103 done, i
use library XXX
ok, i’ll note it
here ...
to get the feature 103 done, i
use library XXX
OK ..
PIP
Data Migration
What if, after your first production
deployment, you have to change the Entity
Relationship ?
Software Configuration
How you keep updated your OS componets/
libraries ?
to get the feature 103 done, i
use library XXX, that require
the module 288
ok, i’ll note it
here ...
to get the feature 103 done, i
use library XXX, that require
the module 903
OK ..
A new way to setup your environment
Write
Configuration
Script
Write
Configuration
Script
Versionable
Environment Management
Production TestingStaging
Manual - Follow recipe
• Integrity problems
• Problem with exception handling
• Basic Skills requirements
• Time consuming - expensive
• Error - prone
• Stress
Build a custom Script
• Do a backup
• Create new directory
• Update the code
• Update dependencies
• Run migration data
• Update Environements
• Warm up cache
• ...
Existing Tools
Fabric
... and more others
• Built in Ruby
• Easy setup
• Event Task based, easy to hook into
• Multiple server
• Multistage extension
• Multiple recipe for different environments
Web deploy Strategy
Document
Root
Web deploy Strategy
Document
Root
Web deploy Strategy
Document
Root
Web deploy Strategy
Document
Root
DEMO
Keep Everything in version
control
Automate Almost
Everything
Thanks

Continuous delivery @wcap 5-09-2013