optimizing your ci: lessons learned from a successful jenkins rebuild - juc us west 2015

49
Optimizing Your CI: Lessons Learned from a Successful Jenkins Rebuild Santa Clara, Us West, September 2015 Jonathann Zenou

Upload: jonathann-zenou

Post on 17-Feb-2017

471 views

Category:

Engineering


1 download

TRANSCRIPT

Page 1: Optimizing Your CI: Lessons Learned from a Successful Jenkins Rebuild - JUC US West 2015

Optimizing Your CI: Lessons Learned from a Successful Jenkins Rebuild

Santa Clara, Us West, September 2015Jonathann Zenou

Page 2: Optimizing Your CI: Lessons Learned from a Successful Jenkins Rebuild - JUC US West 2015

Footer

#jenkinsconf

Greetings fellow humans

• Hi, my name is Jonathann• Living in Tel Aviv, Israel• Originally from Marseille, France• Leading the DevOps effort at Ravello Systems• @Zenoujohn• [email protected]

Page 3: Optimizing Your CI: Lessons Learned from a Successful Jenkins Rebuild - JUC US West 2015

#jenkinsconf

Footer

What is Ravello Systems ?

Page 4: Optimizing Your CI: Lessons Learned from a Successful Jenkins Rebuild - JUC US West 2015

#jenkinsconf

Footer

Ravello Systems

• 30 developers • 7 major projects• Kanban like

Author
we don't employ a formal methodology, rather believe in a feature centric process with quick small releases (thus CI (and in the future CD) is a must) and self-contained dev teams without centralised functions (automation, devops, etc.) which tend to become bottlenecks.
Page 5: Optimizing Your CI: Lessons Learned from a Successful Jenkins Rebuild - JUC US West 2015

#jenkinsconf

Footer

A part of our stack

Page 6: Optimizing Your CI: Lessons Learned from a Successful Jenkins Rebuild - JUC US West 2015

#jenkinsconf

Footer

What are we going to talk about ?

Page 7: Optimizing Your CI: Lessons Learned from a Successful Jenkins Rebuild - JUC US West 2015

#jenkinsconf

Footer

Old problems

Page 8: Optimizing Your CI: Lessons Learned from a Successful Jenkins Rebuild - JUC US West 2015

#jenkinsconf

Footer

Jobs Leftovers

• Causes full disk• Workspace Cleanup Plugin• Can pollute your maven repo or npm cache• Solution needed : a new clean environment for every job

Page 9: Optimizing Your CI: Lessons Learned from a Successful Jenkins Rebuild - JUC US West 2015

Footer

#jenkinsconf

Better resource distribution

Backend Team Frontend Team

Page 10: Optimizing Your CI: Lessons Learned from a Successful Jenkins Rebuild - JUC US West 2015

Footer

#jenkinsconf

Better resource distribution

Backend Team Frontend Team

Page 11: Optimizing Your CI: Lessons Learned from a Successful Jenkins Rebuild - JUC US West 2015

Footer

#jenkinsconf

Better resource distribution

Backend Team Frontend Team

Page 12: Optimizing Your CI: Lessons Learned from a Successful Jenkins Rebuild - JUC US West 2015

Footer

#jenkinsconf

Better resource distribution

Backend Team Frontend Team

Page 13: Optimizing Your CI: Lessons Learned from a Successful Jenkins Rebuild - JUC US West 2015

Footer

#jenkinsconf

Better resource distribution

Backend Team Frontend Team

“waiting for next available executor …”

Page 14: Optimizing Your CI: Lessons Learned from a Successful Jenkins Rebuild - JUC US West 2015

Footer

#jenkinsconf

Better resource distribution

Backend Team/Frontend Team

Page 15: Optimizing Your CI: Lessons Learned from a Successful Jenkins Rebuild - JUC US West 2015

Footer

#jenkinsconf

Better resource distribution

Backend Team/Frontend Team

Page 16: Optimizing Your CI: Lessons Learned from a Successful Jenkins Rebuild - JUC US West 2015

Footer

#jenkinsconf

Better resource distribution

Backend Team/Frontend Team

