SlideShare a Scribd company logo
1 of 17
Larry cai <larry.caiyu@gmail.com>
Agenda
 Introduction
 Exercise 1: Run the example to know the power
 Exercise 2: Hello World – first DSL
 Exercise 3: One complete JobDSL
 Exercise 4: JenkinsView and Loop
 Exercise 5: Configure Block to extend DSL
 Reference
2 08/12/15
Environment Preparation (docker)
 Boot2docker Installer (127M)
 Contains latest docker already, fast
 Container persistence via disk automount on /var/lib/docker
 $ docker -v
 User/Passwd: docker/tcuser (192.168.59.103)
 Download Jenkins JobDSL docker images
 $ docker pull larrycai/jenkins-jobdsl
 Notepad++ & MobaXterm are recommended
3 08/12/15
http://boot2docker.io/
Introduction
 Jenkins is a de-facto CI standard used for lots of products
 Easy to start, configure and extending (300+ plugins)
 Configure jobs in UI mostly
 Weak parts:
 Update git repo for many jobs
 Create dozens of jobs in fly for new project
 Monitor the changes
4 08/12/15
Learn new way to configure jenkins Jobs
Exercise 1: Hello World
 Run first app inside docker environment
$ cd /c/<Users>/codingwithme/jobdsl # create in advance
$ docker run -it –v $PWD:/opt/jenkins/data/jobs/jobdsl/workspace -p
8080:8080 larrycai/jenkins-jobdsl
 Browse: http://192.168.59.103:8080
Clean jenkins UI with one Job “HelloWorld”
 Exercise :
1. Execute job “HelloWorld”, and check result
2. See configuration
3. Run it again
4. Delete job “Compile-DSL-Tutorial-0” and Update job “Package-DSL-
Tutorial-0” and Run it again
5 08/12/15
JobDSL is Groovy based
 DSL : Domain Specific Language, easy to read and
understand
 JobDSL is jenkins plugin, https://wiki.jenkins-ci.org/display/JENKINS/Job+DSL+Plugin
 Groovy based
6 08/12/15
• Groovy is a multi-faceted
language for the Java
platform
• Groovy used in jenkins to
access internal data
JobDSL & Idempotent
 JobDSL helps to simplify the maintenance of jenkins jobs
 An idempotent operation is one that can be applied
multiple times without changing the result beyond the
initial application
 Keep the environment stable, reliable
 No matter the job is changed by someone, if the jobDSL
script is run, it will reach to the desired status
7 08/12/15
Exercise 2:Hello World
 Configure “HelloWorld” job
 Replace script like below
freeStyleJob("Hello2") {
steps {
shell('echo "Hello Larry"')
}
}
 Select option “Action for removed jobs” to “Delete”
and option “Action for removed views” to “Delete”,
Run it again
8 08/12/15
Jenkins Job mapping to JobDSL
9 08/12/15
 Job Type (freeStyleJob)
 Build Parameters (parameters)
 SCM (scm)
 BuildTriggers (triggers)
 Steps (steps)
 Post Build Actions (publishers)
https://github.com/jenkinsci/job-dsl-plugin/wiki/Job-reference
Exercise 3: Complete JobDSL example
 Follow the existing Jenkins job “Sample” and convert it into
JobDSL in “jobdsl”
 Cover Scm/trigger/shell/archive
 Steps:
 New job “jobdsl” (freestyle)
 New build step – Process Job DSLs
 Choose “Look on Filesystem”
 complete.groovy
 In file, use freeStyleJob(“Hello3”)
 Edit it in Windows env. (codingwith/jobdsl) # mapped into docker
 Compare the result
10 08/12/15
Reference: https://github.com/jenkinsci/job-dsl-plugin/wiki/Job-reference
Jenkins View & Groovy DSL
 JenkinsView is simple as jobs
 Name/filter/column .
 Learn some groovy to handle
common tasks
 Loop
 Read & Parse external config files
11 08/12/15
Exercise 4: List View and Loop
 Create different ListView and generate multi jobs based
on the config file
 Based on HelloWorld Example for jobs
 Json file: HelloWorld/workspace/views.json
 Steps
 Create new view.groovy
 Run inside job jobdsl
12 08/12/15
Configure block
 Not every jenkins Plugin are supported in JobDSL (may
changes in the future)
 Raise issues to get support
 Configure blocks are used inside the Job DSL to give
direct access to underlying XML of the Jenkins config.xml
13 08/12/15
https://github.com/jenkinsci/job-dsl-plugin/wiki/The-Configure-Block
Exercise 5: Configure Block for testNG
 Change the Sample job to export testNG result, which is
not support by jobDSL yet.
 Steps:
 Configure Sample job to publish testNG result in post-build
 Check generate config.xml
http://localhost:8080/view/CodingWithMe/job/Sample/config.xml
 Write testng.groovy based on complete.groovy
 Generate job Hello5
 Compare result
14 08/12/15
Summary
 JobDSL is the powerful to simplify the maintenance of
