SlideShare a Scribd company logo
1 of 50
DEVOPS CERTIFICATION TRAINING www.edureka.co/devops
What Will I Learn Today?
Why Continuous
Delivery?
What is Continuous
Delivery?
Before Jenkins Pipeline
What is a Jenkins
pipeline?
Pipeline Concepts
Create your first
Jenkins Pipeline
Declarative Pipeline Demo
Scripted Pipeline Demo
DEVOPS CERTIFICATION TRAINING www.edureka.co/devops
FAILURE
Developers
Manual testing
(UT, IT)
Application directly
deployed to prod
Code repo
• Different environments (servers)
• Different libraries & packages (dependencies)
• End user load (traffic)
• App not accessible to intended audience
Why did it fail?
POSSIBLE REASONS
Why Do We Need Continuous Delivery (CD)?
DEVOPS CERTIFICATION TRAINING www.edureka.co/devops
CD Pipeline
BUILD
CI-Jenkins
(UT, IT)
TEST ENVIRONMENT
(Acceptance testing, Load
testing)
COMMIT
(Version control system (Git))
Production readyDevelopers
DEVOPS CERTIFICATION TRAINING www.edureka.co/devops
Advantages of Continuous Delivery
Automates software release
Increases developer
productivity
Locates and addresses bugs
quicker
DEVOPS CERTIFICATION TRAINING www.edureka.co/devops
What is CD?
• Continuous Delivery is a practise to continuously (any-time) release
software
• Code changes are continuously built, tested & pushed to a non-
production environment by using automation tools
• Software delivery cycles are more rapid and effective
DEVOPS CERTIFICATION TRAINING www.edureka.co/devops
uh
CASE STUDY:-
Continuous Delivery @ HP
DEVOPS CERTIFICATION TRAINING www.edureka.co/devops
HP Future Smart Case Study
HP’s LaserJet firmware division builds firmware that runs all their scanners and printers
• In 2008, they were facing problems, their product delivery cycle was slow
• It took them 6-12 months to build new features; making them slower than all their competitors
Problems
DEVOPS CERTIFICATION TRAINING www.edureka.co/devops
HP Future Smart Case Study
Single platform to support the whole workflow
Improved quality releases
Faster releases
Solution
DEVOPS CERTIFICATION TRAINING www.edureka.co/devops
HP Future Smart Case Study
How did they achieve this?
They implemented a CD pipeline
with two key features
• Practice CI
• Automation at every step
• Overall development cost reduced ~ 40%
• Programs under development increased ~ 140%
• Development cost per program went down ~ 78%
DEVOPS CERTIFICATION TRAINING www.edureka.co/devops
Before Jenkins Pipeline
DEVOPS CERTIFICATION TRAINING www.edureka.co/devops
Before Jenkins Pipeline
Over the years, there have been multiple Jenkins pipeline releases including, Jenkins Build flow, Jenkins Build Pipeline plugin,
Jenkins Workflow, etc.
What are the key features of these plugins?
These pipelines are a collection of Jenkins jobs which trigger each
other in a specified sequence
Represent multiple Jenkins jobs as one pipeline
What do these pipelines do?
DEVOPS CERTIFICATION TRAINING www.edureka.co/devops
Build Plugin Pipeline Example
• 3 jobs: Job1 → building, Job2 → testing the application and Job3 → deployment
• Chain these jobs together & run using Build Pipeline Plugin (better for small deployment)
DEVOPS CERTIFICATION TRAINING www.edureka.co/devops
Limitations Of The Build Pipeline Plugin
The maintenance cost is huge and increases with the number of processes
Complex pipelines are hard to implement
Tedious to build and manage such a vast number of jobs
DEVOPS CERTIFICATION TRAINING www.edureka.co/devops
Jenkins Pipeline
DEVOPS CERTIFICATION TRAINING www.edureka.co/devops
What Is A Jenkins Pipeline?
• Jenkins pipeline is a single platform that runs the entire pipeline as code
• All the standard jobs defined by Jenkins are manually written in one script and they can be stored in a VCS
• Instead of building several jobs for each phase, you can now code the entire workflow and put it in a Jenkinsfile
DEVOPS CERTIFICATION TRAINING www.edureka.co/devops
Key Features Of Jenkins Pipeline
Pipeline as
code
Restart
from saved
checkpoint
Run jobs in
parallel
Integrate
with other
plugins
Allows
conditional
loops (for,
when)
Code can
be checked
into a VCS
Incorporates
user input
DEVOPS CERTIFICATION TRAINING www.edureka.co/devops
What is a Jenkinsfile?
DEVOPS CERTIFICATION TRAINING www.edureka.co/devops
What Is A Jenkinsfile?
A text file that stores the pipeline as code
It can be checked into a SCM on your local
system
Enables the developers to access, edit and
check the code at all times
It is written using the Groovy DSL
Written based on two syntaxes
DEVOPS CERTIFICATION TRAINING www.edureka.co/devops
Two Ways Of Writing Jenkinsfile
DECLARATIVE PIPELINE
• Recent feature
• Simpler groovy syntax
• Code is written locally in a file and is
checked into a SCM
• The code is defined within a ‘pipeline’
block
SCRIPTED PIPELINE
• Traditional way of writing the code
• Stricter groovy syntax
• Code is written on the Jenkins UI
instance
• The code is defined within a ‘node’
block
DEVOPS CERTIFICATION TRAINING www.edureka.co/devops
Pipeline Concepts
DEVOPS CERTIFICATION TRAINING www.edureka.co/devops
Pipeline Concepts
Pipeline: A user defined block which contains all the stages. It is a key
part of declarative pipeline syntax.
Node: A node is a machine that executes an entire workflow. It is a key
part of the scripted pipeline syntax.
Note: Stages are explained in the following slides
DEVOPS CERTIFICATION TRAINING www.edureka.co/devops
Pipeline Concepts
Agent: instructs Jenkins to allocate an executor for the builds. It is defined for an entire pipeline or a specific stage.
It has the following parameters:
• Any: Runs pipeline/ stage on any available agent
• None: applied at the root of the pipeline, it indicates that there is no global agent for the entire pipeline & each stage must
specify its own agent
• Label: Executes the pipeline/stage on the labelled agent.
• Docker: Uses docker container as an execution environment for the pipeline or a specific stage.
DEVOPS CERTIFICATION TRAINING www.edureka.co/devops
Pipeline Concepts
Stages: It contains all the work, each stage
performs a specific task.
Steps: steps are carried out in sequence to execute a stage
DEVOPS CERTIFICATION TRAINING www.edureka.co/devops
Create Your First
Jenkins Pipeline
DEVOPS CERTIFICATION TRAINING www.edureka.co/devops
Create Your First Jenkins Pipeline
Step 1: Log into Jenkins and select New Item from the Dashboard
DEVOPS CERTIFICATION TRAINING www.edureka.co/devops
Create Your First Jenkins Pipeline
Step 2: Next, enter a name for your pipeline and select ‘Pipeline project’. Click ‘ok’ to proceed
DEVOPS CERTIFICATION TRAINING www.edureka.co/devops
Create Your First Jenkins Pipeline
Step 3: Scroll down to the pipeline and choose if you want a Declarative or Scripted pipeline.
DEVOPS CERTIFICATION TRAINING www.edureka.co/devops
Create Your First Jenkins Pipeline
Step 4a: If you want a Scripted pipeline, then choose ‘pipeline script’ and start typing your code
DEVOPS CERTIFICATION TRAINING www.edureka.co/devops
Create Your First Jenkins Pipeline
Step 4b: If you want a Declarative Pipeline, select ‘Pipeline script from SCM’ and choose your SCM. In my case I’m going to use Git
throughout this demo. Enter your repository URL
DEVOPS CERTIFICATION TRAINING www.edureka.co/devops
Create Your First Jenkins Pipeline
Step 5: Within the Script path is the name of the Jenkinsfile that is going to be accessed from your SCM (Git) to run. Finally click
on ‘apply’ and ‘save’. You have successfully created your first pipeline
DEVOPS CERTIFICATION TRAINING www.edureka.co/devops
Declarative
Pipeline demo
DEVOPS CERTIFICATION TRAINING www.edureka.co/devops
Declarative Pipeline Demo (Code)
Note: The code is explained in the following slides
DEVOPS CERTIFICATION TRAINING www.edureka.co/devops
Declarative Pipeline Demo (Code)
Note: The code is explained in the following slides
DEVOPS CERTIFICATION TRAINING www.edureka.co/devops
Declarative Pipeline Demo
runs a simple echo command
executes an input directive
runs ‘when’ directive with ‘not’ tag
runs a parallel directive
Stage
1
Stage
2
Stage
3
Stage
4
DEVOPS CERTIFICATION TRAINING www.edureka.co/devops
Declarative Pipeline Demo
The echo command specified in ‘steps’ block,
displays the message
Stage One
runs a simple echo command
Stage Two
executes an input directive
Stage Three
runs ‘when’ directive with ‘not’ tag
Stage Four
runs a parallel directive
DEVOPS CERTIFICATION TRAINING www.edureka.co/devops
Declarative Pipeline Demo
• Input directive allows to prompt a user input in
a stage
• On receiving the user input the pipeline either
proceeds with further execution or aborts
Stage One
runs a simple echo command
Stage Two
executes an input directive
Stage Three
runs ‘when’ directive with ‘not’ tag
Stage Four
runs a parallel directive
DEVOPS CERTIFICATION TRAINING www.edureka.co/devops
Declarative Pipeline Demo
• ‘when’ executes a step depending on the conditions
defined within loop
• If conditions are met, corresponding stage is executed
• In this demo we’re using a ‘not’ tag
• This tag executes a stage when the nested condition
is false
Stage One
runs a simple echo command
Stage Two
executes an input directive
Stage Three
runs ‘when’ directive with ‘not’ tag
Stage Four
runs a parallel directive
DEVOPS CERTIFICATION TRAINING www.edureka.co/devops
Declarative Pipeline Demo
• Runs ‘Unit test’ and ‘Integration test’ stages in
parallel
• ‘Unit Test’ runs an echo command
• In ‘Integration test’ stage, a docker agent pulls an
‘ubuntu’ image & runs the reuseNode which is a
Boolean (returns false by default)
• If true, the docker container will run on the agent
specified at the top-level of the pipeline
Stage One
runs a simple echo command
Stage Two
executes an input directive
Stage Three
runs ‘when’ directive with ‘not’ tag
Stage Four
runs a parallel directive
DEVOPS CERTIFICATION TRAINING www.edureka.co/devops
Declarative Pipeline Demo
Now that I’ve explained the code, lets run the pipeline. The following screenshot is the result of the pipeline.
In the below image, the pipeline waits for the user input and on clicking ‘proceed’ the execution resumes.
DEVOPS CERTIFICATION TRAINING www.edureka.co/devops
Declarative Pipeline Demo
Final output of the Declarative pipeline demo
DEVOPS CERTIFICATION TRAINING www.edureka.co/devops
Scripted Pipeline
Demo
DEVOPS CERTIFICATION TRAINING www.edureka.co/devops
Scripted Pipeline Demo (Code)
To give you a basic understanding of the scripted pipeline, lets execute a simple code.
I will run the following script
DEVOPS CERTIFICATION TRAINING www.edureka.co/devops
Scripted Pipeline Demo (Code)
• The node block runs the conditional ‘for’ loop for creating 2 stages: Stage #0 & Stage #1
• These stages print ‘hello world!’ message
• ‘if’ loop is used to execute 2 commands when ‘i’ = 0:
‘git’ command to clone the git directory & ‘echo‘ to display a message
• ‘else’ is executed when ‘i’ != 0:
‘build’ executes the job (‘Declarative pipeline’) and then runs the echo command
DEVOPS CERTIFICATION TRAINING www.edureka.co/devops
Scripted Pipeline Demo
Now that I’ve explained the code, lets run the pipeline.
The following screenshot is the result of Stage #0.
DEVOPS CERTIFICATION TRAINING www.edureka.co/devops
Scripted Pipeline Demo
Shows the logs of Stage #1 and starts building the ‘Declarative pipeline’
DEVOPS CERTIFICATION TRAINING www.edureka.co/devops
Scripted Pipeline Demo
Execution of the ‘Declarative pipeline’
DEVOPS CERTIFICATION TRAINING www.edureka.co/devops
Scripted Pipeline Demo
Results show the completion of ‘Declarative pipeline’ and Stage #1
DEVOPS CERTIFICATION TRAINING www.edureka.co/devops
Summary
Pipeline ConceptsWhat is a Jenkinsfile?
Why Continuous Delivery? HP Future Smart Case Study
What is a Jenkins Pipeline?
What Continuous Delivery?
DEVOPS CERTIFICATION TRAINING www.edureka.co/devops
WebDriver vs. IDE vs. RC
➢ Data Warehouse is like a relational database designed for analytical needs.
➢ It functions on the basis of OLAP (Online Analytical Processing).
➢ It is a central location where consolidated data from multiple locations (databases) are stored.