Page 17: Optimizing Your CI: Lessons Learned from a Successful Jenkins Rebuild - JUC US West 2015

Footer

#jenkinsconf

Frontend Team leader’s reaction

Page 18: Optimizing Your CI: Lessons Learned from a Successful Jenkins Rebuild - JUC US West 2015

#jenkinsconf

Footer

Better resource distribution

• Solution needed : a rapid and scalable way to spawn dynamic environments

Page 19: Optimizing Your CI: Lessons Learned from a Successful Jenkins Rebuild - JUC US West 2015

#jenkinsconf

Footer

Better resource distribution

Page 20: Optimizing Your CI: Lessons Learned from a Successful Jenkins Rebuild - JUC US West 2015

#jenkinsconf

Footer

Using Docker in Jenkins

• Using Jenkins Docker plugin• Dedicated Docker host for each team• Hosts machine capabilities are a function of team size and

requirements • All images on all hosts• Problems solved : jobs leftovers and resource distribution

Page 21: Optimizing Your CI: Lessons Learned from a Successful Jenkins Rebuild - JUC US West 2015

#jenkinsconf

Footer

Security

• No active directory or LDAP• Jim uses Dave’s account• Employee leaves the company

Page 22: Optimizing Your CI: Lessons Learned from a Successful Jenkins Rebuild - JUC US West 2015

#jenkinsconf

Footer

Security

Page 23: Optimizing Your CI: Lessons Learned from a Successful Jenkins Rebuild - JUC US West 2015

#jenkinsconf

Footer

Security

Page 24: Optimizing Your CI: Lessons Learned from a Successful Jenkins Rebuild - JUC US West 2015

#jenkinsconf

Footer

Security

• Solution needed: third party dynamic authentication mechanism

Page 25: Optimizing Your CI: Lessons Learned from a Successful Jenkins Rebuild - JUC US West 2015

#jenkinsconf

Footer

Security

• Using Jenkins Google Login plugin• Coupled with Matrix Authorization Strategy plugin• 2-Factor authentication• Open our Jenkins to the world

Page 26: Optimizing Your CI: Lessons Learned from a Successful Jenkins Rebuild - JUC US West 2015

#jenkinsconf

Footer

Too much code in jobs

Page 27: Optimizing Your CI: Lessons Learned from a Successful Jenkins Rebuild - JUC US West 2015

#jenkinsconf

Footer

Too much code in jobs

• Hard to maintain• Can be easily broken• “Who touched this ??”

Page 28: Optimizing Your CI: Lessons Learned from a Successful Jenkins Rebuild - JUC US West 2015

#jenkinsconf

Footer

Too much code in jobs

• Solution:• Put your scripts in revision control (Github)• Using Jenkins Multiple SCM plugin

Page 29: Optimizing Your CI: Lessons Learned from a Successful Jenkins Rebuild - JUC US West 2015

#jenkinsconf

Footer

Jobs Versioning

Page 30: Optimizing Your CI: Lessons Learned from a Successful Jenkins Rebuild - JUC US West 2015

#jenkinsconf

Footer

Jobs Versioning• Solution:

• Using Jenkins JobConfigHistory plugin• Saves old configurations• Diff between jobs configurations• Revert job configuration

• Coupled with Jenkins SCM sync configuration plugin• Saves you whole Jenkins configuration in revision

control (Github)

Page 31: Optimizing Your CI: Lessons Learned from a Successful Jenkins Rebuild - JUC US West 2015

#jenkinsconf

Footer

Jobs data sharing

Backend Job Frontend Job

Parameters:- Backend version: 1.1- Frontend version: stable

Parameters:- Frontend version: 1.1- Backend version: stable

Page 32: Optimizing Your CI: Lessons Learned from a Successful Jenkins Rebuild - JUC US West 2015

#jenkinsconf

Footer

Jobs data sharing

• Solution needed: an interface/service that will store data that will be accessible from all the jobs

• Using Jenkins Global Variable String Parameter Plugin• Cannot alter them from a job• But you can using Groovy …

Page 33: Optimizing Your CI: Lessons Learned from a Successful Jenkins Rebuild - JUC US West 2015

#jenkinsconf

Footer

Jobs data sharing