your jenkins jobs and keep it in professional way
 Put jobDSL scripts in git repo
 What we learn
 Execute JobDSL in jenkins jobs
 Inside script & script file
 Create job/View in jobDSL
 Simple Groovy knowledge to handle loop/read external data
 Configure Block in jobDSL to handle not direct supported
plugins
15 08/12/15
Reference
 jobDSL slides
 http://www.slideshare.net/daspilker/configuration-as-code-the-job-dsl-plugin
 JobDSL ref
 https://github.com/jenkinsci/job-dsl-plugin/wiki/View-Reference
 https://github.com/jenkinsci/job-dsl-plugin/wiki/Job-reference
 https://github.com/jenkinsci/job-dsl-plugin/wiki/The-Configure-Block
 Groovy Json
 http://www.groovy-lang.org/json.html
 Exercise Gist
 https://gist.github.com/larrycai/aeb9a3b037dcb17df9b2
16 08/12/15
CodingWithMe
 "CodingWithMe - Learning by Coding" is a coding
workshop, it aims to learn one technology in 90
minutes by practice
 Features:
 4-5 well tuned hands on exercises in 90 minutes
 First exercise shall be started in 20 minutes
 It well follows Bob Pike’s 90/20/8 rules (happen to
know)
 It is recommended arranged for several parallel
sessions if it is organized in the company.
17 08/12/15
http://www.larrycaiyu.com/blog/2014/03/18/codingwithme_introduction/

More Related Content

What's hot

Володимир Дубенко "Node.js for desktop development (based on Electron library)"
Володимир Дубенко "Node.js for desktop development (based on Electron library)"Володимир Дубенко "Node.js for desktop development (based on Electron library)"
Володимир Дубенко "Node.js for desktop development (based on Electron library)"Fwdays
 
Zero to Continuous Delivery on Google Cloud
Zero to Continuous Delivery on Google CloudZero to Continuous Delivery on Google Cloud
Zero to Continuous Delivery on Google CloudJames Heggs
 
Testing with Docker
Testing with DockerTesting with Docker
Testing with Dockertoffermann
 
Building an Extensible, Resumable DSL on Top of Apache Groovy
Building an Extensible, Resumable DSL on Top of Apache GroovyBuilding an Extensible, Resumable DSL on Top of Apache Groovy
Building an Extensible, Resumable DSL on Top of Apache Groovyjgcloudbees
 
Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners HubSpot
 
[Image Results] Java Build Tools: Part 2 - A Decision Maker's Guide Compariso...
[Image Results] Java Build Tools: Part 2 - A Decision Maker's Guide Compariso...[Image Results] Java Build Tools: Part 2 - A Decision Maker's Guide Compariso...
[Image Results] Java Build Tools: Part 2 - A Decision Maker's Guide Compariso...ZeroTurnaround
 
Containerizing a Web Application with Vue.js and Java
Containerizing a Web Application with Vue.js and JavaContainerizing a Web Application with Vue.js and Java
Containerizing a Web Application with Vue.js and JavaJadson Santos
 
JCConf 2015 workshop 動手玩 Java 專案建置工具
JCConf 2015 workshop 動手玩 Java 專案建置工具JCConf 2015 workshop 動手玩 Java 專案建置工具
JCConf 2015 workshop 動手玩 Java 專案建置工具謝 宗穎
 
(Declarative) Jenkins Pipelines
(Declarative) Jenkins Pipelines(Declarative) Jenkins Pipelines
(Declarative) Jenkins PipelinesSteffen Gebert
 
Continuous Delivery Pipeline with Docker and Jenkins
Continuous Delivery Pipeline with Docker and JenkinsContinuous Delivery Pipeline with Docker and Jenkins
Continuous Delivery Pipeline with Docker and JenkinsCamilo Ribeiro
 
Jenkins 101: Getting Started
Jenkins 101: Getting StartedJenkins 101: Getting Started
Jenkins 101: Getting StartedR Geoffrey Avery
 
Deploying an application with Chef and Docker
Deploying an application with Chef and DockerDeploying an application with Chef and Docker
Deploying an application with Chef and DockerDaniel Ku
 
JavaOne 2016 - Pipeline as code
JavaOne 2016 - Pipeline as codeJavaOne 2016 - Pipeline as code
JavaOne 2016 - Pipeline as codeBert Jan Schrijver
 
Jenkins Pipeline @ Scale. Building Automation Frameworks for Systems Integration
Jenkins Pipeline @ Scale. Building Automation Frameworks for Systems IntegrationJenkins Pipeline @ Scale. Building Automation Frameworks for Systems Integration
Jenkins Pipeline @ Scale. Building Automation Frameworks for Systems IntegrationOleg Nenashev
 
Python virtualenv & pip in 90 minutes
Python virtualenv & pip in 90 minutesPython virtualenv & pip in 90 minutes
Python virtualenv & pip in 90 minutesLarry Cai
 
