SlideShare a Scribd company logo
1
Jenkins Days Workshop
Let’s Build a Jenkins
Pipeline
3
Goals for today
Install Jenkins Enterprise
Create a Jenkins Pipeline
Try the basics
See what else is possible and get connected!
Welcome!
1
2
3
4
About your guide: Eric Long
4
Hands-on Delivery experience on CloudBees Jenkins and Pipelines
Senior DevOps Consultant
@ericlongtx
What is Jenkins?
5
Well that’s a funny question.
A CI server? A CD Server?
An automation server
Easy to Start
6
java -jar jenkins.war
CloudBees Jenkins Enterprise
… part of CloudBees Jenkins Platform
7
Jenkins for the EnterpriseCommunity Innovation
What is Jenkins Pipeline?
● Formerly known as Jenkins Workflow, Jenkins Pipeline was introduced in
2014
● New job type – a single Groovy script using an embedded DSL - no need to
jump between multiple job configuration screens to see what is going on
● Durable - keeps running even if Jenkins master is not
● Distributable – a Pipeline job may be run across an unlimited number of
nodes, including in parallel
● Pausable – allows waiting for input from users before continuing to the next
step
● Visualized - Pipeline Stage View provides status at-a-glance dashboards to
include trending
8
Lab Exercise:
Install Jenkins Enterprise
Install Jenkins Enterprise
10
Have Docker?
No Docker? No problem.
https://www.cloudbees.com/get-started
docker run -d -p 80:8080 --name cje -v
/var/run/docker.sock:/var/run/docker.sock beedemo/jenkins-
enterprise-trial
Finish Install
Unlock Jenkins
Request a trial license
Install suggested plugins
Create First Admin User
11
docker logs -f cje
Jenkins initial setup is required. An admin user has been created and a
password generated.
Please use the following password to proceed to installation:
1a90312e459b4d4693f18d48d102d6c6
Lab Exercise:
Create a Pipeline
Pipeline: a new job type
Key Benefits
✓ Long-running
✓ Durable
✓ Scriptable
✓ One-place for Everything
Pipeline: a new job type
✓ Makes building Pipelines
Simple
Domain Specific Language
15
Simple, Groovy-based DSL (“Domain Specific Language”) to
manage build step orchestration
Can be defined as DSL in Jenkins or as Jenkinsfile in SCM
Groovy is widely used in Jenkins ecosystem. You can leverage
the large Jenkins Groovy experience
If you don’t like/care about Groovy, just consider the DSL as a
dedicated simple syntax
Snippet Generator
16
Create a Pipeline - core steps
17
stage - group your steps into its component parts and control
concurrency
node - schedules the steps to run by adding them to Jenkins'
build queue and creates a workspace specific to this pipeline
sh (or bat) - execute shell (*nix) or batch scripts (Windows)
just like freestyle jobs, calling any tools in the agent
Create a Pipeline
stage('build')
echo 'hello from jenkins master'
node {
sh 'echo hello from jenkins agent'
}
stage('test')
echo 'test some things'
stage('deploy')
echo 'deploy some things'
18
Lab Exercise:
Checkout from SCM
Files
stash - store some files for later use
unstash - retrieve previously stashed files (even across
nodes)
writeFile - write a file to the workspace
readFile - read a file from the workspace
20
Checkout from SCM and stash Files
stage('build')
node {
git 'https://github.com/beedemo/mobile-deposit-api.git'
writeFile encoding: 'UTF-8', file: 'config', text:
'version=1'
stash includes: 'pom.xml,config', name: 'pom-config'
}
stage('test')
node {
unstash 'pom-config'
configValue = readFile encoding: 'UTF-8', file: 'config'
echo configValue
}
21
try up to N times
retry(5) {
// some block
}
wait for a condition
waitUntil {
// some block
}
Flow Control
22
wait for a set time
sleep time: 1000, unit:'NANOSECONDS'
timeout
timeout(time: 30, unit: 'SECONDS'){
// some block
}
You can also rely on Groovy control flow syntax!
while(something) {
// do something
if (something_else) {
// do something else
}
}
Flow Control
23
try{
//some things
}catch(e){
//
}
Advanced Flow Control
input - pause for manual or automated approval
parallel - allows simultaneous execution of build steps on the current
node or across nodes, thus increasing build speed
parallel 'quality scan': {
node {sh 'mvn sonar:sonar'}
}, 'integration test': {
node {sh 'mvn verify'}
}
checkpoint - capture the workspace state so it can be reused
as a starting point for subsequent runs
Lab Exercise:
Input and Checkpoints
Input Approval & Checkpoints
26
stage('deploy')
input message: 'Do you want to deploy?'
node {
echo 'deployed'
}
Input Approval & Checkpoints
27
checkpoint 'testing-complete'
stage('approve')
mail body: "Approval needed for '${env.JOB_NAME}' at
${env.BUILD_URL}, subject: "${env.JOB_NAME}
Approval",
to: "ops@acme.com"
timeout(time: 7, unit: 'DAYS') {
input message: 'Do you want to deploy?',
parameters: [string(defaultValue: '', description:
'Provide any comments regarding decision.', name:
'Comments')], submitter: 'ops'
}
Lab Exercise:
Tool Management
tool Step
● Binds a tool installation to a variable
● The tool home directory is returned
● Only tools already configured are available
def mvnHome = tool 'M3'
sh "${mvnHome}/bin/mvn -B verify"
29
Use Docker Containers
● The CloudBees Docker Pipeline plugin allows running steps
inside a container
● You can even build the container as part of the same
Pipeline
docker.image('maven:3.3.3-jdk-8').inside() {
sh 'mvn -B verify'
}
30
Lab Exercise:
Pipeline as Code
Pipeline script in SCM
32
33
Pipeline-as-Code
Pipeline Multibranch
34
Pipeline Shared Libraries
35
What Next?
More Advanced Steps
Send email
mail body: 'Uh oh.', subject: 'Build Failed!', to: 'dev@cloudbees.com'
step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients:
'info@cloudbees.com'])
Deploy to Amazon Elastic Beanstalk
wrap([$class: 'AmazonAwsCliBuildWrapper', credentialsId: 'aws-
beanstalk-credentials', defaultRegion: 'us-east-1']) {
sh 'aws elasticbeanstalk create-application-version'
}
Integrate with Jira
jiraComment(issueKey: "EX-111", body: "Job '${env.JOB_NAME}'
(${env.BUILD_NUMBER}) built. Please go to ${env.BUILD_URL}.")
37
@issc29 #JenkinsWorld
Docker + Pipelines
© 2016 CloudBees, Inc. All Rights Reserved
@issc29 #JenkinsWorld
Agent
Gartner: “Using Docker to Run Build Nodes is Ideal.”
© 2016 CloudBees, Inc. All Rights Reserved
Master
z
Agent
Agent
@issc29 #JenkinsWorld
Accelerating CD with Containers
Workflow CD Pipeline Triggers:
✓ New application code (feature, bug fix, etc.)
✓ Updated certified stack (security fix in Linux, etc.)
✓ Will lead to a new gold image being built and
available for … TESTING … STAGING … PRODUCTION
✓ All taking place in a standardized/similar/consistent OS
environment
© 2016 CloudBees, Inc. All Rights Reserved
+
Jenkins Pipeline
TEST
STAGE
PRODUCTIO
N
App
<code>
(git, etc.)
Gold
Docker
Image
(~per app)
<OS config>
Certified
Docker
Images
(Ubuntu, etc.)
<OS config>
@issc29 #JenkinsWorld
Jenkins Pipeline Docker Commands
• withRegistry
– Specifies which Docker Registry to use for pushing/pulling
• withServer
– Specifies which Server to issue Docker commands against
• Build
– Builds container from Dockerfile
• Image.run
– Runs a container
• Image.inside
– Runs container and allows you to execute command inside the container
• Image.push
– Pushed image to Docker Registry with specified credentials
© 2016 CloudBees, Inc. All Rights Reserved
@issc29 #JenkinsWorld
Pipeline - Docker Example
stage 'Build'
node('docker-cloud') {
checkout scm
docker.image('java:jdk-8').inside('-v
/data:/data') {
sh "mvn clean package" }}
© 2016 CloudBees, Inc. All Rights Reserved
stage 'Quality Analysis'
node('docker-cloud') {
unstash 'pom'
parallel(
JRE8Test: {
docker.image('java:jre-8').inside('-v /data:/data') {
sh 'mvn -Dmaven.repo.local=/data/mvn/repo
verify' }
},JRE7Test: {
docker.image('java:jre-7').inside('-v /data:/data') {
sh 'mvn -Dmaven.repo.local=/data/mvn/repo
verify' }
}, failFast: true )}
@issc29 #JenkinsWorld
Pipeline - Docker Example
node('docker-cloud') {
stage 'Build Docker Image'
dir('target') {
mobileDepositApiImage = docker.build "beedemo/mobile-deposit-api:${dockerTag}"
}
stage 'Publish Docker Image'
withDockerRegistry(registry: [credentialsId: 'docker-hub-beedemo']) {
mobileDepositApiImage.push()
}
}
© 2016 CloudBees, Inc. All Rights Reserved
Get Involved!
https://go.cloudbees.com/solutions/pipelines.html
https://jenkins.io/doc/pipeline/
https://jenkins.io/doc/pipeline/steps/
44
Twitter
@ericlongtx

More Related Content

What's hot

CI/CD with GitHub Actions
CI/CD with GitHub ActionsCI/CD with GitHub Actions
CI/CD with GitHub Actions
Swaminathan Vetri
 
Java 9 Features
Java 9 FeaturesJava 9 Features
Java 9 Features
NexThoughts Technologies
 
Continuous Integration/Deployment with Gitlab CI
Continuous Integration/Deployment with Gitlab CIContinuous Integration/Deployment with Gitlab CI
Continuous Integration/Deployment with Gitlab CI
David Hahn
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
Rob O'Doherty
 
Continuous Delivery with Jenkins
Continuous Delivery with JenkinsContinuous Delivery with Jenkins
Continuous Delivery with Jenkins
Jadson Santos
 
Introduction to Github Actions
Introduction to Github ActionsIntroduction to Github Actions
Introduction to Github Actions
Knoldus Inc.
 
webpack 101 slides
webpack 101 slideswebpack 101 slides
webpack 101 slides
mattysmith
 
Using GitHub Actions to Deploy your Workloads to Azure
Using GitHub Actions to Deploy your Workloads to AzureUsing GitHub Actions to Deploy your Workloads to Azure
Using GitHub Actions to Deploy your Workloads to Azure
Kasun Kodagoda
 
An introduction to Maven
An introduction to MavenAn introduction to Maven
An introduction to Maven
Joao Pereira
 
Git and Github slides.pdf
Git and Github slides.pdfGit and Github slides.pdf
Git and Github slides.pdf
Tilton2
 
Intro to vue.js
Intro to vue.jsIntro to vue.js
Intro to vue.js
TechMagic
 
(Declarative) Jenkins Pipelines
(Declarative) Jenkins Pipelines(Declarative) Jenkins Pipelines
(Declarative) Jenkins Pipelines
Steffen Gebert
 
Jenkins Overview
Jenkins OverviewJenkins Overview
Jenkins Overview
Ahmed M. Gomaa
 
Spring Boot Tutorial
Spring Boot TutorialSpring Boot Tutorial
Spring Boot Tutorial
Naphachara Rattanawilai
 
Jenkins for java world
Jenkins for java worldJenkins for java world
Jenkins for java world
Ashok Kumar
 
Using GitLab CI
Using GitLab CIUsing GitLab CI
Using GitLab CI
ColCh
 
Git
GitGit
Jenkins presentation
Jenkins presentationJenkins presentation
Jenkins presentation
Valentin Buryakov
 
Jenkins vs GitLab CI
Jenkins vs GitLab CIJenkins vs GitLab CI
Jenkins vs GitLab CI
CEE-SEC(R)
 

What's hot (20)

CI/CD with GitHub Actions
CI/CD with GitHub ActionsCI/CD with GitHub Actions
CI/CD with GitHub Actions
 
Java 9 Features
Java 9 FeaturesJava 9 Features
Java 9 Features
 
Continuous Integration/Deployment with Gitlab CI
Continuous Integration/Deployment with Gitlab CIContinuous Integration/Deployment with Gitlab CI
Continuous Integration/Deployment with Gitlab CI
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Continuous Delivery with Jenkins
Continuous Delivery with JenkinsContinuous Delivery with Jenkins
Continuous Delivery with Jenkins
 
Introduction to Github Actions
Introduction to Github ActionsIntroduction to Github Actions
Introduction to Github Actions
 
webpack 101 slides
webpack 101 slideswebpack 101 slides
webpack 101 slides
 
Using GitHub Actions to Deploy your Workloads to Azure
Using GitHub Actions to Deploy your Workloads to AzureUsing GitHub Actions to Deploy your Workloads to Azure
Using GitHub Actions to Deploy your Workloads to Azure
 
An introduction to Maven
An introduction to MavenAn introduction to Maven
An introduction to Maven
 
Git and Github slides.pdf
Git and Github slides.pdfGit and Github slides.pdf
Git and Github slides.pdf
 
Intro to vue.js
Intro to vue.jsIntro to vue.js
Intro to vue.js
 
(Declarative) Jenkins Pipelines
(Declarative) Jenkins Pipelines(Declarative) Jenkins Pipelines
(Declarative) Jenkins Pipelines
 
Jenkins Overview
Jenkins OverviewJenkins Overview
Jenkins Overview
 
Git real slides
Git real slidesGit real slides
Git real slides
 
Spring Boot Tutorial
Spring Boot TutorialSpring Boot Tutorial
Spring Boot Tutorial
 
Jenkins for java world
Jenkins for java worldJenkins for java world
Jenkins for java world
 
Using GitLab CI
Using GitLab CIUsing GitLab CI
Using GitLab CI
 
Git
GitGit
Git
 
Jenkins presentation
Jenkins presentationJenkins presentation
Jenkins presentation
 
Jenkins vs GitLab CI
Jenkins vs GitLab CIJenkins vs GitLab CI
Jenkins vs GitLab CI
 

Viewers also liked

Continuous Development Pipeline
Continuous Development PipelineContinuous Development Pipeline
Continuous Development Pipeline
Izzet Mustafaiev
 
Delivery Pipeline as Code: using Jenkins 2.0 Pipeline
Delivery Pipeline as Code: using Jenkins 2.0 PipelineDelivery Pipeline as Code: using Jenkins 2.0 Pipeline
Delivery Pipeline as Code: using Jenkins 2.0 Pipeline
Slawa Giterman
 
Jenkins Pipelines
Jenkins PipelinesJenkins Pipelines
Jenkins Pipelines
Steffen Gebert
 
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)
CloudBees
 
Jenkins JobDSL - Configuration as code
Jenkins JobDSL - Configuration as codeJenkins JobDSL - Configuration as code
Jenkins JobDSL - Configuration as code
tomasnorre
 
Jumping from Continuous Integration to Continuous Delivery with Jenkins Enter...
Jumping from Continuous Integration to Continuous Delivery with Jenkins Enter...Jumping from Continuous Integration to Continuous Delivery with Jenkins Enter...
Jumping from Continuous Integration to Continuous Delivery with Jenkins Enter...
CloudBees
 
Introduction to Amazon EC2 Container Service and setting up build pipeline wi...
Introduction to Amazon EC2 Container Service and setting up build pipeline wi...Introduction to Amazon EC2 Container Service and setting up build pipeline wi...
Introduction to Amazon EC2 Container Service and setting up build pipeline wi...
Swapnil Dahiphale
 
Jenkins hudsonci-101002103143-phpapp02
Jenkins hudsonci-101002103143-phpapp02Jenkins hudsonci-101002103143-phpapp02
Jenkins hudsonci-101002103143-phpapp02
Praveen Pamula
 
Native iphone app test automation with appium
Native iphone app test automation with appiumNative iphone app test automation with appium
Native iphone app test automation with appiumJames Eisenhauer
 
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
Michal Ziarnik
 
Jenkins Plugin Development With Gradle And Groovy
Jenkins Plugin Development With Gradle And GroovyJenkins Plugin Development With Gradle And Groovy
Jenkins Plugin Development With Gradle And Groovy
Daniel Spilker
 
Using PaaS for Continuous Delivery (Cloud Foundry Summit 2014)
Using PaaS for Continuous Delivery (Cloud Foundry Summit 2014)Using PaaS for Continuous Delivery (Cloud Foundry Summit 2014)
Using PaaS for Continuous Delivery (Cloud Foundry Summit 2014)
VMware Tanzu
 
Super Charged Configuration As Code
Super Charged Configuration As CodeSuper Charged Configuration As Code
Super Charged Configuration As Code
Alan Beale
 
JCConf2016 Jenkins Pipeline
JCConf2016 Jenkins PipelineJCConf2016 Jenkins Pipeline
JCConf2016 Jenkins Pipeline
Ching Yi Chan
 
Jenkins Job DSL plugin
Jenkins Job DSL plugin Jenkins Job DSL plugin
Jenkins Job DSL plugin
Nikita Bugrovsky
 
Continuous Delivery of Puppet-Based Infrastructure - PuppetConf 2014
Continuous Delivery of Puppet-Based Infrastructure - PuppetConf 2014Continuous Delivery of Puppet-Based Infrastructure - PuppetConf 2014
Continuous Delivery of Puppet-Based Infrastructure - PuppetConf 2014
Puppet
 
Managing Jenkins with Jenkins (Jenkins User Conference Palo Alto, 2013)
Managing Jenkins with Jenkins (Jenkins User Conference Palo Alto, 2013)Managing Jenkins with Jenkins (Jenkins User Conference Palo Alto, 2013)
Managing Jenkins with Jenkins (Jenkins User Conference Palo Alto, 2013)
Gareth Bowles
 
Continuous Infrastructure: Modern Puppet for the Jenkins Project - PuppetConf...
Continuous Infrastructure: Modern Puppet for the Jenkins Project - PuppetConf...Continuous Infrastructure: Modern Puppet for the Jenkins Project - PuppetConf...
Continuous Infrastructure: Modern Puppet for the Jenkins Project - PuppetConf...
Puppet
 
Synchronizing parallel delivery flows in jenkins using groovy, build flow and...
Synchronizing parallel delivery flows in jenkins using groovy, build flow and...Synchronizing parallel delivery flows in jenkins using groovy, build flow and...
Synchronizing parallel delivery flows in jenkins using groovy, build flow and...
Andrey Devyatkin
 
Los vatos
Los vatosLos vatos
Los vatos
losvatoslocos
 

Viewers also liked (20)

Continuous Development Pipeline
Continuous Development PipelineContinuous Development Pipeline
Continuous Development Pipeline
 
Delivery Pipeline as Code: using Jenkins 2.0 Pipeline
Delivery Pipeline as Code: using Jenkins 2.0 PipelineDelivery Pipeline as Code: using Jenkins 2.0 Pipeline
Delivery Pipeline as Code: using Jenkins 2.0 Pipeline
 
Jenkins Pipelines
Jenkins PipelinesJenkins Pipelines
Jenkins Pipelines
 
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)
 
Jenkins JobDSL - Configuration as code
Jenkins JobDSL - Configuration as codeJenkins JobDSL - Configuration as code
Jenkins JobDSL - Configuration as code
 
Jumping from Continuous Integration to Continuous Delivery with Jenkins Enter...
Jumping from Continuous Integration to Continuous Delivery with Jenkins Enter...Jumping from Continuous Integration to Continuous Delivery with Jenkins Enter...
Jumping from Continuous Integration to Continuous Delivery with Jenkins Enter...
 
Introduction to Amazon EC2 Container Service and setting up build pipeline wi...
Introduction to Amazon EC2 Container Service and setting up build pipeline wi...Introduction to Amazon EC2 Container Service and setting up build pipeline wi...
Introduction to Amazon EC2 Container Service and setting up build pipeline wi...
 
Jenkins hudsonci-101002103143-phpapp02
Jenkins hudsonci-101002103143-phpapp02Jenkins hudsonci-101002103143-phpapp02
Jenkins hudsonci-101002103143-phpapp02
 
Native iphone app test automation with appium
Native iphone app test automation with appiumNative iphone app test automation with appium
Native iphone app test automation with appium
 
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 Plugin Development With Gradle And Groovy
Jenkins Plugin Development With Gradle And GroovyJenkins Plugin Development With Gradle And Groovy
Jenkins Plugin Development With Gradle And Groovy
 
Using PaaS for Continuous Delivery (Cloud Foundry Summit 2014)
Using PaaS for Continuous Delivery (Cloud Foundry Summit 2014)Using PaaS for Continuous Delivery (Cloud Foundry Summit 2014)
Using PaaS for Continuous Delivery (Cloud Foundry Summit 2014)
 
Super Charged Configuration As Code
Super Charged Configuration As CodeSuper Charged Configuration As Code
Super Charged Configuration As Code
 
JCConf2016 Jenkins Pipeline
JCConf2016 Jenkins PipelineJCConf2016 Jenkins Pipeline
JCConf2016 Jenkins Pipeline
 
Jenkins Job DSL plugin
Jenkins Job DSL plugin Jenkins Job DSL plugin
Jenkins Job DSL plugin
 
Continuous Delivery of Puppet-Based Infrastructure - PuppetConf 2014
Continuous Delivery of Puppet-Based Infrastructure - PuppetConf 2014Continuous Delivery of Puppet-Based Infrastructure - PuppetConf 2014
Continuous Delivery of Puppet-Based Infrastructure - PuppetConf 2014
 
Managing Jenkins with Jenkins (Jenkins User Conference Palo Alto, 2013)
Managing Jenkins with Jenkins (Jenkins User Conference Palo Alto, 2013)Managing Jenkins with Jenkins (Jenkins User Conference Palo Alto, 2013)
Managing Jenkins with Jenkins (Jenkins User Conference Palo Alto, 2013)
 
Continuous Infrastructure: Modern Puppet for the Jenkins Project - PuppetConf...
Continuous Infrastructure: Modern Puppet for the Jenkins Project - PuppetConf...Continuous Infrastructure: Modern Puppet for the Jenkins Project - PuppetConf...
Continuous Infrastructure: Modern Puppet for the Jenkins Project - PuppetConf...
 
Synchronizing parallel delivery flows in jenkins using groovy, build flow and...
Synchronizing parallel delivery flows in jenkins using groovy, build flow and...Synchronizing parallel delivery flows in jenkins using groovy, build flow and...
Synchronizing parallel delivery flows in jenkins using groovy, build flow and...
 
Los vatos
Los vatosLos vatos
Los vatos
 

Similar to Jenkins days workshop pipelines - Eric Long

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
Andy Pemberton
 
Atlanta Jenkins Area Meetup October 22nd 2015
Atlanta Jenkins Area Meetup October 22nd 2015Atlanta Jenkins Area Meetup October 22nd 2015
Atlanta Jenkins Area Meetup October 22nd 2015
Kurt Madel
 
413450-rc218-cdw-jenkins-workflow
413450-rc218-cdw-jenkins-workflow413450-rc218-cdw-jenkins-workflow
413450-rc218-cdw-jenkins-workflowAndy Pemberton
 
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
jgcloudbees
 
KubeCon EU 2016: Leveraging ephemeral namespaces in a CI/CD pipeline
KubeCon EU 2016: Leveraging ephemeral namespaces in a CI/CD pipelineKubeCon EU 2016: Leveraging ephemeral namespaces in a CI/CD pipeline
KubeCon EU 2016: Leveraging ephemeral namespaces in a CI/CD pipeline
KubeAcademy
 
Moving from Jenkins 1 to 2 declarative pipeline adventures
Moving from Jenkins 1 to 2 declarative pipeline adventuresMoving from Jenkins 1 to 2 declarative pipeline adventures
Moving from Jenkins 1 to 2 declarative pipeline adventures
Frits Van Der Holst
 
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
Chris Adkin
 
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
Tobias Schneck
 
Continuous Delivery with Docker and Amazon ECS
Continuous Delivery with Docker and Amazon ECSContinuous Delivery with Docker and Amazon ECS
Continuous Delivery with Docker and Amazon ECS
Amazon Web Services
 
Implementing CI CD UiPath Using Jenkins Plugin
Implementing CI CD UiPath Using Jenkins PluginImplementing CI CD UiPath Using Jenkins Plugin
Implementing CI CD UiPath Using Jenkins Plugin
Satish Prasad
 
Jenkins CI presentation
Jenkins CI presentationJenkins CI presentation
Jenkins CI presentation
Jonathan Holloway
 
Testing with Jenkins, Selenium and Continuous Deployment
Testing with Jenkins, Selenium and Continuous DeploymentTesting with Jenkins, Selenium and Continuous Deployment
Testing with Jenkins, Selenium and Continuous Deployment
Max Klymyshyn
 
Stockholm Jenkins Area Meetup, March 2017
Stockholm Jenkins Area Meetup, March 2017Stockholm Jenkins Area Meetup, March 2017
Stockholm Jenkins Area Meetup, March 2017
Andrey Devyatkin
 
Developer Experience Cloud Native - Become Efficient and Achieve Parity
Developer Experience Cloud Native - Become Efficient and Achieve ParityDeveloper Experience Cloud Native - Become Efficient and Achieve Parity
Developer Experience Cloud Native - Become Efficient and Achieve Parity
Michael Hofmann
 
Jenkins as a Service - Code all the way down
Jenkins as a Service - Code all the way downJenkins as a Service - Code all the way down
Jenkins as a Service - Code all the way down
Steve Mactaggart
 
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
Nigel Charman
 
Dockerized maven
Dockerized mavenDockerized maven
Dockerized maven
Matthias Bertschy
 
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
Steffen Gebert
 
Docker–Grid (A On demand and Scalable dockerized selenium grid architecture)
Docker–Grid (A On demand and Scalable dockerized selenium grid architecture)Docker–Grid (A On demand and Scalable dockerized selenium grid architecture)
Docker–Grid (A On demand and Scalable dockerized selenium grid architecture)
STePINForum
 
Developer Experience Cloud Native - From Code Gen to Git Commit without a CI/...
Developer Experience Cloud Native - From Code Gen to Git Commit without a CI/...Developer Experience Cloud Native - From Code Gen to Git Commit without a CI/...
Developer Experience Cloud Native - From Code Gen to Git Commit without a CI/...
Michael Hofmann
 

Similar to Jenkins days workshop pipelines - Eric Long (20)

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
 
Atlanta Jenkins Area Meetup October 22nd 2015
Atlanta Jenkins Area Meetup October 22nd 2015Atlanta Jenkins Area Meetup October 22nd 2015
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
 
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
 
KubeCon EU 2016: Leveraging ephemeral namespaces in a CI/CD pipeline
KubeCon EU 2016: Leveraging ephemeral namespaces in a CI/CD pipelineKubeCon EU 2016: Leveraging ephemeral namespaces in a CI/CD pipeline
KubeCon EU 2016: Leveraging ephemeral namespaces in a CI/CD pipeline
 
Moving from Jenkins 1 to 2 declarative pipeline adventures
Moving from Jenkins 1 to 2 declarative pipeline adventuresMoving from Jenkins 1 to 2 declarative pipeline adventures
Moving from Jenkins 1 to 2 declarative pipeline adventures
 
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
 
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
 
Continuous Delivery with Docker and Amazon ECS
Continuous Delivery with Docker and Amazon ECSContinuous Delivery with Docker and Amazon ECS
Continuous Delivery with Docker and Amazon ECS
 
Implementing CI CD UiPath Using Jenkins Plugin
Implementing CI CD UiPath Using Jenkins PluginImplementing CI CD UiPath Using Jenkins Plugin
Implementing CI CD UiPath Using Jenkins Plugin
 
Jenkins CI presentation
Jenkins CI presentationJenkins CI presentation
Jenkins CI presentation
 
Testing with Jenkins, Selenium and Continuous Deployment
Testing with Jenkins, Selenium and Continuous DeploymentTesting with Jenkins, Selenium and Continuous Deployment
Testing with Jenkins, Selenium and Continuous Deployment
 
Stockholm Jenkins Area Meetup, March 2017
Stockholm Jenkins Area Meetup, March 2017Stockholm Jenkins Area Meetup, March 2017
Stockholm Jenkins Area Meetup, March 2017
 
Developer Experience Cloud Native - Become Efficient and Achieve Parity
Developer Experience Cloud Native - Become Efficient and Achieve ParityDeveloper Experience Cloud Native - Become Efficient and Achieve Parity
Developer Experience Cloud Native - Become Efficient and Achieve Parity
 
Jenkins as a Service - Code all the way down
Jenkins as a Service - Code all the way downJenkins as a Service - Code all the way down
Jenkins as a Service - Code all the way down
 
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
 
Dockerized maven
Dockerized mavenDockerized maven
Dockerized maven
 
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
 
Docker–Grid (A On demand and Scalable dockerized selenium grid architecture)
Docker–Grid (A On demand and Scalable dockerized selenium grid architecture)Docker–Grid (A On demand and Scalable dockerized selenium grid architecture)
Docker–Grid (A On demand and Scalable dockerized selenium grid architecture)
 
Developer Experience Cloud Native - From Code Gen to Git Commit without a CI/...
Developer Experience Cloud Native - From Code Gen to Git Commit without a CI/...Developer Experience Cloud Native - From Code Gen to Git Commit without a CI/...
Developer Experience Cloud Native - From Code Gen to Git Commit without a CI/...
 

Recently uploaded

Enterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptxEnterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptx
QuickwayInfoSystems3
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
Globus
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Shahin Sheidaei
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Launch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in MinutesLaunch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in Minutes
Roshan Dwivedi
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
AMB-Review
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
Georgi Kodinov
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)
abdulrafaychaudhry
 
Graphic Design Crash Course for beginners
Graphic Design Crash Course for beginnersGraphic Design Crash Course for beginners
Graphic Design Crash Course for beginners
e20449
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 

Recently uploaded (20)

Enterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptxEnterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptx
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Launch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in MinutesLaunch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in Minutes
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)
 
