dockercon - building a chef cookbook testing pipeline with drone.io and docker
DESCRIPTION
Building a framework for developing and maintaining chef cookbooks with automated testing and code review using opensource tools. I will walk through setting up Drone.IO (docker based CI) and hooking it up with Github ( regular or enterprise ), securing it behind an Oauth proxy, and configuring appropriate git hooks to automate testing process. I will then show how to use tools such as meez, guard, chefspec, testkitchen to shorten the feedback loop on errors to merely a few seconds, as well as some workflow ideas for gating and merging changes in github for Chef Cookbooks with multiple contributors.TRANSCRIPT
$ whoami pczarkowski
$ whoami pczarkowski
$ whoami pczarkowski
$ whoami pczarkowski
I <3 Docker
0.20
ZNCaaS
Openstack - Dockenstack, Nova-Docker, Solum
http://tech.paulczar.nethttp://github.com/paulczarhttps://index.docker.io/u/paulczar/
Chef Cookbook - Docker
Installs Docker
http://community.opscode.com/cookbooks/dockerhttps://github.com/bflad/chef-docker
Chef Cookbook - Docker
Run your own Registry
http://community.opscode.com/cookbooks/docker
Chef Cookbook - Docker
Backup container
http://community.opscode.com/cookbooks/docker
Chef Cookbook - Docker
just like trusted builds, only cheffy.
http://community.opscode.com/cookbooks/docker
Using Chef in Dockerfile
Run chef-solo in Dockerfile
EZBake
Converge Container on the fly
http://community.opscode.com/cookbooks/docker
Knife container
?
What is Drone ?
http://drone.iohttp://github.com/drone/drone
SaaS or Self HostedWritten in GoUses Docker to run tests/builds
How it works ?
Watches git repo containing `.drone.yml`
Clones repo on `git push`
Creates Docker image
How it works ?
Runs Docker image
Runs a series of commands
Performs action based on result
Why use Drone ?
Same tooling for both Public and Private
Ultra fast - Docker FTW
Opensource
It’s not all rainbows and unicorns
Local user auth only
Single server
UI and Documentation
Installing Drone
https://github.com/justincampbell/chef-drone
Installs drone via chef
Installing Drone
$ curl get.docker.io | bash
$ wget http://downloads.drone.io/latest/drone.deb
$ sudo dpkg -i drone.deb
https://github.com/settings/applications/new
.drone.yml
.drone.yml
.drone.yml
Drone CLI
$ drone build /tmp/example_application
parses .drone.yml
performs build
As a NoOp I need a development workflow with automated CI for building reliable infrastructure using chef cookbooks for my DevOps environment.
“Chef cookbooks are code.”
culture, culture, something,learning organization, something,
devops...
Test your Cookbooks
STYLE / SYNTAX tests
UNIT tests
INTEGRATION tests
Shameless plug… Meez
A tool I wrote … to scratch an itch.
generates a chef cookbook with plumbing for all the testing tools in the previous slides … and more.
Generate a testable cookbook
Run tests!
Short feedback loops
Guard: run tests every change
Git Hooks: refuse to commit if failed tests
Self Discipline!
Github Pull Request Workflow
Questions ?