SlideShare una empresa de Scribd logo
1 de 44
Descargar para leer sin conexión
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

Más contenido relacionado

La actualidad más candente

Practical Sikuli: using screenshots for GUI automation and testing
Practical Sikuli: using screenshots for GUI automation and testingPractical Sikuli: using screenshots for GUI automation and testing
Practical Sikuli: using screenshots for GUI automation and testingvgod
 
Docker Birthday #3 - Intro to Docker Slides
Docker Birthday #3 - Intro to Docker SlidesDocker Birthday #3 - Intro to Docker Slides
Docker Birthday #3 - Intro to Docker SlidesDocker, Inc.
 
Docker Networking Deep Dive
Docker Networking Deep DiveDocker Networking Deep Dive
Docker Networking Deep DiveDocker, Inc.
 
Simply your Jenkins Projects with Docker Multi-Stage Builds
Simply your Jenkins Projects with Docker Multi-Stage BuildsSimply your Jenkins Projects with Docker Multi-Stage Builds
Simply your Jenkins Projects with Docker Multi-Stage BuildsEric Smalling
 
Kubernetes + Python = ❤ - Cloud Native Prague
Kubernetes + Python = ❤ - Cloud Native PragueKubernetes + Python = ❤ - Cloud Native Prague
Kubernetes + Python = ❤ - Cloud Native PragueHenning Jacobs
 
Selenium WebDriver with C#
Selenium WebDriver with C#Selenium WebDriver with C#
Selenium WebDriver with C#srivinayak
 
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 QualityLarry Nung
 
Introduction to Kubernetes Workshop
Introduction to Kubernetes WorkshopIntroduction to Kubernetes Workshop
Introduction to Kubernetes WorkshopBob Killen
 
Docker Basic to Advance
Docker Basic to AdvanceDocker Basic to Advance
Docker Basic to AdvanceParas Jain
 
Jenkins Pipeline Tutorial | Continuous Delivery Pipeline Using Jenkins | DevO...
Jenkins Pipeline Tutorial | Continuous Delivery Pipeline Using Jenkins | DevO...Jenkins Pipeline Tutorial | Continuous Delivery Pipeline Using Jenkins | DevO...
Jenkins Pipeline Tutorial | Continuous Delivery Pipeline Using Jenkins | DevO...Edureka!
 
Kubernetes deployment strategies - CNCF Webinar
Kubernetes deployment strategies - CNCF WebinarKubernetes deployment strategies - CNCF Webinar
Kubernetes deployment strategies - CNCF WebinarEtienne Tremel
 
DevJam 2019 - Introduction to Kubernetes
DevJam 2019 - Introduction to KubernetesDevJam 2019 - Introduction to Kubernetes
DevJam 2019 - Introduction to KubernetesRonny Trommer
 
Kubernetes Networking | Kubernetes Services, Pods & Ingress Networks | Kubern...
Kubernetes Networking | Kubernetes Services, Pods & Ingress Networks | Kubern...Kubernetes Networking | Kubernetes Services, Pods & Ingress Networks | Kubern...
Kubernetes Networking | Kubernetes Services, Pods & Ingress Networks | Kubern...Edureka!
 
Introduction to jenkins
Introduction to jenkinsIntroduction to jenkins
Introduction to jenkinsAbe Diaz
 
CICD Using CircleCI
CICD Using CircleCICICD Using CircleCI
CICD Using CircleCIKnoldus Inc.
 

La actualidad más candente (20)

Practical Sikuli: using screenshots for GUI automation and testing
Practical Sikuli: using screenshots for GUI automation and testingPractical Sikuli: using screenshots for GUI automation and testing
Practical Sikuli: using screenshots for GUI automation and testing
 
Docker Birthday #3 - Intro to Docker Slides
Docker Birthday #3 - Intro to Docker SlidesDocker Birthday #3 - Intro to Docker Slides
Docker Birthday #3 - Intro to Docker Slides
 
