puppet & jenkins
DESCRIPTION
Presentation @ PuppetNYC - Puppet & Jenkins. 2/20/2013, by Matthew BarrTRANSCRIPT
Puppet, Jenkins & CI
SNAP Interactive, Inc.
Presented by:
Matthew BarrTechnical Architect
Thursday, February 21, 13
www.snap-interactive.com
Company Overview• SNAP Interactive, Inc.
• AreYouInterested.com
• Believes it is one of the largest social discovery platforms on the web (based on monthly active users)
• More than 5 million monthly active users
• Over 1 billion total pieces of structured data from its users
• Synced to millions of Facebook profiles
• Receives over 1,000 real-time updates per minute on like actions from Facebook
• Subscription-based business model
• SNAP is publicly traded - Ticker: STVI
Thursday, February 21, 13
www.snap-interactive.com
About me
• Team lead for the operations group
• Sysadmin for over 15 years
• Dev/ops, WebOps, etc.
Thursday, February 21, 13
www.snap-interactive.com
Continuous Integration• The practice of frequently integrating one's
new or changed code with the existing code repository
• Maintain a code repository
• Automate the build
• Make the build self-testing
• Keep the build fast
• Everyone can see the results of the latest build
Thursday, February 21, 13
www.snap-interactive.com
Puppet
• Puppet Labs
• https://puppetlabs.com/
• You’re at PuppetNYC :)
Thursday, February 21, 13
www.snap-interactive.com
Jenkins• An extendable open source continuous integration
server
• http://jenkins-ci.org/
Thursday, February 21, 13
www.snap-interactive.com
So, let’s do this!
• Puppet Dynamic Environments
• Install Jenkins (master)
• Install Jenkins slaves (swarm clients)
• Mergeatron
• Puppet Parsing & Linting
• Puppet Testing
Thursday, February 21, 13
www.snap-interactive.com
Puppet Dynamic Env’s
• google: puppet dynamic environments
• Git based
• Each branch is it’s own environment
• Commit hook / web
• https://puppetlabs.com/blog/git-workflow-and-puppet-environments/
Thursday, February 21, 13
www.snap-interactive.com
Jenkins install
• puppet module install rtyler-jenkins
• Puppet forge module: rtyler/puppet-jenkins
• But: this code hasn’t been merged :(
• It’s in my github repo:
• https://github.com/matthewbarr/puppet-jenkins
Thursday, February 21, 13
www.snap-interactive.com
Jenkins Master
class {'jenkins': lts => 1, # Long term Stable version repo => 0, # Disable Jenkins repo config }jenkins::plugin {'swarm':}
include jenkinsjenkins::plugin {'swarm':}
OR
Thursday, February 21, 13
www.snap-interactive.com
Jenkins Slave: Easy!
include jenkins::slave
Thursday, February 21, 13
www.snap-interactive.com
Jenkins Slave: Features!
class {'jenkins::slave': masterurl => 'http://jenkins01.ayisnap.com:8080', ui_user => 'UI_USER', ui_pass => 'UI_PASS',# version => '1.8', executors => 4,# manage_slave_user => 1, slave_user => $slave_user, slave_uid => '600', slave_home => $slave_home, }
Thursday, February 21, 13
www.snap-interactive.com
Github
• Private repos for organizations
• Pull Requests!
Thursday, February 21, 13
www.snap-interactive.com
Demo!
Thursday, February 21, 13
www.snap-interactive.com
PR: Swarm plugin code
Thursday, February 21, 13
www.snap-interactive.com
Mergeatron
• Developed in house
• Open Source
• Nodejs
• Not yet in NPM :(
• http://snapinteractive.github.com/mergeatron/
Thursday, February 21, 13
www.snap-interactive.com
Mergeatron ^2
• Monitors github (or other) for a pull request
• Triggers a Jenkins “build”
• Build can do anything: unit tests, etc
Thursday, February 21, 13
www.snap-interactive.com
Mergeatron ^3
• We use it to monitor 2 repo’s
• Web site code
• phpunit
• phpcs
• jshint
• Ops repo (Puppet) - puppet parser
Thursday, February 21, 13
www.snap-interactive.com
Puppet Testing
• Puppet Lint
• http://puppet-lint.com/
• Rspec-Puppet
• http://rspec-puppet.com/
• ERB Parsing: erb -‐P -‐x -‐T '-‐' mytempl.erb | ruby -‐c
• Cucumber-puppet
• (Discontinued.)
Thursday, February 21, 13
www.snap-interactive.com
Puppet Testing - Future
• Parsing is a nice start
• Catalog checks can help, especially for supporting systems & edge cases
• Actually running it, though, is the only real test that matters.
• VM’s, functional / unit tests agains real systems that deliver your app.
Thursday, February 21, 13
www.snap-interactive.com
Updates
• Catalog checker w/ other facts- Ohad Levy:
• https://github.com/ohadlevy/manitest
• Github Pull Request Checker for Jenkins• https://wiki.jenkins-ci.org/display/JENKINS/GitHub+pull+request+builder+plugin
Thursday, February 21, 13
www.snap-interactive.com
Contact Us• SNAP Interactive, Inc.
www.snap-interactive.com
• Matthew BarrTechnical [email protected] & Github: @MatthewBarr
Thursday, February 21, 13