Graphic Design Crash Course for beginners
Graphic Design Crash Course for beginnersGraphic Design Crash Course for beginners
Graphic Design Crash Course for beginners
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 

Jenkins days workshop pipelines - Eric Long

  • 1. 1
  • 2. Jenkins Days Workshop Let’s Build a Jenkins Pipeline
  • 3. 3 Goals for today Install Jenkins Enterprise Create a Jenkins Pipeline Try the basics See what else is possible and get connected! Welcome! 1 2 3 4
  • 4. About your guide: Eric Long 4 Hands-on Delivery experience on CloudBees Jenkins and Pipelines Senior DevOps Consultant @ericlongtx
  • 5. What is Jenkins? 5 Well that’s a funny question. A CI server? A CD Server? An automation server
  • 6. Easy to Start 6 java -jar jenkins.war
  • 7. CloudBees Jenkins Enterprise … part of CloudBees Jenkins Platform 7 Jenkins for the EnterpriseCommunity Innovation
  • 8. What is Jenkins Pipeline? ● Formerly known as Jenkins Workflow, Jenkins Pipeline was introduced in 2014 ● New job type – a single Groovy script using an embedded DSL - no need to jump between multiple job configuration screens to see what is going on ● Durable - keeps running even if Jenkins master is not ● Distributable – a Pipeline job may be run across an unlimited number of nodes, including in parallel ● Pausable – allows waiting for input from users before continuing to the next step ● Visualized - Pipeline Stage View provides status at-a-glance dashboards to include trending 8
  • 10. Install Jenkins Enterprise 10 Have Docker? No Docker? No problem. https://www.cloudbees.com/get-started docker run -d -p 80:8080 --name cje -v /var/run/docker.sock:/var/run/docker.sock beedemo/jenkins- enterprise-trial
  • 11. Finish Install Unlock Jenkins Request a trial license Install suggested plugins Create First Admin User 11 docker logs -f cje Jenkins initial setup is required. An admin user has been created and a password generated. Please use the following password to proceed to installation: 1a90312e459b4d4693f18d48d102d6c6
  • 13. Pipeline: a new job type
  • 14. Key Benefits ✓ Long-running ✓ Durable ✓ Scriptable ✓ One-place for Everything Pipeline: a new job type ✓ Makes building Pipelines Simple
  • 15. Domain Specific Language 15 Simple, Groovy-based DSL (“Domain Specific Language”) to manage build step orchestration Can be defined as DSL in Jenkins or as Jenkinsfile in SCM Groovy is widely used in Jenkins ecosystem. You can leverage the large Jenkins Groovy experience If you don’t like/care about Groovy, just consider the DSL as a dedicated simple syntax
  • 17. Create a Pipeline - core steps 17 stage - group your steps into its component parts and control concurrency node - schedules the steps to run by adding them to Jenkins' build queue and creates a workspace specific to this pipeline sh (or bat) - execute shell (*nix) or batch scripts (Windows) just like freestyle jobs, calling any tools in the agent
  • 18. Create a Pipeline stage('build') echo 'hello from jenkins master' node { sh 'echo hello from jenkins agent' } stage('test') echo 'test some things' stage('deploy') echo 'deploy some things' 18
  • 20. Files stash - store some files for later use unstash - retrieve previously stashed files (even across nodes) writeFile - write a file to the workspace readFile - read a file from the workspace 20
  • 21. Checkout from SCM and stash Files stage('build') node { git 'https://github.com/beedemo/mobile-deposit-api.git' writeFile encoding: 'UTF-8', file: 'config', text: 'version=1' stash includes: 'pom.xml,config', name: 'pom-config' } stage('test') node { unstash 'pom-config' configValue = readFile encoding: 'UTF-8', file: 'config' echo configValue } 21
  • 22. try up to N times retry(5) { // some block } wait for a condition waitUntil { // some block } Flow Control 22 wait for a set time sleep time: 1000, unit:'NANOSECONDS' timeout timeout(time: 30, unit: 'SECONDS'){ // some block }
  • 23. You can also rely on Groovy control flow syntax! while(something) { // do something if (something_else) { // do something else } } Flow Control 23 try{ //some things }catch(e){ // }
  • 24. Advanced Flow Control input - pause for manual or automated approval parallel - allows simultaneous execution of build steps on the current node or across nodes, thus increasing build speed parallel 'quality scan': { node {sh 'mvn sonar:sonar'} }, 'integration test': { node {sh 'mvn verify'} } checkpoint - capture the workspace state so it can be reused as a starting point for subsequent runs
  • 25. Lab Exercise: Input and Checkpoints
  • 26. Input Approval & Checkpoints 26 stage('deploy') input message: 'Do you want to deploy?' node { echo 'deployed' }
  • 27. Input Approval & Checkpoints 27 checkpoint 'testing-complete' stage('approve') mail body: "Approval needed for '${env.JOB_NAME}' at ${env.BUILD_URL}, subject: "${env.JOB_NAME} Approval", to: "ops@acme.com" timeout(time: 7, unit: 'DAYS') { input message: 'Do you want to deploy?', parameters: [string(defaultValue: '', description: 'Provide any comments regarding decision.', name: 'Comments')], submitter: 'ops' }
  • 29. tool Step ● Binds a tool installation to a variable ● The tool home directory is returned ● Only tools already configured are available def mvnHome = tool 'M3' sh "${mvnHome}/bin/mvn -B verify" 29
  • 30. Use Docker Containers ● The CloudBees Docker Pipeline plugin allows running steps inside a container ● You can even build the container as part of the same Pipeline docker.image('maven:3.3.3-jdk-8').inside() { sh 'mvn -B verify' } 30
  • 37. More Advanced Steps Send email mail body: 'Uh oh.', subject: 'Build Failed!', to: 'dev@cloudbees.com' step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: 'info@cloudbees.com']) Deploy to Amazon Elastic Beanstalk wrap([$class: 'AmazonAwsCliBuildWrapper', credentialsId: 'aws- beanstalk-credentials', defaultRegion: 'us-east-1']) { sh 'aws elasticbeanstalk create-application-version' } Integrate with Jira jiraComment(issueKey: "EX-111", body: "Job '${env.JOB_NAME}' (${env.BUILD_NUMBER}) built. Please go to ${env.BUILD_URL}.") 37
  • 38. @issc29 #JenkinsWorld Docker + Pipelines © 2016 CloudBees, Inc. All Rights Reserved
  • 39. @issc29 #JenkinsWorld Agent Gartner: “Using Docker to Run Build Nodes is Ideal.” © 2016 CloudBees, Inc. All Rights Reserved Master z Agent Agent
  • 40. @issc29 #JenkinsWorld Accelerating CD with Containers Workflow CD Pipeline Triggers: ✓ New application code (feature, bug fix, etc.) ✓ Updated certified stack (security fix in Linux, etc.) ✓ Will lead to a new gold image being built and available for … TESTING … STAGING … PRODUCTION ✓ All taking place in a standardized/similar/consistent OS environment © 2016 CloudBees, Inc. All Rights Reserved + Jenkins Pipeline TEST STAGE PRODUCTIO N App <code> (git, etc.) Gold Docker Image (~per app) <OS config> Certified Docker Images (Ubuntu, etc.) <OS config>
  • 41. @issc29 #JenkinsWorld Jenkins Pipeline Docker Commands • withRegistry – Specifies which Docker Registry to use for pushing/pulling • withServer – Specifies which Server to issue Docker commands against • Build – Builds container from Dockerfile • Image.run – Runs a container • Image.inside – Runs container and allows you to execute command inside the container • Image.push – Pushed image to Docker Registry with specified credentials © 2016 CloudBees, Inc. All Rights Reserved
  • 42. @issc29 #JenkinsWorld Pipeline - Docker Example stage 'Build' node('docker-cloud') { checkout scm docker.image('java:jdk-8').inside('-v /data:/data') { sh "mvn clean package" }} © 2016 CloudBees, Inc. All Rights Reserved stage 'Quality Analysis' node('docker-cloud') { unstash 'pom' parallel( JRE8Test: { docker.image('java:jre-8').inside('-v /data:/data') { sh 'mvn -Dmaven.repo.local=/data/mvn/repo verify' } },JRE7Test: { docker.image('java:jre-7').inside('-v /data:/data') { sh 'mvn -Dmaven.repo.local=/data/mvn/repo verify' } }, failFast: true )}
  • 43. @issc29 #JenkinsWorld Pipeline - Docker Example node('docker-cloud') { stage 'Build Docker Image' dir('target') { mobileDepositApiImage = docker.build "beedemo/mobile-deposit-api:${dockerTag}" } stage 'Publish Docker Image' withDockerRegistry(registry: [credentialsId: 'docker-hub-beedemo']) { mobileDepositApiImage.push() } } © 2016 CloudBees, Inc. All Rights Reserved