Cheatsheet - Continuous Delivery
Cheatsheet - Continuous Delivery
#145
Get More Refcardz! Visit refcardz.com
CONTENTS INCLUDE:
n
n
The Deployment Pipeline
Benefits
Continuous Delivery
n
Configuration Management
Continuous Integration
n
Patterns and Antipatterns
n
n
Testing
Hot Tips and more...
in the Software Lifecycle
By Paul M. Duvall
•F
eedback: Team members learn of problems as soon as they
ABOUT CONTINUOUS DELIVERY occur so that issues are fixed as soon as possible.
•C
ontinually Deploy: Through a fully automated process, you
With Continuous Delivery (CD), teams continuously deliver new
can deploy and release any version of the software to any
versions of software to production by decreasing the cycle time
environment. (1)
between an idea and usable software through the automation of
the entire delivery system: build, deployment, test, and release. CD In the Deployment Pipeline diagram above, all of the patterns are
is enabled through the Deployment Pipeline, which encompasses a shown in context. There are some patterns that span multiple stages
collection of patterns described in this Refcard. of the pipeline, so I chose the stage where it’s most predominately
used.
CD is concerned with “…how all the moving parts fit together:
configuration management, automated testing, continuous
integration and deployment, data management, environment BENEFITS
management, and release management.” (1)
•E
mpowering Teams: Because the deployment pipeline is a
THE DEPLOYMENT PIPELINE pull system, testers, developers, operations, and others can
self service the application version into an environment of their
choice.
•R
educing Errors: Ensuring the correct version, configuration,
database schema, etc. are applied the same way every time
through automation.
•L
owering Stress: Through push-button releases to production
and Rehearsing Deployments, a release becomes commonplace
without the typical stress.
•D
eployment Flexibility: Instantiate a new environment or
configuration by making a few changes to the automated
delivery system.
• Practice makes Perfect: Through the deployment pipeline, the
final deployment into production is being rehearsed every single
time the software is deployed to any target environments. (1)
Continuous Delivery
Note: Each pattern is cited with a number in parentheses that Single Command Environment (1)
corresponds to the source in the References section. Pattern Check out the project’s version-control repository
and run a single command to build and deploy the
application to any accessible environment, including
Configurable Third-Party Software (1) the local development.
Pattern Evaluate and use third-party software that can be Anti-patterns Forcing the developer to define and configure
easily configured, deployed, and automated. environment variables. Making the developer install
numerous tools in order for the build/deployment to
Anti-patterns Procuring software that cannot be externally
work.
configured. Software without an API or command-
line interface that forces teams to use the GUI only.
Single Path to Production (1)
Configuration Catalog (1) Pattern Configuration management of the entire system -
Pattern Maintain a catalog of all options for each application, source, configuration, environment and data. Any
how to change these options and storage locations for change can be tied back to a single revision in the
each application. Automatically create this catalog as version-control system.
part of the build process. Anti-patterns Parts of system are not versioned. Inability to get back
Anti-patterns Configuration options are not documented. The to a previously configured software system.
catalog of applications and other assets is “tribal
knowledge”.
Mainline (3)
Pattern Minimize merging and keep the number of active code Build Threshold (5)
lines manageable by developing on a mainline. Pattern Fail a build when a project rule is violated – such
as architectural breaches, slow tests, and coding
Anti-patterns Multiple branches per project.
standard violations.
Anti-patterns Manual code reviews. Learning of code quality
Merge Daily (1) issues later in the development cycle.
Pattern Changes committed to the mainline are applied to
each branch on at least a daily basis.
Commit Often (6)
Anti-patterns Merging every iteration once a week or less often
Pattern Each team member checks in regularly to trunk - at
than once a day.
least once a day but preferably after each task to
trigger the CI system.
Protected Configuration (5) ,(1) Anti-patterns Source files are committed less frequently than daily
Pattern Store configuration information in secure remotely due to the number of changes from the developer.
accessible locations such as a database, directory, or
registry. Continuous Feedback (6)
Anti-patterns Open text passwords and/or single machine or share. Pattern Send automated feedback from CI system to all
Cross-Functional Team members.
Anti-patterns Notifications are not sent; notifications are ignored; CI
system spams everyone with information they cannot
use.
Repository (3) , (1)
Pattern All source files - executable code, configuration, host
environment, and data - are committed to a version- Continuous Integration (6)
control repository. Pattern Building and testing software with every change
Anti-patterns Some files are checked in, others, such as committed to a project’s version control repository.
environment configuration or data changes, are not. Anti-patterns Scheduled builds, nightly builds, building
Binaries – that can be recreated through the build periodically, building exclusively on developer’s
and deployment process – are checked in. machines, not building at all.
Stop the Line (5) , (1) , (4), (12) Parallel Tests (1)
Pattern Fix software delivery errors as soon as they occur; Pattern Run multiple tests in parallel across hardware instances
stop the line. No one checks in on a broken build as to decrease the time in running tests.
the fix becomes the highest priority. Anti-patterns Running tests on one machine or instance. Running
Anti-patterns Builds stay broken for long periods of time, dependent tests that cannot be run in parallel.
thus preventing developers from checking out
functioning code. Stub Systems (1)
Pattern Use stubs to simulate external systems to reduce
Independent Build (6) deployment complexity.
Pattern Write build scripts that are decoupled from IDEs. Anti-patterns Manually installing and configuring interdependent
These build scripts are executed by a CI system so that systems for Commit Stage build and deployment.
software is built at every change.
Anti-patterns Automated build relies on IDE settings. Builds are
unable to be run from the command line. DEPLOYMENT PIPELINE
Deployment- Automating tests to verify the deployment and Anti-patterns Multiple copies of the same binary dependencies
configuration were successful. Sometimes referred to as a “smoke in each and every project. Redefining the same
tests”. information for each project. Classpath hell!
assigned to the most appropriate category or duplicated when Components and Ivy, Archiva, Nexus, Artifactory, Bundler
necessary. Dependencies
Category Example Software Tools Collaboration Mingle, Greenhopper, JIRA
Configuration Subversion (SVN), git, Perforce, PassPack,
Management PasswordSafe, ESCAPE, ConfigGen
Deployment Pipeline Go, AntHill Pro 5. Paul M. Duvall, “Continuous integration. Patterns and Antipatterns”, DZone refcard #84, 2010
http://bit.ly/l8rfVS
Build and Deployment Ant, AntContrib, NAnt, MSBuild, Buildr, Gant,
6. Paul M. Duvall, “Continuous integration. Improving Software Quality and Reducing Risk”,
Scripting Gradle, make, Maven, Rake, Java Secure Channel,
Addison Wesley, 2007
ControlTier, Altiris, Capistrano, Fabric, Func
7. Scott W. Ambler and Pramodkumar J. Saladage, “Refactoring Databases. Evolutionary
Infrastructure and AWS EC2, AWS S3, Windows Azure, Google Database Design”, Addison Wesley, 2006.
Environments App Engine, AWS Elastic Beanstalk, Heroku,
Capistrano, Cobbler, BMC Bladelogic, CFEngine, 8. Paul M. Duvall, IBM developerWorks series “Automation for the people” http://ibm.co/iwwvPX
IBM Tivoli Provisioning Manager, Puppet, Chef,
9. IMVU: http://bit.ly/jhqP5f
Bcfg2, AWS Cloud Formation, Windows Azure
AppFabric, rPath, JEOS, BoxGrinder, CLIP, 10. Martin Fowler and Facebook: http://on.fb.me/miBrOM
Eucalyptus, AppLogic, CloudKick, CloudWatch,
11. Facebook Engineering: http://on.fb.me/miBrOM
Nagios, Zabbix, Zenoss
12. Paul Julius, Enterprise Continuous Integration Maturity Model, http://bit.ly/m7h5vC
Data Hibernate, MySQL, Liquibase, Oracle, PostgreSQL,
SQL Server, SimpleDB, SQL Azure, Ant, MongoDB,
dbdeploy
DZone, Inc.
140 Preston Executive Dr.
Suite 100
Cary, NC 27513
DZone communities deliver over 6 million pages each month to 888.678.0399
more than 3.3 million software developers, architects and decision 919.678.0300
makers. DZone offers something for everyone, including news,
Refcardz Feedback Welcome
$7.95
tutorials, cheat sheets, blogs, feature articles, source code and more.
refcardz@dzone.com
“DZone is a developer’s dream,” says PC Magazine.
Sponsorship Opportunities
Copyright © 2011 DZone, Inc. All rights reserved. No part of this publication may be reproduced, stored in a
retrieval system, or transmitted, in any form or by means electronic, mechanical, photocopying, or otherwise, sales@dzone.com Version 1.0
without prior written permission of the publisher.