SlideShare a Scribd company logo
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
CLUG 2014-10 - Cookbook CI with Jenkins
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
Subsequently… 
• Federated Jenkins with Chef 
• github:erichelgeson/jenkins-chef-dsl/
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
CLUG 2014-10 - Cookbook CI with Jenkins
CLUG 2014-10 - Cookbook CI with Jenkins
Pipeline 
• Foodcritic 
• Chefspec 
• Kitchen 
• Publish
And after publish? 
• That's why this is Part 1...
Foodcritic 
• Warnings plugin :) 
• XML config :(
CLUG 2014-10 - Cookbook CI with Jenkins
CLUG 2014-10 - Cookbook CI with Jenkins
Chefspec 
• yarjuf gem 
• Publish JUnit test result report
CLUG 2014-10 - Cookbook CI with Jenkins
CLUG 2014-10 - Cookbook CI with Jenkins
Test Kitchen 
• kitchen-docker 
• Matrix jobs 
• EnvInject and AnsiColor plugins
CLUG 2014-10 - Cookbook CI with Jenkins
Berkshelf 
• upload to Chef server 
• record version as artifact
CLUG 2014-10 - Cookbook CI with Jenkins
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/wiki 
https://wiki.jenkins-ci.org/display/JENKINS/Build+Pipeline+Plugin 
https://wiki.jenkins-ci.org/display/JENKINS/Building+a+matrix+project
Thankyou 
Twitter: @zts 
email: zts@elastera.com

More Related Content

PPTX
Testing for infra code using test-kitchen,docker,chef
PDF
Test Driven Development with Chef
PDF
Testable Infrastructure with Chef, Test Kitchen, and Docker
PDF
Continous delivery with Jenkins and Chef
PPTX
Jenkins and Chef: Infrastructure CI and Automated Deployment
PPTX
How to Write Chef Cookbook
PDF
Test-Driven Infrastructure with Chef
PDF
Server Installation and Configuration with Chef
Testing for infra code using test-kitchen,docker,chef
Test Driven Development with Chef
Testable Infrastructure with Chef, Test Kitchen, and Docker
Continous delivery with Jenkins and Chef
Jenkins and Chef: Infrastructure CI and Automated Deployment
How to Write Chef Cookbook
Test-Driven Infrastructure with Chef
Server Installation and Configuration with Chef

What's hot (20)

PPT
Chef, Devops, and You
PDF
Introduction to Chef
PDF
Automating your infrastructure with Chef
PDF
Docker
PDF
Infrastructure Automation with Chef
PPTX
Automate your Development Environment with Vagrant & Chef
PDF
Introduction to Chef: Automate Your Infrastructure by Modeling It In Code
PPTX
Vagrant and Chef on FOSSASIA 2014
PPTX
Chef introduction
PPTX
Chef Cookbook Design Patterns
PPTX
Understand Chef
KEY
Michelin Starred Cooking with Chef
PPTX
Vagrant, Chef and TYPO3 - A Love Affair
PDF
Tips and Tricks for Automating Windows with Chef
PDF
Community Cookbooks & further resources - Fundamentals Webinar Series Part 6
PDF
Chef Fundamentals Training Series Module 2: Workstation Setup
PDF
JUC Europe 2015: Optimizing Your CI: Lessons Learned from a Successful Jenkin...
PDF
Lessons from Etsy: Avoiding Kitchen Nightmares - #ChefConf 2012
PPTX
Azure handsonlab
PDF
The unintended benefits of Chef
Chef, Devops, and You
Introduction to Chef
Automating your infrastructure with Chef
Docker
Infrastructure Automation with Chef
Automate your Development Environment with Vagrant & Chef
Introduction to Chef: Automate Your Infrastructure by Modeling It In Code
Vagrant and Chef on FOSSASIA 2014
Chef introduction
Chef Cookbook Design Patterns
Understand Chef
Michelin Starred Cooking with Chef
Vagrant, Chef and TYPO3 - A Love Affair
Tips and Tricks for Automating Windows with Chef
Community Cookbooks & further resources - Fundamentals Webinar Series Part 6
Chef Fundamentals Training Series Module 2: Workstation Setup
JUC Europe 2015: Optimizing Your CI: Lessons Learned from a Successful Jenkin...
Lessons from Etsy: Avoiding Kitchen Nightmares - #ChefConf 2012
Azure handsonlab
The unintended benefits of Chef
Ad

Similar to CLUG 2014-10 - Cookbook CI with Jenkins (20)

PPTX
Introduction to jenkins
PPTX
The Key Components of Adopting CI The OpenStack Way
PDF
Steamlining your puppet development workflow
PDF
Puppet Camp New York 2014: Streamlining Puppet Development Workflow
PDF
Codifying the Build and Release Process with a Jenkins Pipeline Shared Library
PPTX
Emerging chef patterns and practices
PPTX
Cooking the Cake for Nuget packages
PPTX
Louisville Software Engineering Meet Up: Continuous Integration Using Jenkins
PDF
An Open-Source Chef Cookbook CI/CD Implementation Using Jenkins Pipelines
PDF
Jenkins-CI
PPTX
CD with spinnaker
PDF
From Virtual Machines to Containers
PDF
JUC Europe 2015: From Virtual Machines to Containers: Achieving Continuous In...
PDF
Juc boston2014.pptx
PPTX
Next generation pipelines
KEY
Continuous Delivery Using Jenkins
PDF
Continuous Integration at Mollie
PPTX
Jenkins & scriptable build
PDF
Cooking on Windows without the Windows Cookbook
PDF
JUC Europe 2015: How to Optimize Automated Testing with Everyone's Favorite B...
Introduction to jenkins
The Key Components of Adopting CI The OpenStack Way
Steamlining your puppet development workflow
Puppet Camp New York 2014: Streamlining Puppet Development Workflow
Codifying the Build and Release Process with a Jenkins Pipeline Shared Library
Emerging chef patterns and practices
Cooking the Cake for Nuget packages
Louisville Software Engineering Meet Up: Continuous Integration Using Jenkins
An Open-Source Chef Cookbook CI/CD Implementation Using Jenkins Pipelines
Jenkins-CI
CD with spinnaker
From Virtual Machines to Containers
JUC Europe 2015: From Virtual Machines to Containers: Achieving Continuous In...
Juc boston2014.pptx
Next generation pipelines
Continuous Delivery Using Jenkins
Continuous Integration at Mollie
Jenkins & scriptable build
Cooking on Windows without the Windows Cookbook
JUC Europe 2015: How to Optimize Automated Testing with Everyone's Favorite B...
Ad

Recently uploaded (20)

PDF
medical staffing services at VALiNTRY
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
System and Network Administraation Chapter 3
PPTX
Introduction to Artificial Intelligence
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PPTX
ai tools demonstartion for schools and inter college
PPTX
Transform Your Business with a Software ERP System
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
How Creative Agencies Leverage Project Management Software.pdf
PPTX
L1 - Introduction to python Backend.pptx
PDF
Odoo Companies in India – Driving Business Transformation.pdf
medical staffing services at VALiNTRY
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
System and Network Administraation Chapter 3
Introduction to Artificial Intelligence
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
VVF-Customer-Presentation2025-Ver1.9.pptx
Operating system designcfffgfgggggggvggggggggg
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Odoo POS Development Services by CandidRoot Solutions
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
ai tools demonstartion for schools and inter college
Transform Your Business with a Software ERP System
PTS Company Brochure 2025 (1).pdf.......
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
Wondershare Filmora 15 Crack With Activation Key [2025
How Creative Agencies Leverage Project Management Software.pdf
L1 - Introduction to python Backend.pptx
Odoo Companies in India – Driving Business Transformation.pdf

CLUG 2014-10 - Cookbook CI with Jenkins

Editor's Notes

  • #3: Yes, we’re hiring.
  • #4: Let’s get the “hands up” out of the way… Who tests their cookbooks, chefspec and/or kitchen? Who practices TDD for their cookbooks? Who automatically runs tests on commits?
  • #5: Not here to sell you on TDD, but it’s worth trying if you haven’t. Can encourage better design, as well as building a library of useful tests.
  • #6: Addresses a problem on large, shared codebases - parallel streams of activity, on branches, taking a lot of effort to merge. Not such a huge problem on single cookbook repo’s (in my experience). However, the tooling to support this is useful.
  • #7: With a good set of tests, prevents a whole class of errors caused by haste/impatience/divergent dev envs/etc.
  • #9: Also worth mentioning - pipelines are something of an afterthought
  • #11: Early this year, I demonstrated how to use Chef to configure Jenkins to run cookbook tests. This demonstrated some of the things I’m using today, but it was pretty rough. It was already due for an update two weeks after it was published (thanks to a new Jenkins cookbook), and I haven’t gone back to it yet…
  • #12: Meanwhile, Eric Helgeson wrote a great post (with example cookbook) showing how he was using Jenkins. This includes groovy scripts for configuring authentication, and use of the Jenkins DSL plugin (which we’ll come to later). This motivated me to have another crack at the problem.
  • #13: Add slides with examples of each
  • #15: This needs to be a better way to solve this, but it wasn’t immediately apparent and pragmatism triumphed.
  • #16: Idempotent? Well, you’ll get the same result but it will run every time…
  • #19: Screenshot
  • #20: If you’ve used these tools, you’ll know that foodcritic is very fast, chefspec is relatively fast, and kitchen tests are relatively slow. If your chefspec tests fail, you won’t even bother running Kitchen. Only if everything passes will you publish that commit to the Chef server.
  • #24: Screenshot
  • #28: Why not use kitchen parallel runner? Documented as intended for interactive use. Hard to read interleaved output.
  • #33: What’s an artifact? For compiled languages, a build step compiles the source code, the resulting artifact is passed to subsequent jobs. In my pipeline, the primary artifact is Berksfile.lock
  • #34: Others? Build Graph(?), Build Flow DSL (?), etc
  • #37: Subjects for a later talk…
  • #38: Sharing useful nuggets makes it easier for others to get started and contribute. Special thanks (again) to Eric Hegelson for this.
  • #41: Add contact details