More Related Content

What's hot

Continuous integration
Continuous integrationContinuous integration
Continuous integration
amscanne
 
Yale Jenkins Show and Tell
Yale Jenkins Show and TellYale Jenkins Show and Tell
Yale Jenkins Show and Tell
E. Camden Fisher
 

What's hot (20)

Jenkins
JenkinsJenkins
Jenkins
 
Jenkins Pipelines
Jenkins PipelinesJenkins Pipelines
Jenkins Pipelines
 
Jenkins presentation
Jenkins presentationJenkins presentation
Jenkins presentation
 
Jenkins CI
Jenkins CIJenkins CI
Jenkins CI
 
CI/CD
CI/CDCI/CD
CI/CD
 
Continuous Delivery with Jenkins
Continuous Delivery with JenkinsContinuous Delivery with Jenkins
Continuous Delivery with Jenkins
 
Introduction to CI/CD
Introduction to CI/CDIntroduction to CI/CD
Introduction to CI/CD
 
Jenkins tutorial
Jenkins tutorialJenkins tutorial
Jenkins tutorial
 
Jenkins
JenkinsJenkins
Jenkins
 
Introduction to CI/CD
Introduction to CI/CDIntroduction to CI/CD
Introduction to CI/CD
 
Jenkins Overview
Jenkins OverviewJenkins Overview
Jenkins Overview
 
