Code & Release Management
Code & Release Management
Eli White
Zend
http://eliw.com/
What are we talking about?
Eli White — Code & Release Management — Dutch PHP Conference 2009 — 6/13/2009
Version Control
Use it!
It is the core component of this process.
Eli White — Code & Release Management — Dutch PHP Conference 2009 — 6/13/2009
Version Control Options
CVS
Eli White — Code & Release Management — Dutch PHP Conference 2009 — 6/13/2009
Version Control Options
Eli White — Code & Release Management — Dutch PHP Conference 2009 — 6/13/2009
Version Control Terminology
Commit / Check-in
Changes to the code base are added to the repository
Branch
Making a copy of the code to be managed in parallel
Tag
Marking a snapshot in time of a set of files
Trunk
The main line of development, before branching
Merge
Combining two sets of changes into one
Eli White — Code & Release Management — Dutch PHP Conference 2009 — 6/13/2009
Subversion (SVN) 101
Subversion thinks in terms of a directory structure
Projects are subdirectories of a repository:
//host/project
The mainline (trunk) of code:
//host/project/trunk
Branches & Tags have parallel directories:
//host/project/branches/v3.0
//host/project/tags/v3.0.1
Eli White — Code & Release Management — Dutch PHP Conference 2009 — 6/13/2009
Version Control Policies
Come up with general rules that you apply:
Intermediate (non-working) checkins?
Where should you check code in?
Are there places that are less controlled?
How does this flow into releases?
What about tags vs branches vs trunk?
Eli White — Code & Release Management — Dutch PHP Conference 2009 — 6/13/2009
Uses of Tags/Branches/Trunk
No matter what style of management:
Trunk:
Contains the 'core' codebase
Branches:
Used to 'segment' into logical areas of responsibility
Tags:
Marking a specific state of code, a release
Eli White — Code & Release Management — Dutch PHP Conference 2009 — 6/13/2009
Explore Three Styles
Stage Branches
Feature Branches
Release Branches
Eli White — Code & Release Management — Dutch PHP Conference 2009 — 6/13/2009
Stage Branches
All new work done against Trunk
Branches exist for each stage of a project:
staging, production, etc.
When ready for a release, merge into staging
After testing, merge into production
Tag against production branch for releases
Eli White — Code & Release Management — Dutch PHP Conference 2009 — 6/13/2009
Stage Branches
Eli White — Code & Release Management — Dutch PHP Conference 2009 — 6/13/2009
Stage Branches
Pros: Cons:
Simple No parallel work
No dynamic branches No old patches
No room for errors
Long scale work hard
Error prone merging
Eli White — Code & Release Management — Dutch PHP Conference 2009 — 6/13/2009
Feature Branches
Eli White — Code & Release Management — Dutch PHP Conference 2009 — 6/13/2009
Feature Branches
Eli White — Code & Release Management — Dutch PHP Conference 2009 — 6/13/2009
Feature Branches
Pros: Cons:
Parallel work easy Often creating branches
Long scale work easy Lots of merging
No old patches
Fixes are complicated
Eli White — Code & Release Management — Dutch PHP Conference 2009 — 6/13/2009
Release Branches
All new work done on trunk
When ready for release, create a versional
branch: /branches/v3.0
Test against the branch
Tag the branch with a versional tag for
release: /tags/v3.0.0
Fix bugs against branch, and tag as needed
Continue doing new work against trunk
Eli White — Code & Release Management — Dutch PHP Conference 2009 — 6/13/2009
Release Branches
Eli White — Code & Release Management — Dutch PHP Conference 2009 — 6/13/2009
Release Branches
Pros: Cons:
Easy maintenance Branch/Tag creation
Long scale work OK Assumes single goal
Some parallel work
Little merging
Eli White — Code & Release Management — Dutch PHP Conference 2009 — 6/13/2009
Mix and Match
Eli White — Code & Release Management — Dutch PHP Conference 2009 — 6/13/2009
Pushing Code Live
Have a script
Handle multiple machines
Use for all phases staging/testing
Have a rollback procedure
Multiple ways to accomplish
Incorporate everything together:
Services, DB, PHP, etc
Eli White — Code & Release Management — Dutch PHP Conference 2009 — 6/13/2009
So Many Options
Eli White — Code & Release Management — Dutch PHP Conference 2009 — 6/13/2009
Live SVN Checkout
Eli White — Code & Release Management — Dutch PHP Conference 2009 — 6/13/2009
SVN Export & rsync
Simple
Easy to scale & automate
Eli White — Code & Release Management — Dutch PHP Conference 2009 — 6/13/2009
Partial Updates with rsync
Eli White — Code & Release Management — Dutch PHP Conference 2009 — 6/13/2009
Rollbacks with rsync
Eli White — Code & Release Management — Dutch PHP Conference 2009 — 6/13/2009
Questions?
Twitter: @eliw
Zend's DevZone:
http://dz.zend.com/