automation and the deployment pipeline

28
Automation & the Deployment Pipeline Adam Goucher @adamgoucher [email protected] This workshop is about the various forms of automation that happens in the Deployment Pipeline. On this slide we talk about: - The Going Camping Heuristic photo credit: http://www.flickr.com/photos/nataliejohnson/2763306217/

Upload: adam-goucher

Post on 16-Jan-2015

3.639 views

Category:

Documents


1 download

DESCRIPTION

This is the deck for a [number of] talks I do on Continuous Delivery and where automation fits into each step of getting code out of a product owner's imagination and into the hands of eager users.

TRANSCRIPT

Page 1: Automation and the Deployment Pipeline

Automation & the Deployment Pipeline

Adam Goucher@adamgoucher

[email protected] workshop is about the various forms of automation that happens in the Deployment Pipeline.

On this slide we talk about:- The Going Camping Heuristic

photo credit: http://www.flickr.com/photos/nataliejohnson/2763306217/

Page 2: Automation and the Deployment Pipeline

End-user PerspectiveFrom the end-user perspective, your application just delivers its <thing> to them.

photo credit: http://www.flickr.com/photos/auntlaura/4806934654/

Page 3: Automation and the Deployment Pipeline

RealityWe know that the reality is slightly different. But even this is well organized and logical -- if you understand the system.

photo credit: http://www.flickr.com/photos/incandopolis/2867941478/

Page 4: Automation and the Deployment Pipeline

An Ethical DistinctionOn this slide we talk about:- Continuous Delivery vs Continuous Deployment

http://www.flickr.com/photos/8840244@N04/3644022974/

Page 5: Automation and the Deployment Pipeline

The Lightsaber HeuristicThere are commercial tools available to do all this stuff. Instead, we’ll use all open-source tools to build a custom solution.

On this slide we talk about:- The Lightsaber Heuristic

photo credit: http://www.flickr.com/photos/pasukaru76/3694179131/

Page 6: Automation and the Deployment Pipeline

Lots of parts, working togetherTo have a fully automated deployment pipeline, there are /lots/ of moving parts. The big ones are- acceptance criteria- configuration management- continuous integration- data migration- deployment- functional test automation- immunization systems.

We will be talking about each of these

photo credit: http://www.flickr.com/photos/19779889@N00/4398186065/

Page 7: Automation and the Deployment Pipeline

The best way to illustrate all these things is to do them live. As a result, we will create a Ruby-on-Rails application and have push it through each part of the Deployment Pipeline. Both the application and all the pipeline support code will be made available shortly after the workshop.

Page 8: Automation and the Deployment Pipeline

SpecificationsIt can be argued when the Pipeline really starts. So lets start from the beginning; with acceptance criteria.

On this slide we talk about:- Specification Workshops- Given / When / Then

I’m not a fan of any of the current BDD/ATDD tools from an automation perspective, but going through the exercise of producing the specifications absolutely has merit.

photo credit: http://www.flickr.com/photos/wallyhartshorn/2680766935/

Page 9: Automation and the Deployment Pipeline

Manual InspectionFor our purposes though, the automation part begins when someone inspects their change as to whether it is time to Commit.

photo credit: http://www.flickr.com/photos/mooney77/229524092/

Page 10: Automation and the Deployment Pipeline

Commit

There is one path through the pipeline and our Commit starts it.

On this slide we talk about:- Check-in vs. Commit- Clean vs. dirty trunk- Pre-Commit checks- Commit checks- Post-Commit checks

photo credit: http://www.flickr.com/photos/jkgroove/119112238/

Page 11: Automation and the Deployment Pipeline

‘Cans’Once our code is versioned, we need to have machines to run our checks against.

On this slide we talk about:- Machines as ‘cans’

photo credit: http://www.flickr.com/photos/neonman/1438473495/

Page 12: Automation and the Deployment Pipeline

Puppet

Puppet

On this slide we talk about:- Puppet vs. Chef vs. Cfengine- What Configuration Management is.... and isn’t

And we provision our server, demonstrating how Puppet controls- packages- services- users/groups

photo credit: http://www.flickr.com/photos/sukigirl74/2716951216/

Page 13: Automation and the Deployment Pipeline

ContinuousIntegration

With a machine to run things again, we now turn our attention to the control center of the whole Pipeline; the Continuous Integration server.

photo credit: http://www.flickr.com/photos/clintjcl/2847746499/

Page 14: Automation and the Deployment Pipeline

Jenkins

Jenkins (part one)

On this slide we talk about:- Role of CI- Jenkins vs. Hudson

