CI for Chefs
-
Upload
nikolay-yurin -
Category
Software
-
view
197 -
download
1
description
Transcript of CI for Chefs
![Page 1: CI for Chefs](https://reader031.fdocuments.net/reader031/viewer/2022020116/55941a171a28abf02b8b4596/html5/thumbnails/1.jpg)
CI for ChefsHow to cook successful deployments
Author: Nikolay Yurin - @yurinnick
![Page 2: CI for Chefs](https://reader031.fdocuments.net/reader031/viewer/2022020116/55941a171a28abf02b8b4596/html5/thumbnails/2.jpg)
Why?
● Code quality
● Portability
● DevOps time saving
![Page 3: CI for Chefs](https://reader031.fdocuments.net/reader031/viewer/2022020116/55941a171a28abf02b8b4596/html5/thumbnails/3.jpg)
Why?
Because we need stable
deployments, that’s why!
![Page 4: CI for Chefs](https://reader031.fdocuments.net/reader031/viewer/2022020116/55941a171a28abf02b8b4596/html5/thumbnails/4.jpg)
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
![Page 5: CI for Chefs](https://reader031.fdocuments.net/reader031/viewer/2022020116/55941a171a28abf02b8b4596/html5/thumbnails/5.jpg)
Unacceptable!● About 20 minutes● Manual testing● No info about
current code status
![Page 6: CI for Chefs](https://reader031.fdocuments.net/reader031/viewer/2022020116/55941a171a28abf02b8b4596/html5/thumbnails/6.jpg)
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
![Page 7: CI for Chefs](https://reader031.fdocuments.net/reader031/viewer/2022020116/55941a171a28abf02b8b4596/html5/thumbnails/7.jpg)
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
![Page 8: CI for Chefs](https://reader031.fdocuments.net/reader031/viewer/2022020116/55941a171a28abf02b8b4596/html5/thumbnails/8.jpg)
Foodcritic - verify ingredients
● Tests 45 most common mistakes
● Checks template and variables
● Integrates with Jenkins
![Page 9: CI for Chefs](https://reader031.fdocuments.net/reader031/viewer/2022020116/55941a171a28abf02b8b4596/html5/thumbnails/9.jpg)
ChefSpec - check recipe ● Test your recipes in RSpec style
● DSL with tons of manuals
![Page 10: CI for Chefs](https://reader031.fdocuments.net/reader031/viewer/2022020116/55941a171a28abf02b8b4596/html5/thumbnails/10.jpg)
Serverspec - deployment taste
● RSpec syntax again
● SSH or local exec
● Basic Windows
support
![Page 11: CI for Chefs](https://reader031.fdocuments.net/reader031/viewer/2022020116/55941a171a28abf02b8b4596/html5/thumbnails/11.jpg)
Development workflow
new_recipe.rbspec_new_recipe.rb Foodcritic ChefSpec
Docker container
Chef + Serverspec
Local validation process
![Page 12: CI for Chefs](https://reader031.fdocuments.net/reader031/viewer/2022020116/55941a171a28abf02b8b4596/html5/thumbnails/12.jpg)
Development workflow
CI Server
Git repository
new commit
fb-static-tests
Foodcritic
ChefSpec
fb-integration-tests
Serverspec
Artifact
Build report
On-commit code validation
![Page 13: CI for Chefs](https://reader031.fdocuments.net/reader031/viewer/2022020116/55941a171a28abf02b8b4596/html5/thumbnails/13.jpg)
Shut up and setup my CI!● Start writing tests!● Use dependency
manager● Setup CI server● Create centralized
release binary repo
![Page 14: CI for Chefs](https://reader031.fdocuments.net/reader031/viewer/2022020116/55941a171a28abf02b8b4596/html5/thumbnails/14.jpg)
TDD for Chef
http://www.amazon.com/Test-Driven-Infrastructure-Chef-Behavior-Driven-Development/dp/1449372201
![Page 15: CI for Chefs](https://reader031.fdocuments.net/reader031/viewer/2022020116/55941a171a28abf02b8b4596/html5/thumbnails/15.jpg)
Questions?Nikolay Yurin - @yurinnick - [email protected]