O slideshow foi denunciado.
Seu SlideShare está sendo baixado. ×

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

Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
DEVOPS CERTIFICATION TRAINING www.edureka.co/devops
What Will I Learn Today?
Why Continuous
Delivery?
What is Continuous
D...

Vídeos do YouTube não são mais aceitos pelo SlideShare

Visualizar original no YouTube

DEVOPS CERTIFICATION TRAINING www.edureka.co/devops
FAILURE
Developers
Manual testing
(UT, IT)
Application directly
deploy...
Próximos SlideShares
Jenkins
Jenkins
Carregando em…3
×

Confira estes a seguir

1 de 51 Anúncio

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

** DevOps Training: https://www.edureka.co/devops **
This Edureka tutorial on "Jenkins pipeline Tutorial" will help you understand the basic concepts of a Jenkins pipeline. Below are the topics covered in the tutorial:

1. The need for Continuous Delivery
2. What is Continuous Delivery?
3. Features before the Jenkins Pipeline
4. What is a Jenkins Pipeline?
5. What is a Jenkinsfile?
6. Pipeline Concepts
7. Hands-On

Check our complete DevOps playlist here (includes all the videos mentioned in the video): http://goo.gl/O2vo13

** DevOps Training: https://www.edureka.co/devops **
This Edureka tutorial on "Jenkins pipeline Tutorial" will help you understand the basic concepts of a Jenkins pipeline. Below are the topics covered in the tutorial:

1. The need for Continuous Delivery
2. What is Continuous Delivery?
3. Features before the Jenkins Pipeline
4. What is a Jenkins Pipeline?
5. What is a Jenkinsfile?
6. Pipeline Concepts
7. Hands-On

Check our complete DevOps playlist here (includes all the videos mentioned in the video): http://goo.gl/O2vo13

Anúncio
Anúncio

Mais Conteúdo rRelacionado

Diapositivos para si (20)

Semelhante a Jenkins Pipeline Tutorial | Continuous Delivery Pipeline Using Jenkins | DevOps Training | Edureka (20)

Anúncio

Mais de Edureka! (20)

Mais recentes (20)

Anúncio

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

  1. 1. 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
  2. 2. 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)?
  3. 3. 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
  4. 4. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops Advantages of Continuous Delivery Automates software release Increases developer productivity Locates and addresses bugs quicker
  5. 5. 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
  6. 6. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops uh CASE STUDY:- Continuous Delivery @ HP
  7. 7. 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
  8. 8. 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
  9. 9. 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%
  10. 10. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops Before Jenkins Pipeline
  11. 11. 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?
  12. 12. 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)
  13. 13. 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
  14. 14. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops Jenkins Pipeline
  15. 15. 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
  16. 16. 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
  17. 17. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops What is a Jenkinsfile?
  18. 18. 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
  19. 19. 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
  20. 20. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops Pipeline Concepts
  21. 21. 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
  22. 22. 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.
  23. 23. 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
  24. 24. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops Create Your First Jenkins Pipeline
  25. 25. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops Create Your First Jenkins Pipeline Step 1: Log into Jenkins and select New Item from the Dashboard
  26. 26. 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
  27. 27. 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.
  28. 28. 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
  29. 29. 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
  30. 30. 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
  31. 31. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops Declarative Pipeline demo
  32. 32. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops Declarative Pipeline Demo (Code) Note: The code is explained in the following slides
  33. 33. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops Declarative Pipeline Demo (Code) Note: The code is explained in the following slides
  34. 34. 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
  35. 35. 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
  36. 36. 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
  37. 37. 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
  38. 38. 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
  39. 39. 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.
  40. 40. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops Declarative Pipeline Demo Final output of the Declarative pipeline demo
  41. 41. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops Scripted Pipeline Demo
  42. 42. 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
  43. 43. 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
  44. 44. 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.
  45. 45. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops Scripted Pipeline Demo Shows the logs of Stage #1 and starts building the ‘Declarative pipeline’
  46. 46. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops Scripted Pipeline Demo Execution of the ‘Declarative pipeline’
  47. 47. DEVOPS CERTIFICATION TRAINING www.edureka.co/devops Scripted Pipeline Demo Results show the completion of ‘Declarative pipeline’ and Stage #1
  48. 48. 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?
  49. 49. 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.

×