CI for Chefs 
How to cook successful deployments 
Author: Nikolay Yurin - @yurinnick
Why? 
● Code quality 
● Portability 
● DevOps time saving
Why? 
Because we need stable 
deployments, that’s why!
Deployment testing 
● Start VM on Vagrant/AWS ~ 1-3 minutes 
● Install chef client ~ 1 minute 
● Wait for deployment ~ 10 - ∞ minutes 
● Check configuration ~ 5 - 30 minutes
Unacceptable! 
● About 20 minutes 
● Manual testing 
● No info about 
current code status
CI/CD for deployment automation 
● Unit test for every recipe 
● Integration tests for every service 
● Automated on-commit builds 
● Email notifications 
● Release to file storage or Chef Server
Kitchen set for the better chef 
● ChefSpec - unit testing for every recipe 
● Serverspec - integration testing for server 
configurations 
● Foodcritic - static code validation 
● Docker - fast start/destroy containers
Foodcritic - verify ingredients 
● Tests 45 most common 
mistakes 
● Checks template and 
variables 
● Integrates with Jenkins
ChefSpec - check recipe 
● Test your recipes in RSpec style 
● DSL with tons of manuals
Serverspec - deployment taste 
● RSpec syntax again 
● SSH or local exec 
● Basic Windows 
support
Development workflow 
new_recipe.rb 
spec_new_recipe.rb Foodcritic ChefSpec 
Docker container 
Chef + 
Serverspec 
Local validation process
Development workflow 
CI Server 
Git repository 
new commit 
fb-static-tests 
Foodcritic 
ChefSpec 
fb-integration-tests 
Serverspec 
Artifact 
Build report 
On-commit code validation
Shut up and setup my CI! 
● Start writing tests! 
● Use dependency 
manager 
● Setup CI server 
● Create centralized 
release binary repo
TDD for Chef 
http://www.amazon.com/Test-Driven-Infrastructure-Chef- 
Behavior-Driven-Development/dp/1449372201
Questions? 
Nikolay Yurin - @yurinnick - yurinnick@outlook.com

CI for Chefs

  • 1.
    CI for Chefs How to cook successful deployments Author: Nikolay Yurin - @yurinnick
  • 2.
    Why? ● Codequality ● Portability ● DevOps time saving
  • 3.
    Why? Because weneed stable deployments, that’s why!
  • 4.
    Deployment testing ●Start VM on Vagrant/AWS ~ 1-3 minutes ● Install chef client ~ 1 minute ● Wait for deployment ~ 10 - ∞ minutes ● Check configuration ~ 5 - 30 minutes
  • 5.
    Unacceptable! ● About20 minutes ● Manual testing ● No info about current code status
  • 6.
    CI/CD for deploymentautomation ● Unit test for every recipe ● Integration tests for every service ● Automated on-commit builds ● Email notifications ● Release to file storage or Chef Server
  • 7.
    Kitchen set forthe better chef ● ChefSpec - unit testing for every recipe ● Serverspec - integration testing for server configurations ● Foodcritic - static code validation ● Docker - fast start/destroy containers
  • 8.
    Foodcritic - verifyingredients ● Tests 45 most common mistakes ● Checks template and variables ● Integrates with Jenkins
  • 9.
    ChefSpec - checkrecipe ● Test your recipes in RSpec style ● DSL with tons of manuals
  • 10.
    Serverspec - deploymenttaste ● RSpec syntax again ● SSH or local exec ● Basic Windows support
  • 11.
    Development workflow new_recipe.rb spec_new_recipe.rb Foodcritic ChefSpec Docker container Chef + Serverspec Local validation process
  • 12.
    Development workflow CIServer Git repository new commit fb-static-tests Foodcritic ChefSpec fb-integration-tests Serverspec Artifact Build report On-commit code validation
  • 13.
    Shut up andsetup my CI! ● Start writing tests! ● Use dependency manager ● Setup CI server ● Create centralized release binary repo
  • 14.
    TDD for Chef http://www.amazon.com/Test-Driven-Infrastructure-Chef- Behavior-Driven-Development/dp/1449372201
  • 15.
    Questions? Nikolay Yurin- @yurinnick - yurinnick@outlook.com