Continuous integration
Continuous integrationContinuous integration
Continuous integration
 
"DevOps > CI+CD "
"DevOps > CI+CD ""DevOps > CI+CD "
"DevOps > CI+CD "
 
Yale Jenkins Show and Tell
Yale Jenkins Show and TellYale Jenkins Show and Tell
Yale Jenkins Show and Tell
 
DevOps: Age Of CI/CD
DevOps: Age Of CI/CDDevOps: Age Of CI/CD
DevOps: Age Of CI/CD
 
CI/CD Best Practices for Your DevOps Journey
CI/CD Best  Practices for Your DevOps JourneyCI/CD Best  Practices for Your DevOps Journey
CI/CD Best Practices for Your DevOps Journey
 
Fundamentals of DevOps and CI/CD
Fundamentals of DevOps and CI/CDFundamentals of DevOps and CI/CD
Fundamentals of DevOps and CI/CD
 
Continuous integration using Jenkins and Sonar
Continuous integration using Jenkins and SonarContinuous integration using Jenkins and Sonar
Continuous integration using Jenkins and Sonar
 
Continuous Delivery, Continuous Integration
Continuous Delivery, Continuous Integration Continuous Delivery, Continuous Integration
Continuous Delivery, Continuous Integration
 
Devops | CICD Pipeline
Devops | CICD PipelineDevops | CICD Pipeline
Devops | CICD Pipeline
 

