clug 2014-10 - cookbook ci with jenkins

Post on 26-Jun-2015

456 Views

Category:

Software

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

An overview of how I'm using Chef to automate Jenkins to test Chef cookbooks.

TRANSCRIPT

Cookbook CI with Jenkins

Part 1

Who Am I?

• "zts" most places on the internet

• Mostly Ops, Background, Mostly

• Co-founder Elastera

Who Are You?

Cookbook Testing

• foodcritic, chefspec, test-kitchen

• Get things right

• Keep things right

CI Servers

• System for running actions on every commit

• Identify problems early

• Jenkins, GoCD, TravisCI, Wercker, etc

Why Jenkins?

• Mature

• Extensible

• Good Chef Cookbook

• Free

Why Not Jenkins?

• TMTOWTDI

• XML, so much XML

• Automation is not a joy

Jenkins Cookbook

• Install Jenkins & Plugins

• Create jobs

• Run commands and scripts

Previously…

• Cooking With Jenkins

• ...and Kitchen, and Docker

Basic Configuration

• Install Plugins

• Configure Plugins

• Configure Jenkins

Installing Plugins

• Idempotent

• No dependency resolution

• Restart may be required

Plugin Configuration

• XML :(

• ...containing module version strings :((

• Hold nose and use cookbook_file

Jenkins Configuration

Creating Jobs

• jenkins_job

• Job DSL plugin

• Jenkins Job Builder

Pipeline

• Foodcritic

• Chefspec

• Kitchen

• Publish

And after publish?

• That's why this is Part 1...

Foodcritic

• Warnings plugin :)

• XML config :(

Chefspec

• yarjuf gem

• Publish JUnit test result report

Test Kitchen

• kitchen-docker

• Matrix jobs

• EnvInject and AnsiColor plugins

Berkshelf

• upload to Chef server

• record version as artifact

Berkshelf

• curl -s https://jenkins.example/job/berks-upload/lastSuccessfulBuild/artifact/VERSION

Gluing it together

• Publish Artifact

• Copy Artifact

• Build Pipeline

Pipelines

• Build Pipeline plugin

• Build Graph View plugin

• Build Flow DSL

• ...and more

Build Pipeline

What's Missing?

• JUnit output from serverspec

• View most recent run of all pipelines

• Notifications

Not the whole story...

• Testing a set of cookbooks

• Testing multiple nodes

• Promoting releases

Summary

• Not that hard to get started

• Immediately valuable

• Share your work!

Questions?

Resources

http://www.cryptocracy.com/blog/2014/01/03/cooking-with-jenkins-test-kitchen-and-docker/https://erichelgeson.github.io/blog/2014/05/10/automating-your-automation-federated-jenkins-with-chef/http://atomic-penguin.github.io/blog/2014/05/16/stupid-jenkins-tricks-part-2-cookbook-pipelines/http://www.hurryupandwait.io/blog/using-git-to-version-stamp-chef-artifacts

https://github.com/jenkinsci/job-dsl-plugin/wikihttps://wiki.jenkins-ci.org/display/JENKINS/Build+Pipeline+Pluginhttps://wiki.jenkins-ci.org/display/JENKINS/Building+a+matrix+project

Thankyou

Twitter: @zts

email: zts@elastera.com

top related