Jenkins Declarative Pipeline

Jenkins Declarative Pipeline

✔️What is Pipeline

A pipeline in DevOps refers to a series of automated processes that integrate code changes, build applications, and deploy them to production. It ensures efficient and consistent software delivery, reducing manual interventions and improving development speed and quality.

✔️Why you should have a Pipeline?

  • Automation: Pipeline automates the software delivery process, reducing errors and ensuring consistency.

  • Faster Time-to-Market: It speeds up development, allowing quicker releases of features and bug fixes.

  • Quality Assurance: Comprehensive testing ensures high-quality, reliable software.

  • Collaboration: Teams work together better with a centralized view of progress and feedback loops.

  • Continuous Improvement: Data-driven insights lead to ongoing process optimization.

✔️Pipeline syntax:

pipeline {
    agent any 
    stages {
        stage('Build') { 
            steps {
                // 
            }
        }
        stage('Test') { 
            steps {
                // 
            }
        }
        stage('Deploy') { 
            steps {
                // 
            }
        }
    }
}

✔️Task: Create a New Job using Pipeline Hello World Example

step1: Navigate to the Jenkins home page. Create a new Job and select Pipeline.

step2:Follow the Official Jenkins Hello world example

step3: Now configure the project with a valid description.

step4:Now, navigate to the Pipeline section to write the Groovy pipeline code.

 pipeline {
     agent any
     stages {
         stage('Build') {
             steps {
                 echo 'Hello World'
             }
         }
     }
 }

see in

step5:Click on Save and then build now.

step 6: You can check the Full Stage View regarding the time of execution.

step7:We can verify the Hello World using Console Output

  1. click on #1

  2. Go to console output.

  3. see your console output as a success.

For another Jenkins project.

Follow me on LinkedIn to see interesting posts like this : )

linkedin.com/in/prabir-kumar-mahatha-6a0025..

Visit my git hub profile: github.com/PrabirKumarMahatha