IBM Drupal Users Group Discussion on Managing and Deploying Configuration
IBM Drupal Users Group Discussion on Managing and Deploying ConfigurationIBM Drupal Users Group Discussion on Managing and Deploying Configuration
IBM Drupal Users Group Discussion on Managing and Deploying ConfigurationDevelopment Seed
 
Baking docker using chef
Baking docker using chefBaking docker using chef
Baking docker using chefMukta Aphale
 
Pipeline as code - new feature in Jenkins 2
Pipeline as code - new feature in Jenkins 2Pipeline as code - new feature in Jenkins 2
Pipeline as code - new feature in Jenkins 2Michal Ziarnik
 

What's hot (20)

Володимир Дубенко "Node.js for desktop development (based on Electron library)"
Володимир Дубенко "Node.js for desktop development (based on Electron library)"Володимир Дубенко "Node.js for desktop development (based on Electron library)"
Володимир Дубенко "Node.js for desktop development (based on Electron library)"
 
Zero to Continuous Delivery on Google Cloud
Zero to Continuous Delivery on Google CloudZero to Continuous Delivery on Google Cloud
Zero to Continuous Delivery on Google Cloud
 
Testing with Docker
Testing with DockerTesting with Docker
Testing with Docker
 
Building an Extensible, Resumable DSL on Top of Apache Groovy
Building an Extensible, Resumable DSL on Top of Apache GroovyBuilding an Extensible, Resumable DSL on Top of Apache Groovy
Building an Extensible, Resumable DSL on Top of Apache Groovy
 
Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners
 
GlassFish Embedded API
GlassFish Embedded APIGlassFish Embedded API
GlassFish Embedded API
 
[Image Results] Java Build Tools: Part 2 - A Decision Maker's Guide Compariso...
[Image Results] Java Build Tools: Part 2 - A Decision Maker's Guide Compariso...[Image Results] Java Build Tools: Part 2 - A Decision Maker's Guide Compariso...
[Image Results] Java Build Tools: Part 2 - A Decision Maker's Guide Compariso...
 
Containerizing a Web Application with Vue.js and Java
Containerizing a Web Application with Vue.js and JavaContainerizing a Web Application with Vue.js and Java
Containerizing a Web Application with Vue.js and Java
 
JCConf 2015 workshop 動手玩 Java 專案建置工具
JCConf 2015 workshop 動手玩 Java 專案建置工具JCConf 2015 workshop 動手玩 Java 專案建置工具
JCConf 2015 workshop 動手玩 Java 專案建置工具
 
(Declarative) Jenkins Pipelines
(Declarative) Jenkins Pipelines(Declarative) Jenkins Pipelines
(Declarative) Jenkins Pipelines
 
Continuous Delivery Pipeline with Docker and Jenkins
Continuous Delivery Pipeline with Docker and JenkinsContinuous Delivery Pipeline with Docker and Jenkins
Continuous Delivery Pipeline with Docker and Jenkins
 
Jenkins 101: Getting Started
Jenkins 101: Getting StartedJenkins 101: Getting Started
Jenkins 101: Getting Started
 
Deploying an application with Chef and Docker
Deploying an application with Chef and DockerDeploying an application with Chef and Docker
Deploying an application with Chef and Docker
 
Jenkins Pipelines
Jenkins PipelinesJenkins Pipelines
Jenkins Pipelines
 
JavaOne 2016 - Pipeline as code
JavaOne 2016 - Pipeline as codeJavaOne 2016 - Pipeline as code
JavaOne 2016 - Pipeline as code
 
Jenkins Pipeline @ Scale. Building Automation Frameworks for Systems Integration
Jenkins Pipeline @ Scale. Building Automation Frameworks for Systems IntegrationJenkins Pipeline @ Scale. Building Automation Frameworks for Systems Integration
Jenkins Pipeline @ Scale. Building Automation Frameworks for Systems Integration
 
Python virtualenv & pip in 90 minutes
Python virtualenv & pip in 90 minutesPython virtualenv & pip in 90 minutes
Python virtualenv & pip in 90 minutes
 
IBM Drupal Users Group Discussion on Managing and Deploying Configuration
IBM Drupal Users Group Discussion on Managing and Deploying ConfigurationIBM Drupal Users Group Discussion on Managing and Deploying Configuration
IBM Drupal Users Group Discussion on Managing and Deploying Configuration
 
Baking docker using chef
Baking docker using chefBaking docker using chef
Baking docker using chef
 
Pipeline as code - new feature in Jenkins 2
Pipeline as code - new feature in Jenkins 2Pipeline as code - new feature in Jenkins 2
Pipeline as code - new feature in Jenkins 2
 

Viewers also liked

Configuration as Code: The Job DSL Plugin
Configuration as Code: The Job DSL PluginConfiguration as Code: The Job DSL Plugin
Configuration as Code: The Job DSL PluginDaniel Spilker
 
Configuration As Code - Adoption of the Job DSL Plugin at Netflix
Configuration As Code - Adoption of the Job DSL Plugin at NetflixConfiguration As Code - Adoption of the Job DSL Plugin at Netflix
Configuration As Code - Adoption of the Job DSL Plugin at NetflixJustin Ryan
 