Jenkins
JenkinsJenkins
Jenkins
 
Docker Networking Deep Dive
Docker Networking Deep DiveDocker Networking Deep Dive
Docker Networking Deep Dive
 
Simply your Jenkins Projects with Docker Multi-Stage Builds
Simply your Jenkins Projects with Docker Multi-Stage BuildsSimply your Jenkins Projects with Docker Multi-Stage Builds
Simply your Jenkins Projects with Docker Multi-Stage Builds
 
Kubernetes + Python = ❤ - Cloud Native Prague
Kubernetes + Python = ❤ - Cloud Native PragueKubernetes + Python = ❤ - Cloud Native Prague
Kubernetes + Python = ❤ - Cloud Native Prague
 
Selenium WebDriver with C#
Selenium WebDriver with C#Selenium WebDriver with C#
Selenium WebDriver with C#
 
BDD & Cucumber
BDD & CucumberBDD & Cucumber
BDD & Cucumber
 
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
 
Introduction to Kubernetes Workshop
Introduction to Kubernetes WorkshopIntroduction to Kubernetes Workshop
Introduction to Kubernetes Workshop
 
Docker Basic to Advance
Docker Basic to AdvanceDocker Basic to Advance
Docker Basic to Advance
 
Jenkins Pipeline Tutorial | Continuous Delivery Pipeline Using Jenkins | DevO...
Jenkins Pipeline Tutorial | Continuous Delivery Pipeline Using Jenkins | DevO...Jenkins Pipeline Tutorial | Continuous Delivery Pipeline Using Jenkins | DevO...
Jenkins Pipeline Tutorial | Continuous Delivery Pipeline Using Jenkins | DevO...
 
Kubernetes deployment strategies - CNCF Webinar
Kubernetes deployment strategies - CNCF WebinarKubernetes deployment strategies - CNCF Webinar
Kubernetes deployment strategies - CNCF Webinar
 
DevJam 2019 - Introduction to Kubernetes
DevJam 2019 - Introduction to KubernetesDevJam 2019 - Introduction to Kubernetes
DevJam 2019 - Introduction to Kubernetes
 
Kubernetes Networking | Kubernetes Services, Pods & Ingress Networks | Kubern...
Kubernetes Networking | Kubernetes Services, Pods & Ingress Networks | Kubern...Kubernetes Networking | Kubernetes Services, Pods & Ingress Networks | Kubern...
Kubernetes Networking | Kubernetes Services, Pods & Ingress Networks | Kubern...
 
Introduction to jenkins
Introduction to jenkinsIntroduction to jenkins
Introduction to jenkins
 
Jenkins Overview
Jenkins OverviewJenkins Overview
Jenkins Overview
 
Jenkins presentation
Jenkins presentationJenkins presentation
Jenkins presentation
 
CICD Using CircleCI
CICD Using CircleCICICD Using CircleCI
CICD Using CircleCI
 
Jenkins tutorial
Jenkins tutorialJenkins tutorial
Jenkins tutorial
 

Destacado

Continuous Development Pipeline
Continuous Development PipelineContinuous Development Pipeline
Continuous Development PipelineIzzet 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 PipelineSlawa Giterman
 
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 codetomasnorre
 
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-phpapp02Praveen 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 2Michal 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 GroovyDaniel 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 CodeAlan Beale
 
JCConf2016 Jenkins Pipeline
JCConf2016 Jenkins PipelineJCConf2016 Jenkins Pipeline
JCConf2016 Jenkins PipelineChing Yi Chan
 
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 2014Puppet
 
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
 

