Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

ALM Summit 3 - Setting up a Continuous Delivery Deployment Pipeline with TFS

7,631 views

Published on

Slides for my session at ALM Summit 3, at Microsoft Redmond.

Published in: Technology

ALM Summit 3 - Setting up a Continuous Delivery Deployment Pipeline with TFS

  1. 1. Setting up a DeploymentPipeline with TFSJosé-Luis Soriajlsoria@plainconcepts.com@jlsoriat
  2. 2. Speaker Bio Chapter IOnce upon a time, there was a little kid whose name was José-Luis.Nobody knows the actual reason, but he began to be interested incomputers in the mid ’80s when, after so much careful consideration by hisparents, he received an 8bit computer as a present, along with some other stuffsuch as a bicycle and pajamas. That day he felt so happy with the bicycle, so frustrated with thepajamas, and somewhat confused about how to properly deal with the computer. Soon he started towrite all kinds of small and useless programs, but surprisingly none of them have made their way to being mentioned inthe history of computer programming. Several years later he went to university, where he studied Computer Science and signedup for the weirdest student associations. His strange inclination for Application Lifecycle Management began unexpectedly onesunny spring day when, while playing a soccer match, he was hit hard on the head by the ball and lost consciousness. When he woke up in bed athospital after a couple of days, all the words that came out of his mouth were about arcane and obscure matters related to version control systems,automated builds and similar kinds of esoteric no-brainers. From that moment on, his parents, close relatives and friends lost the small amount of hope they still had inJose’s ability to succeed in life and be a person of worth. This behavior has done nothing but get worse until the present day, when he travels around the world trying to
  3. 3. (shorter) Speaker Bio• ALM Team Leader at Plain Concepts• Professional Scrum Trainer for Scrum.org• From Madrid, Spain• Knows about Continuous Delivery with TFS ;-)
  4. 4. In This Session, You’ll Learn…What a pipeline is Potential benefitsWhy bother Success criteriaWho can use it Warning signsHow to implement it
  5. 5. What is a pipeline?
  6. 6. Deployment Pipeline AUTOMATED COMMIT MANUAL TESTING RELEASE ACCEPTANCE TEST1.0.1.11.0.1.21.0.1.3 AUTOMATED NON-FUNCTIONAL1.0.1.4 ACCEPTANCE TEST MANUAL TESTING TESTING
  7. 7. Another example
  8. 8. Stages AUTOMATED COMMIT MANUAL TESTING RELEASE ACCEPTANCE TEST1.0.1.11.0.1.21.0.1.3 AUTOMATED NON-FUNCTIONAL1.0.1.4 ACCEPTANCE TEST MANUAL TESTING TESTING
  9. 9. The Cowboy Coder Pipeline COMMIT RELEASE FIGHT FIRES 1.0.1.1 1.0.1.2 1.0.1.3 AUTOMATED 1.0.1.4 ACCEPTANCE TEST MANUAL TESTING
  10. 10. The Bureaucratic Pipeline FILL ASK BOSS RESERVE SNEAK INT ACCEPT. MANUAL BRIBE THE COMMIT OFFICIAL FOR DEPLOY TICKET THE SERVE TEST TESTING PERMISSION AT IT DEPT. ADMIN ROOM FORM1.0.1.11.0.1.21.0.1.3 AUTOMATED NON- NON- NON- NON- NON- MANUAL1.0.1.4 ACCEPTANCE TESTING FUNCTIONAL FUNCTIONAL FUNCTIONAL FUNCTIONAL FUNCTIONA TEST TESTING TESTING TESTING TESTING TESTING
  11. 11. Instances:Changes, Builds or Versions AUTOMATED COMMIT MANUAL TESTING RELEASE ACCEPTANCE TEST1.0.1.11.0.1.21.0.1.3 AUTOMATED NON-FUNCTIONAL1.0.1.4 ACCEPTANCE TEST MANUAL TESTING TESTING
  12. 12. The Waterfall-ish Pipeline AUTOMATED COMMIT MANUAL TESTING RELEASE ACCEPTANCE TESTSpring 2008 Fall 2009Summer 2011
  13. 13. Propagating Changes AUTOMATED COMMIT MANUAL TESTING RELEASE ACCEPTANCE TEST1.0.1.11.0.1.21.0.1.31.0.1.4
  14. 14. Why bother to builda pipeline?
  15. 15. No early feedbackA pipeline allows you to get feedback about changes as soon aspossible. Each instance of the pipeline provides feedback about that change, while work is started on other changes
  16. 16. No visibility in the process The pipeline mirrors yourprocess. All the aspects of the way you deliver are reflected in the pipeline. The status is clearly known at any time.
  17. 17. Paralyze development while releasingWork on new features, or any kind of change, can be started ona new instance of the pipeline, while releasing is done for older changes in existing instances.
  18. 18. Long and unpredictable release cyclesIt is always clear what steps are taken to release, and how long they last on average.
  19. 19. Lack oftraceabilityabout the originof problemsFor each issue, you canalways investigate thechange that originatedthe instance of thepipeline where the issueappears.
  20. 20. Stressful, problematic and long deployments Stress-free deploymentsDeployments are automated and done frequently, so they nno longer represent a problem. Practice makes perfect.
  21. 21. Who else can benefit from a pipeline?
  22. 22. Fast-changingbusinesses,needing toshortenrelease cycles
  23. 23. People working in silos
  24. 24. Teams facing an intolerable amount of bugs
  25. 25. Anyone willing to improve!
  26. 26. How to implement a pipeline
  27. 27. Is TFS well suited to setting up a Deployment Pipeline?
  28. 28. Practices already covered
  29. 29. Build, test, code analysisDefault build template
  30. 30. Prepare artifacts for later stagesWeb Deploy Custom workflowsDatabase projects Scripting in general .bat, PowerShell…
  31. 31. Practices already covered
  32. 32. Run automated tests, smoke-test deploymentsWrite automated tests: MSTest, CodedUI, NUnit, xUnit, etc. Have the builds run these tests
  33. 33. Automate deployments, always deploy the same wayUse custom workflow activities or deployment scripts: Web Deploy, bat, PowerShell, etc. Use the same automations all the time, with environments as parameters
  34. 34. Self-service deployments Set up builds that trigger the automated deployment.Use the Build-Deploy-Test workflow in LabManagement, deactivate the Build and Test parts if needed.
  35. 35. Environment provision & management, prepare to back out changes Use Lab Management to provision and manage environments.Use environment snapshots to back out changes.For standard environments, automate backup and restore
  36. 36. Practices not covered or needing clarification
  37. 37. Build only once Rebuilding from source at each step can introduce unexpected changes that could lead to issues. Use the Lab build template for stages other that the Commit Stage.If you can’t use Lab, set up a simple build template only for deployment and testing.
  38. 38. Propagate changes through the pipeline instantlyModify build definitions so they trigger the next step in the pipeline automatically, when needed. You can use a custom workflow activity for this.For example, the QueueBuild activity from the Community Extensions http://bit.ly/14vEEg3.
  39. 39. If any part of the pipeline fails, stop the lineFor automated steps, only trigger them if the previous one has been successful.
  40. 40. View pipeline status Write a custom dashboard.An easy option is to use OData for TFS (http://bit.ly/UDbiID). AUTOMATED COMMIT MANUAL TESTING RELEASE ACCEPTANCE TEST 1.0.1.1 1.0.1.2 1.0.1.3 AUTOMATED NON-FUNCTIONAL 1.0.1.4 ACCEPTANCE TEST MANUAL TESTING TESTING
  41. 41. Further improvements• Version builds: Versioning workflow activity from Community TFS Build Extensions (http://bit.ly/14vEEg3)• Build in parallel: parallel workflow activity, Parallel Template (http://bit.ly/VvSD4k)
  42. 42. Further improvements: Version Builds• Versioning workflow activity from Community TFS Build Extensions (http://tfsbuildextensions.codeplex.com/)
  43. 43. Lab Management is going tosave you a lot of work. Use it!
  44. 44. Demo!
  45. 45. Potential benefits
  46. 46. Transparent and predictable delivery process AUTOMATED COMMIT MANUAL TESTING RELEASE ACCEPTANCE TEST1.0.1.11.0.1.21.0.1.3 AUTOMATED NON-FUNCTIONAL1.0.1.4 ACCEPTANCE TEST MANUAL TESTING TESTING The pipeline reflects at any moment the way software is delivered, and the status of that process.
  47. 47. Less defects in productionNo reds ever reach the Release column. No regressions. AUTOMATED COMMIT MANUAL TESTING RELEASE ACCEPTANCE TEST1.0.1.11.0.1.21.0.1.3 AUTOMATED NON-FUNCTIONAL1.0.1.4 ACCEPTANCE TEST MANUAL TESTING TESTING
  48. 48. Flexibility to cope with changes AUTOMATED COMMIT MANUAL TESTING RELEASE ACCEPTANCE TEST1.0.1.11.0.1.21.0.1.3 AUTOMATED NON-FUNCTIONAL1.0.1.4 ACCEPTANCE TEST MANUAL TESTING TESTING Changes can be addressed in one or more new instances of the pipeline. Everything is already set up and ready.
  49. 49. Useful and actionable feedback AUTOMATED COMMIT MANUAL TESTING RELEASE ACCEPTANCE TEST 1.0.1.1 1.0.1.2 1.0.1.3 AUTOMATED NON-FUNCTIONAL 1.0.1.4 ACCEPTANCE TEST MANUAL TESTING TESTINGFeedback is obtained multiple times, for every change (instance) that gets into the pipeline. There is more information, it arrives earlier and it’s more focused.
  50. 50. Shorter time to deploy and release AUTOMATED COMMIT MANUAL TESTING RELEASE ACCEPTANCE TEST 1.0.1.1 1.0.1.2 1.0.1.3 AUTOMATED NON-FUNCTIONAL 1.0.1.4 ACCEPTANCE TEST MANUAL TESTING TESTINGDeployment is done automatically across most of the stages. Release is done frequently, for each change, so it’s a predictable and optimized process.
  51. 51. Empowered teams
  52. 52. Success criteria
  53. 53. Shorter Cycle TimeKanban board and Cumulative Flow Diagram: http://bit.ly/10Zomxd Interpreting a CFD: http://slidesha.re/cQjhmu
  54. 54. Greater automated test coverageUsing code coverage: http://bit.ly/WtZGW7Coverage reports: http://bit.ly/XIFtLZBuild summary report: http://bit.ly/Wu0ryd
  55. 55. Larger MTBFCheck also Reporting on Work Items: http://bit.ly/VDng44 http://bit.ly/X1BACX
  56. 56. Improved Velocity Using the velocity report: http://bit.ly/YvWLCi
  57. 57. Impact on the code churnand frequency of check-ins Code churn reports: http://bit.ly/XIFtLZ http://bit.ly/b9oFiS Build summary report: http://bit.ly/Wu0ryd
  58. 58. Impact on build cadence Build summary report: http://bit.ly/Wu0ryd
  59. 59. Warning signs
  60. 60. Rebuilding from sourceand using environment- specific binariesUsing the lab template helps to avoid rebuilding. Use the same binaries through all the stages.
  61. 61. Builds (steps) that takea great amount of time
  62. 62. Broken builds or failed stepsnot being addressed quickly
  63. 63. Manualdeployments
  64. 64. Automate deployments!!!DoDon’t
  65. 65. Configuration and other items not being versionedPut everything under version control.Use config transforms http://bit.ly/WwetSU.For non-web projects use slowcheetah http://bit.ly/VqOLhz.
  66. 66. Issues with branching• Keep your branching model as simple as possible.• Use Branch by Abstraction while developing http://bit.ly/X7RMRp.• Use Feature Toggles for deploying http://bit.ly/VqPSO7.
  67. 67. Poorly managed dependencies NuGet can help!Use NuGet package restorehttp://bit.ly/Wf9CX2.If you want more control, considersetting up your own NuGet feedhttp://bit.ly/WwqVlu.
  68. 68. Lack of rollback procedures Use Lab Management snapshots if available. Automate backups and rollback procedures.
  69. 69. Continuous Delivery = ≠ContinuousDeployment
  70. 70. Big ball of mudA BIG BALL OF MUD is haphazardlystructured, sprawling, sloppy, duct-tapeand bailing wire, spaghetti code jungle.http://www.laputan.org/mud/mud.htmlYou CAN Continuously Deployspaghetti to a BIG BALL OFMUD. That’s not ContinuousDelivery.
  71. 71. Continuous Deployment is only a part of the whole picture! Continuous Delivery Automate environment Smoke-test provision deployments Propagate changes through Continuous Self-service …and much more!!! the pipeline Deployment deployments View pipeline status Test Build only Automation once Stop the line Deploy the same way to every Have a rollback environment procedure
  72. 72. Summary• A Continuous Delivery pipeline can address many typical problems with the software development process.• Visual Studio + TFS, with some customization, are suitable for setting up a pipeline (better with Lab Management).• When properly implemented, it can bring many benefits.• You have to watch out for some common warning signs.
  73. 73. Plain Concepts
  74. 74. Image creditshttp://www.flickr.com/photos/danielpanev/3299995912/http://www.flickr.com/photos/jdlasica/424927934/http://www.flickr.com/photos/afterfate/459042219/http://www.flickr.com/photos/huangjiahui/3179858408/http://en.wikipedia.org/wiki/File:Pipeline,_4_stage.svghttp://www.flickr.com/photos/ninonatividad/8112215283/http://www.flickr.com/photos/crabbylioncardsandmore/4980927493/http://www.flickr.com/photos/seattlemunicipalarchives/3360591350/http://www.flickr.com/photos/selva/20600897/http://www.flickr.com/photos/willowherb/3319973581/http://www.flickr.com/photos/tommy-ironic/3437613067/http://www.flickr.com/photos/seattlemunicipalarchives/7165372144/http://commons.wikimedia.org/wiki/File:Gusher_Okemah_OK_1922.jpghttp://www.flickr.com/photos/perspective/6222453924/in/photostream/http://commons.wikimedia.org/wiki/File:Mirrool_Silos.jpghttp://commons.wikimedia.org/wiki/File:Large_Milkweed_Bug_Oncopeltus_fasciatus_Bugs_2400px.jpghttp://www.flickr.com/photos/avi_abrams/421717471/sizes/o/http://www.celoriu.com/2012/10/25/sociedad-ocio-y-cultura/las-copas-de-la-seleccion-llegan-a-llanes/http://www.nypost.com/p/news/local/jersey_field_of_oabCIiTLOJ1QzPFltXiniOhttp://www.flickr.com/photos/nzrico/4591154338/http://www.flickr.com/photos/leva/215368257/http://www.signgenerator.org/books/dummies/http://www.cinismoilustrado.com/2012/12/iconos-que-te-joden-el-dia.html
  75. 75. Thanks! Any questions?jlsoria@plainconcepts.com@jlsoriathttp://geeks.ms/blogs/jlsoriaGet these slides: http://slidesha.re/11fljAc

×