SlideShare a Scribd company logo
1 of 46
Download to read offline
So Continuous.
Much Delivery.
Very Chef.
Wow.
A Case Study on using Chef to start building a
Continuous Delivery Pipeline
About Me

•

George Miranda

•

Sr Consultant at Chef Software, Inc.

•

Unix guy (15+ years)
Minimum Viable Pipeline
What we know
•

Step 1: Develop a new change

•

Step 2: ???

•

Step 3: Production!

•

MOAR FASTERZ
Case Study: Requirements
•

Must utilize existing tools within the company

•

Git for SCM

•

Jenkins approved for use

•

Working in a static VM environment

•

Just migrated to single cookbook repos

•

Starting with infrastructure cookbooks

•

Want a manual go-to-production button (ugh!)
Case Study: Code Review Model
•

Git PR model: branch from master for any
new feature

•

4-person team, only 3 active at any time

•

Code review done manually and informally

•

Simple communication/reqs (makes it easy!)
Figuring out new workflow
•

How are developers expected to work locally?

•

When do they push to remote? How do we
verify their work?

•

Code Review criteria: what does it mean to be
ready to merge?

•

How do we go from merged code to artifact?

•

How do we get that artifact all the way to
Production?
Local Development Work
•

New branch for every feature

•

Create a failing test

•

Write a resource to pass the test

•

Local commits

•

Test-Kitchen + guard

•

Once local tests passed, push to remote
Push to remote
•

Open a Pull Request (new branch to master)

•

Triggers a build via Jenkins GHPRB plugin
Push to remote
The Verify Build Job
•

Verify syntax (knife cookbook check)

•

Foodcritic Rules

•

Test-Kitchen w/ BATS busser
BATS: Simple Unit Tests
@test "My directory is created" {!
test -d /foo/bar!
}!
!

@test "A basharific test" {!
if [ foo != bar ]; then!
skip "foo isn't bar"!
fi!
!

run foo!
[ "$status" -eq 0 ]!
}!
!
•
•

https://github.com/sstephenson/bats
Super low learning curve (but also very limited)
Push to remote
•

If failed, notify
•

Another commit to the same branch
triggers another Verify Build Job

•

Super easy to track, comment, and approve

•

If passed, let’s go to Human Code Review
Human Code Review Rules
•

Only one change per one cookbook at one
time

•

Must have test for feature that changed
•

One for one: resource unit tests

•

Consider the smoke test
Unit Test vs Smoke Test
•

Unit tests: small, fast, check one single
concern
•

•

Smoke tests: test multiple things in the course
of one concern
•

•

In this context: checking Chef resources

In this context: check the intent of a recipe

Note: that was testing for this use case
When are we ready to merge?
•

Only 3 active team members at any given
time
•
•

•

Submitter cannot approve
Merge approval requires 2 approvals

Code review can happen at any time, but
only merge when you’re ready to fix it.
Merged code to artifact
•

Freeze your cookbooks!

•

Semantic versioning: Major.Minor.Patch
•
•

•

You own Major.Minor
The Pipeline owns .Patch

No one gets to knife upload

No one.!
Ever.!
•

"git merge" is the new "knife upload"
The Integration Job
•

Bumps Cookbook version

•

Re-commits to master

•

Upload frozen cookbook (via berks)

•

Pin that new cookbook to the Integration
environment

•

Converge all nodes that use that cookbook
The Integration Job

•

First sign that things may be broken

•

These nodes also run smoke tests
•

serverspec, minitest, etc
The Integration Job
•

We survived! Trigger the next job(s)

•

The Jenkins Build Pipelines Plugin allows
upstream/downstream definitions to string
together jobs

•

From here out, it’s all the same Promote Job*

•

After the Integration job, we just run X number
of Promote Jobs
* (mostly)
Promote Jobs

•

Pin cookbook to new Chef Environment

•

Converge all nodes using this cookbook

•

