SlideShare una empresa de Scribd logo
1 de 28
Descargar para leer sin conexión
Automation & the
                     Deployment Pipeline


                                                   Adam Goucher
                                                   @adamgoucher
                                                 adam@element34.ca
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/
End-user Perspective
From the end-user perspective, your application just delivers its <thing> to them.

photo credit: http://www.flickr.com/photos/auntlaura/4806934654/
Reality
We 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/
An Ethical Distinction
On this slide we talk about:
- Continuous Delivery vs Continuous Deployment

http://www.flickr.com/photos/8840244@N04/3644022974/
The Lightsaber Heuristic
There 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/
Lots of parts, working together
To 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/
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.
Specifications
It 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/
Manual Inspection
For 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/
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/
‘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/
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/
Continuous
                                                                                                              Integration




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/
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
Data Migration
Data 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/
Deployment
Compared 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/
Functional Automation
So 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
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/
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/
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/
Pesticide Paradox
Imagine you are a farmer...

On this slide we talk about:
- The Pesticide Paradox

photo credit: http://www.flickr.com/photos/gregoryjordan/4735058616/
Land mine problem
You 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/
Tags
Manual 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 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/
Jenkins (Redux)




Jenkins (again)

On this slide we talk about:
- Using Jenkins as a replacement for se-grid
- Advanced job chaining
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/
G-Forces
Kent 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/
Adam Goucher
                                                @adamgoucher
                                              adam@element34.ca




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

Más contenido relacionado

Más de Adam Goucher

Selenium IDE - The future if plugin-y
Selenium IDE - The future if plugin-ySelenium IDE - The future if plugin-y
Selenium IDE - The future if plugin-yAdam Goucher
 
You're doing it wrong
You're doing it wrongYou're doing it wrong
You're doing it wrongAdam Goucher
 
Everything I learned about Agile I learned from Pirates
Everything I learned about Agile I learned from PiratesEverything I learned about Agile I learned from Pirates
Everything I learned about Agile I learned from PiratesAdam Goucher
 
Agile Test Case Management
Agile Test Case ManagementAgile Test Case Management
Agile Test Case ManagementAdam Goucher
 
The Many Hats of a Tester
The Many Hats of a TesterThe Many Hats of a Tester
The Many Hats of a TesterAdam Goucher
 
Testing inspiration
Testing inspirationTesting inspiration
Testing inspirationAdam Goucher
 
Agile Hats Art Show
Agile Hats Art ShowAgile Hats Art Show
Agile Hats Art ShowAdam Goucher
 
Quality through the lens of Astrophysics
Quality through the lens of AstrophysicsQuality through the lens of Astrophysics
Quality through the lens of AstrophysicsAdam Goucher
 
Legend of Zealot Anarchist Robot
Legend of Zealot Anarchist RobotLegend of Zealot Anarchist Robot
Legend of Zealot Anarchist RobotAdam Goucher
 
Scripting Recipes KWSQA2009
Scripting Recipes KWSQA2009Scripting Recipes KWSQA2009
Scripting Recipes KWSQA2009Adam Goucher
 
Scripting Recipes for Testers
Scripting Recipes for TestersScripting Recipes for Testers
Scripting Recipes for TestersAdam Goucher
 
Adam Goucher I18n And L10n
Adam Goucher   I18n And L10nAdam Goucher   I18n And L10n
Adam Goucher I18n And L10nAdam Goucher
 
Performance Testing With Jmeter
Performance Testing With JmeterPerformance Testing With Jmeter
Performance Testing With JmeterAdam Goucher
 

Más de Adam Goucher (19)

Selenium IDE - The future if plugin-y
Selenium IDE - The future if plugin-ySelenium IDE - The future if plugin-y
Selenium IDE - The future if plugin-y
 
You're doing it wrong
You're doing it wrongYou're doing it wrong
You're doing it wrong
 
Namesmatter
NamesmatterNamesmatter
Namesmatter
 
Everything I learned about Agile I learned from Pirates
Everything I learned about Agile I learned from PiratesEverything I learned about Agile I learned from Pirates
Everything I learned about Agile I learned from Pirates
 
Agile Test Case Management
Agile Test Case ManagementAgile Test Case Management
Agile Test Case Management
 
Mitigation
MitigationMitigation
Mitigation
 
The Many Hats of a Tester
The Many Hats of a TesterThe Many Hats of a Tester
The Many Hats of a Tester
 
Testing inspiration
Testing inspirationTesting inspiration
Testing inspiration
 
Archetypes
ArchetypesArchetypes
Archetypes
 
Agile Hats Art Show
Agile Hats Art ShowAgile Hats Art Show
Agile Hats Art Show
 
Quality through the lens of Astrophysics
Quality through the lens of AstrophysicsQuality through the lens of Astrophysics
Quality through the lens of Astrophysics
 
Legend of Zealot Anarchist Robot
Legend of Zealot Anarchist RobotLegend of Zealot Anarchist Robot
Legend of Zealot Anarchist Robot
 
Scripting Recipes KWSQA2009
Scripting Recipes KWSQA2009Scripting Recipes KWSQA2009
Scripting Recipes KWSQA2009
 
Scripting Recipes for Testers
Scripting Recipes for TestersScripting Recipes for Testers
Scripting Recipes for Testers
 
Kids In Armor
Kids In ArmorKids In Armor
Kids In Armor
 
Adam Goucher I18n And L10n
Adam Goucher   I18n And L10nAdam Goucher   I18n And L10n
Adam Goucher I18n And L10n
 
Performance Testing With Jmeter
Performance Testing With JmeterPerformance Testing With Jmeter
Performance Testing With Jmeter
 
Selenium
SeleniumSelenium
Selenium
 
Slime
SlimeSlime
Slime
 

Automation and the Deployment Pipeline

  • 1. Automation & the Deployment Pipeline Adam Goucher @adamgoucher adam@element34.ca 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/
  • 2. End-user Perspective From the end-user perspective, your application just delivers its <thing> to them. photo credit: http://www.flickr.com/photos/auntlaura/4806934654/
  • 3. Reality We 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/
  • 4. An Ethical Distinction On this slide we talk about: - Continuous Delivery vs Continuous Deployment http://www.flickr.com/photos/8840244@N04/3644022974/
  • 5. The Lightsaber Heuristic There 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/
  • 6. Lots of parts, working together To 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/
  • 7. 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.
  • 8. Specifications It 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/
  • 9. Manual Inspection For 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/
  • 10. 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/
  • 11. ‘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/
  • 12. 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/
  • 13. Continuous Integration 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/
  • 14. 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
  • 15. Data Migration Data 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/
  • 16. Deployment Compared 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/
  • 17. Functional Automation So 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
  • 18. 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/
  • 19. 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/
  • 20. 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/
  • 21. Pesticide Paradox Imagine you are a farmer... On this slide we talk about: - The Pesticide Paradox photo credit: http://www.flickr.com/photos/gregoryjordan/4735058616/
  • 22. Land mine problem You 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/
  • 23. Tags Manual 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/
  • 24. 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/
  • 25. Jenkins (Redux) Jenkins (again) On this slide we talk about: - Using Jenkins as a replacement for se-grid - Advanced job chaining
  • 26. 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/
  • 27. G-Forces Kent 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/
  • 28. Adam Goucher @adamgoucher adam@element34.ca photo credit: http://www.flickr.com/photos/teimoury/2431264409/