Similar to Jenkins Pipeline Tutorial | Continuous Delivery Pipeline Using Jenkins | DevOps Training | Edureka

Continous Integration.pptx
Continous Integration.pptxContinous Integration.pptx
Continous Integration.pptx
Anuj Sharma
 

Similar to Jenkins Pipeline Tutorial | Continuous Delivery Pipeline Using Jenkins | DevOps Training | Edureka (20)

Introduction to DevOps Tools | DevOps Training | DevOps Tutorial for Beginner...
Introduction to DevOps Tools | DevOps Training | DevOps Tutorial for Beginner...Introduction to DevOps Tools | DevOps Training | DevOps Tutorial for Beginner...
Introduction to DevOps Tools | DevOps Training | DevOps Tutorial for Beginner...
 
Jenkins pipeline as code
Jenkins pipeline as codeJenkins pipeline as code
Jenkins pipeline as code
 
Continuous Delivery Agiles 2014 Medellin
Continuous Delivery Agiles 2014 MedellinContinuous Delivery Agiles 2014 Medellin
Continuous Delivery Agiles 2014 Medellin
 
Continous Integration.pptx
Continous Integration.pptxContinous Integration.pptx
Continous Integration.pptx
 
Devops CI-CD pipeline with Containers
Devops CI-CD pipeline with ContainersDevops CI-CD pipeline with Containers
Devops CI-CD pipeline with Containers
 