8 lessons learned from becoming agile
8 lessons learned from becoming agile8 lessons learned from becoming agile
8 lessons learned from becoming agileMarko Taipale
 
OpenStack Introduction Ecosystem
OpenStack Introduction EcosystemOpenStack Introduction Ecosystem
OpenStack Introduction EcosystemNUTC, imac
 
Large Scale Development with Git and Gerrit - EclipseCon Europe 2012
Large Scale Development with Git and Gerrit - EclipseCon Europe 2012Large Scale Development with Git and Gerrit - EclipseCon Europe 2012
Large Scale Development with Git and Gerrit - EclipseCon Europe 2012msohn
 
Jenkins Best Practices Meetup Slides
Jenkins Best Practices Meetup SlidesJenkins Best Practices Meetup Slides
Jenkins Best Practices Meetup SlidesGergely Brautigam
 
Code Review with Git and Gerrit - Devoxx 2011 - Tools in Action - 2011-11-14
Code Review with Git and Gerrit - Devoxx 2011 - Tools in Action - 2011-11-14Code Review with Git and Gerrit - Devoxx 2011 - Tools in Action - 2011-11-14
Code Review with Git and Gerrit - Devoxx 2011 - Tools in Action - 2011-11-14msohn
 
Write book in markdown
Write book in markdownWrite book in markdown
Write book in markdownLarry Cai
 
So, you want to be a plugin developer?
So, you want to be a plugin developer?So, you want to be a plugin developer?
So, you want to be a plugin developer?ylefebvre
 
Intégration continue
Intégration continueIntégration continue
Intégration continueKlee Group
 
Introduction to ci with jenkins
Introduction to ci with jenkinsIntroduction to ci with jenkins
Introduction to ci with jenkinsEric Hogue
 
Lcu14 Lightning Talk- NGINX
Lcu14 Lightning Talk- NGINXLcu14 Lightning Talk- NGINX
Lcu14 Lightning Talk- NGINXLinaro
 
Introduction to OpenStack : Barcamp Bangkhen 2016
Introduction to OpenStack : Barcamp Bangkhen 2016Introduction to OpenStack : Barcamp Bangkhen 2016
Introduction to OpenStack : Barcamp Bangkhen 2016Opsta
 
Learn nginx in 90mins
Learn nginx in 90minsLearn nginx in 90mins
Learn nginx in 90minsLarry Cai
 
Askep kelompok cempaka
Askep kelompok cempakaAskep kelompok cempaka
Askep kelompok cempakaEtika Nurasih
 
The top 5 things planners need to know about self-driving vehicles
The top 5 things planners need to know about self-driving vehiclesThe top 5 things planners need to know about self-driving vehicles
The top 5 things planners need to know about self-driving vehiclesChris Hedden
 
Dr Chris Stout Getting Better at Private Practice
Dr Chris Stout Getting Better at Private PracticeDr Chris Stout Getting Better at Private Practice
Dr Chris Stout Getting Better at Private PracticeDr. Chris Stout
 
綻放的
綻放的綻放的
綻放的unotour
 

Viewers also liked (20)

Configuration as Code: The Job DSL Plugin
Configuration as Code: The Job DSL PluginConfiguration as Code: The Job DSL Plugin
Configuration as Code: The Job DSL Plugin
 
Configuration As Code - Adoption of the Job DSL Plugin at Netflix
Configuration As Code - Adoption of the Job DSL Plugin at NetflixConfiguration As Code - Adoption of the Job DSL Plugin at Netflix
Configuration As Code - Adoption of the Job DSL Plugin at Netflix
 
8 lessons learned from becoming agile
8 lessons learned from becoming agile8 lessons learned from becoming agile
8 lessons learned from becoming agile
 
OpenStack Introduction Ecosystem
OpenStack Introduction EcosystemOpenStack Introduction Ecosystem
OpenStack Introduction Ecosystem
 
Large Scale Development with Git and Gerrit - EclipseCon Europe 2012
Large Scale Development with Git and Gerrit - EclipseCon Europe 2012Large Scale Development with Git and Gerrit - EclipseCon Europe 2012
Large Scale Development with Git and Gerrit - EclipseCon Europe 2012
 
Jenkins Best Practices Meetup Slides
Jenkins Best Practices Meetup SlidesJenkins Best Practices Meetup Slides
Jenkins Best Practices Meetup Slides
 
Code Review with Git and Gerrit - Devoxx 2011 - Tools in Action - 2011-11-14
Code Review with Git and Gerrit - Devoxx 2011 - Tools in Action - 2011-11-14Code Review with Git and Gerrit - Devoxx 2011 - Tools in Action - 2011-11-14
Code Review with Git and Gerrit - Devoxx 2011 - Tools in Action - 2011-11-14
 
Group Development
Group DevelopmentGroup Development
Group Development
 
Write book in markdown
Write book in markdownWrite book in markdown
Write book in markdown
 
