CI for Chefs
-
Upload
nikolay-yurin -
Category
Software
-
view
191 -
download
1
description
Transcript of CI for Chefs
CI for ChefsHow 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.rbspec_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 - [email protected]