Introduction to Jenkins Pipeline?

Jenkins Pipeline is a collection of plugins that aid in the implementation and integration of continuous delivery pipelines into Jenkins.Pipeline offers an extendable collection of tools for modelling basic to complex delivery pipelines “as code” using…


This content originally appeared on DEV Community and was authored by Rohith ND

Jenkins Pipeline is a collection of plugins that aid in the implementation and integration of continuous delivery pipelines into Jenkins.Pipeline offers an extendable collection of tools for modelling basic to complex delivery pipelines "as code" using the Pipeline Domain Specific Language (DSL).

A pipeline's purpose is to allow builds to flow through it constantly, similar to how water flows through a plumbing system; fluid and always available. The goal is to deploy and/or release the modifications contained in the builds into production.

A continuous delivery pipeline is an automated representation of your software delivery process, from version control to your users and clients. Every update to your program (committed in source control) through a rigorous procedure before it is released. This process involves constructing the software in a dependable and repeatable manner, as well as advancing the developed software (referred to as a "build") through various phases of testing and deployment.

The specification of a Jenkins Pipeline is often written into a text file (known as a Jenkinsfile), which is then checked into a project's source control repository. Creating a Jenkinsfile has a lot of obvious advantages:

  • Create Pipelines automatically for all Branches and Pull Requests
  • Code review/iteration on the Pipeline
  • Audit trail for the Pipeline
  • Single source of truth for the Pipeline that can be seen and changed by different project members
// Declarative //
pipeline {
    agent any 
    stages {
        stage('Build') { 
            steps { 
                sh 'make' 
            }
    }
    stage('Test'){
        steps {
            sh 'make check'
            junit 'reports/**/*.xml' 
        }
    }
    stage('Deploy') {
        steps {
            sh 'make publish'
        }
    }
}
}

① Jenkins should allocate an executor and workspace for this segment of the Pipeline, as indicated by the agent.
② This Pipeline's stage is described by stage.
③ steps summarises the steps that will be performed at this stage
④ sh executes the given shell command
⑤ The plugin provides junit as a Pipeline step: junit is a JUnit plugin for collecting test results.

//sample
node {
    stage('Build') {
        sh 'make'
    }
    stage('Test') {
        sh 'make check'
        junit 'reports/**/*.xml'
    }
    stage('Deploy') {
        sh 'make publish'
    }
}

Reference : Jenkins User Handbook , Mastering Jenkins


This content originally appeared on DEV Community and was authored by Rohith ND


Print Share Comment Cite Upload Translate Updates
APA

Rohith ND | Sciencx (2022-04-02T15:31:57+00:00) Introduction to Jenkins Pipeline?. Retrieved from https://www.scien.cx/2022/04/02/introduction-to-jenkins-pipeline/

MLA
" » Introduction to Jenkins Pipeline?." Rohith ND | Sciencx - Saturday April 2, 2022, https://www.scien.cx/2022/04/02/introduction-to-jenkins-pipeline/
HARVARD
Rohith ND | Sciencx Saturday April 2, 2022 » Introduction to Jenkins Pipeline?., viewed ,<https://www.scien.cx/2022/04/02/introduction-to-jenkins-pipeline/>
VANCOUVER
Rohith ND | Sciencx - » Introduction to Jenkins Pipeline?. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/04/02/introduction-to-jenkins-pipeline/
CHICAGO
" » Introduction to Jenkins Pipeline?." Rohith ND | Sciencx - Accessed . https://www.scien.cx/2022/04/02/introduction-to-jenkins-pipeline/
IEEE
" » Introduction to Jenkins Pipeline?." Rohith ND | Sciencx [Online]. Available: https://www.scien.cx/2022/04/02/introduction-to-jenkins-pipeline/. [Accessed: ]
rf:citation
» Introduction to Jenkins Pipeline? | Rohith ND | Sciencx | https://www.scien.cx/2022/04/02/introduction-to-jenkins-pipeline/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.