Run Tests
Pin the cookbook to Env
#!/opt/chef/embedded/bin/ruby

!

require 'chef/environment'
require 'chef'
Chef::Config.from_file("/var/lib/jenkins/tools/knife.rb")

!

def pin_env(env, cookbook_versions)
to = Chef::Environment.load(env)
cookbook_versions.each do |cb, version|
puts "Pinning #{cb} #{version} in #{env}"
to.cookbook_versions[cb] = version
end
to.save
end

!

cookbook_data = Array.new

!

if File.exists?(File.expand_path(File.join(ENV['WORKSPACE'], 'metadata.rb')))
metadata_file = File.expand_path(File.join(ENV['WORKSPACE'], 'metadata.rb'))
File.read(metadata_file).each_line do |line|
if line =~ /^names+["'](w+)["'].*$/
cookbook_data << $1
end
if line =~ /^versions+["'](d+.d+.d+)["'].*$/
cookbook_data << "= #{$1}"
end
end
end

!

cookbook_versions = Hash[*cookbook_data]

!

pin_env(ARGV[0], cookbook_versions)
Pin the cookbook to Env

$ berks apply <environment>
Converge Nodes
$ knife ssh "recipes:mycookbook AND
chef_environment:promote-environment”
'sudo chef-client'!
… OR …
Pushy!
Run Tests
•

Most testing frameworks have a Report
Handler to automatically run tests
•

chef-serverspec-handler

•

minitest-handler

•

Deploy to your nodes by adding
‘chef_handler’ to their run_list

•

Many community cookbooks are already
packaged with tests
Run Tests
•

In this particular use case:
•

Build job: BATS (unit tests)

•

Integration & Promote jobs: serverspec
(smoke tests)

•

UAT: also ran Cucumber tests (acceptance)
Promoting to more environments
•

Can string together N number of promotions
•

UAT

•

Production A

•

Production B

•

etc
Push to Production

•

In production monitoring is the test

•

Could not queue up changes reliably anyway

•

There is no spoon
Results
•

Small incremental deployments led to greater
confidence

•

TDD was pushed to the forefront of priorities

•

Commitment from Dev group to write
application deployment cookbooks

•

But the biggest lesson learned…
Let’s Go Devop with a CD tool
•

Continuous Delivery is a practice, not a tool

•

Small incremental changes in code

•

Small incremental changes in workflow

•

Small incremental changes in tooling

•

You will constantly improve your code, your
workflow, your tools, your team, and your
skills.
RECAP
What We Wanted
•

Step 1: Develop a new change

•

Step 2: ???

•

Step 3: Production!

•

MOAR FASTERZ
Wait… what was Step 2?
•

(Pre-req) Test Driven Development

•

2A. Establish development workflow before submitting changes *

•

2B. Auto verification of submission before humans look at it

•

2C. Humans Apply Code Review Criteria *

•

2D. Don’t merge unless you mean it *

•

2E. Merge kicks off an Integration Job

•

2F. Followed by a series of Promotion Jobs

•

2G. There is no spoon *
What We Got
•
•

Step 1: Develop a new change
Step 2:

(Pre-req) Test Driven Development
2A. Establish development workflow before submitting changes *
2B. Auto verification of submission before humans look at it

!

2C. Humans Apply Code Review Criteria *
2D. Don’t merge unless you mean it *
2E. Merge kicks off an Integration Job

!

2F. Followed by a series of Promotion Jobs
2G. There is no spoon *

•

Step 3: Production!

•

Step 4: Level Up. This is great!

•

Step 5: MOAR THINGS! Wait. This is hard!

•

Go to Step 1
Key Chef Ecosystem Tools
•

Test Kitchen — http://kitchen.ci/

•

Guard Plugin for Test Kitchen —
https://github.com/test-kitchen/guard-kitchen

•

Foodcritic — http://acrmp.github.io/foodcritic/

•

Berkshelf — http://berkshelf.com/
Helpful Jenkins Plugins
•

git

•

github

•

build-pipeline-plugin

•

ghprb

•

warnings

•

mailer
I want to hear from you!
!

@gmiranda23
gmiranda@getchef.com

More Related Content

What's hot

Ansible top 10 - 2018
Ansible top 10 -  2018Ansible top 10 -  2018
Ansible top 10 - 2018Viresh Doshi
 
An Open-Source Chef Cookbook CI/CD Implementation Using Jenkins Pipelines
An Open-Source Chef Cookbook CI/CD Implementation Using Jenkins PipelinesAn Open-Source Chef Cookbook CI/CD Implementation Using Jenkins Pipelines
An Open-Source Chef Cookbook CI/CD Implementation Using Jenkins PipelinesSteffen Gebert
 
Managing Jenkins with Jenkins (Jenkins User Conference Palo Alto, 2013)
Managing Jenkins with Jenkins (Jenkins User Conference Palo Alto, 2013)Managing Jenkins with Jenkins (Jenkins User Conference Palo Alto, 2013)
Managing Jenkins with Jenkins (Jenkins User Conference Palo Alto, 2013)Gareth Bowles
 
Introduction to Git for developers
Introduction to Git for developersIntroduction to Git for developers
Introduction to Git for developersDmitry Guyvoronsky
 
Continuous deployment steve povilaitis
Continuous deployment   steve povilaitisContinuous deployment   steve povilaitis
Continuous deployment steve povilaitisSteve Povilaitis
 
Continuous delivery in Qbon
Continuous delivery  in QbonContinuous delivery  in Qbon
Continuous delivery in QbonJaric Kuo
 
An almost complete continuous delivery pipeline including configuration manag...
An almost complete continuous delivery pipeline including configuration manag...An almost complete continuous delivery pipeline including configuration manag...
An almost complete continuous delivery pipeline including configuration manag...ulfmansson
 
Continuous delivery of your legacy application
Continuous delivery of your legacy applicationContinuous delivery of your legacy application
Continuous delivery of your legacy applicationColdFusionConference
 
Continuous Deployment at Etsy: A Tale of Two Approaches
Continuous Deployment at Etsy: A Tale of Two ApproachesContinuous Deployment at Etsy: A Tale of Two Approaches
Continuous Deployment at Etsy: A Tale of Two ApproachesRoss Snyder
 
eZ Publish 5: from zero to automated deployment (and no regressions!) in one ...
eZ Publish 5: from zero to automated deployment (and no regressions!) in one ...eZ Publish 5: from zero to automated deployment (and no regressions!) in one ...
eZ Publish 5: from zero to automated deployment (and no regressions!) in one ...Gaetano Giunta
 
Continuous Integration at Mollie
Continuous Integration at MollieContinuous Integration at Mollie
Continuous Integration at Molliewillemstuursma
 
Continuous Integration
Continuous IntegrationContinuous Integration
Continuous IntegrationJoerg Henning
 
Building Evolvable Infrastructure
Building Evolvable InfrastructureBuilding Evolvable Infrastructure
Building Evolvable Infrastructurekiefdotcom
 
Smarter deployments with octopus deploy
Smarter deployments with octopus deploySmarter deployments with octopus deploy
Smarter deployments with octopus deployThibaud Gravrand
 
Continuous integration
Continuous integrationContinuous integration
Continuous integrationhugo lu
 
DevOps 及 TDD 開發流程哲學
DevOps 及 TDD 開發流程哲學DevOps 及 TDD 開發流程哲學
DevOps 及 TDD 開發流程哲學謝 宗穎
 
Introduction to jenkins
Introduction to jenkinsIntroduction to jenkins
Introduction to jenkinsAbe Diaz
 
Continuous Integration, Build Pipelines and Continuous Deployment
Continuous Integration, Build Pipelines and Continuous DeploymentContinuous Integration, Build Pipelines and Continuous Deployment
Continuous Integration, Build Pipelines and Continuous DeploymentChristopher Read
 

What's hot (20)

Ansible top 10 - 2018
Ansible top 10 -  2018Ansible top 10 -  2018
Ansible top 10 - 2018
 
An Open-Source Chef Cookbook CI/CD Implementation Using Jenkins Pipelines
An Open-Source Chef Cookbook CI/CD Implementation Using Jenkins PipelinesAn Open-Source Chef Cookbook CI/CD Implementation Using Jenkins Pipelines
An Open-Source Chef Cookbook CI/CD Implementation Using Jenkins Pipelines
 
Managing Jenkins with Jenkins (Jenkins User Conference Palo Alto, 2013)
Managing Jenkins with Jenkins (Jenkins User Conference Palo Alto, 2013)Managing Jenkins with Jenkins (Jenkins User Conference Palo Alto, 2013)
Managing Jenkins with Jenkins (Jenkins User Conference Palo Alto, 2013)
 
Introduction to Git for developers
Introduction to Git for developersIntroduction to Git for developers
Introduction to Git for developers
 
Continuous deployment steve povilaitis
Continuous deployment   steve povilaitisContinuous deployment   steve povilaitis
Continuous deployment steve povilaitis
 
Continuous delivery in Qbon
Continuous delivery  in QbonContinuous delivery  in Qbon
Continuous delivery in Qbon
 
Continuous Testing
Continuous TestingContinuous Testing
Continuous Testing
 
An almost complete continuous delivery pipeline including configuration manag...
An almost complete continuous delivery pipeline including configuration manag...An almost complete continuous delivery pipeline including configuration manag...
An almost complete continuous delivery pipeline including configuration manag...
 
Continuous delivery of your legacy application
Continuous delivery of your legacy applicationContinuous delivery of your legacy application
Continuous delivery of your legacy application
 
Dev ops
Dev opsDev ops
Dev ops
 
Continuous Deployment at Etsy: A Tale of Two Approaches
Continuous Deployment at Etsy: A Tale of Two ApproachesContinuous Deployment at Etsy: A Tale of Two Approaches
Continuous Deployment at Etsy: A Tale of Two Approaches
 
eZ Publish 5: from zero to automated deployment (and no regressions!) in one ...
eZ Publish 5: from zero to automated deployment (and no regressions!) in one ...eZ Publish 5: from zero to automated deployment (and no regressions!) in one ...
eZ Publish 5: from zero to automated deployment (and no regressions!) in one ...
 
Continuous Integration at Mollie
Continuous Integration at MollieContinuous Integration at Mollie
Continuous Integration at Mollie
 
Continuous Integration
Continuous IntegrationContinuous Integration
Continuous Integration
 
Building Evolvable Infrastructure
Building Evolvable InfrastructureBuilding Evolvable Infrastructure
Building Evolvable Infrastructure
 
Smarter deployments with octopus deploy
Smarter deployments with octopus deploySmarter deployments with octopus deploy
Smarter deployments with octopus deploy
 
Continuous integration
Continuous integrationContinuous integration
Continuous integration
 
DevOps 及 TDD 開發流程哲學
DevOps 及 TDD 開發流程哲學DevOps 及 TDD 開發流程哲學
DevOps 及 TDD 開發流程哲學
 
Introduction to jenkins
Introduction to jenkinsIntroduction to jenkins
Introduction to jenkins
 
Continuous Integration, Build Pipelines and Continuous Deployment
Continuous Integration, Build Pipelines and Continuous DeploymentContinuous Integration, Build Pipelines and Continuous Deployment
Continuous Integration, Build Pipelines and Continuous Deployment
 

Similar to Cfg mgmtcamp c-dwithchef

TYPO3 Camp Stuttgart 2015 - Continuous Delivery with Open Source Tools
TYPO3 Camp Stuttgart 2015 - Continuous Delivery with Open Source ToolsTYPO3 Camp Stuttgart 2015 - Continuous Delivery with Open Source Tools
TYPO3 Camp Stuttgart 2015 - Continuous Delivery with Open Source ToolsMichael Lihs
 
London Atlassian User Group - February 2014
London Atlassian User Group - February 2014London Atlassian User Group - February 2014
London Atlassian User Group - February 2014Steve Smith
 
The Key Components of Adopting CI The OpenStack Way
The Key Components of Adopting CI The OpenStack WayThe Key Components of Adopting CI The OpenStack Way
The Key Components of Adopting CI The OpenStack WayiWeb (group INAP)
 
Puppet Camp New York 2014: Streamlining Puppet Development Workflow
Puppet Camp New York 2014: Streamlining Puppet Development Workflow Puppet Camp New York 2014: Streamlining Puppet Development Workflow
Puppet Camp New York 2014: Streamlining Puppet Development Workflow Puppet
 
Steamlining your puppet development workflow
Steamlining your puppet development workflowSteamlining your puppet development workflow
Steamlining your puppet development workflowTomas Doran
 
Emerging chef patterns and practices
Emerging chef patterns and practicesEmerging chef patterns and practices
Emerging chef patterns and practicesOwain Perry
 
Continuous Delivery Using Jenkins
Continuous Delivery Using JenkinsContinuous Delivery Using Jenkins
Continuous Delivery Using JenkinsCliffano Subagio
 
Source version control using subversion
Source version control using subversionSource version control using subversion
Source version control using subversionMangesh Bhujbal
 
Testing API's: Tools & Tips & Tricks (Oh My!)
Testing API's: Tools & Tips & Tricks (Oh My!)Testing API's: Tools & Tips & Tricks (Oh My!)
Testing API's: Tools & Tips & Tricks (Oh My!)Ford Prior
 
Road to Continuous Delivery - Wix.com
Road to Continuous Delivery - Wix.comRoad to Continuous Delivery - Wix.com
Road to Continuous Delivery - Wix.comAviran Mordo
 
Alm with tfs 2013
Alm with tfs 2013Alm with tfs 2013
Alm with tfs 2013MSDEVMTL
 
DevOps Brisbane Meetup - June - ChefCon 2015
DevOps Brisbane Meetup - June - ChefCon 2015DevOps Brisbane Meetup - June - ChefCon 2015
DevOps Brisbane Meetup - June - ChefCon 2015Michael Villis
 
Devops journey chefpopup-2016.04.26-v2
Devops journey chefpopup-2016.04.26-v2Devops journey chefpopup-2016.04.26-v2
Devops journey chefpopup-2016.04.26-v2Chef
 
Testable Infrastructure with Chef, Test Kitchen, and Docker
Testable Infrastructure with Chef, Test Kitchen, and DockerTestable Infrastructure with Chef, Test Kitchen, and Docker
Testable Infrastructure with Chef, Test Kitchen, and DockerMandi Walls
 
Aki Salmi - Refactoring legacy code: a true story @ I T.A.K.E. Unconference 2...
Aki Salmi - Refactoring legacy code: a true story @ I T.A.K.E. Unconference 2...Aki Salmi - Refactoring legacy code: a true story @ I T.A.K.E. Unconference 2...
Aki Salmi - Refactoring legacy code: a true story @ I T.A.K.E. Unconference 2...Mozaic Works
 
DevOps in 5 minutes
DevOps in 5 minutesDevOps in 5 minutes
DevOps in 5 minutesJolyon Brown
 
Introduction to Automated Testing
Introduction to Automated TestingIntroduction to Automated Testing
Introduction to Automated TestingLars Thorup
 
Introduction to-automated-testing
Introduction to-automated-testingIntroduction to-automated-testing
Introduction to-automated-testingBestBrains
 

Similar to Cfg mgmtcamp c-dwithchef (20)

Chef Jumpstart
Chef JumpstartChef Jumpstart
Chef Jumpstart
 
TYPO3 Camp Stuttgart 2015 - Continuous Delivery with Open Source Tools
TYPO3 Camp Stuttgart 2015 - Continuous Delivery with Open Source ToolsTYPO3 Camp Stuttgart 2015 - Continuous Delivery with Open Source Tools
TYPO3 Camp Stuttgart 2015 - Continuous Delivery with Open Source Tools
 
London Atlassian User Group - February 2014
London Atlassian User Group - February 2014London Atlassian User Group - February 2014
London Atlassian User Group - February 2014
 
The Key Components of Adopting CI The OpenStack Way
The Key Components of Adopting CI The OpenStack WayThe Key Components of Adopting CI The OpenStack Way
The Key Components of Adopting CI The OpenStack Way
 
Puppet Camp New York 2014: Streamlining Puppet Development Workflow
Puppet Camp New York 2014: Streamlining Puppet Development Workflow Puppet Camp New York 2014: Streamlining Puppet Development Workflow
Puppet Camp New York 2014: Streamlining Puppet Development Workflow
 
Steamlining your puppet development workflow
Steamlining your puppet development workflowSteamlining your puppet development workflow
Steamlining your puppet development workflow
 
Emerging chef patterns and practices
Emerging chef patterns and practicesEmerging chef patterns and practices
Emerging chef patterns and practices
 
Continuous Delivery Using Jenkins
Continuous Delivery Using JenkinsContinuous Delivery Using Jenkins
Continuous Delivery Using Jenkins
 
Source version control using subversion
Source version control using subversionSource version control using subversion
Source version control using subversion
 
Testing API's: Tools & Tips & Tricks (Oh My!)
Testing API's: Tools & Tips & Tricks (Oh My!)Testing API's: Tools & Tips & Tricks (Oh My!)
Testing API's: Tools & Tips & Tricks (Oh My!)
 
Road to Continuous Delivery - Wix.com
Road to Continuous Delivery - Wix.comRoad to Continuous Delivery - Wix.com
Road to Continuous Delivery - Wix.com
 
eXtreme Programming
eXtreme ProgrammingeXtreme Programming
eXtreme Programming
 
Alm with tfs 2013
Alm with tfs 2013Alm with tfs 2013
Alm with tfs 2013
 
DevOps Brisbane Meetup - June - ChefCon 2015
DevOps Brisbane Meetup - June - ChefCon 2015DevOps Brisbane Meetup - June - ChefCon 2015
DevOps Brisbane Meetup - June - ChefCon 2015
 
Devops journey chefpopup-2016.04.26-v2
Devops journey chefpopup-2016.04.26-v2Devops journey chefpopup-2016.04.26-v2
Devops journey chefpopup-2016.04.26-v2
 
Testable Infrastructure with Chef, Test Kitchen, and Docker
Testable Infrastructure with Chef, Test Kitchen, and DockerTestable Infrastructure with Chef, Test Kitchen, and Docker
Testable Infrastructure with Chef, Test Kitchen, and Docker
 
Aki Salmi - Refactoring legacy code: a true story @ I T.A.K.E. Unconference 2...
Aki Salmi - Refactoring legacy code: a true story @ I T.A.K.E. Unconference 2...Aki Salmi - Refactoring legacy code: a true story @ I T.A.K.E. Unconference 2...
Aki Salmi - Refactoring legacy code: a true story @ I T.A.K.E. Unconference 2...
 
DevOps in 5 minutes
DevOps in 5 minutesDevOps in 5 minutes
DevOps in 5 minutes
 
Introduction to Automated Testing
Introduction to Automated TestingIntroduction to Automated Testing
Introduction to Automated Testing
 
Introduction to-automated-testing
Introduction to-automated-testingIntroduction to-automated-testing
Introduction to-automated-testing
 

Recently uploaded

Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditSkynet Technologies
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...panagenda
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...AliaaTarek5
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 

Recently uploaded (20)

Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance Audit
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 

Cfg mgmtcamp c-dwithchef

  • 1. So Continuous. Much Delivery. Very Chef. Wow. A Case Study on using Chef to start building a Continuous Delivery Pipeline
  • 2. About Me • George Miranda • Sr Consultant at Chef Software, Inc. • Unix guy (15+ years)
  • 3.
  • 4.
  • 5.
  • 7. What we know • Step 1: Develop a new change • Step 2: ??? • Step 3: Production! • MOAR FASTERZ
  • 8. Case Study: Requirements • Must utilize existing tools within the company • Git for SCM • Jenkins approved for use • Working in a static VM environment • Just migrated to single cookbook repos • Starting with infrastructure cookbooks • Want a manual go-to-production button (ugh!)
  • 9. Case Study: Code Review Model • Git PR model: branch from master for any new feature • 4-person team, only 3 active at any time • Code review done manually and informally • Simple communication/reqs (makes it easy!)
  • 10. Figuring out new workflow • How are developers expected to work locally? • When do they push to remote? How do we verify their work? • Code Review criteria: what does it mean to be ready to merge? • How do we go from merged code to artifact? • How do we get that artifact all the way to Production?
  • 11. Local Development Work • New branch for every feature • Create a failing test • Write a resource to pass the test • Local commits • Test-Kitchen + guard • Once local tests passed, push to remote
  • 12. Push to remote • Open a Pull Request (new branch to master) • Triggers a build via Jenkins GHPRB plugin
  • 13. Push to remote The Verify Build Job • Verify syntax (knife cookbook check) • Foodcritic Rules • Test-Kitchen w/ BATS busser
  • 14. BATS: Simple Unit Tests @test "My directory is created" {! test -d /foo/bar! }! ! @test "A basharific test" {! if [ foo != bar ]; then! skip "foo isn't bar"! fi! ! run foo! [ "$status" -eq 0 ]! }! ! • • https://github.com/sstephenson/bats Super low learning curve (but also very limited)
  • 15. Push to remote • If failed, notify • Another commit to the same branch triggers another Verify Build Job • Super easy to track, comment, and approve • If passed, let’s go to Human Code Review
  • 16. Human Code Review Rules • Only one change per one cookbook at one time • Must have test for feature that changed • One for one: resource unit tests • Consider the smoke test
  • 17. Unit Test vs Smoke Test • Unit tests: small, fast, check one single concern • • Smoke tests: test multiple things in the course of one concern • • In this context: checking Chef resources In this context: check the intent of a recipe Note: that was testing for this use case
  • 18. When are we ready to merge? • Only 3 active team members at any given time • • • Submitter cannot approve Merge approval requires 2 approvals Code review can happen at any time, but only merge when you’re ready to fix it.
  • 19. Merged code to artifact • Freeze your cookbooks! • Semantic versioning: Major.Minor.Patch • • • You own Major.Minor The Pipeline owns .Patch No one gets to knife upload No one.! Ever.! • "git merge" is the new "knife upload"
  • 20.
  • 21. The Integration Job • Bumps Cookbook version • Re-commits to master • Upload frozen cookbook (via berks) • Pin that new cookbook to the Integration environment • Converge all nodes that use that cookbook
  • 22. The Integration Job • First sign that things may be broken • These nodes also run smoke tests • serverspec, minitest, etc
  • 23. The Integration Job • We survived! Trigger the next job(s) • The Jenkins Build Pipelines Plugin allows upstream/downstream definitions to string together jobs • From here out, it’s all the same Promote Job* • After the Integration job, we just run X number of Promote Jobs * (mostly)
  • 24.
  • 25.
  • 26.
  • 27. Promote Jobs • Pin cookbook to new Chef Environment • Converge all nodes using this cookbook • Run Tests
  • 28. Pin the cookbook to Env #!/opt/chef/embedded/bin/ruby ! require 'chef/environment' require 'chef' Chef::Config.from_file("/var/lib/jenkins/tools/knife.rb") ! def pin_env(env, cookbook_versions) to = Chef::Environment.load(env) cookbook_versions.each do |cb, version| puts "Pinning #{cb} #{version} in #{env}" to.cookbook_versions[cb] = version end to.save end ! cookbook_data = Array.new ! if File.exists?(File.expand_path(File.join(ENV['WORKSPACE'], 'metadata.rb'))) metadata_file = File.expand_path(File.join(ENV['WORKSPACE'], 'metadata.rb')) File.read(metadata_file).each_line do |line| if line =~ /^names+["'](w+)["'].*$/ cookbook_data << $1 end if line =~ /^versions+["'](d+.d+.d+)["'].*$/ cookbook_data << "= #{$1}" end end end ! cookbook_versions = Hash[*cookbook_data] ! pin_env(ARGV[0], cookbook_versions)
  • 29. Pin the cookbook to Env $ berks apply <environment>
  • 30. Converge Nodes $ knife ssh "recipes:mycookbook AND chef_environment:promote-environment” 'sudo chef-client'! … OR … Pushy!
  • 31. Run Tests • Most testing frameworks have a Report Handler to automatically run tests • chef-serverspec-handler • minitest-handler • Deploy to your nodes by adding ‘chef_handler’ to their run_list • Many community cookbooks are already packaged with tests
  • 32. Run Tests • In this particular use case: • Build job: BATS (unit tests) • Integration & Promote jobs: serverspec (smoke tests) • UAT: also ran Cucumber tests (acceptance)
  • 33.
  • 34. Promoting to more environments • Can string together N number of promotions • UAT • Production A • Production B • etc
  • 35.
  • 36.
  • 37. Push to Production • In production monitoring is the test • Could not queue up changes reliably anyway • There is no spoon
  • 38. Results • Small incremental deployments led to greater confidence • TDD was pushed to the forefront of priorities • Commitment from Dev group to write application deployment cookbooks • But the biggest lesson learned…
  • 39. Let’s Go Devop with a CD tool • Continuous Delivery is a practice, not a tool • Small incremental changes in code • Small incremental changes in workflow • Small incremental changes in tooling • You will constantly improve your code, your workflow, your tools, your team, and your skills.
  • 40. RECAP
  • 41. What We Wanted • Step 1: Develop a new change • Step 2: ??? • Step 3: Production! • MOAR FASTERZ
  • 42. Wait… what was Step 2? • (Pre-req) Test Driven Development • 2A. Establish development workflow before submitting changes * • 2B. Auto verification of submission before humans look at it • 2C. Humans Apply Code Review Criteria * • 2D. Don’t merge unless you mean it * • 2E. Merge kicks off an Integration Job • 2F. Followed by a series of Promotion Jobs • 2G. There is no spoon *
  • 43. What We Got • • Step 1: Develop a new change Step 2: (Pre-req) Test Driven Development 2A. Establish development workflow before submitting changes * 2B. Auto verification of submission before humans look at it ! 2C. Humans Apply Code Review Criteria * 2D. Don’t merge unless you mean it * 2E. Merge kicks off an Integration Job ! 2F. Followed by a series of Promotion Jobs 2G. There is no spoon * • Step 3: Production! • Step 4: Level Up. This is great! • Step 5: MOAR THINGS! Wait. This is hard! • Go to Step 1
  • 44. Key Chef Ecosystem Tools • Test Kitchen — http://kitchen.ci/ • Guard Plugin for Test Kitchen — https://github.com/test-kitchen/guard-kitchen • Foodcritic — http://acrmp.github.io/foodcritic/ • Berkshelf — http://berkshelf.com/
  • 46. I want to hear from you! ! @gmiranda23 gmiranda@getchef.com