Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Belgium jenkins-meetup-job-jungle-0.1

280 views

Published on

Getting out of the job jungle - how to get from 0 to 10000 Jenkins jobs in three years

Published in: Software
  • Be the first to comment

  • Be the first to like this

Belgium jenkins-meetup-job-jungle-0.1

  1. 1. JOB SCALABILITY IN JENKINS GETTING OUT OF THE JOB JUNGLE JBAM - June 1st 2017 - @DamienCoraboeuf
  2. 2. WHO AM I? ▸ Damien Coraboeuf (@DamienCoraboeuf) ▸ Born to Java in 1996 ▸ Working in Continuous Delivery since 2008 ▸ Automating pipelines @ FIS I’ll be your guide on this journey
  3. 3. > 10 jobs? > 100 jobs? > 1000 jobs? > 10000 jobs?
  4. 4. 2052 3244 4365 6668 10373 0 2000 4000 6000 8000 10000 12000 Oct-15 Jan-16 May-16 Aug-16 Nov-16 Mar-17 Jun-17 Jobs 10373 JOBS IN 3 YEARS
  5. 5. STORY OF A JOURNEY OUT OF THE JUNGLE
  6. 6. THE MAP Short introduction to Jenkins Birth of a pipeline Manual mode The Job DSL Branching and its consequences Pipeline as code Pipeline as not code Automation of automation We want to get there Look, there is another
 beach here! Do not go there! 💀 There are traps here! 💀
  7. 7. x✔ Three years ago in the jungle…
  8. 8. JENKINS - JOBS & FOLDERS
  9. 9. JENKINS - JOB CONFIGURATION Let’s get some sources… Let’s run some build… Let’s trigger another job…
  10. 10. PIPELINES ▸ Defining jobs ▸ Linking them together ▸ Running them in parallel or in sequence ▸ Some triggers are automatic, other ones are manual BUILD DEPLOY ENV 1 DEPLOY ENV 2 DEPLOY ENV 3 PUBLICATION RELEASE
  11. 11. A PIPELINE IS BORN BUILD DEPLOY ENV 1 DEPLOY ENV 2 DEPLOY ENV 3 PUBLICATION RELEASE BUILD DEPLOY ENV 1 DEPLOY ENV 2 DEPLOY ENV 3 PUBLICATION RELEASE BUILD DEPLOY ENV 1 DEPLOY ENV 2 DEPLOY ENV 3 PUBLICATION RELEASE Commit 1 Commit 2 Commit 3
  12. 12. SO FAR SO GOOD “Look Ma, I’ve built a pipeline!” “Lovely. Now, build one for your sister.”
  13. 13. THE STORY Product A Product B Project C Maintenance 11.8 Maintenance 11.9 Maintenance 11.10 Maintenance 7.2 Maintenance 8.0 Maintenance 5.0 Check Publication WAS JBoss … Promotion for QA QAWAS QAJBoss … Promotion for NFT Sonar Fortify Perf Promotion for delivery Delivery Auto Manual Pipeline Products & Projects Branches …
  14. 14. THE STORY Jenkins team > 10000 jobs and growing…
  15. 15. In order to scale, we want: ✔ Self service ✔ Security ✔ Simplicity ✔ Extensibility
  16. 16. “What are we?” “Developers!” “What do we do?” “Code!” “Why do we do it?” “Automation!”
  17. 17. JOB DSL PLUGIN - START OF THE JOURNEY OUT OF THE JUNGLE ▸ Define a job using a Groovy based DSL!
  18. 18. JOB DSL PLUGIN ▸ Very well supported ▸ Very good documentation ▸ Supports most of the plugins ▸ Built-in extensibility: inline or DSL extensions
  19. 19. JOB DSL PLUGIN ▸ Folders & views ▸ … automatic triggers upon generation ▸ … using files in workspace
  20. 20. JOB DSL PLUG-IN ▸ This remains code…
  21. 21. JOB DSL PLUGIN - SEED JOB ▸ DSL based generation done from a job ▸ Can generate and/or update other jobs ▸ Can even run while jobs are running :) SEED JOB GENERATED JOB(S) DSL SCRIPT Generates Accesses (SCM or inline) GENERATED JOB(S) GENERATED JOB(S)
  22. 22. PIPELINE EVOLUTION ▸ One Seed DSL job is all very good but… ▸ Pipeline evolves with the code Builds
 this code Builds
 this code W ill fail for this code New platform being
 added Job for the
 new platform
  23. 23. BRANCHING ▸ One Seed DSL job is all very good but… ▸ Different pipelines for different branches develop release/2.0 Pipelines for releases
 might be more complex Release job
  24. 24. PIPELINE VERSIONS ▸ Where do we put the DSL script? develop release/2.0 Pipelines for releases
 might be more complex DSL.GROOVY DSL.GROOVY DSL.GROOVY
  25. 25. PIPELINE AS CODE ▸ Your pipeline is linked to the code it builds ▸ Define your pipeline in your code Project src pom.xml job-dsl-script.groovy
  26. 26. PIPELINE CODE DUPLICATION ▸ We can now generate a pipeline for any branch, any commit
 
 
 
 ▸ It evolves with your branches and is merged like any other piece of code ▸ That’s good enough for 1 project ▸ With several (many) projects, the level of DSL code duplication explodes! DEVELOP FEATURE/BIG RELEASE/1.0 DSL SCRIPT DSL SCRIPT DSL SCRIPT DEVELOP FEATURE/BIG RELEASE/1.0 DSL SCRIPT DSL SCRIPT DSL SCRIPT DEVELOP FEATURE/BIG RELEASE/1.0 DSL SCRIPT DSL SCRIPT DSL SCRIPT DEVELOP FEATURE/BIG RELEASE/1.0 DSL SCRIPT DSL SCRIPT DSL SCRIPT DEVELOP FEATURE/BIG RELEASE/1.0 DSL SCRIPT DSL SCRIPT DSL SCRIPT
  27. 27. PIPELINE CODE DUPLICATION ▸ Job DSL code duplication has the same issues than production code duplication DEVELOP FEATURE/BIG RELEASE/1.0 DSL SCRIPT DSL SCRIPT DSL SCRIPT DEVELOP FEATURE/BIG RELEASE/1.0 DSL SCRIPT DSL SCRIPT DSL SCRIPT DEVELOP FEATURE/BIG RELEASE/1.0 DSL SCRIPT DSL SCRIPT DSL SCRIPT DEVELOP FEATURE/BIG RELEASE/1.0 DSL SCRIPT DSL SCRIPT DSL SCRIPT ✘ ✘ ✘ ✘ ✘ ✘ ✘✘✘✘✘✘ DEVELOP FEATURE/BIG RELEASE/1.0 DSL SCRIPT DSL SCRIPT DSL SCRIPT DEVELOP FEATURE/BIG RELEASE/1.0 DSL SCRIPT DSL SCRIPT DSL SCRIPT ✘✘✘✘✘✘ DEVELOP FEATURE/BIG RELEASE/1.0 DSL SCRIPT DSL SCRIPT DSL SCRIPT DEVELOP FEATURE/BIG RELEASE/1.0 DSL SCRIPT DSL SCRIPT DSL SCRIPT ✘✘✘✘✘✘ DEVELOP DSL SCRIPT DEVELOP DSL SCRIPT ✘ ✘ DEVELOP DSL SCRIPT ✘ DEVELOP DSL SCRIPT ✘ LEASE/1.0 L SCRIPT LEASE/1.0 L SCRIPT LEASE/1.0 L SCRIPT LEASE/1.0 L SCRIPT DEVELOP FEATURE/BIG RELEASE/1.0 DEVELOP FEATURE/BIG RELEASE/1.0 DEVELOPLEASE/1.0
  28. 28. PIPELINE LIBRARIES TO THE RESCUE ▸ Pipeline is code ▸ Reuse of code through versioned libraries DEVELOP FEATURE/BIG RELEASE/1.0 DSL SCRIPT DSL SCRIPT DSL SCRIPT PIPELINE DSL LIBRARY 1.1 1.0 Normal project
 Can be tested
 Can be released
  29. 29. PIPELINE DSL LIBRARY B PIPELINE LIBRARIES TO THE RESCUE ▸ DSL libraries as code libraries DEVELOP FEATURE/BIG DEVELOP DSL SCRIPT DSL SCRIPT DSL SCRIPT PIPELINE DSL LIBRARY A 1.1 1.0 COMMON DSL LIBRARY 1.0 Dependencies 2.0
  30. 30. ARE WE DONE? ▸ We can describe a pipeline using a DSL ▸ The pipeline is defined together with the code it builds ▸ The DSL can use libraries to reduce code duplication ?
  31. 31. NOT QUITE… ▸ This is not enough to really scale ▸ We still have to write some DSL ▸ Self service ✔ ▸ Security ✘ ▸ Simplicity ✘ ▸ Extensibility ✔
  32. 32. PIPELINE AS “NOT CODE” ▸ Let’s describe the pipeline using a properties file ▸ Which pipeline library & which version ▸ Configuration properties - specific to the library ▸ Property file format ubiquitous ▸ No code running on the master ▸ Can be used for reporting on all the pipelines!
  33. 33. PIPELINE AS PROPERTIES seed.properties
  34. 34. PIPELINE AS… PROPERTIES SEED JOB SCM Repository Jobs Gets the
 seed.properties Gets the pipeline
 library version Configures and runs
 the pipeline library
  35. 35. PIPELINE AS… PROPERTIES SEED JOB
  36. 36. PIPELINE AS… METADATA ▸ The seed.properties files provide a wonderful way to do reporting on all projects and branches DEVELOP FEATURE/BIG RELEASE/1.0 SEED SEED SEED DEVELOP FEATURE/NEW RELEASE/3.4 SEED SEED SEED seed.properties seed.properties “Give me all branches using JDK 6”
 “Give me all projects having no SonarQube scan”
 “…”
  37. 37. SEED PLUGIN ▸ Putting everything together ▸ https://github.com/jenkinsci/seed-plugin ▸ Allows to generate: ▸ projects folders ▸ branches pipelines ▸ based on seed files (properties and/or DSL) ▸ integration with hooks
  38. 38. SEVERAL INTEGRATION MODES SEED.PROPERTIES SEED PLUGIN SEED.PROPERTIES SEED.GROOVYSEED.GROOVY PIPELINE LIBRARY PIPELINE LIBRARY BRANCH PIPELINE 95% 4% 1%
  39. 39. GENERATION STRUCTURE SEED PROJECT GENERATOR PROJECT FOLDER BOOTSTRAPPING BRANCH GENERATOR BRANCH FOLDER BRANCH JOB 1 BRANCH JOB 2 BRANCH JOB 3 BRANCH JOB 4 GENERATION Project teamJenkins team
  40. 40. PIPELINE SECURITY SEED A FOLDER A GENERATOR BOOTSTRAPPING A team Jenkins team B team GENERATION A BRANCHES A PIPELINES B FOLDER B GENERATOR B BRANCHES B PIPELINES
  41. 41. GENERATION - HOW IT LOOKS LIKE BOOTSTRAPPING GENERATION GENERATION
  42. 42. AUTOMATION
  43. 43. HOOKS ▸ Generations can be automated using hooks at SCM level ▸ Support for GitHub, BitBucket, generic HTTP calls (for SVN) ▸ Configurable. For example: BRANCH CREATION SCM EVENT Seed plug-in COMMIT SEED CHANGED BRANCH DELETION PIPELINE EVENT Generation Triggers the pipeline Regenerates the pipeline Deletes the pipeline
  44. 44. RESPONSIBILITIES Jenkins team Pipeline libraries Develops and maintains Development team Seed files Defines Seed plug-in SCM Triggers
  45. 45. WHAT DID WE JUST ACHIEVE? ▸ Automation of automation ▸ Self service ✔ ▸ Pipeline automation from SCM ▸ Security ✔ ▸ Project level authorisations ▸ No code on the master ▸ Simplicity ✔ ▸ Property files ▸ Extensibility ✔ ▸ Pipeline libraries ▸ Direct job DSL still possible
  46. 46. OUT OF THE JUNGLE…
  47. 47. SEED & PIPELINE PLUGIN ▸ The Seed plugin will keep working ▸ It can already generate pipeline jobs (Job DSL) ▸ But overlap of functionalities Branch pipelines Pipeline as code SEED PIPELINE Hook integration Pipeline as properties Community & support Pipeline libraries Pipeline script library
  48. 48. SEED IN PIPELINE PLUGIN ▸ The Seed plugin as extension of the Pipeline plugin Branch pipelines Pipeline as code SEED PIPELINE Hook integrationPipeline as properties Community & support Pipeline libraries Pipeline script library
  49. 49. THANKS YOU! Thanks to the Jenkins
 Belgium Area
 Meetup Contact: ▸ http://nemerosa.com ▸ @DamienCoraboeuf

×