Steps to Creating an Effective DevOps-Focused Deployment Pipeline
Learn about the core stages of continuous delivery, how you can effectively use a Kanban board within your team, and more.
Join the DZone community and get the full member experience.Join For Free
continuous delivery is a set of practices and principles aimed at building, testing, and releasing software faster and more frequently. if you're lucky enough to start out in a "greenfield" organization without an established coding culture, it's a good idea to try to create and automate your software delivery pipeline upfront. if you're successful out-of-the-gate in creating a continuous delivery pipeline, your business will be much more competitive since you'll be able to get higher-quality software into the hands of your users and customers faster than your competitors, and you'll be able to react to business demand and change much more rapidly.
if you are adding a continuous delivery (cd) pipeline to an existing organization, where you start depends on your current development and testing practices and the bottlenecks in your software delivery process. these bottlenecks can include slow, error-prone manual processes as well as poor-quality, big-bang rollouts that fail in production, leading to unhappy users.
there are several ways to get a handle on the current state of your deployment processes, including using workflow visualization tools like flowcharts and business process maps to break down and understand your current delivery processes. one of the simplest visual process management tools you can use to help make these kinds of decisions is a kanban board.
kanban boards, like the one pictured below, are typically just sticky notes on a whiteboard that are used to communicate project status, progress, and other issues.
many organizations today are also experimenting with value stream maps (vsms) to better understand the infrastructure changes needed to automate their software delivery process. borrowed from the lean manufacturing camp, a vsm is a technique used to analyze value chains, which are the series of events required to bring a product or service to a consumer.
a value stream map, like the one pictured below, shows both material and information flow. not only does it show process flow but it includes data associated with each process such as inventory between processes. it describes the method by which material moves from one process to another, and information flows between production control (a central production scheduling or control department, person or operation) and various processes, suppliers, and customers, including customer demand.
current state value stream map with environmental, health and safety (ehs) data
mary and tom poppendieck, who adapted concepts of lean manufacturing and value stream mapping to the software development process in their highly-regarded book, implementing lean software development , stress the importance of starting and ending with real customer demand. this means that a software organization that delivers multiple software products, such as a company doing game development, may want to use a vsm to optimize the delivery process for a popular product that brings in more revenue to the company, before adapting the new process to less-popular products.
building a successful cd pipeline means creating a devops culture of collaboration among the various teams involved in software delivery (developers, operations, quality assurance teams , management, etc.), as well as reducing the cost, time, and risk of delivering software changes by allowing for more incremental updates to applications in production. in practice, this means teams produce software in short cycles, ensuring that the software can be reliably released at any time.
how short can you make your cycles? it depends on the degree of collaboration and trust you can build among the teams involved, as well as the amount of resources and time you devote to automating your delivery process. you can also use value chain mapping to measure your progress in creating a cd pipeline, which can be done in two steps:
- the first step measures the efficiency of the different build, deploy and test stages of the current state of your software delivery. in doing time measurements (in whatever metric you choose: minutes, hours, or days), you initially try to determine execution time and the wait time in each step. wait time, in this case, is any non-value added activity such as handoffs, signoffs, manual processes, or delays caused by hardware and software issues.
- the second step measures the efficiency of the different build, deploy, and test stages your software delivery target state. as you remove non-value added activity by implementing the core stages of devops continuous delivery (continuous integration, test automation, continuous deployment, etc.) , you'll then be able to measure your progress in implementing your cd pipeline.
it may seem as if you're trying to hit a moving target if the vsm target state is not fully continuous or automatic, but that's acceptable because this approach provides a clear and measurable improvement path toward a cd pipeline that should highlight many or most of the bottlenecks in your current software delivery approach.
(check out asheesh mehdiratta's use of value stream maps to build a dashboard that highlights the efficiency gains possible in using continuous delivery to remove waste from the software production process.)
core stages of continuous delivery
because large and slow software releases make for buggy and unreliable code, continuous delivery pipelines rely on frequent releases of smaller amounts of functionality. a typical cd pipeline can be broken down into the following sequence of stages:
stage one: build automation
build automation is the first stage in moving toward implementing a culture of continuous delivery and devops. if your developers are practicing test-driven development (tdd), they'll write unit tests for each piece of code they write, even before the code itself is written. an important part of the agile methodology, tdd helps developers think through the desired behavior of each unit of software they're building, including inputs, outputs, and error conditions. new features implemented by developers are then checked into a central code base prior to the software build, which compiles the source code into binary code. with build automation, the software build happens automatically, using tools such as makefiles or ant, rather than when a developer manually invokes the complier.
stage two: continuous integration
in continuous integration, developers check code into a shared repository several times a day. each check-in is then verified by an automated build, allowing teams to detect errors and conflicts as soon as possible. originally one of the fundamental practices outlined in the extreme programming (xp) methodology pioneered by developers like martin fowler, continuous integration (ci) has become an essential ingredient for teams doing iterative and incremental software delivery.
stage three: test automation
the next stage in implementing your deployment pipeline is test automation . manual testing is a time-consuming and labor-intensive process and, in most cases, also a non-value added activity since you're only trying to verify that a piece of software does what it’s supposed to do.
if developers are integrating code into a shared repository several times a day, testing needs to be done continuously as well. this means running unit tests, component tests (unit tests that touch the filesystem or database), and a variety of acceptance and integration tests on every check-in. use the following agile testing quadrants matrix (developed by brian marick and refined by lisa crispin) to prioritize the many different types of tests that you intend to automate in your cd pipeline. there are no hard and fast rules about what tests (performance, functionality, security, user acceptance, etc.) to automate, when to automate them, or even whether certain manual tests really need automation. crispin and other agile testing experts favor automating unit tests and component tests before other tests since these represent the highest return on investment.
stage four: deployment automation
in the last stage of the pipeline, once an application passes all the required tests, it's then released into production. for all intents and purposes, this means releasing every good build to users. the upside of deployment automation is that it allows delivery of new functionality to users within minutes whenever it's needed, as well as instant feedback to the devops team that, in turn, allows them to respond rapidly to customer demand.
because deployment is carried out automatically as software moves through the delivery pipeline and devops teams are trying to quickly respond to a variety of customer requests, the downside of automated deployment is downtime caused by software that may not be production-ready. to achieve zero downtime, devops teams commonly take advantage of a couple of different deployment strategies for their deployment pipelines: “canary releasing” and “blue-green deployment.”
canary releasing is an allusion to the caged birds that early-day miners would carry down into mine tunnels with them to check to see if the air was safe to breathe or not. this strategy involves releasing the next version of your software into production, but only exposing it to a small percentage of your user base. after it passes a number of environmental tests, you then release it to more servers in your infrastructure and route more users to it.
the blue-green deployment strategy involves setting up the latest version of your application on an identical clone of your production application stack, and then switching traffic from the current production stack to the new one as soon as the application passes all the manual and automated tests in your deployment pipeline. this ties into the concept of using cloud resources and virtual infrastructure to setup and manage your deployment pipeline.
a fully automated deployment pipeline requires the ability to deploy and release any version of a software application to any environment. doing this effectively requires infrastructure automation, where environments (machines, network devices, operating systems, middleware, etc. ) can be configured and specified in a fully automatable format.
infrastructure as code (iac) has become increasingly widespread with the adoption of cloud computing and infrastructure as a service (iaas), which relies on virtual machines and other resources that cloud providers like amazon web services and microsoft azure supply on-demand from their large pools of equipment installed in data centers. iac lets devops teams automatically manage and provision iaas resources using high-level programming languages. in practice, this means developers have the ability to control most or all iaas resources via api calls, in order to do things like start a server, load balance, or start a hadoop cluster. many devops shops also let developers write or modify an iac template to provision and deploy new applications instead of relying on operators or system administrators to manage the operational aspect of their devops environment.
infrastructure as code is a powerful tool to help build an effective continuous delivery pipeline. but it can also lead to deployment chaos if your organization doesn't have an established devops culture in place with the right tools such as devops test management and high-value workgroup qualities like teamwork and trust. use the value steam mapping approach outlined above to build the collaboration and trust you'll need to achieve the goal of creating a software deployment pipeline that delivers new features to users as fast and efficiently as possible.
Published at DZone with permission of Sanjay Zalavadia, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.