Damien Corabouef, Multipharma, Clear2Pay
Implementing a CI/CD solution based on Jenkins has become very easy. Dealing with multiple feature, staging and release branches? Not so much. Having to handle that for multiple teams and multiple projects becomes a real challenge. This presentation shows a solution to scale to several thousands of jobs, used by dozens of different development and test teams, 24 hours a day, 7 days a week, on a worldwide schedule.
I will talk about the challenges that we’ve met, and how we’ve put in place a scalable and on-demand solution, secure and simple to use.
This is a real-life, real-scale story of making CI/CD a day-to-day reality by allowing development and test teams to consider automation as a simple and customisable service.
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. 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!
💀
5. JENKINS
▸ http://jenkins-ci.org/
▸ Very versatile Continuous Integration engine
▸ ~ 70% of the CI market (2012 figures)
▸ Open source - strong community
▸ Extensible
▸ more than 1000 plugins
▸ easy to develop new ones
▸ Integrates with basically everything
▸ Job scheduler
7. JENKINS - JOB CONFIGURATION
Let’s get some sources…
Let’s run some build…
Let’s trigger another job…
8. 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
10. SO FAR SO GOOD
“Look Ma, I’ve built a pipeline!”
“Lovely. Now, build one for your sister.”
11. 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
…
20. 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)
21. 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
22. 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
23. 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
24. 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
25. 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 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. 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. 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. NOT QUITE…
▸ This is not enough to really scale
▸ We still have to write some DSL
▸ Self service ✔
▸ Security ✘
▸ Simplicity ✘
▸ Extensibility ✔
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!
34. PIPELINE AS… PROPERTIES
SEED JOB
SCM Repository
Jobs
Gets the
seed.properties
Gets the pipeline
library version
Configures and runs
the pipeline library
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”
“…”
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. GENERATION - HOW IT LOOKS LIKE
BOOTSTRAPPING
GENERATION
GENERATION
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
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
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. 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