8 Principles of Continuous Delivery
Join the DZone community and get the full member experience.Join For Free
dave farley co-authored “continuous delivery”, an excellent book in the martin fowler signature series, which goes into great detail about the evolution of continuous integration, and how to achieve continuous delivery (or continuous deployment) using “build pipelines”.
i went along to hear dave farley give a talk on continuous delivery and how they’re doing it where he works, at lmax. it was a really great session and he managed to cover, in quite a short session, a great deal of content from in the book. i’ve put together a highlight of what he covered in the talk, mixed with my own take on things
here’s what i learned…
continuous delivery is basically the logical extension of continuous integration – it’s a more holistic solution than c.i. though, as it encapsulates a lot more than just the development of software.
for instance, continuous delivery focuses a lot more on requirements than c.i. ever did, and involves a great deal more people on the delivery chain than traditional c.i. as well. it also has a greater customer focus than c.i.
now, here’s something i didn’t know about continuous delivery…
there are 12 principles behind the agile manifesto. the first of which is:
our highest priority is to satisfy the customer through early and continuous delivery of valuable software
well who’d have thought it? continuous delivery was mentioned waaaaay back in the days of the agile manifesto, some 2500 years bc* and yet for most of us it seems like a pretty new idea.
continuous delivery is based on the use of smart automation. this is all about creating a repeatable and reliable process for delivering software. you have to automate pretty much everything in order to be able to achieve continuous delivery. manual steps will get in the way or become a bottleneck. this goes for everything from requirements authoring to deploying to production.
the focus is on the finished article – again, this is described as being:
working software in the hands of the user
because the focus is on the software in the hands of the user , there’s less tendency from a developers perspective, to simply chuck software over the wall to the qa team, and similarly to the netops/production team.
continuous delivery is all about getting that product out there, and getting the feedback from the users. this might mean delivering “unfinished” demo software during your development iterations, and getting your users to give valuable early feedback, or it might mean deploying experimental software to a website cluster and tracking how successful this new site is as compared to the existing system. either way, it’s all about feedback loops . essentially you want to have as rapid a feedback loop with your users as possible.
feedback loops are familiar to everyone who has worked on a continuous integration system. in c.i. feedback loops are generally about getting test feedback (unit test, acceptance test, performance test etc) as quickly as possible – “fail fast” – as you’ve probably heard.
continuous delivery, as described, takes this idea to it’s logical conclusion, and gets the users involved in the feedback loop . this is a good example of how continuous delivery is more holistic than its c.i. predecessor. in continuous delivery, the feedback loop provides feedback not only on the quality of your code, but on the quality of your requirements, and the quality of your processes for delivering software.
8 principles of continuous delivery
- the process for releasing/deploying software must be repeatable and reliable . this leads onto the 2nd principle…
- automate everything! a manual deployment can never be described as repeatable and reliable (not if i’m doing it anyway!). you have to invest seriously in automating all the tasks you do repeatedly, and this tends to lead to reliability.
- if somethings difficult or painful, do it more often. on the surface this sounds silly, but basically what this means is that doing something painful, more often, will lead you to improve it, probably automate it, and this will eventually make it painless and easy. take for example doing a deployment of a database schema. if this is tricky, you tend to not do it very often, you put it off, maybe you’ll do 1 a month. really what you should do is improve the process of doing the schema deployments, get good at it, and do it more often, like 1 a day if needed. if you’re doing something every day, you’re going to be a lot better at it than if you only do it once a month.
- keep everything in source control – this sounds like a bit of a weird one in this day and age, i mean seriously, who doesn’t keep everything in source control? apparently quite a few people. who knew?
- done means “released” . this implies ownership of a project right up until it’s in the hands of the user, and working properly. there’s none of this “i’ve checked in my code so it’s done as far as i’m concerned”. i have been fortunate enough to work with some software teams who eagerly made sure their code changes were working right up to the point when their changes were in production, and then monitored the live system to make sure their changes were successful. on the other hand i’ve worked with teams who though their responsibility ended when they checked their code in to the vcs.
- build quality in! take the time to invest in your quality metrics. a project with good, targeted quality metrics (we could be talking about unit test coverage, code styling, rules violations, complexity measurements – or preferably, all of the above) will invariably be better than one without, and easier to maintain in the long run.
- everybody has responsibility for the release process. a program running on a developers laptop isn’t going to make any money for the company. similarly, a project with no plan for deployment will never get released, and again make no money. companies make money by getting their products released to customers, therefore, this process should be in the interest of everybody. developers should develop projects with a mind for how to deploy them. project managers should plan projects with attention to deployment. testers should test for deployment defects with as much care and attention as they do for code defects (and this should be automated and built into the deployment task itself).
- improve continuously. don’t sit back and wait for your system to become out of date or impossible to maintain. continuous improvement means your system will always be evolving and therefore easier to change when needs be.
to go with these principles there are also:
4 practices of continuous delivery
- build binaries only once. you’d be staggered by the number of times i’ve seen people recompile code between one environment and the next. binaries should be compiled once and once only. the binary should then be stored someplace which is accessible only to your deployment mechanism, and your deployment mechanism should deploy this same binary to each successive environment…
- use precisely the same mechanism to deploy to every environment. it sounds obvious, but i’ve genuinely seen cases where deployments to qa were automated, only for the production deployments to be manual. i’ve also seen cases where deployments to qa and production were both automated, but in 2 entirely different languages. this is obviously the work of mad people.
- smoke test your deployment. don’t leave it to chance that your deployment was a roaring success, write a smoke test and include that in the deployment process. i also like to include a simple diagnostics test, all it does it check that everything is where it’s meant to be – it compares a file list of what you expect to see in your deployment against what actually ends up on the server. i call it a diagnostics test because it’s a good first port of call when there’s a problem.
- if anything fails, stop the line! throw it away and start the process again, don’t patch, don’t hack. if a problem arises, no matter where, discard the deployment (i.e. rollback), fix the issue properly, check it in to source control and repeat the deployment process. a lot of people comment that this is impossible, especially if you’ve got a tiny outage window to deploy things to your live system, or if you do your production changes are done in the middle of the night while nobody else is around to fix the issue properly. i would say that these arguments rather miss the point. firstly, if you have only a tiny outage window, hacking your live system should be the last thing you want to do, because this will invalidate all your other environments unless you similarly hack all of them as well. secondly, the next time you do a deployment, you may reintroduce the original issue. thirdly, if you’re doing your deployments in the middle of the night with nobody around to fix issues, then you’re not paying enough attention to the 7th principle of continuous delivery – everybody has responsibility for the release process. unless you can’t avoid it, i wouldn’t recommend doing releases when there’s the least amount of support available, it simply goes against common sense.
* approximate date. ok, very approximate.
Opinions expressed by DZone contributors are their own.