SlideShare une entreprise Scribd logo
1  sur  39
Continuous Delivery
Pipeline as code
Mike van Vendeloo
Software Craftsman at JPoint
TU Delft - Computer Science
Scrum master
Assignments at customers like KLM, Rabobank, Government,
de Persgroep.
Focus on improvement of software development process and
quality
Hobb: Korfball, domotica
@mikevanvendeloo
Agenda
• Definitions CI/CD/Pipeline
• Jenkins 2: Pipeline as code
• Pipeline snippets
• Reuse with pipeline libraries
• Declarative pipelines
• Blue Ocean
• Demo
Definitions
Definitions - Continuous Integration
“Continuous Integration is a software development practice
where members of a team integrate their work frequently,
usually each person integrates at least daily - leading to
multiple integrations per day. Each integration is verified by
an automated build (including test) to detect integration errors
as quickly as possible.“
Martin Fowler
Continuous Delivery: Automate everything
“If it hurts, do it more
frequently, and bring the pain
forward.”
― Jez Humble,
Continuous Delivery
Definitions - Continuous Delivery
“Continuous Delivery is the ability to get changes of all
types—including new features, configuration changes, bug
fixes and experiments—into production, or into the hands of
users, safely and quickly in a sustainable way.”
Definitions - Continuous Deployment
Definitions - Pipeline
A pipeline is a set of stages to bring functionality from developer to the end user.
Jenkins pipeline as code
Jenkins 1
Jenkins 2 - Pipeline as code
Sample basic pipeline stages
➔ Checkout
Source code checkout from repository
➔ Build
Compile & Unit test
➔ QA
Code style check & integration testing
➔ Deploy
Deploy to a server
Basic pipeline definition
#!/usr/bin/groovy
node('linux') {
stage('Checkout') {
checkout scm
}
stage('Build') {
sh "mvn clean deploy"
junit allowEmptyResults: true, testResults: 'target/surefire-reports/*.xml'
}
stage('Deploy') {
build "Deployer"
}
}
Pipeline snippets
Error handling
node {
stage('Doing my thing') {
try {
sh 'exit 1'
} catch (someException) {
echo 'Something failed, somebody should be notified!'
throw someException
} finally {
hipchatSend color: 'BLUE', credentialId: 'hipChat', message: “Build result
${env.BUILD_RESULT}”, room: 'BuildResults'
}
}
}
Pipeline properties - cleanup
properties(
[buildDiscarder(
logRotator(
artifactDaysToKeepStr: '',
artifactNumToKeepStr: '',
daysToKeepStr: '7',
numToKeepStr: '25')
),
pipelineTriggers([])
]
)
Pipeline properties - Parameters
properties(
[parameters(
[choice(
choices: ['dev', 'test', 'acc', 'prod'], description: 'Kies de omgeving', name: 'omgeving')]
),
pipelineTriggers([])
])
Parallel tasks
parallel ‘test’: {
sh ‘mvn clean test’
}, ‘mutation-test’: {
Sh ‘mvn org.pitest:pitest-maven:mutationCoverage’
},
failFast: true
Share information between nodes/executors
node {
stage(‘Build’)
sh(“mvn -B clean package”)
stash excludes:’target/’, includes: ‘**’, name: ‘source’
}
stage (‘test’) {
unstash ‘source’
}
}
Notifications
def notify(String colorCode, String color, String summary)
slackSend (color: colorCode, message: summary)
hipchatSend (color: color, notify: true, message: summary)
emailext (
to: team@mydomain.com',
subject: “Build ${env.JOB_NAME} [${env.BUILD_NUMBER}] result ${currentBuild.result}”
body: “<a href='${env.BUILD_URL}'>${env.JOB_NAME} [${env.BUILD_NUMBER}]</a>”,
recipientProviders: [[$class: 'DevelopersRecipientProvider']]
)
}
Pipeline libraries
Reuse between pipelines: libraries
Library implementation
package vanvendeloo.jenkins
def checkout(String repositoryName) {
git “git@bitbucket.org:vanvendeloo/${repositoryName}”
}
def updateVersion() {
sh “mvn build-helper:parse-version versions:set -
DnewVersion=${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${
parsedVersion.nextIncrementalVersion} versions:commit”
}
// Return the contents of this script as object so it can be re-used in Jenkinsfiles.
return this
Use the library: @Library
@Library(‘pipeline-library’)
node {
pipelineSteps = new PipelineSteps()
stage(‘Preparation’) {
pipelineSteps.checkout(‘my-service’)
pipelineSteps.updateVersion()
}
}
Catch: Groovy Sandbox
org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: ↵
Scripts not permitted to use method java.lang.String replaceAll java.lang.String
java.lang.String
1. Go to Manage Jenkins > In-process
Script Approval
2. Review the pending signatures and
click Approve to add them to the
whitelist
3. Re-run your job; it should no longer
fail (for this particular method call)
Declarative pipelines
Declarative Pipelines
node {
stage(‘Checkout’) {
checkout scm
}
stage(‘Build’) {
withEnv(["PATH+MAVEN=${tool 'M3'}/bin"]) {
try {
sh 'mvn clean install'
} catch (e) {
currentBuild.result = 'FAILURE'
}
}
}
pipeline {
agent any
tools { maven 'M3' }
stages {
stage('Checkout') {
steps { checkout scm }
}
stage(Build) {
steps {
sh ‘mvn clean install’
}
post {
success {
junit '**/surefire-reports/**/*.xml'
}
}
}
}
Blue Ocean
Blue Ocean
Pipeline result
Conclusions
Pipeline evaluates with your code
Reuse in libraries keeps your Jenkinsfile clean and simple
BlueOcean definately an improvement, but need to get used to it
Pipeline editor very cool feature!
http://github.com/mikevanvendeloo
https://jenkins.io/doc/book/pipeline/syntax/
https://jenkins.io/blog/2017/02/07/declarative-maven-project/
Resources
@mikevanvendeloo

Contenu connexe

Tendances

7 Habits of Highly Effective Jenkins Users
7 Habits of Highly Effective Jenkins Users7 Habits of Highly Effective Jenkins Users
7 Habits of Highly Effective Jenkins UsersJules Pierre-Louis
 
Jenkins days workshop pipelines - Eric Long
Jenkins days workshop  pipelines - Eric LongJenkins days workshop  pipelines - Eric Long
Jenkins days workshop pipelines - Eric Longericlongtx
 
Brujug Jenkins pipeline scalability
Brujug Jenkins pipeline scalabilityBrujug Jenkins pipeline scalability
Brujug Jenkins pipeline scalabilityDamien Coraboeuf
 
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
 
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
 
Jenkins Pipeline @ Scale. Building Automation Frameworks for Systems Integration
Jenkins Pipeline @ Scale. Building Automation Frameworks for Systems IntegrationJenkins Pipeline @ Scale. Building Automation Frameworks for Systems Integration
Jenkins Pipeline @ Scale. Building Automation Frameworks for Systems IntegrationOleg Nenashev
 
Continuous Delivery Pipeline with Docker and Jenkins
Continuous Delivery Pipeline with Docker and JenkinsContinuous Delivery Pipeline with Docker and Jenkins
Continuous Delivery Pipeline with Docker and JenkinsCamilo Ribeiro
 
Build, Publish, Deploy and Test Docker images and containers with Jenkins Wor...
Build, Publish, Deploy and Test Docker images and containers with Jenkins Wor...Build, Publish, Deploy and Test Docker images and containers with Jenkins Wor...
Build, Publish, Deploy and Test Docker images and containers with Jenkins Wor...Docker, Inc.
 
Building Jenkins Pipelines at Scale
Building Jenkins Pipelines at ScaleBuilding Jenkins Pipelines at Scale
Building Jenkins Pipelines at ScaleJulien Pivotto
 
Monitoring Akka with Kamon 1.0
Monitoring Akka with Kamon 1.0Monitoring Akka with Kamon 1.0
Monitoring Akka with Kamon 1.0Steffen Gebert
 
Codifying the Build and Release Process with a Jenkins Pipeline Shared Library
Codifying the Build and Release Process with a Jenkins Pipeline Shared LibraryCodifying the Build and Release Process with a Jenkins Pipeline Shared Library
Codifying the Build and Release Process with a Jenkins Pipeline Shared LibraryAlvin Huang
 
Testing with Docker
Testing with DockerTesting with Docker
Testing with Dockertoffermann
 
Let's go HTTPS-only! - More Than Buying a Certificate
Let's go HTTPS-only! - More Than Buying a CertificateLet's go HTTPS-only! - More Than Buying a Certificate
Let's go HTTPS-only! - More Than Buying a CertificateSteffen Gebert
 
Pimp your jenkins platform with docker - Devops.com 2015/11
Pimp your jenkins platform with docker - Devops.com 2015/11Pimp your jenkins platform with docker - Devops.com 2015/11
Pimp your jenkins platform with docker - Devops.com 2015/11CloudBees
 
Ci with jenkins docker and mssql belgium
Ci with jenkins docker and mssql belgiumCi with jenkins docker and mssql belgium
Ci with jenkins docker and mssql belgiumChris Adkin
 
413450-rc218-cdw-jenkins-workflow
413450-rc218-cdw-jenkins-workflow413450-rc218-cdw-jenkins-workflow
413450-rc218-cdw-jenkins-workflowAndy Pemberton
 
Automated acceptance test
Automated acceptance testAutomated acceptance test
Automated acceptance testBryan Liu
 

Tendances (20)

7 Habits of Highly Effective Jenkins Users
7 Habits of Highly Effective Jenkins Users7 Habits of Highly Effective Jenkins Users
7 Habits of Highly Effective Jenkins Users
 
Jenkins days workshop pipelines - Eric Long
Jenkins days workshop  pipelines - Eric LongJenkins days workshop  pipelines - Eric Long
Jenkins days workshop pipelines - Eric Long
 
sed.pdf
sed.pdfsed.pdf
sed.pdf
 
Brujug Jenkins pipeline scalability
Brujug Jenkins pipeline scalabilityBrujug Jenkins pipeline scalability
Brujug Jenkins pipeline scalability
 
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
 
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
 
Jenkins Pipeline @ Scale. Building Automation Frameworks for Systems Integration
Jenkins Pipeline @ Scale. Building Automation Frameworks for Systems IntegrationJenkins Pipeline @ Scale. Building Automation Frameworks for Systems Integration
Jenkins Pipeline @ Scale. Building Automation Frameworks for Systems Integration
 
Jenkins pipeline as code
Jenkins pipeline as codeJenkins pipeline as code
Jenkins pipeline as code
 
Continuous Delivery Pipeline with Docker and Jenkins
Continuous Delivery Pipeline with Docker and JenkinsContinuous Delivery Pipeline with Docker and Jenkins
Continuous Delivery Pipeline with Docker and Jenkins
 
Build, Publish, Deploy and Test Docker images and containers with Jenkins Wor...
Build, Publish, Deploy and Test Docker images and containers with Jenkins Wor...Build, Publish, Deploy and Test Docker images and containers with Jenkins Wor...
Build, Publish, Deploy and Test Docker images and containers with Jenkins Wor...
 
Jenkins Pipelines
Jenkins PipelinesJenkins Pipelines
Jenkins Pipelines
 
Building Jenkins Pipelines at Scale
Building Jenkins Pipelines at ScaleBuilding Jenkins Pipelines at Scale
Building Jenkins Pipelines at Scale
 
Monitoring Akka with Kamon 1.0
Monitoring Akka with Kamon 1.0Monitoring Akka with Kamon 1.0
Monitoring Akka with Kamon 1.0
 
Codifying the Build and Release Process with a Jenkins Pipeline Shared Library
Codifying the Build and Release Process with a Jenkins Pipeline Shared LibraryCodifying the Build and Release Process with a Jenkins Pipeline Shared Library
Codifying the Build and Release Process with a Jenkins Pipeline Shared Library
 
Testing with Docker
Testing with DockerTesting with Docker
Testing with Docker
 
Let's go HTTPS-only! - More Than Buying a Certificate
Let's go HTTPS-only! - More Than Buying a CertificateLet's go HTTPS-only! - More Than Buying a Certificate
Let's go HTTPS-only! - More Than Buying a Certificate
 
Pimp your jenkins platform with docker - Devops.com 2015/11
Pimp your jenkins platform with docker - Devops.com 2015/11Pimp your jenkins platform with docker - Devops.com 2015/11
Pimp your jenkins platform with docker - Devops.com 2015/11
 
Ci with jenkins docker and mssql belgium
Ci with jenkins docker and mssql belgiumCi with jenkins docker and mssql belgium
Ci with jenkins docker and mssql belgium
 
413450-rc218-cdw-jenkins-workflow
413450-rc218-cdw-jenkins-workflow413450-rc218-cdw-jenkins-workflow
413450-rc218-cdw-jenkins-workflow
 
Automated acceptance test
Automated acceptance testAutomated acceptance test
Automated acceptance test
 

En vedette

Making Makers: Making as a Pathway to Engineering
Making Makers: Making as a Pathway to EngineeringMaking Makers: Making as a Pathway to Engineering
Making Makers: Making as a Pathway to EngineeringChad Ratliff
 
Zero To Cloud (OSCon 2014)
Zero To Cloud (OSCon 2014)Zero To Cloud (OSCon 2014)
Zero To Cloud (OSCon 2014)Justin Ryan
 
AWS Code{Commit,Deploy,Pipeline} (June 2016)
 AWS Code{Commit,Deploy,Pipeline} (June 2016) AWS Code{Commit,Deploy,Pipeline} (June 2016)
AWS Code{Commit,Deploy,Pipeline} (June 2016)Julien SIMON
 
Part 3: Enabling Continuous Delivery (Pivotal Cloud Platform Roadshow)
Part 3: Enabling Continuous Delivery (Pivotal Cloud Platform Roadshow)Part 3: Enabling Continuous Delivery (Pivotal Cloud Platform Roadshow)
Part 3: Enabling Continuous Delivery (Pivotal Cloud Platform Roadshow)VMware Tanzu
 
Continuous Development Pipeline
Continuous Development PipelineContinuous Development Pipeline
Continuous Development PipelineIzzet Mustafaiev
 
Pipeline: Continuous Delivery as Code in Jenkins 2.0
Pipeline: Continuous Delivery as Code in Jenkins 2.0Pipeline: Continuous Delivery as Code in Jenkins 2.0
Pipeline: Continuous Delivery as Code in Jenkins 2.0Jules Pierre-Louis
 
Cut the ITIL Anchor, Raise the ITIL Sail, an ITSM Academy Webinar
Cut the ITIL Anchor, Raise the ITIL Sail, an ITSM Academy WebinarCut the ITIL Anchor, Raise the ITIL Sail, an ITSM Academy Webinar
Cut the ITIL Anchor, Raise the ITIL Sail, an ITSM Academy WebinarITSM Academy, Inc.
 
Enterprise CI as-a-Service using Jenkins
Enterprise CI as-a-Service using JenkinsEnterprise CI as-a-Service using Jenkins
Enterprise CI as-a-Service using JenkinsCollabNet
 
SD DevOps Meet-up - Jenkins 2.0 and Pipeline-as-Code
SD DevOps Meet-up - Jenkins 2.0 and Pipeline-as-CodeSD DevOps Meet-up - Jenkins 2.0 and Pipeline-as-Code
SD DevOps Meet-up - Jenkins 2.0 and Pipeline-as-CodeBrian Dawson
 
Agile and ITIL Continuous Delivery
Agile and ITIL Continuous DeliveryAgile and ITIL Continuous Delivery
Agile and ITIL Continuous DeliveryMartin Jackson
 
CI and CD with Jenkins
CI and CD with JenkinsCI and CD with Jenkins
CI and CD with JenkinsMartin Málek
 
Jenkins - From Continuous Integration to Continuous Delivery
Jenkins - From Continuous Integration to Continuous DeliveryJenkins - From Continuous Integration to Continuous Delivery
Jenkins - From Continuous Integration to Continuous DeliveryVirendra Bhalothia
 
DevOps and Continuous Delivery Reference Architectures - Volume 2
DevOps and Continuous Delivery Reference Architectures - Volume 2DevOps and Continuous Delivery Reference Architectures - Volume 2
DevOps and Continuous Delivery Reference Architectures - Volume 2Sonatype
 
DevOps Practices: Configuration as Code
DevOps Practices:Configuration as CodeDevOps Practices:Configuration as Code
DevOps Practices: Configuration as CodeDoug Seven
 
The Continuous People Pipeline, with Jayne Groll - an ITSM Academy Webinar
The Continuous People Pipeline, with Jayne Groll - an ITSM Academy WebinarThe Continuous People Pipeline, with Jayne Groll - an ITSM Academy Webinar
The Continuous People Pipeline, with Jayne Groll - an ITSM Academy WebinarITSM Academy, Inc.
 
DevOps: A Culture Transformation, More than Technology
DevOps: A Culture Transformation, More than TechnologyDevOps: A Culture Transformation, More than Technology
DevOps: A Culture Transformation, More than TechnologyCA Technologies
 

En vedette (20)

Digital in 2016
Digital in 2016Digital in 2016
Digital in 2016
 
Making Makers: Making as a Pathway to Engineering
Making Makers: Making as a Pathway to EngineeringMaking Makers: Making as a Pathway to Engineering
Making Makers: Making as a Pathway to Engineering
 
Zero To Cloud (OSCon 2014)
Zero To Cloud (OSCon 2014)Zero To Cloud (OSCon 2014)
Zero To Cloud (OSCon 2014)
 
AWS Code{Commit,Deploy,Pipeline} (June 2016)
 AWS Code{Commit,Deploy,Pipeline} (June 2016) AWS Code{Commit,Deploy,Pipeline} (June 2016)
AWS Code{Commit,Deploy,Pipeline} (June 2016)
 
Part 3: Enabling Continuous Delivery (Pivotal Cloud Platform Roadshow)
Part 3: Enabling Continuous Delivery (Pivotal Cloud Platform Roadshow)Part 3: Enabling Continuous Delivery (Pivotal Cloud Platform Roadshow)
Part 3: Enabling Continuous Delivery (Pivotal Cloud Platform Roadshow)
 
Continuous Development Pipeline
Continuous Development PipelineContinuous Development Pipeline
Continuous Development Pipeline
 
Pipeline: Continuous Delivery as Code in Jenkins 2.0
Pipeline: Continuous Delivery as Code in Jenkins 2.0Pipeline: Continuous Delivery as Code in Jenkins 2.0
Pipeline: Continuous Delivery as Code in Jenkins 2.0
 
Cut the ITIL Anchor, Raise the ITIL Sail, an ITSM Academy Webinar
Cut the ITIL Anchor, Raise the ITIL Sail, an ITSM Academy WebinarCut the ITIL Anchor, Raise the ITIL Sail, an ITSM Academy Webinar
Cut the ITIL Anchor, Raise the ITIL Sail, an ITSM Academy Webinar
 
Enterprise CI as-a-Service using Jenkins
Enterprise CI as-a-Service using JenkinsEnterprise CI as-a-Service using Jenkins
Enterprise CI as-a-Service using Jenkins
 
SD DevOps Meet-up - Jenkins 2.0 and Pipeline-as-Code
SD DevOps Meet-up - Jenkins 2.0 and Pipeline-as-CodeSD DevOps Meet-up - Jenkins 2.0 and Pipeline-as-Code
SD DevOps Meet-up - Jenkins 2.0 and Pipeline-as-Code
 
Agile and ITIL Continuous Delivery
Agile and ITIL Continuous DeliveryAgile and ITIL Continuous Delivery
Agile and ITIL Continuous Delivery
 
CI and CD with Jenkins
CI and CD with JenkinsCI and CD with Jenkins
CI and CD with Jenkins
 
Jenkins - From Continuous Integration to Continuous Delivery
Jenkins - From Continuous Integration to Continuous DeliveryJenkins - From Continuous Integration to Continuous Delivery
Jenkins - From Continuous Integration to Continuous Delivery
 
AWS Code Services
AWS Code ServicesAWS Code Services
AWS Code Services
 
DevOps and Continuous Delivery Reference Architectures - Volume 2
DevOps and Continuous Delivery Reference Architectures - Volume 2DevOps and Continuous Delivery Reference Architectures - Volume 2
DevOps and Continuous Delivery Reference Architectures - Volume 2
 
DevOps Practices: Configuration as Code
DevOps Practices:Configuration as CodeDevOps Practices:Configuration as Code
DevOps Practices: Configuration as Code
 
The Continuous People Pipeline, with Jayne Groll - an ITSM Academy Webinar
The Continuous People Pipeline, with Jayne Groll - an ITSM Academy WebinarThe Continuous People Pipeline, with Jayne Groll - an ITSM Academy Webinar
The Continuous People Pipeline, with Jayne Groll - an ITSM Academy Webinar
 
DevOps
DevOpsDevOps
DevOps
 
DevOps: A Culture Transformation, More than Technology
DevOps: A Culture Transformation, More than TechnologyDevOps: A Culture Transformation, More than Technology
DevOps: A Culture Transformation, More than Technology
 
DevOps 101
DevOps 101DevOps 101
DevOps 101
 

Similaire à Continuous Delivery Pipeline as Code

Our Puppet Story – Patterns and Learnings (sage@guug, March 2014)
Our Puppet Story – Patterns and Learnings (sage@guug, March 2014)Our Puppet Story – Patterns and Learnings (sage@guug, March 2014)
Our Puppet Story – Patterns and Learnings (sage@guug, March 2014)DECK36
 
Shipping Code like a keptn: Continuous Delivery & Automated Operations on k8s
Shipping Code like a keptn: Continuous Delivery & Automated Operations on k8sShipping Code like a keptn: Continuous Delivery & Automated Operations on k8s
Shipping Code like a keptn: Continuous Delivery & Automated Operations on k8sAndreas Grabner
 
Jenkins Pipelines Advanced
Jenkins Pipelines AdvancedJenkins Pipelines Advanced
Jenkins Pipelines AdvancedOliver Lemm
 
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
 
Chicago DevOps Meetup Nov2019
Chicago DevOps Meetup Nov2019Chicago DevOps Meetup Nov2019
Chicago DevOps Meetup Nov2019Mike Villiger
 
Anatomy of a Build Pipeline
Anatomy of a Build PipelineAnatomy of a Build Pipeline
Anatomy of a Build PipelineSamuel Brown
 
Don't Deploy Into the Dark: DORA Metrics for your K8s GitOps Deployments
Don't Deploy Into the Dark: DORA Metrics for your K8s GitOps DeploymentsDon't Deploy Into the Dark: DORA Metrics for your K8s GitOps Deployments
Don't Deploy Into the Dark: DORA Metrics for your K8s GitOps DeploymentsAndreas Grabner
 
Scala, docker and testing, oh my! mario camou
Scala, docker and testing, oh my! mario camouScala, docker and testing, oh my! mario camou
Scala, docker and testing, oh my! mario camouJ On The Beach
 
CI/CD and TDD in deploying kamailio
CI/CD and TDD in deploying kamailioCI/CD and TDD in deploying kamailio
CI/CD and TDD in deploying kamailioAleksandar Sosic
 
Surviving the Script-apocalypse
Surviving the Script-apocalypseSurviving the Script-apocalypse
Surviving the Script-apocalypseDevOps.com
 
Continuos Integration and Delivery: from Zero to Hero with TeamCity, Docker a...
Continuos Integration and Delivery: from Zero to Hero with TeamCity, Docker a...Continuos Integration and Delivery: from Zero to Hero with TeamCity, Docker a...
Continuos Integration and Delivery: from Zero to Hero with TeamCity, Docker a...Lean IT Consulting
 
HashiStack. To the cloud and beyond...
HashiStack. To the cloud and beyond...HashiStack. To the cloud and beyond...
HashiStack. To the cloud and beyond...Oleg Lobanov
 
Integrating Infrastructure as Code into a Continuous Delivery Pipeline | AWS ...
Integrating Infrastructure as Code into a Continuous Delivery Pipeline | AWS ...Integrating Infrastructure as Code into a Continuous Delivery Pipeline | AWS ...
Integrating Infrastructure as Code into a Continuous Delivery Pipeline | AWS ...Amazon Web Services
 
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
 
Criando pipelines de entrega contínua multilinguagem com Docker e Jenkins
Criando pipelines de entrega contínua multilinguagem com Docker e JenkinsCriando pipelines de entrega contínua multilinguagem com Docker e Jenkins
Criando pipelines de entrega contínua multilinguagem com Docker e JenkinsCamilo Ribeiro
 
Eclipse DemoCamp Bucharest 2014 - Continuous Integration Jenkins/Hudson
Eclipse DemoCamp Bucharest 2014 - Continuous Integration Jenkins/HudsonEclipse DemoCamp Bucharest 2014 - Continuous Integration Jenkins/Hudson
Eclipse DemoCamp Bucharest 2014 - Continuous Integration Jenkins/HudsonVladLica
 
Software Delivery in 2016 - A Continuous Delivery Approach
Software Delivery in 2016 - A Continuous Delivery ApproachSoftware Delivery in 2016 - A Continuous Delivery Approach
Software Delivery in 2016 - A Continuous Delivery ApproachGiovanni Toraldo
 

Similaire à Continuous Delivery Pipeline as Code (20)

Our Puppet Story – Patterns and Learnings (sage@guug, March 2014)
Our Puppet Story – Patterns and Learnings (sage@guug, March 2014)Our Puppet Story – Patterns and Learnings (sage@guug, March 2014)
Our Puppet Story – Patterns and Learnings (sage@guug, March 2014)
 
Shipping Code like a keptn: Continuous Delivery & Automated Operations on k8s
Shipping Code like a keptn: Continuous Delivery & Automated Operations on k8sShipping Code like a keptn: Continuous Delivery & Automated Operations on k8s
Shipping Code like a keptn: Continuous Delivery & Automated Operations on k8s
 
Jenkins Pipelines Advanced
Jenkins Pipelines AdvancedJenkins Pipelines Advanced
Jenkins Pipelines Advanced
 
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
 
CI and CD
CI and CDCI and CD
CI and CD
 
Chicago DevOps Meetup Nov2019
Chicago DevOps Meetup Nov2019Chicago DevOps Meetup Nov2019
Chicago DevOps Meetup Nov2019
 
Anatomy of a Build Pipeline
Anatomy of a Build PipelineAnatomy of a Build Pipeline
Anatomy of a Build Pipeline
 
Don't Deploy Into the Dark: DORA Metrics for your K8s GitOps Deployments
Don't Deploy Into the Dark: DORA Metrics for your K8s GitOps DeploymentsDon't Deploy Into the Dark: DORA Metrics for your K8s GitOps Deployments
Don't Deploy Into the Dark: DORA Metrics for your K8s GitOps Deployments
 
Scala, docker and testing, oh my! mario camou
Scala, docker and testing, oh my! mario camouScala, docker and testing, oh my! mario camou
Scala, docker and testing, oh my! mario camou
 
CI/CD and TDD in deploying kamailio
CI/CD and TDD in deploying kamailioCI/CD and TDD in deploying kamailio
CI/CD and TDD in deploying kamailio
 
Surviving the Script-apocalypse
Surviving the Script-apocalypseSurviving the Script-apocalypse
Surviving the Script-apocalypse
 
Continuos Integration and Delivery: from Zero to Hero with TeamCity, Docker a...
Continuos Integration and Delivery: from Zero to Hero with TeamCity, Docker a...Continuos Integration and Delivery: from Zero to Hero with TeamCity, Docker a...
Continuos Integration and Delivery: from Zero to Hero with TeamCity, Docker a...
 
HashiStack. To the cloud and beyond...
HashiStack. To the cloud and beyond...HashiStack. To the cloud and beyond...
HashiStack. To the cloud and beyond...
 
Dev ops meetup
Dev ops meetupDev ops meetup
Dev ops meetup
 
Integrating Infrastructure as Code into a Continuous Delivery Pipeline | AWS ...
Integrating Infrastructure as Code into a Continuous Delivery Pipeline | AWS ...Integrating Infrastructure as Code into a Continuous Delivery Pipeline | AWS ...
Integrating Infrastructure as Code into a Continuous Delivery Pipeline | AWS ...
 
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
 
Criando pipelines de entrega contínua multilinguagem com Docker e Jenkins
Criando pipelines de entrega contínua multilinguagem com Docker e JenkinsCriando pipelines de entrega contínua multilinguagem com Docker e Jenkins
Criando pipelines de entrega contínua multilinguagem com Docker e Jenkins
 
Eclipse DemoCamp Bucharest 2014 - Continuous Integration Jenkins/Hudson
Eclipse DemoCamp Bucharest 2014 - Continuous Integration Jenkins/HudsonEclipse DemoCamp Bucharest 2014 - Continuous Integration Jenkins/Hudson
Eclipse DemoCamp Bucharest 2014 - Continuous Integration Jenkins/Hudson
 
FV04_MostoviczT_RAD
FV04_MostoviczT_RADFV04_MostoviczT_RAD
FV04_MostoviczT_RAD
 
Software Delivery in 2016 - A Continuous Delivery Approach
Software Delivery in 2016 - A Continuous Delivery ApproachSoftware Delivery in 2016 - A Continuous Delivery Approach
Software Delivery in 2016 - A Continuous Delivery Approach
 

Dernier

Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 

Dernier (20)

Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 

Continuous Delivery Pipeline as Code

  • 2. Mike van Vendeloo Software Craftsman at JPoint TU Delft - Computer Science Scrum master Assignments at customers like KLM, Rabobank, Government, de Persgroep. Focus on improvement of software development process and quality Hobb: Korfball, domotica @mikevanvendeloo
  • 3. Agenda • Definitions CI/CD/Pipeline • Jenkins 2: Pipeline as code • Pipeline snippets • Reuse with pipeline libraries • Declarative pipelines • Blue Ocean • Demo
  • 5. Definitions - Continuous Integration “Continuous Integration is a software development practice where members of a team integrate their work frequently, usually each person integrates at least daily - leading to multiple integrations per day. Each integration is verified by an automated build (including test) to detect integration errors as quickly as possible.“ Martin Fowler
  • 6. Continuous Delivery: Automate everything “If it hurts, do it more frequently, and bring the pain forward.” ― Jez Humble, Continuous Delivery
  • 7. Definitions - Continuous Delivery “Continuous Delivery is the ability to get changes of all types—including new features, configuration changes, bug fixes and experiments—into production, or into the hands of users, safely and quickly in a sustainable way.”
  • 9. Definitions - Pipeline A pipeline is a set of stages to bring functionality from developer to the end user.
  • 12. Jenkins 2 - Pipeline as code
  • 13. Sample basic pipeline stages ➔ Checkout Source code checkout from repository ➔ Build Compile & Unit test ➔ QA Code style check & integration testing ➔ Deploy Deploy to a server
  • 14. Basic pipeline definition #!/usr/bin/groovy node('linux') { stage('Checkout') { checkout scm } stage('Build') { sh "mvn clean deploy" junit allowEmptyResults: true, testResults: 'target/surefire-reports/*.xml' } stage('Deploy') { build "Deployer" } }
  • 15.
  • 17. Error handling node { stage('Doing my thing') { try { sh 'exit 1' } catch (someException) { echo 'Something failed, somebody should be notified!' throw someException } finally { hipchatSend color: 'BLUE', credentialId: 'hipChat', message: “Build result ${env.BUILD_RESULT}”, room: 'BuildResults' } } }
  • 18. Pipeline properties - cleanup properties( [buildDiscarder( logRotator( artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '7', numToKeepStr: '25') ), pipelineTriggers([]) ] )
  • 19. Pipeline properties - Parameters properties( [parameters( [choice( choices: ['dev', 'test', 'acc', 'prod'], description: 'Kies de omgeving', name: 'omgeving')] ), pipelineTriggers([]) ])
  • 20. Parallel tasks parallel ‘test’: { sh ‘mvn clean test’ }, ‘mutation-test’: { Sh ‘mvn org.pitest:pitest-maven:mutationCoverage’ }, failFast: true
  • 21. Share information between nodes/executors node { stage(‘Build’) sh(“mvn -B clean package”) stash excludes:’target/’, includes: ‘**’, name: ‘source’ } stage (‘test’) { unstash ‘source’ } }
  • 22. Notifications def notify(String colorCode, String color, String summary) slackSend (color: colorCode, message: summary) hipchatSend (color: color, notify: true, message: summary) emailext ( to: team@mydomain.com', subject: “Build ${env.JOB_NAME} [${env.BUILD_NUMBER}] result ${currentBuild.result}” body: “<a href='${env.BUILD_URL}'>${env.JOB_NAME} [${env.BUILD_NUMBER}]</a>”, recipientProviders: [[$class: 'DevelopersRecipientProvider']] ) }
  • 25. Library implementation package vanvendeloo.jenkins def checkout(String repositoryName) { git “git@bitbucket.org:vanvendeloo/${repositoryName}” } def updateVersion() { sh “mvn build-helper:parse-version versions:set - DnewVersion=${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${ parsedVersion.nextIncrementalVersion} versions:commit” } // Return the contents of this script as object so it can be re-used in Jenkinsfiles. return this
  • 26. Use the library: @Library @Library(‘pipeline-library’) node { pipelineSteps = new PipelineSteps() stage(‘Preparation’) { pipelineSteps.checkout(‘my-service’) pipelineSteps.updateVersion() } }
  • 27. Catch: Groovy Sandbox org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: ↵ Scripts not permitted to use method java.lang.String replaceAll java.lang.String java.lang.String 1. Go to Manage Jenkins > In-process Script Approval 2. Review the pending signatures and click Approve to add them to the whitelist 3. Re-run your job; it should no longer fail (for this particular method call)
  • 29. Declarative Pipelines node { stage(‘Checkout’) { checkout scm } stage(‘Build’) { withEnv(["PATH+MAVEN=${tool 'M3'}/bin"]) { try { sh 'mvn clean install' } catch (e) { currentBuild.result = 'FAILURE' } } } pipeline { agent any tools { maven 'M3' } stages { stage('Checkout') { steps { checkout scm } } stage(Build) { steps { sh ‘mvn clean install’ } post { success { junit '**/surefire-reports/**/*.xml' } } } }
  • 33.
  • 34.
  • 35.
  • 36. Conclusions Pipeline evaluates with your code Reuse in libraries keeps your Jenkinsfile clean and simple BlueOcean definately an improvement, but need to get used to it Pipeline editor very cool feature!
  • 37.

Notes de l'éditeur

  1. Continuous Delivery is sometimes confused with Continuous Deployment. Continuous Deployment means that every change goes through the pipeline and automatically gets put into production, resulting in many production deployments every day. Continuous Delivery just means that you are able to do frequent deployments but may choose not to do it, usually due to businesses preferring a slower rate of deployment. In order to do Continuous Deployment you must be doing Continuous Delivery.
  2. Pipeline as first class citizen