Page 34: Optimizing Your CI: Lessons Learned from a Successful Jenkins Rebuild - JUC US West 2015

#jenkinsconf

Footer

Jobs data sharing

• Keep a global parameter for each of product stable version

• Let all the other jobs use these values• Change the global parameter value of a product stable

version automatically when this product passes a green CI• Gist link: https://gist.github.com/johnyzed/2af71090419af2b20c5a

Page 35: Optimizing Your CI: Lessons Learned from a Successful Jenkins Rebuild - JUC US West 2015

#jenkinsconf

Footer

CI at Ravello Systems

build+

unit tests

environment creation

codedeployment test suites stop

environments

artifactory

log collection

Page 36: Optimizing Your CI: Lessons Learned from a Successful Jenkins Rebuild - JUC US West 2015

#jenkinsconf

Footer

CI at Ravello Systems

environment creation

Page 37: Optimizing Your CI: Lessons Learned from a Successful Jenkins Rebuild - JUC US West 2015

#jenkinsconf

Footer

Before digging further

Page 38: Optimizing Your CI: Lessons Learned from a Successful Jenkins Rebuild - JUC US West 2015

#jenkinsconf

Footer

The pieces are ready• What Do Developers Want ?• Blackbox• No duplication• C.D.R.S• Single form, with a lot of triggers• Using Multijob Plugin

Page 39: Optimizing Your CI: Lessons Learned from a Successful Jenkins Rebuild - JUC US West 2015

#jenkinsconf

Footer

Jobs sandbox• Improving a job without:

• Breaking it• Stopping other people using it

• Solution needed: a parallel Jenkins environment almost identical to our production Jenkins environment to test the new changes on

Page 40: Optimizing Your CI: Lessons Learned from a Successful Jenkins Rebuild - JUC US West 2015

#jenkinsconf

Footer

Jobs sandbox• Jenkins environment blueprint on Ravello Systems • Using Ansible:

• git clone• minor changes

• Running regular jobs• All that orchestrated from a Jenkins job

Page 41: Optimizing Your CI: Lessons Learned from a Successful Jenkins Rebuild - JUC US West 2015

#jenkinsconf

Footer

Jenkins sandbox flow

changes on Jenkins script

branch

create dynamic Jenkins

environmentrun jobs stop dynamic

environment

Page 42: Optimizing Your CI: Lessons Learned from a Successful Jenkins Rebuild - JUC US West 2015

#jenkinsconf

Footer

Jobs sandbox

Page 43: Optimizing Your CI: Lessons Learned from a Successful Jenkins Rebuild - JUC US West 2015

#jenkinsconf

Footer

Comparing Jenkins environment

Old Jenkins New Jenkins

Number of jobs 137 56Number of slaves 10 0-50Build and test duration 70 43

Page 44: Optimizing Your CI: Lessons Learned from a Successful Jenkins Rebuild - JUC US West 2015

#jenkinsconf

Footer

Comparing Jenkins environment

Page 45: Optimizing Your CI: Lessons Learned from a Successful Jenkins Rebuild - JUC US West 2015

#jenkinsconf

Footer

Take-aways

• Ask your developers how to make their life easier

• Don’t be afraid to break things• Follow @jenkins_release

Page 46: Optimizing Your CI: Lessons Learned from a Successful Jenkins Rebuild - JUC US West 2015

#jenkinsconf

Footer

One last thing

• Ravello Repo• http://www.ravellosystems.com/repo/• http://www.ravellosystems.com/repo/blueprints/6039143

6

Page 47: Optimizing Your CI: Lessons Learned from a Successful Jenkins Rebuild - JUC US West 2015

#jenkinsconf

Footer

Questions ?

Page 48: Optimizing Your CI: Lessons Learned from a Successful Jenkins Rebuild - JUC US West 2015

#jenkinsconf

Footer

Please Share Your Feedback

• Did you find this session valuable?• Please share your thoughts in the

Jenkins User Conference Mobile App.

• Find the session in the app and click on the feedback area.

Page 49: Optimizing Your CI: Lessons Learned from a Successful Jenkins Rebuild - JUC US West 2015

#jenkinsconf

Thank you