SlideShare a Scribd company logo
1 of 25
Download to read offline
Enabling Continuous Delivery
with Jenkins Workflow
Kurt Madel-@kmadel
Continuous Delivery
2
What is Continuous Delivery?
3
ProdDev
Automate the Application Lifecycle
4
ProdDev BuildCommit Test Stage Deploy
Feedback Loop
The Automation Engine at the Heart of CD is Critical
5
Automation
Engine
Developer
Source
Code
Control
System
Compile
/BuildCode
Scan TestsCode
Commit
Results
Report
BuildCommit Test Stage Deploy
Deploy
Prod
Deploy
Stage
Complex Delivery Pipelines
Delivery of App and Config
Enterprise-grade
CD Automation
Platform
Continuous Delivery
ProdDev
Jenkins, with Workflow, is the Proven CD Platform
6
Developer
Source
Code
Control
System
Compile
/BuildCode
Scan TestsCode
Commit
Results
Report
BuildCommit Test Stage Deploy
Deploy
Prod
Deploy
Stage
Complex Delivery Pipelines
Delivery of App and Config
Jenkins Workflow
ProdDev
Jenkins is the Hub of the CD Ecosystem
7
Plug-ins for all
your tools
RunDeployStageTestBuildCommit
Jenkins Workflow Plugin
8
Jenkins Workflow CD Pipelines
9
Jenkins Workflow
ProdDev
Perf Test
BuildCommit
Selenium
Test Stage Deploy
Sonar
Test
Pipelines Need:
• Branching
• Looping
• Restarts
• Checkpoints
• Manual Input
??
Jenkins Workflow
10
• A first-class feature for managing complex, multi-step pipelines
• Brings the power of the Jenkins domain and plugin ecosystem into a Groovy
based scriptable Domain-Specific Language (DSL)
• Workflow is extensible by third-party developers, supporting custom
extensions to the Workflow DSL and various options for plugin integration
• Workflow scripts may be loaded directly from SCM
Key Workflow Features
11
• Entire flow is one concise Groovy script using Workflow DSL
– For loops,try-finally, fork-join,parallel …
• Workflow execution is resumable in the event the Jenkins master crashes or is
restarted
• Allocate slave nodes and workspaces
– As many as you want, when you want
• Stages allow throttling concurrency of builds
• Human input/approval integrated into flow
• Standard project concepts: SCM, artifacts,plugins
Your First Workflow
12
• Install the Workflow: Aggregator plugin*
• Click New Item, pick a name for your flow, select Workflow, and click OK
• The Script text area is where your flow script is defined
• Enter the following step into the Script text area:
echo 'Hello world'
• If you are not a Jenkins administrator, check the Use Groovy Sandbox option
• Save your workflow and click Build Now to run it
Workflow Snippet Generator
13
• The Workflow Snippet Generator
makes editing your workflows easier
• The Snippet Generator is dynamically
populated based on the Workflow
plugins you have installed
Workflow node Step
14
• The node step schedules a task to run by adding it to the Jenkins build
queue
• As soon as an executor slot is available on a node (the Jenkins master, or a
slave), the task is run on that node
• A node also allocates a workspace (file directory) on that node for the
duration of the task
• The body of the node step may contain many steps and some steps can only
run in the context of a node (git and sh for example)
• The node step takes a label expression to select a specific node type
Checking Out Code
15
• Simple syntax for retrieving source code, leveraging the many existing SCM
plugins for Jenkins:
checkout([$class: 'GitSCM', branches: [[name: '*/ master']],
userRemoteConfigs: [[url: 'http://github.com/ cloudbees/todo-
api.git']]])
• simplified syntax for Git based SCM:
git 'https://github.com/cloudbees/todo-api.git'
Workflow Stages
16
• Stages are usually the topmost element of Workflow syntax
• Stages allow you to group your build steps into its component parts
• Multiple builds of the same workflow can run concurrently,the stage step
allows you to control concurrency for a specific part of your flow:
stage 'build' node{ ... }
stage name: 'test', concurrency: 3 node{ ... }
stage name: 'deploy', concurrency: 1 node{ ... }
Workflow Parallelism
17
• The parallel construct allows you to run steps concurrenlty in the same
flow:
parallel (
"stream 1" : { ... things ... },
"stream 2" : { ... things in parallel ... }
)
• The parallel construct allows you to distribute a flow across multiple
nodes:
parallel (
"stream 1" : {
node { unstash "binary" sh "sleep 20s" sh "echo hstream1" }
}, "stream 2" : {
node { unstash "binary" sh "echo hello2" sh "hashtag fail" }
} )
Working with Files
18
• The stash and unstash steps share files between nodes
node{ stash includes: 'pom.xml', name: 'pom’}
node { unstash 'pom’}
• The archive step allows you to maintain binaries from your Workflow
build in Jenkins for easy access later:
archive includes: '*.jar, excludes: '*-sources.jar’
• Beyond stashing and archiving files, the following Workflow steps also work
with the file system:
pwd()
dir(''){}
writeFile file: 'target/results.txt', text: '' readFile
'target/results.txt'
fileExists 'target/results.txt'
Workflow Global Library
19
• Enables sharing ‘sub-scripts’ across multiple workflows
• Creates a ‘shared script library’ Git repository inside Jenkins
• Every workflow script in your Jenkins see these shared library scripts in their
classpath
• Add/modify scripts by cloning the repo and pushing to it
• You can define your own functions that looks and feels like built-in step
functions
• More info is available: https://github.com/jenkinsci/workflow-
plugin/blob/master/cps-global-lib/README.md
Mulitbranch Workflow
20
• A new Jenkins item type
• Configured as a Groovy CPS DSL from SCM
• Git, Subversion and Mercurial are currently supported
• Creates a sub-project (with separate build history, etc) for each branch in the
SCM project
• The Jenkins Multibranch Workflow job expects to find a script named
Jenkinsfile in branches it can build
Docker Workflow Plugin
21
How Does it Help You
22
• Customize slave allocation
• Run steps inside Docker containers
• Build and publish images
• Use custom registries and Docker hosts
• Running and testing images
Docker Workflow Example
23
stage 'Build’
node('docker') {
docker.image(‘maven:3.3.3-jdk-8’).inside('-v /repo:/repo’) {
git 'https://github.com/cloudbees/mobile-deposit-api.git’
sh 'mvn clean package’
}
}
node('docker') {
docker.withServer('tcp://docker.beedemo.net:2376', ’docker-beedemo-creds'){
stage 'Build Docker Image’
def dockerImage = docker.build “cloudbees/mobile-deposit-api:${buildVersion}”
stage ’Deploy Docker Image’
dockerImage.run("--name mobile-deposit-api -p 8080:8080”)
stage 'Publish Docker Image’
docker.withRegistry('https://registry.beedemo.net/', 'docker-registry-login') {
dockerImage.push()
}
}
}
Workflow Resources
24
• The GitHub project has documentations and tutorials:
https://github.com/jenkinsci/workflow-plugin
• Current plugin compatibility and notes for plugin developers:
https://github.com/jenkinsci/workflow-
plugin/blob/master/COMPATIBILITY.md
• There is a Dzone Refcard that lists all the core steps and some additional
steps: https://dzone.com/refcardz/continuous-delivery-with-jenkins-
workflow
• Numerous blog posts – do a Google search as there are too many to list!
Thank	you!

More Related Content

What's hot

Jenkins Workflow Webinar - Dec 10, 2014
Jenkins Workflow Webinar - Dec 10, 2014Jenkins Workflow Webinar - Dec 10, 2014
Jenkins Workflow Webinar - Dec 10, 2014
CloudBees
 

What's hot (20)

DevOps World | Jenkins World 2018 and The Future of Jenkins
DevOps World | Jenkins World 2018 and The Future of JenkinsDevOps World | Jenkins World 2018 and The Future of Jenkins
DevOps World | Jenkins World 2018 and The Future of Jenkins
 
Jenkins Workflow Webinar - Dec 10, 2014
Jenkins Workflow Webinar - Dec 10, 2014Jenkins Workflow Webinar - Dec 10, 2014
Jenkins Workflow Webinar - Dec 10, 2014
 
Automate App Container Delivery with CI/CD and DevOps
Automate App Container Delivery with CI/CD and DevOpsAutomate App Container Delivery with CI/CD and DevOps
Automate App Container Delivery with CI/CD and DevOps
 
Continuous Delivery to Kubernetes with Jenkins and Helm
Continuous Delivery to Kubernetes with Jenkins and HelmContinuous Delivery to Kubernetes with Jenkins and Helm
Continuous Delivery to Kubernetes with Jenkins and Helm
 
DockerCon SF 2015: Docker in the New York Times Newsroom
DockerCon SF 2015: Docker in the New York Times NewsroomDockerCon SF 2015: Docker in the New York Times Newsroom
DockerCon SF 2015: Docker in the New York Times Newsroom
 
Continuous Delivery with Jenkins
Continuous Delivery with JenkinsContinuous Delivery with Jenkins
Continuous Delivery with Jenkins
 
DockerCon 15 Keynote - Day 2
DockerCon 15 Keynote - Day 2DockerCon 15 Keynote - Day 2
DockerCon 15 Keynote - Day 2
 
How to Improve Your Image Builds Using Advance Docker Build
How to Improve Your Image Builds Using Advance Docker BuildHow to Improve Your Image Builds Using Advance Docker Build
How to Improve Your Image Builds Using Advance Docker Build
 
Introduction to Docker - Vellore Institute of Technology
Introduction to Docker - Vellore Institute of TechnologyIntroduction to Docker - Vellore Institute of Technology
Introduction to Docker - Vellore Institute of Technology
 
DockerCon SF 2015: Keynote Day 1
DockerCon SF 2015: Keynote Day 1DockerCon SF 2015: Keynote Day 1
DockerCon SF 2015: Keynote Day 1
 
7 Habits of Highly Effective Jenkins Users
7 Habits of Highly Effective Jenkins Users7 Habits of Highly Effective Jenkins Users
7 Habits of Highly Effective Jenkins Users
 
A Shift from Monolith to Microservice using Docker
A Shift from Monolith to Microservice using DockerA Shift from Monolith to Microservice using Docker
A Shift from Monolith to Microservice using Docker
 
Analyze This! CloudBees Jenkins Cluster Operations and Analytics
Analyze This! CloudBees Jenkins Cluster Operations and AnalyticsAnalyze This! CloudBees Jenkins Cluster Operations and Analytics
Analyze This! CloudBees Jenkins Cluster Operations and Analytics
 
Baking Docker Using Chef
Baking Docker Using ChefBaking Docker Using Chef
Baking Docker Using Chef
 
2016 Docker Palo Alto - CD with ECS and Jenkins
2016 Docker Palo Alto -  CD with ECS and Jenkins2016 Docker Palo Alto -  CD with ECS and Jenkins
2016 Docker Palo Alto - CD with ECS and Jenkins
 
Cloud Native CI/CD with Jenkins X and Knative Pipelines
Cloud Native CI/CD with Jenkins X and Knative PipelinesCloud Native CI/CD with Jenkins X and Knative Pipelines
Cloud Native CI/CD with Jenkins X and Knative Pipelines
 
Docker for any type of workload and any IT Infrastructure
Docker for any type of workload and any IT InfrastructureDocker for any type of workload and any IT Infrastructure
Docker for any type of workload and any IT Infrastructure
 
Using Docker Hub at Scale to Support Micro Focus' Delivery and Deployment Model
Using Docker Hub at Scale to Support Micro Focus' Delivery and Deployment ModelUsing Docker Hub at Scale to Support Micro Focus' Delivery and Deployment Model
Using Docker Hub at Scale to Support Micro Focus' Delivery and Deployment Model
 
Docker Container As A Service - JAX 2016
Docker Container As A Service - JAX 2016Docker Container As A Service - JAX 2016
Docker Container As A Service - JAX 2016
 
DockerCon SF 2015: Ben Golub's Keynote Day 1
DockerCon SF 2015: Ben Golub's Keynote Day 1DockerCon SF 2015: Ben Golub's Keynote Day 1
DockerCon SF 2015: Ben Golub's Keynote Day 1
 

Viewers also liked

Using Jenkins XML API
Using Jenkins XML APIUsing Jenkins XML API
Using Jenkins XML API
Anton Weiss
 

Viewers also liked (20)

Pimp your Continuous Delivery Pipeline with Jenkins workflow (W-JAX 14)
Pimp your Continuous Delivery Pipeline with Jenkins workflow (W-JAX 14)Pimp your Continuous Delivery Pipeline with Jenkins workflow (W-JAX 14)
Pimp your Continuous Delivery Pipeline with Jenkins workflow (W-JAX 14)
 
Los vatos
Los vatosLos vatos
Los vatos
 
Juc west-how to build a jenkins db the wrong way!
Juc west-how to build a jenkins db the wrong way!Juc west-how to build a jenkins db the wrong way!
Juc west-how to build a jenkins db the wrong way!
 
Jenkins Workflow - An Introduction
Jenkins Workflow - An IntroductionJenkins Workflow - An Introduction
Jenkins Workflow - An Introduction
 
20160929 android taipei Sonatype nexus on amazon ec2
20160929 android taipei Sonatype nexus on amazon ec2 20160929 android taipei Sonatype nexus on amazon ec2
20160929 android taipei Sonatype nexus on amazon ec2
 
Using Jenkins XML API
Using Jenkins XML APIUsing Jenkins XML API
Using Jenkins XML API
 
DevOps – SonarQube
DevOps – SonarQubeDevOps – SonarQube
DevOps – SonarQube
 
Continuous Cross Platform Mobile App Development using Jenkins Build Server
Continuous Cross Platform Mobile App Development using Jenkins Build ServerContinuous Cross Platform Mobile App Development using Jenkins Build Server
Continuous Cross Platform Mobile App Development using Jenkins Build Server
 
Track code quality with SonarQube
Track code quality with SonarQubeTrack code quality with SonarQube
Track code quality with SonarQube
 
Maven Nexus
Maven NexusMaven Nexus
Maven Nexus
 
CONTINUOUS INTEGRATION WITH JENKINS AND GIT
CONTINUOUS INTEGRATION WITH JENKINS AND GITCONTINUOUS INTEGRATION WITH JENKINS AND GIT
CONTINUOUS INTEGRATION WITH JENKINS AND GIT
 
Build and deployment with Jenkins and Code Deploy on AWS
Build and deployment with Jenkins and Code Deploy on AWSBuild and deployment with Jenkins and Code Deploy on AWS
Build and deployment with Jenkins and Code Deploy on AWS
 
Sonarqube
SonarqubeSonarqube
Sonarqube
 
Jenkins days workshop pipelines - Eric Long
Jenkins days workshop  pipelines - Eric LongJenkins days workshop  pipelines - Eric Long
Jenkins days workshop pipelines - Eric Long
 
Ci jenkins maven svn
Ci jenkins maven svnCi jenkins maven svn
Ci jenkins maven svn
 
Jenkins CI presentation
Jenkins CI presentationJenkins CI presentation
Jenkins CI presentation
 
Continuous Delivery with Jenkins Workflow
Continuous Delivery with Jenkins WorkflowContinuous Delivery with Jenkins Workflow
Continuous Delivery with Jenkins Workflow
 
SonarQube - The leading platform for Continuous Code Quality
SonarQube - The leading platform for Continuous Code QualitySonarQube - The leading platform for Continuous Code Quality
SonarQube - The leading platform for Continuous Code Quality
 
Tracking and improving software quality with SonarQube
Tracking and improving software quality with SonarQubeTracking and improving software quality with SonarQube
Tracking and improving software quality with SonarQube
 
SONAR
SONAR SONAR
SONAR
 

Similar to Atlanta Jenkins Area Meetup October 22nd 2015

413450-rc218-cdw-jenkins-workflow
413450-rc218-cdw-jenkins-workflow413450-rc218-cdw-jenkins-workflow
413450-rc218-cdw-jenkins-workflow
Andy Pemberton
 
DevOps Interview Questions Part - 2 | Devops Interview Questions And Answers ...
DevOps Interview Questions Part - 2 | Devops Interview Questions And Answers ...DevOps Interview Questions Part - 2 | Devops Interview Questions And Answers ...
DevOps Interview Questions Part - 2 | Devops Interview Questions And Answers ...
Simplilearn
 

Similar to Atlanta Jenkins Area Meetup October 22nd 2015 (20)

(Declarative) Jenkins Pipelines
(Declarative) Jenkins Pipelines(Declarative) Jenkins Pipelines
(Declarative) Jenkins Pipelines
 
Jenkins Pipelines
Jenkins PipelinesJenkins Pipelines
Jenkins Pipelines
 
Jenkins Days - Workshop - Let's Build a Pipeline - Los Angeles
Jenkins Days - Workshop - Let's Build a Pipeline - Los AngelesJenkins Days - Workshop - Let's Build a Pipeline - Los Angeles
Jenkins Days - Workshop - Let's Build a Pipeline - Los Angeles
 
413450-rc218-cdw-jenkins-workflow
413450-rc218-cdw-jenkins-workflow413450-rc218-cdw-jenkins-workflow
413450-rc218-cdw-jenkins-workflow
 
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
 
Jenkins presentation
Jenkins presentationJenkins presentation
Jenkins presentation
 
An Open-Source Chef Cookbook CI/CD Implementation Using Jenkins Pipelines
An Open-Source Chef Cookbook CI/CD Implementation Using Jenkins PipelinesAn Open-Source Chef Cookbook CI/CD Implementation Using Jenkins Pipelines
An Open-Source Chef Cookbook CI/CD Implementation Using Jenkins Pipelines
 
DevOps Interview Questions Part - 2 | Devops Interview Questions And Answers ...
DevOps Interview Questions Part - 2 | Devops Interview Questions And Answers ...DevOps Interview Questions Part - 2 | Devops Interview Questions And Answers ...
DevOps Interview Questions Part - 2 | Devops Interview Questions And Answers ...
 
SenchaCon 2016: Develop, Test & Deploy with Docker - Jonas Schwabe
SenchaCon 2016: Develop, Test & Deploy with Docker - Jonas Schwabe SenchaCon 2016: Develop, Test & Deploy with Docker - Jonas Schwabe
SenchaCon 2016: Develop, Test & Deploy with Docker - Jonas Schwabe
 
Docker and Puppet for Continuous Integration
Docker and Puppet for Continuous IntegrationDocker and Puppet for Continuous Integration
Docker and Puppet for Continuous Integration
 
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...
 
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
 
Continuous Integration With Jenkins Docker SQL Server
Continuous Integration With Jenkins Docker SQL ServerContinuous Integration With Jenkins Docker SQL Server
Continuous Integration With Jenkins Docker SQL Server
 
DevOPS training - Day 2/2
DevOPS training - Day 2/2DevOPS training - Day 2/2
DevOPS training - Day 2/2
 
Dockerized maven
Dockerized mavenDockerized maven
Dockerized maven
 
Versioning for Developers
Versioning for DevelopersVersioning for Developers
Versioning for Developers
 
Efficient Parallel Testing with Docker by Laura Frank
Efficient Parallel Testing with Docker by Laura FrankEfficient Parallel Testing with Docker by Laura Frank
Efficient Parallel Testing with Docker by Laura Frank
 
Fullstack workshop
Fullstack workshopFullstack workshop
Fullstack workshop
 
OpenShift Build Pipelines @ Lightweight Java User Group Meetup
OpenShift Build Pipelines @ Lightweight Java User Group MeetupOpenShift Build Pipelines @ Lightweight Java User Group Meetup
OpenShift Build Pipelines @ Lightweight Java User Group Meetup
 
Настройка окружения для кросскомпиляции проектов на основе docker'a
Настройка окружения для кросскомпиляции проектов на основе docker'aНастройка окружения для кросскомпиляции проектов на основе docker'a
Настройка окружения для кросскомпиляции проектов на основе docker'a
 

Recently uploaded

+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
masabamasaba
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 

Recently uploaded (20)

Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 

Atlanta Jenkins Area Meetup October 22nd 2015

  • 1. Enabling Continuous Delivery with Jenkins Workflow Kurt Madel-@kmadel
  • 3. What is Continuous Delivery? 3 ProdDev
  • 4. Automate the Application Lifecycle 4 ProdDev BuildCommit Test Stage Deploy Feedback Loop
  • 5. The Automation Engine at the Heart of CD is Critical 5 Automation Engine Developer Source Code Control System Compile /BuildCode Scan TestsCode Commit Results Report BuildCommit Test Stage Deploy Deploy Prod Deploy Stage Complex Delivery Pipelines Delivery of App and Config Enterprise-grade CD Automation Platform Continuous Delivery ProdDev
  • 6. Jenkins, with Workflow, is the Proven CD Platform 6 Developer Source Code Control System Compile /BuildCode Scan TestsCode Commit Results Report BuildCommit Test Stage Deploy Deploy Prod Deploy Stage Complex Delivery Pipelines Delivery of App and Config Jenkins Workflow ProdDev
  • 7. Jenkins is the Hub of the CD Ecosystem 7 Plug-ins for all your tools RunDeployStageTestBuildCommit
  • 9. Jenkins Workflow CD Pipelines 9 Jenkins Workflow ProdDev Perf Test BuildCommit Selenium Test Stage Deploy Sonar Test Pipelines Need: • Branching • Looping • Restarts • Checkpoints • Manual Input ??
  • 10. Jenkins Workflow 10 • A first-class feature for managing complex, multi-step pipelines • Brings the power of the Jenkins domain and plugin ecosystem into a Groovy based scriptable Domain-Specific Language (DSL) • Workflow is extensible by third-party developers, supporting custom extensions to the Workflow DSL and various options for plugin integration • Workflow scripts may be loaded directly from SCM
  • 11. Key Workflow Features 11 • Entire flow is one concise Groovy script using Workflow DSL – For loops,try-finally, fork-join,parallel … • Workflow execution is resumable in the event the Jenkins master crashes or is restarted • Allocate slave nodes and workspaces – As many as you want, when you want • Stages allow throttling concurrency of builds • Human input/approval integrated into flow • Standard project concepts: SCM, artifacts,plugins
  • 12. Your First Workflow 12 • Install the Workflow: Aggregator plugin* • Click New Item, pick a name for your flow, select Workflow, and click OK • The Script text area is where your flow script is defined • Enter the following step into the Script text area: echo 'Hello world' • If you are not a Jenkins administrator, check the Use Groovy Sandbox option • Save your workflow and click Build Now to run it
  • 13. Workflow Snippet Generator 13 • The Workflow Snippet Generator makes editing your workflows easier • The Snippet Generator is dynamically populated based on the Workflow plugins you have installed
  • 14. Workflow node Step 14 • The node step schedules a task to run by adding it to the Jenkins build queue • As soon as an executor slot is available on a node (the Jenkins master, or a slave), the task is run on that node • A node also allocates a workspace (file directory) on that node for the duration of the task • The body of the node step may contain many steps and some steps can only run in the context of a node (git and sh for example) • The node step takes a label expression to select a specific node type
  • 15. Checking Out Code 15 • Simple syntax for retrieving source code, leveraging the many existing SCM plugins for Jenkins: checkout([$class: 'GitSCM', branches: [[name: '*/ master']], userRemoteConfigs: [[url: 'http://github.com/ cloudbees/todo- api.git']]]) • simplified syntax for Git based SCM: git 'https://github.com/cloudbees/todo-api.git'
  • 16. Workflow Stages 16 • Stages are usually the topmost element of Workflow syntax • Stages allow you to group your build steps into its component parts • Multiple builds of the same workflow can run concurrently,the stage step allows you to control concurrency for a specific part of your flow: stage 'build' node{ ... } stage name: 'test', concurrency: 3 node{ ... } stage name: 'deploy', concurrency: 1 node{ ... }
  • 17. Workflow Parallelism 17 • The parallel construct allows you to run steps concurrenlty in the same flow: parallel ( "stream 1" : { ... things ... }, "stream 2" : { ... things in parallel ... } ) • The parallel construct allows you to distribute a flow across multiple nodes: parallel ( "stream 1" : { node { unstash "binary" sh "sleep 20s" sh "echo hstream1" } }, "stream 2" : { node { unstash "binary" sh "echo hello2" sh "hashtag fail" } } )
  • 18. Working with Files 18 • The stash and unstash steps share files between nodes node{ stash includes: 'pom.xml', name: 'pom’} node { unstash 'pom’} • The archive step allows you to maintain binaries from your Workflow build in Jenkins for easy access later: archive includes: '*.jar, excludes: '*-sources.jar’ • Beyond stashing and archiving files, the following Workflow steps also work with the file system: pwd() dir(''){} writeFile file: 'target/results.txt', text: '' readFile 'target/results.txt' fileExists 'target/results.txt'
  • 19. Workflow Global Library 19 • Enables sharing ‘sub-scripts’ across multiple workflows • Creates a ‘shared script library’ Git repository inside Jenkins • Every workflow script in your Jenkins see these shared library scripts in their classpath • Add/modify scripts by cloning the repo and pushing to it • You can define your own functions that looks and feels like built-in step functions • More info is available: https://github.com/jenkinsci/workflow- plugin/blob/master/cps-global-lib/README.md
  • 20. Mulitbranch Workflow 20 • A new Jenkins item type • Configured as a Groovy CPS DSL from SCM • Git, Subversion and Mercurial are currently supported • Creates a sub-project (with separate build history, etc) for each branch in the SCM project • The Jenkins Multibranch Workflow job expects to find a script named Jenkinsfile in branches it can build
  • 22. How Does it Help You 22 • Customize slave allocation • Run steps inside Docker containers • Build and publish images • Use custom registries and Docker hosts • Running and testing images
  • 23. Docker Workflow Example 23 stage 'Build’ node('docker') { docker.image(‘maven:3.3.3-jdk-8’).inside('-v /repo:/repo’) { git 'https://github.com/cloudbees/mobile-deposit-api.git’ sh 'mvn clean package’ } } node('docker') { docker.withServer('tcp://docker.beedemo.net:2376', ’docker-beedemo-creds'){ stage 'Build Docker Image’ def dockerImage = docker.build “cloudbees/mobile-deposit-api:${buildVersion}” stage ’Deploy Docker Image’ dockerImage.run("--name mobile-deposit-api -p 8080:8080”) stage 'Publish Docker Image’ docker.withRegistry('https://registry.beedemo.net/', 'docker-registry-login') { dockerImage.push() } } }
  • 24. Workflow Resources 24 • The GitHub project has documentations and tutorials: https://github.com/jenkinsci/workflow-plugin • Current plugin compatibility and notes for plugin developers: https://github.com/jenkinsci/workflow- plugin/blob/master/COMPATIBILITY.md • There is a Dzone Refcard that lists all the core steps and some additional steps: https://dzone.com/refcardz/continuous-delivery-with-jenkins- workflow • Numerous blog posts – do a Google search as there are too many to list!