Continuous Delivery Overview
Continuous Delivery Overview
Luca Minudel
Continuous Delivery Overview
Contents
Introduction .............................................................................................................................. 3
Defining continuous delivery............................................................................................. 3
Why continuous delivery..................................................................................................... 5
What is DevOps, by Kief Morris ........................................................................................ 8
Continuous integration, the second step of the CD journey ................................. 8
About continuous deployment.......................................................................................... 9
Principles of CD........................................................................................................................ 9
Collaboration practices for CD ........................................................................................ 11
Technical practices of CD .................................................................................................. 12
CD and DevOps tools, by Kief Morris ............................................................................ 19
The CD journey, changing together ............................................................................... 21
Anecdotes and stories about CD ..................................................................................... 21
About the authors ................................................................................................................. 23
2
Continuous Delivery Overview
Introduction
This booklet is a rapid and comprehensive overview of continuous delivery (CD) for busy
people. It introduces the principles, the practices, and the value proposition of CD. It
contains references to the most important resources and it ends with anecdotes and war
stories about CD adoptions.
When deadlines loom, often all certainties about the real progress of a project disappear.
Sometimes significant problems are discovered only late into the integration or hardening
phase. Other times it is the release to production that becomes a lengthy and painful
experience, followed by weeks of bug-fixing and firefighting.
Often a new product is released after many months of waiting and hard work. Only then can
the business see if the product solves the right problem, if it fits the real needs of the
customers, if the market likes it. Other times, even after the release, no one really knows
which features are used and generate value and which do not.
CD is that part of lean and agile approaches to software development that promises to make
real project progress always obvious and tangible, supports early discovery and gradual
development of customers and products, and eliminates the gap between customers,
business, and IT. In short, CD turns risky, painful releases to production into safe and
regular events.
Continuous Delivery is a software development discipline where you build software in such a
way that the software can be released to production at any time - Martin Fowler.
Continuous Delivery aims to reduce the cost, time, and risk of delivering incremental
changes to users - Jez Humble.
3
Continuous Delivery Overview
Following the modern industry trend of shortening products’ life cycles, more and more
teams and organizations release-cycles are moving from years and months to weeks and
days. This allows repeatable, safe, weekly - or daily - releases to become the norm.
Suggested readings:
● Continuous Delivery, Jez Humble and David Farley: Addison-Wesley (2010)
● Delivery Guide, Martin Fowler
● Continuous Delivery, Martin Fowler, (2013)
● Continuous Delivery (video), Martin Fowler and Jez Humble (2011)
● Jez Humble on Continuous Delivery (video), Jez Humble (2012)
4
Continuous Delivery Overview
These two goals have traditionally been seen as conflicting, like in a zero-sum game.
Because of this, many organizations’ governance and policies are seen as requiring
expensive solutions to search for an acceptable trade-off between the two.
Surprisingly, CD has the paradoxical effect of increasing the throughput of new features and
stabilizing production systems, increasing innovation and predictability together at the same
time. Furthermore, CD closes the gap between market, business, and IT.
Jez Humble emphasizes three main benefits of CD: building the right thing; reducing the risk
of release; and making real project progress obvious and tangible. Let’s look at common
motivators and inhibitors for adopting CD.
Compelling needs
For some organizations in some contexts and for some projects, CD is more than an
opportunity - it is a compelling need. An example is the situation where the following two
forces are present at the same time:
1. Pressure to change
○ pressure to innovate (i.e. stay ahead of competitors);
○ technical novelty and variety in the technologies used for the project;
○ uncertainty (e.g. from the domain, the market, the users, the partners, the
suppliers)
This is where CD comes into play in enabling an organization to increase the throughput,
innovation, and stability all at the same time.
● Reduced risks
Thanks to early and frequent releases, it is possible to see if the organization is
building the right thing in the right way. The real progress of the project becomes
tangible in every moment, and you overcome the infamous 90% Syndrome.
Problems are detected early, when it is easier and cheaper to fix them. The
consequences of a mistake are limited by the small scope and size of each
incremental release.
5
Continuous Delivery Overview
● Reduced waste
Increased automation reduces the number of errors caused by repetitive manual
work in testing and deployment, and reduces the probability of subtle errors caused
by manual setup and configuration of the environments and infrastructure.
● Increased quality
Lessons learned and information discovered while releasing the product early and
often are reused immediately. This raises the internal and external quality, reducing
defects and focusing on what really matters to users and customers.
● Increased resilience
Remediation plans define how to recover from specific errors and showstopper bugs
when a new deploy to production fails. Remediation plans are an integral part of CD.
Remediation procedures are automated, tested, and put to use so that there will be
no unpleasant surprises when they are needed. The small size of each release to
production makes remediation plans simpler so that recovery is faster and easier with
very limited consequences.
● Increased responsiveness
The reduced lead-time cuts the time required to change direction, to make a change,
to react to new circumstances, or to deal with an unexpected event. The small size of
each release makes it faster to identify the reason for a problem and consequently
the time to fix it.
● Increased innovation
The ability to release early and often presents the opportunity to explore the market,
to measure the value, to explore the fitness for purpose of the product, to conduct
safe-to-fail experiments, to explore the reaction of users to the product, and so to
discover new business opportunities. It enables the possibility of exaptation, one of
the fundamental mechanisms of innovation.
6
Continuous Delivery Overview
Suggested readings:
● The Lean Startup, Eric Ries (2011)
● Agile Manifesto Principles, K.Beck, A.Cockburn, W.Cunningham, M.Fowler,
J.Highsmith, R.Jeffries, R.C.Martin, K.Schwaber, J.Sutherland et al. (2001)
Inhibitors
There are internal and external factors that make it more difficult to adopt and apply CD.
These include the following examples.
Internal factors:
● lack of training;
● resistance to change.
External factors:
● compliance with external regulations and policies that requires extensive processes;
long paperwork trails or long waits before being authorized to publicly release a new
version of the product;
● dependency on external resources (e.g. hardware, logistic, etc.) for which most
decisions or actions are irreversible;
● use of new technologies that do not already have tools to support CD.
Contrary to popular belief, CD can also help to successfully go to market infrequently with
huge marketing events. CD also helps with the compliance to standards such as SOX, PCI
DSS, ITIL, and COBIT. And in many cases, problems with external policies are due to
implementations of an interpretation of a policy, while there are other, lightweight ways to
achieve the policy goals that actually produce better outcomes.
7
Continuous Delivery Overview
DevOps is a natural extension of the agile software movement. Agile broke down barriers
between customers, business analysts, architects, QAs, and developers, and now DevOps
extends this collaboration to include infrastructure, release management, support, security,
and other roles in IT operations.
DevOps doesn't require particular roles; in fact, many believe that creating a separate role
for DevOps misses the point that developers and operations people should share ownership
of the software, end to end. It also doesn't necessarily require changing organisational
structures, although oftentimes existing structures, incentives, and culture creates an
environment in which collaboration is difficult.
John Willis uses acronym CAMS for culture, automation, measurement, sharing – the main
elements of DevOps. Culture is the foundation of DevOps, putting people and process first.
Automation of infrastructure and change management can provide a shared platform around
which development and operations can collaborate. Measurement is necessary for
continuous improvement. And sharing between people and groups creates a loopback for
continuous improvement.
Suggested readings:
● Release It!: Design and Deploy Production-Ready Software, Michael T. Nygard: The
Pragmatic Programmers (2007)
● What Devops Means to Me, John Willis (2010)
The following is the verbatim definition of CI that Martin Fowler uses on his Web site:
You are probably wondering what first step of the CD journey comes before CI. The
following picture from Jim Highsmith’s Adaptive Leadership answers the question: it is
8
Continuous Delivery Overview
iterative software development, which is a key element of lean and agile and of any modern
software-development process.
Suggested readings:
● Continuous Integration: Improving Software Quality and Reducing Risk, Paul Duvall:
Addison-Wesley Professional (2007)
● Continuous Integration, Martin Fowler (2006)
Principles of CD
Different teams, different projects, and different organizations need different implementations
of CD. There is no standardized version of CD. Instead, there is a mix of skills, tools, and
technical and organizational practices. Finding the right mix can be a challenge.
Luckily, all the CD implementations share common principles that are precious foundations
and can guide the CD journey.
This main principle incorporates the whole idea of CD: create a repeatable, reliable way to
release software.
The next two principles of CD are related to people and collaboration practices:
9
Continuous Delivery Overview
1. Continuous improvement
A big-bang approach for the adoption of CD doesn’t work well. Changing one thing at
time and observing the results work better.
A gradual approach is preferable, driven by all the parties involved and affected by
CD, gathering together regularly to reflect on the next opportunity of improvement, to
analyze feedback, to reach consensus, and to take actions.
All the people involved throughout the value stream of the product, from concept to
cash, should share this common goal and be evaluated as a team against this
common goal.
A new team member should be able to check out the project’s artifacts from the
version-control system and use a command to build and deploy the software to any
available environment including the development workstation machine.
5. Build quality in
Making mistakes is a natural human activity. There is a level beyond which trying to
prevent mistakes is no longer effective and instead slows down the progress of the
work.
10
Continuous Delivery Overview
"Build quality in" means to add to the skills, the practices, and the tools of the team
the ability to detect mistakes early, when it is cheaper to fix them and possible to fix
them quickly and without consequences.
Collaboration practices are essential in CD because they support the technical practices and
vice versa.
● Developers and IT ops cooperate closely for the release and the support.
From the inception of the project, IT ops are involved in the release planning and in
the iteration planning where they can express their requirements for the system to be
developed and deployed to production and supported. Developers work and
cooperate with IT ops to create the required tools, to write the required automation
scripts, and to define, test, and execute the release and remediation plan. Both share
the responsibility of keeping the system functioning well and profitably in production.
The usual collaboration practices among developers working on the same project and on the
same code base are also required to support the technical practices.
11
Continuous Delivery Overview
Suggested reading:
Extreme Programming Explained: Embrace Change, Kent Beck: Addison-Wesley
(2004)
The Lean Startup, Eric Ries (2011)
The Phoenix Project: A Novel About IT, DevOps, and Helping Your Business Win,
Gene Kim, Kevin Behr, and George Spafford (2013)
When the code base grows and teams working on the code base grow in size and number,
complexity and costs of communication grow exponentially.
A code base that has grown too large or too complex can be split into autonomous end-to-
end business-facing components and services, and small cross-functional teams can be
reorganized around these components and services in accordance with Conway’s law:
Software that is too complex to integrate, package, build, test with automatic tests, or deploy
because the number or the complexity of the dependencies between components and
service can indicate that the code base needs to be reorganized into autonomous
components and services and assigned to small cross-functional teams.
Suggested readings:
● "A Conversation with Werner Vogels". ACM Queue, 4(4), (2006, May)
Technical practices of CD
Engineers as well as developers, testers, and IT ops usually think about CD starting from
technical practices and from the new skill set that CD requires.
When they are given the responsibility and authority to contribute to the CD implementation,
the technical practices become a challenging aspect that is also interesting and fulfilling.
An engineer experienced in CD masters the technical practices and is capable of choosing
the mix of practices that fits a specific team, project, and organization.
The technical practices of CD adhere to a new philosophy. These practices do not just try to
prevent mistakes, defects, and problems. They build in the ability to detect them as early as
possible, when it is easier to recover quickly and with few or no consequences at all.
Following this approach, software development goes faster, quality improves, and the whole
workflow becomes more flexible.
12
Continuous Delivery Overview
The following paragraphs give an overview of the main technical practices of CD and are
mainly interesting for readers with technical roles. Executives and managers may skip to
the next chapter, "CD and DevOps tools, by Kief Morris".
With CI, developers integrate and test their work at least once a day and detect integration
problems early, when they are easier to solve. This approach avoids only discovering
integration problems late into the integration or hardening phase before the release. CI is
also essential to refactoring, because refactoring with feature branches causes a large
number of merge conflicts that are impossible to resolve manually.
CI is one of the primary practices of agile software development and extreme programming
and is a prerequisite for CD. Essentially, CD is an extension of CI.
In 2000, Martin Fowler and Matthew Foemmel from ThoughtWorks were the first to
document the use of CI for large-scale software projects. This resulted in the first
continuous-integration server, the open-source project CruiseControl, created by
ThoughtWorks.
Suggested readings:
● Continuous Integration: Improving Software Quality and Reducing Risk, Paul Duvall:
Addison-Wesley Professional (2007)
● Continuous Integration, Martin Fowler (2006)
Automated testing
Manual QA and testing require many hours or even days of work. It is neither sustainable
nor convenient to repeat manual QA and testing one or more times per day. That’s why
testing automation is absolutely key here. Indeed, automated testing is one of the
prerequisites for CD.
All the testing that can be automated (unit testing, integration testing, functional testing, etc.)
needs to be automated, with exception of tests where humans add value (exploratory testing,
usability testing, etc.).
In addition, automatic tests can be repeated many times without the inevitable errors,
omissions, and delays caused by long and repetitive manual work. This increases quality,
and the quick feedback decreases the time and cost of removing the identified defects.
13
Continuous Delivery Overview
Suggested readings:
● Test Driven Development: By Example, Kent Beck: Addison-Wesley Professional
(2003)
● Growing Object-Oriented Software Guided by Tests, Steve Freeman and Nat Pryce:
Addison-Wesley Professional (2009)
● Specification by Example: How Successful Teams Deliver the Right Software, Gojko
Adzic: Manning Publications (2011)
Trunk-based development
Branching and merging configuration-management (CM) techniques are used to prevent and
manage conflicting changes when parallel software developments are going on at the same
time in the same code base. These techniques have huge hidden costs in terms of planning
and process, time and effort, and risk and rigidity. Long integration and stabilization phases
with an uncertain outcome must precede every release when you have long-lived branches,
and many man-months of work can get lost because of merge conflicts that are hard or
impossible to resolve.
In TBD, all development is done on the mainline (also known as the head or trunk) of the
source-code repository. All the developers commit the code to the mainline at least once per
day. They commit only potentially releasable code using practices like latent-code patterns,
feature toggles, and branch by abstraction. Also, every new release is built from the mainline.
CI, automated testing, and iterative software development are technical practices that
support TBD.
With TDB, release branches are used only to support older versions of a product.
Experiment branches are used for experiments and spikes that are never merged back to
the mainline. All other kinds of branches in TBD are avoided, and in any case a branch
always lasts less than one working day.
Suggested readings:
● What Is Trunk Based Development?, Paul Hammant (2013)
● Feature Branch, Martin Fowler (2009)
● "Forces of Branching and Parallel Development", in Branching Patterns for Parallel
Software Development, B. Appleton, S. Berczuk, R. Cabrera, and R. Orenstein
(1998)
Latent-code patterns
Latent-code patterns are used to support TBD. They enable developers to commit frequently
to the mainline only potentially releasable code even when the feature or change request
14
Continuous Delivery Overview
they are implementing is not yet finished – or when it is finished but the business decision to
release the feature has not yet been taken.
Latent code is code that is committed to the mainline of the source-code repository, is in the
code base, and implements features that get tested by the automatic tests, but remains
inaccessible to the user in the application released to the public.
Latent-code patterns are all these patterns that allow latent code in the code base. Doing
TDD along with ATDD though an API layer while keeping the code inaccessible from the
GUI is the simplest way to have latent code. The most well-known are feature toggles,
branch by abstraction, and dark launching.
Feature toggles
Martin Fowler explains that features toggles basically have a configuration file that defines a
bunch of toggles for various features that are pending. The running application then consults
these toggles in order to decide whether or not to show the feature.
Branch by abstraction
Paul Hammant from ThoughtWorks coined the term to describe the technique of defining an
abstraction in the code so that two implementations can be provided for the abstraction. One
implementation is the original code that will be used in production and the other is the
feature or change request under development that is not yet finished or not ready to be
released, used only in tests.
Dark launching
Dark launching is a well-known latent-code pattern that goes one step further.
With dark launching, a new feature is released to a subset of users and is not shown in the
user interface. Instead, special code automatically triggers the hidden feature with the aim of
testing the infrastructure involved in serving that feature.
See also: "Canary Releasing" in Continuous Delivery, Jez Humble and David Farley:
Addison-Wesley (2010)
Automatic deployment
After a CI build, the application has to be installed in test environments in order to run the
tests. The application should be installed into the production environment in exactly the
15
Continuous Delivery Overview
same way to avoid variations that could produce non-detectable bugs in the test
environments.
Automatic deployment avoids these problems and is faster, repeatable, testable, and
traceable.
Automatic deployment here refers to the ability to automatically deploy, into testing and
production environments, a new version of an application simply by running the same
automatic script. Automatic deployment takes care of all the operations required (including
changes to the application and infrastructure configurations, updates to the database, etc.)
without requiring any further manual activities. The deploy scripts are stored in and retrieved
from a version-control system.
One important goal of CD is the ability to deploy during normal business hours instead of
being limited to deployments during off-peak hours. A further improvement consists of
limiting the interruptions and disruptions for users when deploying to production. This allows
the business to decide when and how often to release a new version of the application
without affecting the users.
The ideal situation is to do hot deployments with zero downtime. It means to deploy to
production without the need to stop and restart the system or the application and without
interrupting the work of the users. This definition applies, with small differences, to mobile
applications, desktop applications, client-server applications, Web applications, and Web
services.
This capability depends on the design and architecture of the system, on the automatic-
deployment procedure and on the data-migration strategy.
Can you imagine driving a car without brakes? You would drive slowly or you would crash.
Remediation plans, like the brakes in a car, let a dev team run faster and safer at the same
time.
In general, CD practices provide the ability to recover quickly from mistakes and defects with
little or no consequence.
When a new version of an application is released into production but starts to malfunction or
users report a showstopper bug, different techniques can help to remedy the problem. The
following is a list of the common techniques.
16
Continuous Delivery Overview
Sometimes the update that causes a showstopper bug contains changes to related moving
parts, e.g. an update of the database schema and a change to a related feature, or a change
to a service and a change to its public API, which affects the clients. The rollback of both
moving parts at the same time may not be a viable solution, e.g. when the database size or
the number of different clients is too large.
A good strategy to deal with this situation is to decouple the changes of the related parts and
deploy to production one part at a time. In this way, rollback is a viable option again. A way
to achieve this is to create and deploy a forward-compatible interim version of one of the
moving parts, i.e. an application that is identical to the previous version except that is
compatible with both the current database schema and the new one, or a service that is
identical to the previous one except that it supports both the current public API and the new
one.
17
Continuous Delivery Overview
A code base is all the source code associated with an application or a collection of
applications. It is self-contained in the sense that it can be built without the need to reference
resources outside the code base itself.
When the code base grows, the time required for the automatic build grows as well.
When the automatic build spends most of the time running automated tests, the cause can
be the proportion of different types of test (e.g. unit tests, integration tests, acceptance tests).
The tests pyramid defines a good heuristic for the proportion of the different types of tests:
you should have many more low-level unit tests than high-level end-to-end tests through the
GUI. It is worthwhile checking the tests against the guidelines from the tests pyramid.
Suggested reading:
● Succeeding with Agile, Mike Cohn: Addison-Wesley Professional (2009)
When you have hyperactive builds because shared components and services trigger a chain
reaction, other approaches should be used.
Google’s approach is to provide every developer with the tools to verify the code and get
valuable feedback before committing the changes and triggering a new build. In this way,
errors can be identified before triggering builds. Google uses a cluster of machines to
execute the builds. It is a brute-force approach that, among other things, enables the
collection and analysis of empirical data about the production code (e.g. code-base growth
trends), the test code, and the test results (e.g. the system suggests deleting tests that
teams spend much time maintaining and often flag errors for reasons other than real bugs).
Amazon’s approach is to turn existing components and services into autonomous units that
are split into distinct code bases, each one treated as a separate product. Compile time is
reduced because a component or service does not need to be rebuilt by every application
that uses it and only a new, official release of a component or service triggers the build of the
applications that use it.
Components and services enable software reuse, encapsulate complexity, and group similar
responsibilities.
Suggested readings:
● Packaging cohesion and coupling principles, Robert C. Martin, 2002
● "A Conversation with Werner Vogels". ACM Queue, 4(4), (2006, May)
● Google's Scaled Trunk Based Development, Paul Hammant (2013)
● Microservices, James Lewis and Martin Fowler (2014)
18
Continuous Delivery Overview
A deployment pipeline uses different environments to build the code and run a variety of
tests. Some of these environments are similar to the production environment and include the
database and other services and configurations.
Infrastructure automation is intended to automatically create from scratch every test and
production environment, from the operating system to the installation and configuration of
the required software and services (networking, DNS, Web server, email server, etc.), and to
automatically apply all the configurations expected for the environment.
Infrastructure as code means to treat the configuration of systems the same way that
software source code is treated.
The goal of infrastructure automation and infrastructure as code is to have environments that
are always in a well-known state and to avoid unnecessary variations that can invalidate the
result of the tests or be a source of bugs in production that are very hard to reproduce.
Suggested readings:
● Snowflake Server, Martin Fowler (2012)
● Immutable Server, Kief Morris (2013)
A proper monitoring strategy allows detection of problems in the production system as early
as possible and gives IT ops more time to react, identify the source of the problem, and fix it.
Monitoring also provides valuable data for QA about the functioning of the application in
production. Monitoring should also be applied in the test environment for the same reason
and this is also an effective way to test the monitoring strategy.
So if there is any rule to selecting tools to support software delivery and support, it is to
assume that:
any tools chosen may need to be changed in the future.
19
Continuous Delivery Overview
Tools need to evolve and adapt to the changes and evolution of the product and the code
base. It’s a dance, and no one can stand still. Whatever tools your team decides to use, the
most important thing is to continuously review how well they are working for you, and to be
able to make improvements and changes as needed.
Following good practice around software and system design helps by ensuring that
individual tools are loosely coupled and surrounded by automated testing, monitoring, and
validation to allow refactoring with confidence.
The elements of a typical deployment pipeline include a tool to orchestrate building software
components and applications, triggering deployments to environments, launching automated
tests, and managing the promotion of artifacts through a progressive series of environments
and gates. Ideally, the orchestration tool should not be tightly coupled to these concerns but
should simply be used to manage when these things happen.
All of the software used for building, deploying, and testing software should be available for
all members across the delivery organisation to use. Developers should be able to deploy
software to a production-like operating system, perhaps locally using Vagrant, so they can
replicate and troubleshoot issues. Developers should also be able to read and run
automated tests themselves so they can check their changes and validate whether they
have fixed defects reported by QA.
There is often a desire to choose a single tool for software deployment across the
organisation. However, it's usually better to use tools and packaging formats designed for
the specific application type and system platform, such as RPMs for Red Hat systems.
Similarly for application build scripting, unit testing and similar tooling that relates to a
specific programming language or platform are best used in preference to universal tools.
Quite often, a tool that tries to work for a variety of different systems offers consistency at the
cost of effectiveness.
20
Continuous Delivery Overview
Every organization is different, on a different point of its own path to CD and faces a different
bottleneck that needs to be tackled.
Suggested reading:
● The Phoenix Project: A Novel About IT, DevOps, and Helping Your Business Win,
Gene Kim, Kevin Behr, and George Spafford (2013)
LinkedIn
Between 2011 and 2013, LinkedIn switched from a waterfall-like development process to CD,
taking a system that requires a month to release new features and turning it into one that
pushes updates into production multiple times per day.
Kevin Scott, longtime Google veteran, joined LinkedIn in 2011 and decided to import
Google’s practice of CD at LinkedIn. Read the article "The Software Revolution Behind
LinkedIn’s Gushing Profits" from Wired.
Facebook
Facebook has deployed software into production multiple times per week since 2005.
Nowadays, with more than 1,000 developers, they release into production many times per
day, affecting more than 845 million people.
Chuck Rossi, release engineer at Facebook since 2008, advises, "Ship early and ship often."
21
Continuous Delivery Overview
HP LaserJet Firmware
The LaserJet FutureSmart Firmware division at HP has more than 400 software engineers
working on a large code base of 10 million lines of code. In 2008, the software division was
the bottleneck for the business and the company's printer products were lagging behind the
competition. They were following a traditional approach for software delivery, using multiple
branches and taking more than six weeks to integrate and complete testing cycle.
Between 2008 and 2011, the firmware division made a successful transition to a modern
approach in the direction of CI and CD, reaching the capacity to run 15 builds per day and
run all automated regressions testing in only 24 hours, reducing costs by 70% and creating
extra capacity for innovation. This case study is documented in the book A Practical
Approach to Large-Scale Agile Development: How HP Transformed LaserJet FutureSmart
Firmware.
Flickr
Flickr in 2004 was a Web startup that one year later was acquired by Yahoo, and in 2013
reached 87 million registered members. Flickr was one of the first well-known examples of
companies using CD. In 2008, the famous code.flickr.com page went live to report on
releases and the authors of the code changes. Starting in 2008, people from Flickr began to
share their experiences in CD at international conferences.
22
Continuous Delivery Overview
Luca Minudel
Kief Morris
23