PuppetConf 2016: Continuous Delivery and DevOps with Jenkins and Puppet Enter...
PuppetConf 2016: Continuous Delivery and DevOps with Jenkins and Puppet Enter...PuppetConf 2016: Continuous Delivery and DevOps with Jenkins and Puppet Enter...
PuppetConf 2016: Continuous Delivery and DevOps with Jenkins and Puppet Enter...
 
DevOps-Ebook
DevOps-EbookDevOps-Ebook
DevOps-Ebook
 
CICD_BestPractices.pdf
CICD_BestPractices.pdfCICD_BestPractices.pdf
CICD_BestPractices.pdf
 
Edureka-DevOps-Ebook.pdf
Edureka-DevOps-Ebook.pdfEdureka-DevOps-Ebook.pdf
Edureka-DevOps-Ebook.pdf
 
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
 
Efficient Parallel Testing with Docker by Laura Frank
Efficient Parallel Testing with Docker by Laura FrankEfficient Parallel Testing with Docker by Laura Frank
Efficient Parallel Testing with Docker by Laura Frank
 
Pipeline+over view
Pipeline+over viewPipeline+over view
Pipeline+over view
 
Efficient Parallel Testing with Docker
Efficient Parallel Testing with DockerEfficient Parallel Testing with Docker
Efficient Parallel Testing with Docker
 
Jenkins days workshop pipelines - Eric Long
Jenkins days workshop  pipelines - Eric LongJenkins days workshop  pipelines - Eric Long
Jenkins days workshop pipelines - Eric Long
 
TYPO3 Camp Stuttgart 2015 - Continuous Delivery with Open Source Tools
TYPO3 Camp Stuttgart 2015 - Continuous Delivery with Open Source ToolsTYPO3 Camp Stuttgart 2015 - Continuous Delivery with Open Source Tools
TYPO3 Camp Stuttgart 2015 - Continuous Delivery with Open Source Tools
 
Jenkins advance topic
Jenkins advance topicJenkins advance topic
Jenkins advance topic
 
Dev/Test scenarios in DevOps world
Dev/Test scenarios in DevOps worldDev/Test scenarios in DevOps world
Dev/Test scenarios in DevOps world
 
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 Declarative Pipelines 101
Jenkins Declarative Pipelines 101Jenkins Declarative Pipelines 101
Jenkins Declarative Pipelines 101
 
Continuous Delivery with Jenkins declarative pipeline XPDays-2018-12-08
Continuous Delivery with Jenkins declarative pipeline XPDays-2018-12-08Continuous Delivery with Jenkins declarative pipeline XPDays-2018-12-08
Continuous Delivery with Jenkins declarative pipeline XPDays-2018-12-08
 

More from Edureka!

More from Edureka! (20)

What to learn during the 21 days Lockdown | Edureka
What to learn during the 21 days Lockdown | EdurekaWhat to learn during the 21 days Lockdown | Edureka
What to learn during the 21 days Lockdown | Edureka
 
Top 10 Dying Programming Languages in 2020 | Edureka
Top 10 Dying Programming Languages in 2020 | EdurekaTop 10 Dying Programming Languages in 2020 | Edureka
Top 10 Dying Programming Languages in 2020 | Edureka
 
Top 5 Trending Business Intelligence Tools | Edureka
Top 5 Trending Business Intelligence Tools | EdurekaTop 5 Trending Business Intelligence Tools | Edureka
Top 5 Trending Business Intelligence Tools | Edureka
 
Tableau Tutorial for Data Science | Edureka
Tableau Tutorial for Data Science | EdurekaTableau Tutorial for Data Science | Edureka
Tableau Tutorial for Data Science | Edureka
 
Python Programming Tutorial | Edureka
Python Programming Tutorial | EdurekaPython Programming Tutorial | Edureka
Python Programming Tutorial | Edureka
 
Top 5 PMP Certifications | Edureka
Top 5 PMP Certifications | EdurekaTop 5 PMP Certifications | Edureka
Top 5 PMP Certifications | Edureka
 
