SlideShare a Scribd company logo
1 of 27
Pipeline as code
with Multibranch Workflows in Jenkins 2
Jenkins
Open source CI/CD project
On premise tool
Supports plugins
Integrates with 3rd party tools and services
Organisation folder
Workflow Multibranch
Pipeline
New in Jenkins
2
Workflow Multibranch
Automatic Workflow (job) creation in Jenkins per new
branch in the repository (assuming webhooks are
registered from SCM to Jenkins)
Build specific to that child-branch and its unique scm
change and build history
Automatic job pruning/deletion for branches deleted from
the repository, according to the settings
Flexibility to individually configure branch properties, by
overriding the parent properties, if required
* Source: Jenkins.io
Organisation folder
Works on project space level within organisation SCM.
Provides ability to create and manage workflow jobs for
all repositories
Automatically removes jobs for merged back branches
Simplified configuration that requires only project name
and credentials
Provides pull request testing functionality. Jenkins will
create a new CD pipeline when a pull-request is
submitted and build/test the pull-request.
Setting up Organisation folder
Pipeline execution
Pipeline definition
Pipelines are “Jenkins job definitions” enabled by the
Pipeline plugin
Based on Groovy programming language
Pipelines leverage the power of multiple steps to execute
both simple and complex tasks according to parameters
that you establish
Pipelines can build code and orchestrate the work required
to drive applications from commit to delivery
* Source: Jenkins.io
Pipeline attributes
Durable: Pipelines can survive both planned and unplanned
restarts of your Jenkins master.
Pausable: Pipelines can optionally stop and wait for human
input or approval before completing the jobs for which
they were built.
Versatile: Pipelines support complex real-world
requirements, including the ability to fork or join, loop,
and work in parallel with each other.
Extensible: The Pipeline plugin supports custom extensions
to its DSL (domain scripting language) and multiple
options for integration with other plugins.
* Source: Jenkins.io
Pipeline pros
Supports complex, real-world, CD Pipeline requirements:
pipelines can fork/join, loop, parallel, to name a few
Resilient - pipeline executions can survive master restarts
Pausable - pipelines can pause and wait for human
input/approval
Efficient - pipelines can restart from saved checkpoints
Visualized - Pipeline StageView provides status at-a-glance
dashboards including trending
Artifact traceability with fingerprinting - support tracking
versions of artifacts using file fingerprinting
Pipeline vocabulary
Step is a single task that is part of build sequence
Node typically enlists help from available executors on
agents to:
Schedules the steps contained within it to run by
adding them to the Jenkins build queue
Creates a workspace where resource-intensive
processing can occur without negatively impacting
your pipeline performance
Stage is a logically distinct part of the execution of any task,
with parameters for locking, ordering, and labeling its
part of a process relative to other parts of the same
process
* Source: Jenkins.io
step([$class: 'ArtifactArchiver', artifacts: '**/target/*.war’, fingerprint: true])
The Jenkinsfile
Jenkinsfile is a container for pipeline (or other) script,
which details what specific steps are needed to perform
a job for which you want to use Jenkins.
Jenkinsfile can be created with text/Groovy editor, or
through the configuration page on of Jenkins instance.
Provides DSL steps with most common build tasks
(https://jenkins.io/doc/pipeline/steps/)
Can be extended by external shell scripts and import user
Groovy scripts
DSL examples
sh, bat - script execution for Unix and Windows system
scm, checkout - checkout source code from VCS
readFile, writeFile, fileExists - file handling
stash, unstash - share workspace results between stages
withEnv, evn.Foo, $BUILD_NUMBER - getting and setting
variables
parallel - set up concurrent tasks
node('nodeJs') {
currentBuild.result = "SUCCESS"
try {
stage('Checkout')
checkout scm
stage('Test')
env.NODE_ENV = "test"
print "Environment will be : ${env.NODE_ENV}"
sh 'node -v && npm prune && npm install && npm test'
stage('Build Docker')
sh './dockerBuild.sh'
stage('Deploy')
echo 'Push to Repo ssh to web server and tell it to pull new image'
sh './dockerPushToRepo.sh'
stage('Cleanup')
echo 'prune and cleanup'
sh 'npm prune && rm node_modules -rf'
mail body: 'project build successful', from: 'xxxx@yyyyy.com', replyTo: 'xxxx@yyyy.com', subject: 'project build successful', to:
'yyy@yy.com'
} catch (err) {
currentBuild.result = "FAILURE"
def specificCause = currentBuild.rawBuild.getCause(hudson.model.Cause$UserIdCause)
mail body: "project build error is here: ${env.BUILD_URL}" , from: 'xxxx@yyyy.com', replyTo: 'yyyy@yyyy.com', subject: 'project build
failed', to: 'zz@yy.com'
throw err }}
Master-agent architecture
Master node has a list of all configured agents
Master node starts required Agents and passes build steps
from Jenkinsfile
All “hard work” is done by Agents
Http: 8080
Slave: 50000
Master
Agent
nodejs
Agent
java
Agent
golang
Slave: 50000
Slave: 50000
Slave: 50000
Jenkins in Kubernetes
Jenkins usage across teams
Nana Beta Pi ...
Jenkins agent
images
Source code
+
Pipeline libraries
What makes "Pipeline as a code" valuable for
build/deployments in Newsweaver
Organization folders - enable Jenkins to automatically detect and include any new
repositories within them as resources.
Jenkinsfile as part of source code - A Jenkinsfile is a container for your pipeline (or
other) script, which details what specific steps are needed to perform a job for which
you want to use Jenkins.
Groovy is good - Jenkinsfiles are written as Groovy scripts which makes them easy to
write and add complex logic
Ability to record test results and artifacts
Call agent for help - build tasks can be distributed and assigned to remote nodes.
DRY - Pipeline can reuse build steps stored in SCM which can allow us to avoid code
duplication in all branches
Inputs - pipelines can be programed with pauses/human interaction
Concurrent build actions - with a help of Parallel Test Executor we can split steps in
parallel parts
New & noteworthy features
Blue Ocean - new UI tailored pipelines as a central theme
to the Jenkins user experience
Visual Pipeline Editor - helps to make things clearer for a
range of users, to help with Workflow adoption
Blue Ocean (https://jenkins.io/projects/blueocean/)
Visual Pipeline Editor (https://www.cloudbees.com/blog/introducing-experimental-visual-pipeline-editor)
Questions

More Related Content

What's hot

(Declarative) Jenkins Pipelines
(Declarative) Jenkins Pipelines(Declarative) Jenkins Pipelines
(Declarative) Jenkins PipelinesSteffen Gebert
 
Brujug Jenkins pipeline scalability
Brujug Jenkins pipeline scalabilityBrujug Jenkins pipeline scalability
Brujug Jenkins pipeline scalabilityDamien Coraboeuf
 
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, pipeline and docker
Jenkins, pipeline and docker Jenkins, pipeline and docker
Jenkins, pipeline and docker AgileDenver
 
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
 
Jenkins Declarative Pipelines 101
Jenkins Declarative Pipelines 101Jenkins Declarative Pipelines 101
Jenkins Declarative Pipelines 101Malcolm Groves
 
Building Jenkins Pipelines at Scale
Building Jenkins Pipelines at ScaleBuilding Jenkins Pipelines at Scale
Building Jenkins Pipelines at ScaleJulien Pivotto
 
CI/CD on Android project via Jenkins Pipeline
CI/CD on Android project via Jenkins PipelineCI/CD on Android project via Jenkins Pipeline
CI/CD on Android project via Jenkins PipelineVeaceslav Gaidarji
 
Voxxed Luxembourd 2016 Jenkins 2.0 et Pipeline as code
Voxxed Luxembourd 2016 Jenkins 2.0 et Pipeline as codeVoxxed Luxembourd 2016 Jenkins 2.0 et Pipeline as code
Voxxed Luxembourd 2016 Jenkins 2.0 et Pipeline as codeDamien Duportal
 
Continuous Delivery - Pipeline as-code
Continuous Delivery - Pipeline as-codeContinuous Delivery - Pipeline as-code
Continuous Delivery - Pipeline as-codeMike van Vendeloo
 
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
 
Testing with Docker
Testing with DockerTesting with Docker
Testing with Dockertoffermann
 
Monitoring Akka with Kamon 1.0
Monitoring Akka with Kamon 1.0Monitoring Akka with Kamon 1.0
Monitoring Akka with Kamon 1.0Steffen Gebert
 
Continuous Integration/Deployment with Docker and Jenkins
Continuous Integration/Deployment with Docker and JenkinsContinuous Integration/Deployment with Docker and Jenkins
Continuous Integration/Deployment with Docker and JenkinsFrancesco Bruni
 
Cleaning Up the Dirt of the Nineties - How New Protocols are Modernizing the Web
Cleaning Up the Dirt of the Nineties - How New Protocols are Modernizing the WebCleaning Up the Dirt of the Nineties - How New Protocols are Modernizing the Web
Cleaning Up the Dirt of the Nineties - How New Protocols are Modernizing the WebSteffen Gebert
 
Learning Maven by Example
Learning Maven by ExampleLearning Maven by Example
Learning Maven by ExampleHsi-Kai Wang
 
Jenkins Shared Libraries Workshop
Jenkins Shared Libraries WorkshopJenkins Shared Libraries Workshop
Jenkins Shared Libraries WorkshopJulien Pivotto
 

What's hot (20)

(Declarative) Jenkins Pipelines
(Declarative) Jenkins Pipelines(Declarative) Jenkins Pipelines
(Declarative) Jenkins Pipelines
 
Brujug Jenkins pipeline scalability
Brujug Jenkins pipeline scalabilityBrujug Jenkins pipeline scalability
Brujug Jenkins pipeline scalability
 
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, pipeline and docker
Jenkins, pipeline and docker Jenkins, pipeline and docker
Jenkins, pipeline and docker
 
Building an Extensible, Resumable DSL on Top of Apache Groovy
Building an Extensible, Resumable DSL on Top of Apache GroovyBuilding an Extensible, Resumable DSL on Top of Apache Groovy
Building an Extensible, Resumable DSL on Top of Apache Groovy
 
Jenkins Declarative Pipelines 101
Jenkins Declarative Pipelines 101Jenkins Declarative Pipelines 101
Jenkins Declarative Pipelines 101
 
Jenkins pipeline as code
Jenkins pipeline as codeJenkins pipeline as code
Jenkins pipeline as code
 
Building Jenkins Pipelines at Scale
Building Jenkins Pipelines at ScaleBuilding Jenkins Pipelines at Scale
Building Jenkins Pipelines at Scale
 
CI/CD on Android project via Jenkins Pipeline
CI/CD on Android project via Jenkins PipelineCI/CD on Android project via Jenkins Pipeline
CI/CD on Android project via Jenkins Pipeline
 
Voxxed Luxembourd 2016 Jenkins 2.0 et Pipeline as code
Voxxed Luxembourd 2016 Jenkins 2.0 et Pipeline as codeVoxxed Luxembourd 2016 Jenkins 2.0 et Pipeline as code
Voxxed Luxembourd 2016 Jenkins 2.0 et Pipeline as code
 
sed.pdf
sed.pdfsed.pdf
sed.pdf
 
Continuous Delivery - Pipeline as-code
Continuous Delivery - Pipeline as-codeContinuous Delivery - Pipeline as-code
Continuous Delivery - Pipeline as-code
 
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
 
Testing with Docker
Testing with DockerTesting with Docker
Testing with Docker
 
Monitoring Akka with Kamon 1.0
Monitoring Akka with Kamon 1.0Monitoring Akka with Kamon 1.0
Monitoring Akka with Kamon 1.0
 
Continuous Integration/Deployment with Docker and Jenkins
Continuous Integration/Deployment with Docker and JenkinsContinuous Integration/Deployment with Docker and Jenkins
Continuous Integration/Deployment with Docker and Jenkins
 
Cleaning Up the Dirt of the Nineties - How New Protocols are Modernizing the Web
Cleaning Up the Dirt of the Nineties - How New Protocols are Modernizing the WebCleaning Up the Dirt of the Nineties - How New Protocols are Modernizing the Web
Cleaning Up the Dirt of the Nineties - How New Protocols are Modernizing the Web
 
Docker & ci
Docker & ciDocker & ci
Docker & ci
 
Learning Maven by Example
Learning Maven by ExampleLearning Maven by Example
Learning Maven by Example
 
Jenkins Shared Libraries Workshop
Jenkins Shared Libraries WorkshopJenkins Shared Libraries Workshop
Jenkins Shared Libraries Workshop
 

Similar to Pipeline as code - new feature in Jenkins 2

413450-rc218-cdw-jenkins-workflow
413450-rc218-cdw-jenkins-workflow413450-rc218-cdw-jenkins-workflow
413450-rc218-cdw-jenkins-workflowAndy Pemberton
 
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
 
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
 
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
 
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 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
 
Continous Integration.pptx
Continous Integration.pptxContinous Integration.pptx
Continous Integration.pptxAnuj Sharma
 
Jenkins advance topic
Jenkins advance topicJenkins advance topic
Jenkins advance topicKalkey
 
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
 
Scaling Jenkins with Kubernetes by Ami Mahloof
Scaling Jenkins with Kubernetes by Ami MahloofScaling Jenkins with Kubernetes by Ami Mahloof
Scaling Jenkins with Kubernetes by Ami MahloofDoiT International
 
Version your build process as you version your code
Version your build process as you version your codeVersion your build process as you version your code
Version your build process as you version your codeVincent Latombe
 
Scaling jenkins with kubernetes
Scaling jenkins with kubernetesScaling jenkins with kubernetes
Scaling jenkins with kubernetesAmi Mahloof
 
Docker - Demo on PHP Application deployment
Docker - Demo on PHP Application deployment Docker - Demo on PHP Application deployment
Docker - Demo on PHP Application deployment Arun prasath
 
Jenkins advance topic
Jenkins advance topicJenkins advance topic
Jenkins advance topicGourav Varma
 

Similar to Pipeline as code - new feature in Jenkins 2 (20)

413450-rc218-cdw-jenkins-workflow
413450-rc218-cdw-jenkins-workflow413450-rc218-cdw-jenkins-workflow
413450-rc218-cdw-jenkins-workflow
 
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
 
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
 
Basic Jenkins Guide.pptx
Basic Jenkins Guide.pptxBasic Jenkins Guide.pptx
Basic Jenkins Guide.pptx
 
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
 
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 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
 
Continous Integration.pptx
Continous Integration.pptxContinous Integration.pptx
Continous Integration.pptx
 
Jenkins presentation
Jenkins presentationJenkins presentation
Jenkins presentation
 
Jenkins advance topic
Jenkins advance topicJenkins advance topic
Jenkins advance topic
 
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
 
Jenkins CI
Jenkins CIJenkins CI
Jenkins CI
 
Build Time Hacking
Build Time HackingBuild Time Hacking
Build Time Hacking
 
Scaling Jenkins with Kubernetes by Ami Mahloof
Scaling Jenkins with Kubernetes by Ami MahloofScaling Jenkins with Kubernetes by Ami Mahloof
Scaling Jenkins with Kubernetes by Ami Mahloof
 
Version your build process as you version your code
Version your build process as you version your codeVersion your build process as you version your code
Version your build process as you version your code
 
Scaling jenkins with kubernetes
Scaling jenkins with kubernetesScaling jenkins with kubernetes
Scaling jenkins with kubernetes
 
Jenkins.pdf
Jenkins.pdfJenkins.pdf
Jenkins.pdf
 
Jenkins & IaC
Jenkins & IaCJenkins & IaC
Jenkins & IaC
 
Docker - Demo on PHP Application deployment
Docker - Demo on PHP Application deployment Docker - Demo on PHP Application deployment
Docker - Demo on PHP Application deployment
 
Jenkins advance topic
Jenkins advance topicJenkins advance topic
Jenkins advance topic
 

Recently uploaded

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 

Recently uploaded (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 

Pipeline as code - new feature in Jenkins 2

  • 1. Pipeline as code with Multibranch Workflows in Jenkins 2
  • 2. Jenkins Open source CI/CD project On premise tool Supports plugins Integrates with 3rd party tools and services
  • 3.
  • 5. Workflow Multibranch Automatic Workflow (job) creation in Jenkins per new branch in the repository (assuming webhooks are registered from SCM to Jenkins) Build specific to that child-branch and its unique scm change and build history Automatic job pruning/deletion for branches deleted from the repository, according to the settings Flexibility to individually configure branch properties, by overriding the parent properties, if required * Source: Jenkins.io
  • 6. Organisation folder Works on project space level within organisation SCM. Provides ability to create and manage workflow jobs for all repositories Automatically removes jobs for merged back branches Simplified configuration that requires only project name and credentials Provides pull request testing functionality. Jenkins will create a new CD pipeline when a pull-request is submitted and build/test the pull-request.
  • 8.
  • 10. Pipeline definition Pipelines are “Jenkins job definitions” enabled by the Pipeline plugin Based on Groovy programming language Pipelines leverage the power of multiple steps to execute both simple and complex tasks according to parameters that you establish Pipelines can build code and orchestrate the work required to drive applications from commit to delivery * Source: Jenkins.io
  • 11. Pipeline attributes Durable: Pipelines can survive both planned and unplanned restarts of your Jenkins master. Pausable: Pipelines can optionally stop and wait for human input or approval before completing the jobs for which they were built. Versatile: Pipelines support complex real-world requirements, including the ability to fork or join, loop, and work in parallel with each other. Extensible: The Pipeline plugin supports custom extensions to its DSL (domain scripting language) and multiple options for integration with other plugins. * Source: Jenkins.io
  • 12. Pipeline pros Supports complex, real-world, CD Pipeline requirements: pipelines can fork/join, loop, parallel, to name a few Resilient - pipeline executions can survive master restarts Pausable - pipelines can pause and wait for human input/approval Efficient - pipelines can restart from saved checkpoints Visualized - Pipeline StageView provides status at-a-glance dashboards including trending Artifact traceability with fingerprinting - support tracking versions of artifacts using file fingerprinting
  • 13. Pipeline vocabulary Step is a single task that is part of build sequence Node typically enlists help from available executors on agents to: Schedules the steps contained within it to run by adding them to the Jenkins build queue Creates a workspace where resource-intensive processing can occur without negatively impacting your pipeline performance Stage is a logically distinct part of the execution of any task, with parameters for locking, ordering, and labeling its part of a process relative to other parts of the same process * Source: Jenkins.io
  • 14.
  • 15.
  • 16. step([$class: 'ArtifactArchiver', artifacts: '**/target/*.war’, fingerprint: true])
  • 17. The Jenkinsfile Jenkinsfile is a container for pipeline (or other) script, which details what specific steps are needed to perform a job for which you want to use Jenkins. Jenkinsfile can be created with text/Groovy editor, or through the configuration page on of Jenkins instance. Provides DSL steps with most common build tasks (https://jenkins.io/doc/pipeline/steps/) Can be extended by external shell scripts and import user Groovy scripts
  • 18. DSL examples sh, bat - script execution for Unix and Windows system scm, checkout - checkout source code from VCS readFile, writeFile, fileExists - file handling stash, unstash - share workspace results between stages withEnv, evn.Foo, $BUILD_NUMBER - getting and setting variables parallel - set up concurrent tasks
  • 19. node('nodeJs') { currentBuild.result = "SUCCESS" try { stage('Checkout') checkout scm stage('Test') env.NODE_ENV = "test" print "Environment will be : ${env.NODE_ENV}" sh 'node -v && npm prune && npm install && npm test' stage('Build Docker') sh './dockerBuild.sh' stage('Deploy') echo 'Push to Repo ssh to web server and tell it to pull new image' sh './dockerPushToRepo.sh' stage('Cleanup') echo 'prune and cleanup' sh 'npm prune && rm node_modules -rf' mail body: 'project build successful', from: 'xxxx@yyyyy.com', replyTo: 'xxxx@yyyy.com', subject: 'project build successful', to: 'yyy@yy.com' } catch (err) { currentBuild.result = "FAILURE" def specificCause = currentBuild.rawBuild.getCause(hudson.model.Cause$UserIdCause) mail body: "project build error is here: ${env.BUILD_URL}" , from: 'xxxx@yyyy.com', replyTo: 'yyyy@yyyy.com', subject: 'project build failed', to: 'zz@yy.com' throw err }}
  • 20. Master-agent architecture Master node has a list of all configured agents Master node starts required Agents and passes build steps from Jenkinsfile All “hard work” is done by Agents Http: 8080 Slave: 50000 Master Agent nodejs Agent java Agent golang Slave: 50000 Slave: 50000 Slave: 50000
  • 22. Jenkins usage across teams Nana Beta Pi ... Jenkins agent images Source code + Pipeline libraries
  • 23. What makes "Pipeline as a code" valuable for build/deployments in Newsweaver Organization folders - enable Jenkins to automatically detect and include any new repositories within them as resources. Jenkinsfile as part of source code - A Jenkinsfile is a container for your pipeline (or other) script, which details what specific steps are needed to perform a job for which you want to use Jenkins. Groovy is good - Jenkinsfiles are written as Groovy scripts which makes them easy to write and add complex logic Ability to record test results and artifacts Call agent for help - build tasks can be distributed and assigned to remote nodes. DRY - Pipeline can reuse build steps stored in SCM which can allow us to avoid code duplication in all branches Inputs - pipelines can be programed with pauses/human interaction Concurrent build actions - with a help of Parallel Test Executor we can split steps in parallel parts
  • 24. New & noteworthy features Blue Ocean - new UI tailored pipelines as a central theme to the Jenkins user experience Visual Pipeline Editor - helps to make things clearer for a range of users, to help with Workflow adoption
  • 26. Visual Pipeline Editor (https://www.cloudbees.com/blog/introducing-experimental-visual-pipeline-editor)