SlideShare ist ein Scribd-Unternehmen logo
1 von 51
Downloaden Sie, um offline zu lesen
JOB SCALABILITY IN JENKINS
GETTING OUT OF THE JOB JUNGLE
JBAM - June 1st 2017 - @DamienCoraboeuf
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
> 10 jobs?
> 100 jobs?
> 1000 jobs?
> 10000 jobs?
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
STORY OF A JOURNEY OUT OF THE JUNGLE
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!
💀
x✔
Three years ago in the
jungle…
JENKINS - JOBS & FOLDERS
JENKINS - JOB CONFIGURATION
Let’s get some sources…
Let’s run some build…
Let’s trigger another job…
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
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
SO FAR SO GOOD
“Look Ma, I’ve built a pipeline!”
“Lovely. Now, build one for your sister.”
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
…
THE STORY
Jenkins team
> 10000 jobs and growing…
In order to scale, we want:
✔ Self service
✔ Security
✔ Simplicity
✔ Extensibility
“What are we?”
“Developers!”
“What do we do?”
“Code!”
“Why do we do it?”
“Automation!”
JOB DSL PLUGIN - START OF THE JOURNEY OUT OF THE JUNGLE
▸ Define a job using a Groovy based DSL!
JOB DSL PLUGIN
▸ Very well supported
▸ Very good documentation
▸ Supports most of the plugins
▸ Built-in extensibility: inline or DSL extensions
JOB DSL PLUGIN
▸ Folders & views
▸ … automatic triggers upon generation
▸ … using files in workspace
JOB DSL PLUG-IN
▸ This remains code…
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)
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
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
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
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
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
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
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
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
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
?
NOT QUITE…
▸ This is not enough to really scale
▸ We still have to write some DSL
▸ Self service ✔
▸ Security ✘
▸ Simplicity ✘
▸ Extensibility ✔
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!
PIPELINE AS PROPERTIES
seed.properties
PIPELINE AS… PROPERTIES
SEED JOB
SCM Repository
Jobs
Gets the

seed.properties
Gets the pipeline

library version
Configures and runs

the pipeline library
PIPELINE AS… PROPERTIES
SEED JOB
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”

“…”
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
SEVERAL INTEGRATION MODES
SEED.PROPERTIES
SEED PLUGIN
SEED.PROPERTIES
SEED.GROOVYSEED.GROOVY
PIPELINE LIBRARY PIPELINE LIBRARY
BRANCH PIPELINE
95% 4%
1%
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
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
GENERATION - HOW IT LOOKS LIKE
BOOTSTRAPPING
GENERATION
GENERATION
AUTOMATION
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
RESPONSIBILITIES
Jenkins team
Pipeline libraries
Develops and
maintains
Development team
Seed files
Defines
Seed plug-in
SCM
Triggers
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
OUT OF THE JUNGLE…
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
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
THANKS YOU!
Thanks to the
Jenkins

Belgium Area

Meetup
Contact:
▸ http://nemerosa.com
▸ @DamienCoraboeuf

Weitere ähnliche Inhalte

Ähnlich wie Belgium jenkins-meetup-job-jungle-0.1

Slides Aquarium Paris 2008
Slides Aquarium Paris 2008Slides Aquarium Paris 2008
Slides Aquarium Paris 2008
julien.ponge
 
Deploy made easy (even on Friday)
Deploy made easy (even on Friday)Deploy made easy (even on Friday)
Deploy made easy (even on Friday)
Riccardo Bini
 

Ähnlich wie Belgium jenkins-meetup-job-jungle-0.1 (20)

Making the most of your gradle build - Devoxx PL 2017
Making the most of your gradle build - Devoxx PL 2017Making the most of your gradle build - Devoxx PL 2017
Making the most of your gradle build - Devoxx PL 2017
 
Makefiles in 2020 — Why they still matter
Makefiles in 2020 — Why they still matterMakefiles in 2020 — Why they still matter
Makefiles in 2020 — Why they still matter
 
Making cloud portability a practical reality (i pad)
Making cloud portability a practical reality (i pad)Making cloud portability a practical reality (i pad)
Making cloud portability a practical reality (i pad)
 
zebra & openconfigd Introduction
zebra & openconfigd Introductionzebra & openconfigd Introduction
zebra & openconfigd Introduction
 
Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...
Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...
Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...
 
Migrate Early, Migrate Often: JDK release cadence strategies
Migrate Early, Migrate Often: JDK release cadence strategiesMigrate Early, Migrate Often: JDK release cadence strategies
Migrate Early, Migrate Often: JDK release cadence strategies
 
Javaland 2014 / GWT architectures and lessons learned
Javaland 2014 / GWT architectures and lessons learnedJavaland 2014 / GWT architectures and lessons learned
Javaland 2014 / GWT architectures and lessons learned
 
Jenkins Job DSL plugin
Jenkins Job DSL plugin Jenkins Job DSL plugin
Jenkins Job DSL plugin
 
Slides Aquarium Paris 2008
Slides Aquarium Paris 2008Slides Aquarium Paris 2008
Slides Aquarium Paris 2008
 
Gradle como alternativa a maven
Gradle como alternativa a mavenGradle como alternativa a maven
Gradle como alternativa a maven
 
PostgreSQL 12: What is coming up?, Enterprise Postgres Day
PostgreSQL 12: What is coming up?, Enterprise Postgres DayPostgreSQL 12: What is coming up?, Enterprise Postgres Day
PostgreSQL 12: What is coming up?, Enterprise Postgres Day
 