Top Maven Interview Questions in 2020 | Edureka
Top Maven Interview Questions in 2020 | EdurekaTop Maven Interview Questions in 2020 | Edureka
Top Maven Interview Questions in 2020 | Edureka
 
Linux Mint Tutorial | Edureka
Linux Mint Tutorial | EdurekaLinux Mint Tutorial | Edureka
Linux Mint Tutorial | Edureka
 
How to Deploy Java Web App in AWS| Edureka
How to Deploy Java Web App in AWS| EdurekaHow to Deploy Java Web App in AWS| Edureka
How to Deploy Java Web App in AWS| Edureka
 
Importance of Digital Marketing | Edureka
Importance of Digital Marketing | EdurekaImportance of Digital Marketing | Edureka
Importance of Digital Marketing | Edureka
 
RPA in 2020 | Edureka
RPA in 2020 | EdurekaRPA in 2020 | Edureka
RPA in 2020 | Edureka
 
Email Notifications in Jenkins | Edureka
Email Notifications in Jenkins | EdurekaEmail Notifications in Jenkins | Edureka
Email Notifications in Jenkins | Edureka
 
EA Algorithm in Machine Learning | Edureka
EA Algorithm in Machine Learning | EdurekaEA Algorithm in Machine Learning | Edureka
EA Algorithm in Machine Learning | Edureka
 
Cognitive AI Tutorial | Edureka
Cognitive AI Tutorial | EdurekaCognitive AI Tutorial | Edureka
Cognitive AI Tutorial | Edureka
 
AWS Cloud Practitioner Tutorial | Edureka
AWS Cloud Practitioner Tutorial | EdurekaAWS Cloud Practitioner Tutorial | Edureka
AWS Cloud Practitioner Tutorial | Edureka
 
Blue Prism Top Interview Questions | Edureka
Blue Prism Top Interview Questions | EdurekaBlue Prism Top Interview Questions | Edureka
Blue Prism Top Interview Questions | Edureka
 
Big Data on AWS Tutorial | Edureka
Big Data on AWS Tutorial | Edureka Big Data on AWS Tutorial | Edureka
Big Data on AWS Tutorial | Edureka
 
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
A star algorithm | A* Algorithm in Artificial Intelligence | EdurekaA star algorithm | A* Algorithm in Artificial Intelligence | Edureka
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
 
Kubernetes Installation on Ubuntu | Edureka
Kubernetes Installation on Ubuntu | EdurekaKubernetes Installation on Ubuntu | Edureka
Kubernetes Installation on Ubuntu | Edureka
 
Introduction to DevOps | Edureka
Introduction to DevOps | EdurekaIntroduction to DevOps | Edureka
Introduction to DevOps | Edureka
 

Recently uploaded

Recently uploaded (20)

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
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
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 