So, you want to be a plugin developer?
So, you want to be a plugin developer?So, you want to be a plugin developer?
So, you want to be a plugin developer?
 
Intégration continue
Intégration continueIntégration continue
Intégration continue
 
Introduction to ci with jenkins
Introduction to ci with jenkinsIntroduction to ci with jenkins
Introduction to ci with jenkins
 
Lcu14 Lightning Talk- NGINX
Lcu14 Lightning Talk- NGINXLcu14 Lightning Talk- NGINX
Lcu14 Lightning Talk- NGINX
 
Introduction to OpenStack : Barcamp Bangkhen 2016
Introduction to OpenStack : Barcamp Bangkhen 2016Introduction to OpenStack : Barcamp Bangkhen 2016
Introduction to OpenStack : Barcamp Bangkhen 2016
 
Learn nginx in 90mins
Learn nginx in 90minsLearn nginx in 90mins
Learn nginx in 90mins
 
Job DSL Plugin for Jenkins
Job DSL Plugin for JenkinsJob DSL Plugin for Jenkins
Job DSL Plugin for Jenkins
 
Askep kelompok cempaka
Askep kelompok cempakaAskep kelompok cempaka
Askep kelompok cempaka
 
The top 5 things planners need to know about self-driving vehicles
The top 5 things planners need to know about self-driving vehiclesThe top 5 things planners need to know about self-driving vehicles
The top 5 things planners need to know about self-driving vehicles
 
Dr Chris Stout Getting Better at Private Practice
Dr Chris Stout Getting Better at Private PracticeDr Chris Stout Getting Better at Private Practice
Dr Chris Stout Getting Better at Private Practice
 
綻放的
綻放的綻放的
綻放的
 

Similar to Learn jobDSL for Jenkins

CICD Pipeline configuration as a code
CICD Pipeline configuration as a codeCICD Pipeline configuration as a code
CICD Pipeline configuration as a codeGrid Dynamics
 
Take control of your Jenkins jobs via job DSL.
Take control of your Jenkins jobs via job DSL.Take control of your Jenkins jobs via job DSL.
Take control of your Jenkins jobs via job DSL.Łukasz Proszek
 
Angular Optimization Web Performance Meetup
Angular Optimization Web Performance MeetupAngular Optimization Web Performance Meetup
Angular Optimization Web Performance MeetupDavid Barreto
 
IBM Index 2018 Conference Workshop: Modernizing Traditional Java App's with D...
IBM Index 2018 Conference Workshop: Modernizing Traditional Java App's with D...IBM Index 2018 Conference Workshop: Modernizing Traditional Java App's with D...
IBM Index 2018 Conference Workshop: Modernizing Traditional Java App's with D...Eric Smalling
 
Oracle WebLogic: Feature Timeline from WLS9 to WLS 12c
Oracle WebLogic: Feature Timeline from WLS9 to WLS 12cOracle WebLogic: Feature Timeline from WLS9 to WLS 12c
Oracle WebLogic: Feature Timeline from WLS9 to WLS 12cfrankmunz
 
Advanced Node.JS Meetup
Advanced Node.JS MeetupAdvanced Node.JS Meetup
Advanced Node.JS MeetupLINAGORA
 
Moving from CruiseControl.NET to Jenkins in the PVS-Studio development team
Moving from CruiseControl.NET to Jenkins in the PVS-Studio development teamMoving from CruiseControl.NET to Jenkins in the PVS-Studio development team
Moving from CruiseControl.NET to Jenkins in the PVS-Studio development teamSofia Fateeva
 
Moving from CruiseControl.NET to Jenkins in the PVS-Studio development team
Moving from CruiseControl.NET to Jenkins in the PVS-Studio development teamMoving from CruiseControl.NET to Jenkins in the PVS-Studio development team
Moving from CruiseControl.NET to Jenkins in the PVS-Studio development teamPVS-Studio
 
Eclipse Buildship JUG Hamburg
Eclipse Buildship JUG HamburgEclipse Buildship JUG Hamburg
Eclipse Buildship JUG Hamburgsimonscholz
 
Docker Introduction.pdf
Docker Introduction.pdfDocker Introduction.pdf
Docker Introduction.pdfOKLABS
 
Continuous delivery the french way Agile Cambridge 2014
Continuous delivery the french way Agile Cambridge 2014Continuous delivery the french way Agile Cambridge 2014
Continuous delivery the french way Agile Cambridge 2014Dimitri Baeli
 
Illia shestakov - The Future of Java JDK #9
Illia shestakov - The Future of Java JDK #9Illia shestakov - The Future of Java JDK #9
Illia shestakov - The Future of Java JDK #9Anna Shymchenko
 
Configuration Management and Transforming Legacy Applications in the Enterpri...
Configuration Management and Transforming Legacy Applications in the Enterpri...Configuration Management and Transforming Legacy Applications in the Enterpri...
Configuration Management and Transforming Legacy Applications in the Enterpri...Docker, Inc.
 