And we configure Jenkins for our application, demonstrating- Jobs- Job chains- Authentication- Remote agents- Reporting- Notifications- Plugins

Page 15: Automation and the Deployment Pipeline

Data MigrationData Migration is tricky. To say the least. But getting it right is critical to getting your pipeline fully automated

On this slide we talk about:- Up- Down- Idempotency

Because we’re using Ruby-on-Rails, we’ll use ActiveRecord Migrations for our pipeline but we’ll also look at dbdeploy

photo credit: http://www.flickr.com/photos/theclyde/1663944456/

Page 16: Automation and the Deployment Pipeline

DeploymentCompared to everything else before now, pushing the code out onto the server(s) is a snap.

On this slide we talk about:- Zero-downtime deploys- Rollbacks

Most ‘platforms’ have a deployment tool that has grown with it. For our deployments, we’ll be using Capistrano. Cap is not limited to just Ruby-on-Rails deployments though so we’ll talk about how to customize it for a number of different scenarios.

photo credit: http://www.flickr.com/photos/mybloodyself/464597917/

Page 17: Automation and the Deployment Pipeline

Functional AutomationSo we’re finally at the point where we can do some ‘traditional’ automation. And since our stack is all Open Source, we’re going to use Selenium.

photo credit: http://www.flickr.com/photos/kwc/1866220494

Page 18: Automation and the Deployment Pipeline

Papers please

Uniquely identifying things on the page is one of the hardest parts about doing web automation. And is one of the main reasons scripts are ‘brittle.’

On this slide we talk about:- attribute-based locators- structural locators- when to use which locator

photo credit: http://www.flickr.com/photos/michaelimage/2843233811/

Page 19: Automation and the Deployment Pipeline

Synchronization

The other common pain point for web automation is synchronizing the script steps with the application

On this slide we talk about:- Web 1.0- Web 2.0- Web 2.0++

photo credit: http://www.flickr.com/photos/bfauld1/121955292/

Page 20: Automation and the Deployment Pipeline

Randomness

Introducing randomness into your scripts is important -- use it!

On this slide we talk about:- Providers- Oracles

photo credit: http://www.flickr.com/photos/richardsummers/195510085/

Page 21: Automation and the Deployment Pipeline

Pesticide ParadoxImagine you are a farmer...

On this slide we talk about:- The Pesticide Paradox

photo credit: http://www.flickr.com/photos/gregoryjordan/4735058616/

Page 22: Automation and the Deployment Pipeline

Land mine problemYou should find the mines.

Not.

Your.

Customer.

On this slide we talk about:- The Land Mine Problem- Continuous Delivery vs. Continuous Deployment

photo credit: http://www.flickr.com/photos/d-minor/120407151/

Page 23: Automation and the Deployment Pipeline

TagsManual built suites of scripts is a code smell

On this slide we talk about:- Tags- Tag taxonomies- Script discovery- Parallel execution- Random execution

photo credit: http://www.flickr.com/photos/thingsarebetterwithaparrott/1437904057/

Page 24: Automation and the Deployment Pipeline

Page Objects

Page Objects bring the power of OO to automation

On this slide we talk about:- Page Objects

For our project, we will construct some Page Object based Selenium scripts using RSpec. Though we can discuss and/or create examples of them in other languages too.

photo credit: http://www.flickr.com/photos/dmclean/2472399095/

Page 25: Automation and the Deployment Pipeline

Jenkins (Redux)

Jenkins (again)

On this slide we talk about:- Using Jenkins as a replacement for se-grid- Advanced job chaining

Page 26: Automation and the Deployment Pipeline

Immunization Systems

Immunizations shots keep you healthy. Immunization systems keep your deployments healthy.

On this slide we talk about:- Immunization Systems- Business vs. Technical metrics- Incremental deployments- Automated rollback

In order to ensure our deployment will not negatively impact our users, we will build a basic Immunization System for our application. By their nature, these are highly customized per application.

photo credit: http://www.flickr.com/photos/irenemiranda/4683185743/

Page 27: Automation and the Deployment Pipeline

G-ForcesKent Beck uses the notion of G-Forces to explain how things respond to speeding up your process. With a fully automated deployment pipeline things will be able to go faster. And faster.

But you could also get thrown from the carousel, so be careful.

On this slide we talk about:- Kent Beck’s G-Forces

photo credit: http://www.flickr.com/photos/areyoumyrik/308908736/

Page 28: Automation and the Deployment Pipeline

Adam Goucher@adamgoucher

[email protected]

photo credit: http://www.flickr.com/photos/teimoury/2431264409/