pipeline in jenkins

Views:
 
Category: Education
     
 

Presentation Description

https://linuxdady.com/pipeline-in-jenkins/Pipeline in jenkins is nothing it’s just an alternative of jenkins dashboard means that task we are performing by click on jenkins dashboard. We can do all that task and some additional task with the help of jenkins pipeline by writing scripts in jenkins file.

Comments

Presentation Transcript

slide 1:

LinuxDady.Com Pipeline in jenkins for beginners For more information visit https://linuxdady.com

slide 2:

Pipeline in jenkins and it’s use case in our infra Pipeline in jenkins is nothing it’s just an alternative of jenkins dashboard means that task we are performing by click on jenkins dashboard. We can do all that task and some additional task with the help of jenkins pipeline by writing scripts in jenkins file. Let’s try to understand in standard way. What is pipeline in jenkins Jenkins pipeline is a continuous delivery pipeline that executes the software workflow as code. I think still we have doubt let’s try to move deeper. In jenkins there are simply two way to build a project ▪ Jenkins dashboard ▪ Jenkins file The limitation of jenkins dashboard is we can use only those option that is given on jenkins dashboard. We cannot do any customization according to our requirement. Jenkins file:- Jenkins file means to write project build step in scripting style. We can put condition according to our requirement like in first stage our code become test then condition become pass and trigger a mail etc. Such kind of things we cannot do with the help of jenkins dashboard. But we can achieve with the help of jenkins file. Finally pipeline in jenkins is a project creation method with file way. Simply define your step or stage of project in a file and execute that file. Why we should use pipeline in jenkins There are lot of reason we should use Jenkins file instead of Jenkins dashboard. Let’s discuss one by one. ▪ We can create multiple automation jobs with the help of jenkins file according to our use cases and run them as a Jenkins pipeline. ▪ Jenkins pipeline is implemented as a code which allows multiple users to edit and execute the pipeline process.

slide 3:

▪ You can pause the pipeline process and make it wait to resume until there is an input from the user. ▪ Jenkins Pipelines support big projects. You can run multiple pipeline jobs in a loop. ▪ It is durable in terms of unplanned restart of the Jenkins master. ▪ It can restart from saved checkpoints. ▪ It supports complex pipelines by incorporating conditional loops fork or join operations and allowing tasks to be performed in parallel. Click Read:– How to install and setup jenkins server There are two way to write jenkins file Mainly there are two way to write jenkins file that is declarative and scripting method. Declarative method is easy as compare to scripting method. So in this tutorial we are going to learn declarative method. a Declarative method b Scripting method Simple demo of pipeline in jenkins by declarative method Go to you Jenkins dashboard and click on – New Item. It will redirect you on below page fills your project details here and select Pipeline option instead of Maven or anything else.

slide 4:

After filling your project details click on OK button and it will redirect you on – configure now select here – Click Pipeline option – Select Pipeline script option and write your declarative scripts here. For testing purpose I have given a demo of declarative scripting style below. But for professional project script you can use jenkins Pipeline syntax or can take format from google that will be written groovy language. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 node def mvnHome stagePreparation GIT git https://github.com/devopsguide/addressbook.git mvnHome tool Maveen_installed stageBuild withEnv"MVN_HOMEmvnHome" if isUnix sh "MVN_HOME/bin/mvn" -Dmaven.test.failure.ignore clean package else bat/"MVN_HOME\bin\mvn" -Dmaven.test.failure.ignore clean package/ Overview of Jenkins file Node :– Node is our base machine where we have installed our jenkins server that have capability to execute jenkins file. Stage :- In jenkins file we will define different stage for different task. Like in above example we have define two stage one for git checkout and second for

slide 5:

build. So similarly we can define N number of stages as our project requirement. As well depend on machine configuration. Environment variable :– I think you already know the use case of environment variable that is used to make script easy and shorter. In above example instead of calling maven directly we have defined a variable that is mvnHome There are large number of parameters that is use in jenkins file. Go throw all variable once from google. Click on save button and start build process then it will prompt a build process like below. It is showing only two stage because in declarative script I have configure only two stage. You can configure according to your requirement. Click Read:– How to configure first jenkins jobs step by step Click Read:– How to integrate jenkins with sonarqube in production infra Conclusion Pipeline in Jenkins has very important roles in Jenkins because we can automatic our lots of task form jenkins file that is not possible form Jenkins dashboard. So here we have explained basic concept of pipeline in Jenkins. Still

slide 6:

if anyone have any query write me in comment box. I will try my best to resolve them. Interview question of Jenkins file ▪ What is jenkins file This is interviewer favourite question. Try to answer in comment box. ▪ Deference between jenkins file and Jenkins pipelining ▪ What is use case of Jenkins pipeline ▪ Name of plugins that is use for Pipelining. ▪ What is Declarative Pipeline in Jenkins ▪ Type of Pipelining in jenkins Ans. There mainly to way to setup jenkins pipelining 1. Declarative pipeline 2. Scripting

authorStream Live Help