Destacado (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 a 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 AngelesAndy 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 2015Kurt 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 Groovyjgcloudbees
 
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 pipelineKubeAcademy
 
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 adventuresFrits 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 ServerChris 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 MeetupTobias 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 ECSAmazon 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 PluginSatish Prasad
 
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 DeploymentMax Klymyshyn
 
Stockholm Jenkins Area Meetup, March 2017
Stockholm Jenkins Area Meetup, March 2017Stockholm Jenkins Area Meetup, March 2017
Stockholm Jenkins Area Meetup, March 2017Andrey 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 ParityMichael 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 downSteve 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 JenkinsNigel Charman
 
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 PipelinesSteffen 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 a 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/...
 

Último

Advantages of Cargo Cloud Solutions.pptx
Advantages of Cargo Cloud Solutions.pptxAdvantages of Cargo Cloud Solutions.pptx
Advantages of Cargo Cloud Solutions.pptxRTS corp
 
Understanding Plagiarism: Causes, Consequences and Prevention.pptx
Understanding Plagiarism: Causes, Consequences and Prevention.pptxUnderstanding Plagiarism: Causes, Consequences and Prevention.pptx
Understanding Plagiarism: Causes, Consequences and Prevention.pptxSasikiranMarri
 
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...OnePlan Solutions
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...Bert Jan Schrijver
 
Effort Estimation Techniques used in Software Projects
Effort Estimation Techniques used in Software ProjectsEffort Estimation Techniques used in Software Projects
Effort Estimation Techniques used in Software ProjectsDEEPRAJ PATHAK
 
The Ultimate Guide to Performance Testing in Low-Code, No-Code Environments (...
The Ultimate Guide to Performance Testing in Low-Code, No-Code Environments (...The Ultimate Guide to Performance Testing in Low-Code, No-Code Environments (...
The Ultimate Guide to Performance Testing in Low-Code, No-Code Environments (...kalichargn70th171
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesVictoriaMetrics
 
Best Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITBest Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITmanoharjgpsolutions
 
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingOpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingShane Coughlan
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slidesvaideheekore1
 
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...OnePlan Solutions
 
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdfSteve Caron
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldRoberto Pérez Alcolea
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorTier1 app
 
Ronisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited CatalogueRonisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited Catalogueitservices996
 
Strategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsStrategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsJean Silva
 
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jGraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jNeo4j
 
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdfPros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdfkalichargn70th171
 
Mastering Project Planning with Microsoft Project 2016.pptx
Mastering Project Planning with Microsoft Project 2016.pptxMastering Project Planning with Microsoft Project 2016.pptx
Mastering Project Planning with Microsoft Project 2016.pptxAS Design & AST.
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shardsChristopher Curtin
 

Último (20)

Advantages of Cargo Cloud Solutions.pptx
Advantages of Cargo Cloud Solutions.pptxAdvantages of Cargo Cloud Solutions.pptx
Advantages of Cargo Cloud Solutions.pptx
 
Understanding Plagiarism: Causes, Consequences and Prevention.pptx
Understanding Plagiarism: Causes, Consequences and Prevention.pptxUnderstanding Plagiarism: Causes, Consequences and Prevention.pptx
Understanding Plagiarism: Causes, Consequences and Prevention.pptx
 
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
 
Effort Estimation Techniques used in Software Projects
Effort Estimation Techniques used in Software ProjectsEffort Estimation Techniques used in Software Projects
Effort Estimation Techniques used in Software Projects
 
The Ultimate Guide to Performance Testing in Low-Code, No-Code Environments (...
The Ultimate Guide to Performance Testing in Low-Code, No-Code Environments (...The Ultimate Guide to Performance Testing in Low-Code, No-Code Environments (...
The Ultimate Guide to Performance Testing in Low-Code, No-Code Environments (...
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 Updates
 
Best Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITBest Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh IT
 
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingOpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slides
 
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
 
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository world
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryError
 
Ronisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited CatalogueRonisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited Catalogue
 
Strategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsStrategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero results
 
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jGraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
 
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdfPros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
 
Mastering Project Planning with Microsoft Project 2016.pptx
Mastering Project Planning with Microsoft Project 2016.pptxMastering Project Planning with Microsoft Project 2016.pptx
Mastering Project Planning with Microsoft Project 2016.pptx
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards
 

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