Jenkins Pipeline Tutorial | Continuous Delivery Pipeline Using Jenkins | DevOps Training | Edureka

  • 1.
  • 2. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops What Will I Learn Today? Why Continuous Delivery? What is Continuous Delivery? Before Jenkins Pipeline What is a Jenkins pipeline? Pipeline Concepts Create your first Jenkins Pipeline Declarative Pipeline Demo Scripted Pipeline Demo
  • 3. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops FAILURE Developers Manual testing (UT, IT) Application directly deployed to prod Code repo • Different environments (servers) • Different libraries & packages (dependencies) • End user load (traffic) • App not accessible to intended audience Why did it fail? POSSIBLE REASONS Why Do We Need Continuous Delivery (CD)?
  • 4. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops CD Pipeline BUILD CI-Jenkins (UT, IT) TEST ENVIRONMENT (Acceptance testing, Load testing) COMMIT (Version control system (Git)) Production readyDevelopers
  • 5. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops Advantages of Continuous Delivery Automates software release Increases developer productivity Locates and addresses bugs quicker
  • 6. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops What is CD? • Continuous Delivery is a practise to continuously (any-time) release software • Code changes are continuously built, tested & pushed to a non- production environment by using automation tools • Software delivery cycles are more rapid and effective
  • 7. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops uh CASE STUDY:- Continuous Delivery @ HP
  • 8. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops HP Future Smart Case Study HP’s LaserJet firmware division builds firmware that runs all their scanners and printers • In 2008, they were facing problems, their product delivery cycle was slow • It took them 6-12 months to build new features; making them slower than all their competitors Problems
  • 9. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops HP Future Smart Case Study Single platform to support the whole workflow Improved quality releases Faster releases Solution
  • 10. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops HP Future Smart Case Study How did they achieve this? They implemented a CD pipeline with two key features • Practice CI • Automation at every step • Overall development cost reduced ~ 40% • Programs under development increased ~ 140% • Development cost per program went down ~ 78%
  • 11. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops Before Jenkins Pipeline
  • 12. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops Before Jenkins Pipeline Over the years, there have been multiple Jenkins pipeline releases including, Jenkins Build flow, Jenkins Build Pipeline plugin, Jenkins Workflow, etc. What are the key features of these plugins? These pipelines are a collection of Jenkins jobs which trigger each other in a specified sequence Represent multiple Jenkins jobs as one pipeline What do these pipelines do?
  • 13. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops Build Plugin Pipeline Example • 3 jobs: Job1 → building, Job2 → testing the application and Job3 → deployment • Chain these jobs together & run using Build Pipeline Plugin (better for small deployment)
  • 14. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops Limitations Of The Build Pipeline Plugin The maintenance cost is huge and increases with the number of processes Complex pipelines are hard to implement Tedious to build and manage such a vast number of jobs
  • 15. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops Jenkins Pipeline
  • 16. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops What Is A Jenkins Pipeline? • Jenkins pipeline is a single platform that runs the entire pipeline as code • All the standard jobs defined by Jenkins are manually written in one script and they can be stored in a VCS • Instead of building several jobs for each phase, you can now code the entire workflow and put it in a Jenkinsfile
  • 17. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops Key Features Of Jenkins Pipeline Pipeline as code Restart from saved checkpoint Run jobs in parallel Integrate with other plugins Allows conditional loops (for, when) Code can be checked into a VCS Incorporates user input
  • 18. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops What is a Jenkinsfile?
  • 19. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops What Is A Jenkinsfile? A text file that stores the pipeline as code It can be checked into a SCM on your local system Enables the developers to access, edit and check the code at all times It is written using the Groovy DSL Written based on two syntaxes
  • 20. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops Two Ways Of Writing Jenkinsfile DECLARATIVE PIPELINE • Recent feature • Simpler groovy syntax • Code is written locally in a file and is checked into a SCM • The code is defined within a ‘pipeline’ block SCRIPTED PIPELINE • Traditional way of writing the code • Stricter groovy syntax • Code is written on the Jenkins UI instance • The code is defined within a ‘node’ block
  • 21. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops Pipeline Concepts
  • 22. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops Pipeline Concepts Pipeline: A user defined block which contains all the stages. It is a key part of declarative pipeline syntax. Node: A node is a machine that executes an entire workflow. It is a key part of the scripted pipeline syntax. Note: Stages are explained in the following slides
  • 23. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops Pipeline Concepts Agent: instructs Jenkins to allocate an executor for the builds. It is defined for an entire pipeline or a specific stage. It has the following parameters: • Any: Runs pipeline/ stage on any available agent • None: applied at the root of the pipeline, it indicates that there is no global agent for the entire pipeline & each stage must specify its own agent • Label: Executes the pipeline/stage on the labelled agent. • Docker: Uses docker container as an execution environment for the pipeline or a specific stage.
  • 24. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops Pipeline Concepts Stages: It contains all the work, each stage performs a specific task. Steps: steps are carried out in sequence to execute a stage
  • 25. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops Create Your First Jenkins Pipeline
  • 26. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops Create Your First Jenkins Pipeline Step 1: Log into Jenkins and select New Item from the Dashboard
  • 27. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops Create Your First Jenkins Pipeline Step 2: Next, enter a name for your pipeline and select ‘Pipeline project’. Click ‘ok’ to proceed
  • 28. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops Create Your First Jenkins Pipeline Step 3: Scroll down to the pipeline and choose if you want a Declarative or Scripted pipeline.
  • 29. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops Create Your First Jenkins Pipeline Step 4a: If you want a Scripted pipeline, then choose ‘pipeline script’ and start typing your code
  • 30. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops Create Your First Jenkins Pipeline Step 4b: If you want a Declarative Pipeline, select ‘Pipeline script from SCM’ and choose your SCM. In my case I’m going to use Git throughout this demo. Enter your repository URL
  • 31. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops Create Your First Jenkins Pipeline Step 5: Within the Script path is the name of the Jenkinsfile that is going to be accessed from your SCM (Git) to run. Finally click on ‘apply’ and ‘save’. You have successfully created your first pipeline
  • 32. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops Declarative Pipeline demo
  • 33. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops Declarative Pipeline Demo (Code) Note: The code is explained in the following slides
  • 34. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops Declarative Pipeline Demo (Code) Note: The code is explained in the following slides
  • 35. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops Declarative Pipeline Demo runs a simple echo command executes an input directive runs ‘when’ directive with ‘not’ tag runs a parallel directive Stage 1 Stage 2 Stage 3 Stage 4
  • 36. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops Declarative Pipeline Demo The echo command specified in ‘steps’ block, displays the message Stage One runs a simple echo command Stage Two executes an input directive Stage Three runs ‘when’ directive with ‘not’ tag Stage Four runs a parallel directive
  • 37. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops Declarative Pipeline Demo • Input directive allows to prompt a user input in a stage • On receiving the user input the pipeline either proceeds with further execution or aborts Stage One runs a simple echo command Stage Two executes an input directive Stage Three runs ‘when’ directive with ‘not’ tag Stage Four runs a parallel directive
  • 38. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops Declarative Pipeline Demo • ‘when’ executes a step depending on the conditions defined within loop • If conditions are met, corresponding stage is executed • In this demo we’re using a ‘not’ tag • This tag executes a stage when the nested condition is false Stage One runs a simple echo command Stage Two executes an input directive Stage Three runs ‘when’ directive with ‘not’ tag Stage Four runs a parallel directive
  • 39. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops Declarative Pipeline Demo • Runs ‘Unit test’ and ‘Integration test’ stages in parallel • ‘Unit Test’ runs an echo command • In ‘Integration test’ stage, a docker agent pulls an ‘ubuntu’ image & runs the reuseNode which is a Boolean (returns false by default) • If true, the docker container will run on the agent specified at the top-level of the pipeline Stage One runs a simple echo command Stage Two executes an input directive Stage Three runs ‘when’ directive with ‘not’ tag Stage Four runs a parallel directive
  • 40. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops Declarative Pipeline Demo Now that I’ve explained the code, lets run the pipeline. The following screenshot is the result of the pipeline. In the below image, the pipeline waits for the user input and on clicking ‘proceed’ the execution resumes.
  • 41. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops Declarative Pipeline Demo Final output of the Declarative pipeline demo
  • 42. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops Scripted Pipeline Demo
  • 43. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops Scripted Pipeline Demo (Code) To give you a basic understanding of the scripted pipeline, lets execute a simple code. I will run the following script
  • 44. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops Scripted Pipeline Demo (Code) • The node block runs the conditional ‘for’ loop for creating 2 stages: Stage #0 & Stage #1 • These stages print ‘hello world!’ message • ‘if’ loop is used to execute 2 commands when ‘i’ = 0: ‘git’ command to clone the git directory & ‘echo‘ to display a message • ‘else’ is executed when ‘i’ != 0: ‘build’ executes the job (‘Declarative pipeline’) and then runs the echo command
  • 45. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops Scripted Pipeline Demo Now that I’ve explained the code, lets run the pipeline. The following screenshot is the result of Stage #0.
  • 46. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops Scripted Pipeline Demo Shows the logs of Stage #1 and starts building the ‘Declarative pipeline’
  • 47. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops Scripted Pipeline Demo Execution of the ‘Declarative pipeline’
  • 48. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops Scripted Pipeline Demo Results show the completion of ‘Declarative pipeline’ and Stage #1
  • 49. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops Summary Pipeline ConceptsWhat is a Jenkinsfile? Why Continuous Delivery? HP Future Smart Case Study What is a Jenkins Pipeline? What Continuous Delivery?
  • 50. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops WebDriver vs. IDE vs. RC ➢ Data Warehouse is like a relational database designed for analytical needs. ➢ It functions on the basis of OLAP (Online Analytical Processing). ➢ It is a central location where consolidated data from multiple locations (databases) are stored.