Similar to Learn jobDSL for Jenkins (20)

CICD Pipeline configuration as a code
CICD Pipeline configuration as a codeCICD Pipeline configuration as a code
CICD Pipeline configuration as a code
 
Take control of your Jenkins jobs via job DSL.
Take control of your Jenkins jobs via job DSL.Take control of your Jenkins jobs via job DSL.
Take control of your Jenkins jobs via job DSL.
 
Jenkins Job DSL plugin
Jenkins Job DSL plugin Jenkins Job DSL plugin
Jenkins Job DSL plugin
 
Angular Optimization Web Performance Meetup
Angular Optimization Web Performance MeetupAngular Optimization Web Performance Meetup
Angular Optimization Web Performance Meetup
 
The power of dots
The power of dotsThe power of dots
The power of dots
 
IBM Index 2018 Conference Workshop: Modernizing Traditional Java App's with D...
IBM Index 2018 Conference Workshop: Modernizing Traditional Java App's with D...IBM Index 2018 Conference Workshop: Modernizing Traditional Java App's with D...
IBM Index 2018 Conference Workshop: Modernizing Traditional Java App's with D...
 
Oracle WebLogic: Feature Timeline from WLS9 to WLS 12c
Oracle WebLogic: Feature Timeline from WLS9 to WLS 12cOracle WebLogic: Feature Timeline from WLS9 to WLS 12c
Oracle WebLogic: Feature Timeline from WLS9 to WLS 12c
 
Gradle como alternativa a maven
Gradle como alternativa a mavenGradle como alternativa a maven
Gradle como alternativa a maven
 
Advanced Node.JS Meetup
Advanced Node.JS MeetupAdvanced Node.JS Meetup
Advanced Node.JS Meetup
 
Moving from CruiseControl.NET to Jenkins in the PVS-Studio development team
Moving from CruiseControl.NET to Jenkins in the PVS-Studio development teamMoving from CruiseControl.NET to Jenkins in the PVS-Studio development team
Moving from CruiseControl.NET to Jenkins in the PVS-Studio development team
 
Moving from CruiseControl.NET to Jenkins in the PVS-Studio development team
Moving from CruiseControl.NET to Jenkins in the PVS-Studio development teamMoving from CruiseControl.NET to Jenkins in the PVS-Studio development team
Moving from CruiseControl.NET to Jenkins in the PVS-Studio development team
 
Learning Docker with Thomas
Learning Docker with ThomasLearning Docker with Thomas
Learning Docker with Thomas
 
Eclipse Buildship JUG Hamburg
Eclipse Buildship JUG HamburgEclipse Buildship JUG Hamburg
Eclipse Buildship JUG Hamburg
 
Docker Introduction.pdf
Docker Introduction.pdfDocker Introduction.pdf
Docker Introduction.pdf
 
Continuous delivery the french way Agile Cambridge 2014
Continuous delivery the french way Agile Cambridge 2014Continuous delivery the french way Agile Cambridge 2014
Continuous delivery the french way Agile Cambridge 2014
 
Git Tutorial
Git TutorialGit Tutorial
Git Tutorial
 
fast_bitcoin_data_mining
fast_bitcoin_data_miningfast_bitcoin_data_mining
fast_bitcoin_data_mining
 
Let me introduce you: DOTS
Let me introduce you: DOTSLet me introduce you: DOTS
Let me introduce you: DOTS
 
Illia shestakov - The Future of Java JDK #9
Illia shestakov - The Future of Java JDK #9Illia shestakov - The Future of Java JDK #9
Illia shestakov - The Future of Java JDK #9
 
Configuration Management and Transforming Legacy Applications in the Enterpri...
Configuration Management and Transforming Legacy Applications in the Enterpri...Configuration Management and Transforming Legacy Applications in the Enterpri...
Configuration Management and Transforming Legacy Applications in the Enterpri...
 

More from Larry Cai

Learn kubernetes in 90 minutes
Learn kubernetes in 90 minutesLearn kubernetes in 90 minutes
Learn kubernetes in 90 minutesLarry Cai
 
Learn RabbitMQ with Python in 90mins
Learn RabbitMQ with Python in 90minsLearn RabbitMQ with Python in 90mins
Learn RabbitMQ with Python in 90minsLarry Cai
 
Learn flask in 90mins
Learn flask in 90minsLearn flask in 90mins
Learn flask in 90minsLarry Cai
 
Learn ELK in docker
Learn ELK in dockerLearn ELK in docker
Learn ELK in dockerLarry Cai
 
Software Engineer Talk
Software Engineer TalkSoftware Engineer Talk
Software Engineer TalkLarry Cai
 
Learn basic ansible using docker
Learn basic ansible using dockerLearn basic ansible using docker
Learn basic ansible using dockerLarry Cai
 
Build service with_docker_in_90mins
Build service with_docker_in_90minsBuild service with_docker_in_90mins
Build service with_docker_in_90minsLarry Cai
 