Play framework
Play frameworkPlay framework
Play framework
 
Open Source at Zalando - OSB Open Source Day 2019
Open Source at Zalando - OSB Open Source Day 2019Open Source at Zalando - OSB Open Source Day 2019
Open Source at Zalando - OSB Open Source Day 2019
 
Javaone - Gradle: Harder, Better, Stronger, Faster
Javaone - Gradle: Harder, Better, Stronger, Faster Javaone - Gradle: Harder, Better, Stronger, Faster
Javaone - Gradle: Harder, Better, Stronger, Faster
 
LT04 IDNOG04 - Affan Basalamah (ITB) - Documenting your network
LT04 IDNOG04 - Affan Basalamah (ITB) - Documenting your networkLT04 IDNOG04 - Affan Basalamah (ITB) - Documenting your network
LT04 IDNOG04 - Affan Basalamah (ITB) - Documenting your network
 
IDNOG 4 Lightning Talks - Documenting your Network in 3 Simple Steps
IDNOG 4 Lightning Talks - Documenting your Network in 3 Simple StepsIDNOG 4 Lightning Talks - Documenting your Network in 3 Simple Steps
IDNOG 4 Lightning Talks - Documenting your Network in 3 Simple Steps
 
Deploy made easy (even on Friday)
Deploy made easy (even on Friday)Deploy made easy (even on Friday)
Deploy made easy (even on Friday)
 
Ontrack - Keeping track of your CI/CD mess
Ontrack - Keeping track of your CI/CD messOntrack - Keeping track of your CI/CD mess
Ontrack - Keeping track of your CI/CD mess
 
Making the most of your gradle build - vJUG24 2017
Making the most of your gradle build - vJUG24 2017Making the most of your gradle build - vJUG24 2017
Making the most of your gradle build - vJUG24 2017
 
Making the most of your gradle build - BaselOne 2017
Making the most of your gradle build - BaselOne 2017Making the most of your gradle build - BaselOne 2017
Making the most of your gradle build - BaselOne 2017
 

Kürzlich hochgeladen

TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Kürzlich hochgeladen (20)

10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 

Belgium jenkins-meetup-job-jungle-0.1

  • 1. JOB SCALABILITY IN JENKINS GETTING OUT OF THE JOB JUNGLE JBAM - June 1st 2017 - @DamienCoraboeuf
  • 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. > 10 jobs? > 100 jobs? > 1000 jobs? > 10000 jobs?
  • 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. STORY OF A JOURNEY OUT OF THE JUNGLE
  • 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. x✔ Three years ago in the jungle…
  • 8. JENKINS - JOBS & FOLDERS
  • 9. JENKINS - JOB CONFIGURATION Let’s get some sources… Let’s run some build… Let’s trigger another job…
  • 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. 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. SO FAR SO GOOD “Look Ma, I’ve built a pipeline!” “Lovely. Now, build one for your sister.”
  • 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. THE STORY Jenkins team > 10000 jobs and growing…
  • 15.
  • 16. In order to scale, we want: ✔ Self service ✔ Security ✔ Simplicity ✔ Extensibility
  • 17. “What are we?” “Developers!” “What do we do?” “Code!” “Why do we do it?” “Automation!”
  • 18. JOB DSL PLUGIN - START OF THE JOURNEY OUT OF THE JUNGLE ▸ Define a job using a Groovy based DSL!
  • 19. JOB DSL PLUGIN ▸ Very well supported ▸ Very good documentation ▸ Supports most of the plugins ▸ Built-in extensibility: inline or DSL extensions
  • 20. JOB DSL PLUGIN ▸ Folders & views ▸ … automatic triggers upon generation ▸ … using files in workspace
  • 21. JOB DSL PLUG-IN ▸ This remains code…
  • 22. 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)
  • 23. 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
  • 24. 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
  • 25. 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
  • 26. 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
  • 27. 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
  • 28. 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
  • 29.
  • 30. 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
  • 31. 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
  • 32. 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 ?
  • 33. NOT QUITE… ▸ This is not enough to really scale ▸ We still have to write some DSL ▸ Self service ✔ ▸ Security ✘ ▸ Simplicity ✘ ▸ Extensibility ✔
  • 34. 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!
  • 36. PIPELINE AS… PROPERTIES SEED JOB SCM Repository Jobs Gets the
 seed.properties Gets the pipeline
 library version Configures and runs
 the pipeline library
  • 38. 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”
 “…”
  • 39. 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
  • 40. SEVERAL INTEGRATION MODES SEED.PROPERTIES SEED PLUGIN SEED.PROPERTIES SEED.GROOVYSEED.GROOVY PIPELINE LIBRARY PIPELINE LIBRARY BRANCH PIPELINE 95% 4% 1%
  • 41. 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
  • 42. 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
  • 43. GENERATION - HOW IT LOOKS LIKE BOOTSTRAPPING GENERATION GENERATION
  • 45. 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
  • 46. RESPONSIBILITIES Jenkins team Pipeline libraries Develops and maintains Development team Seed files Defines Seed plug-in SCM Triggers
  • 47. 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
  • 48. OUT OF THE JUNGLE…
  • 49. 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
  • 50. 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
  • 51. THANKS YOU! Thanks to the Jenkins
 Belgium Area
 Meetup Contact: ▸ http://nemerosa.com ▸ @DamienCoraboeuf