Learn docker in 90 minutes
Learn docker in 90 minutesLearn docker in 90 minutes
Learn docker in 90 minutesLarry Cai
 
Learn Dashing Widget in 90 minutes
Learn Dashing Widget in 90 minutesLearn Dashing Widget in 90 minutes
Learn Dashing Widget in 90 minutesLarry Cai
 
Learn REST API with Python
Learn REST API with PythonLearn REST API with Python
Learn REST API with PythonLarry Cai
 
Jenkins Scriptler in 90mins
Jenkins Scriptler in 90minsJenkins Scriptler in 90mins
Jenkins Scriptler in 90minsLarry Cai
 
Lead changes in software development
Lead changes in software developmentLead changes in software development
Lead changes in software developmentLarry Cai
 
Python in 90mins
Python in 90minsPython in 90mins
Python in 90minsLarry Cai
 
Practical way to experience of Specification by Example
Practical way to experience of Specification by ExamplePractical way to experience of Specification by Example
Practical way to experience of Specification by ExampleLarry Cai
 
Experience from specification_by_examples
Experience from specification_by_examplesExperience from specification_by_examples
Experience from specification_by_examplesLarry Cai
 
Continuous Integration Introduction
Continuous Integration IntroductionContinuous Integration Introduction
Continuous Integration IntroductionLarry Cai
 
Agile & ALM tools
Agile & ALM toolsAgile & ALM tools
Agile & ALM toolsLarry Cai
 

More from Larry Cai (17)

Learn kubernetes in 90 minutes
Learn kubernetes in 90 minutesLearn kubernetes in 90 minutes
Learn kubernetes in 90 minutes
 
Learn RabbitMQ with Python in 90mins
Learn RabbitMQ with Python in 90minsLearn RabbitMQ with Python in 90mins
Learn RabbitMQ with Python in 90mins
 
Learn flask in 90mins
Learn flask in 90minsLearn flask in 90mins
Learn flask in 90mins
 
Learn ELK in docker
Learn ELK in dockerLearn ELK in docker
Learn ELK in docker
 
Software Engineer Talk
Software Engineer TalkSoftware Engineer Talk
Software Engineer Talk
 
Learn basic ansible using docker
Learn basic ansible using dockerLearn basic ansible using docker
Learn basic ansible using docker
 
Build service with_docker_in_90mins
Build service with_docker_in_90minsBuild service with_docker_in_90mins
Build service with_docker_in_90mins
 
Learn docker in 90 minutes
Learn docker in 90 minutesLearn docker in 90 minutes
Learn docker in 90 minutes
 
Learn Dashing Widget in 90 minutes
Learn Dashing Widget in 90 minutesLearn Dashing Widget in 90 minutes
Learn Dashing Widget in 90 minutes
 
Learn REST API with Python
Learn REST API with PythonLearn REST API with Python
Learn REST API with Python
 
Jenkins Scriptler in 90mins
Jenkins Scriptler in 90minsJenkins Scriptler in 90mins
Jenkins Scriptler in 90mins
 
Lead changes in software development
Lead changes in software developmentLead changes in software development
Lead changes in software development
 
Python in 90mins
Python in 90minsPython in 90mins
Python in 90mins
 
Practical way to experience of Specification by Example
Practical way to experience of Specification by ExamplePractical way to experience of Specification by Example
Practical way to experience of Specification by Example
 
Experience from specification_by_examples
Experience from specification_by_examplesExperience from specification_by_examples
Experience from specification_by_examples
 
Continuous Integration Introduction
Continuous Integration IntroductionContinuous Integration Introduction
Continuous Integration Introduction
 
Agile & ALM tools
Agile & ALM toolsAgile & ALM tools
Agile & ALM tools
 

Recently uploaded

The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...AliaaTarek5
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 

Recently uploaded (20)

The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 

Learn jobDSL for Jenkins

  • 2. Agenda  Introduction  Exercise 1: Run the example to know the power  Exercise 2: Hello World – first DSL  Exercise 3: One complete JobDSL  Exercise 4: JenkinsView and Loop  Exercise 5: Configure Block to extend DSL  Reference 2 08/12/15
  • 3. Environment Preparation (docker)  Boot2docker Installer (127M)  Contains latest docker already, fast  Container persistence via disk automount on /var/lib/docker  $ docker -v  User/Passwd: docker/tcuser (192.168.59.103)  Download Jenkins JobDSL docker images  $ docker pull larrycai/jenkins-jobdsl  Notepad++ & MobaXterm are recommended 3 08/12/15 http://boot2docker.io/
  • 4. Introduction  Jenkins is a de-facto CI standard used for lots of products  Easy to start, configure and extending (300+ plugins)  Configure jobs in UI mostly  Weak parts:  Update git repo for many jobs  Create dozens of jobs in fly for new project  Monitor the changes 4 08/12/15 Learn new way to configure jenkins Jobs
  • 5. Exercise 1: Hello World  Run first app inside docker environment $ cd /c/<Users>/codingwithme/jobdsl # create in advance $ docker run -it –v $PWD:/opt/jenkins/data/jobs/jobdsl/workspace -p 8080:8080 larrycai/jenkins-jobdsl  Browse: http://192.168.59.103:8080 Clean jenkins UI with one Job “HelloWorld”  Exercise : 1. Execute job “HelloWorld”, and check result 2. See configuration 3. Run it again 4. Delete job “Compile-DSL-Tutorial-0” and Update job “Package-DSL- Tutorial-0” and Run it again 5 08/12/15
  • 6. JobDSL is Groovy based  DSL : Domain Specific Language, easy to read and understand  JobDSL is jenkins plugin, https://wiki.jenkins-ci.org/display/JENKINS/Job+DSL+Plugin  Groovy based 6 08/12/15 • Groovy is a multi-faceted language for the Java platform • Groovy used in jenkins to access internal data
  • 7. JobDSL & Idempotent  JobDSL helps to simplify the maintenance of jenkins jobs  An idempotent operation is one that can be applied multiple times without changing the result beyond the initial application  Keep the environment stable, reliable  No matter the job is changed by someone, if the jobDSL script is run, it will reach to the desired status 7 08/12/15
  • 8. Exercise 2:Hello World  Configure “HelloWorld” job  Replace script like below freeStyleJob("Hello2") { steps { shell('echo "Hello Larry"') } }  Select option “Action for removed jobs” to “Delete” and option “Action for removed views” to “Delete”, Run it again 8 08/12/15
  • 9. Jenkins Job mapping to JobDSL 9 08/12/15  Job Type (freeStyleJob)  Build Parameters (parameters)  SCM (scm)  BuildTriggers (triggers)  Steps (steps)  Post Build Actions (publishers) https://github.com/jenkinsci/job-dsl-plugin/wiki/Job-reference
  • 10. Exercise 3: Complete JobDSL example  Follow the existing Jenkins job “Sample” and convert it into JobDSL in “jobdsl”  Cover Scm/trigger/shell/archive  Steps:  New job “jobdsl” (freestyle)  New build step – Process Job DSLs  Choose “Look on Filesystem”  complete.groovy  In file, use freeStyleJob(“Hello3”)  Edit it in Windows env. (codingwith/jobdsl) # mapped into docker  Compare the result 10 08/12/15 Reference: https://github.com/jenkinsci/job-dsl-plugin/wiki/Job-reference
  • 11. Jenkins View & Groovy DSL  JenkinsView is simple as jobs  Name/filter/column .  Learn some groovy to handle common tasks  Loop  Read & Parse external config files 11 08/12/15
  • 12. Exercise 4: List View and Loop  Create different ListView and generate multi jobs based on the config file  Based on HelloWorld Example for jobs  Json file: HelloWorld/workspace/views.json  Steps  Create new view.groovy  Run inside job jobdsl 12 08/12/15
  • 13. Configure block  Not every jenkins Plugin are supported in JobDSL (may changes in the future)  Raise issues to get support  Configure blocks are used inside the Job DSL to give direct access to underlying XML of the Jenkins config.xml 13 08/12/15 https://github.com/jenkinsci/job-dsl-plugin/wiki/The-Configure-Block
  • 14. Exercise 5: Configure Block for testNG  Change the Sample job to export testNG result, which is not support by jobDSL yet.  Steps:  Configure Sample job to publish testNG result in post-build  Check generate config.xml http://localhost:8080/view/CodingWithMe/job/Sample/config.xml  Write testng.groovy based on complete.groovy  Generate job Hello5  Compare result 14 08/12/15
  • 15. Summary  JobDSL is the powerful to simplify the maintenance of your jenkins jobs and keep it in professional way  Put jobDSL scripts in git repo  What we learn  Execute JobDSL in jenkins jobs  Inside script & script file  Create job/View in jobDSL  Simple Groovy knowledge to handle loop/read external data  Configure Block in jobDSL to handle not direct supported plugins 15 08/12/15
  • 16. Reference  jobDSL slides  http://www.slideshare.net/daspilker/configuration-as-code-the-job-dsl-plugin  JobDSL ref  https://github.com/jenkinsci/job-dsl-plugin/wiki/View-Reference  https://github.com/jenkinsci/job-dsl-plugin/wiki/Job-reference  https://github.com/jenkinsci/job-dsl-plugin/wiki/The-Configure-Block  Groovy Json  http://www.groovy-lang.org/json.html  Exercise Gist  https://gist.github.com/larrycai/aeb9a3b037dcb17df9b2 16 08/12/15
  • 17. CodingWithMe  "CodingWithMe - Learning by Coding" is a coding workshop, it aims to learn one technology in 90 minutes by practice  Features:  4-5 well tuned hands on exercises in 90 minutes  First exercise shall be started in 20 minutes  It well follows Bob Pike’s 90/20/8 rules (happen to know)  It is recommended arranged for several parallel sessions if it is organized in the company. 17 08/12/15 http://www.larrycaiyu.com/blog/2014/03/18/codingwithme_introduction/