Pipelines in Jenkins

Jenkins Pipelines are a powerful way to automate the software development lifecycle by defining CI/CD workflows as code. They allow you to automate tasks like building, testing, and deploying applications in a structured, repeatable, and scalable manner. Pipelines provide visualization of the workflow stages, support complex scenarios with branching and parallel execution, integrate easily with other tools, and enhance consistency, reliability, and speed in the delivery process, reducing manual errors and increasing efficiency.

Creating a simple pipeline

To create a simple pipeline go to the repository directory and create a text file named "Jenkinsfile". Inside the file copy and paste the below groovy script. This is a simple groovy script which prints some statements in each stage of the build. 

pipeline {
    agent any

    stages {
        stage('Build') {
            steps {
                echo 'Building the Application...'
            }
        }
        stage('Test') {
            steps {
                echo 'Testing the Application ...'
            }
        }
        stage('Deploy') {
            steps {
                echo 'Deploying the Application...'
            }
        }
    }
}

Now check status of jenkins using the following command.

$ sudo systemctl status jenkins

if it is active then go to jenkins running url (default is localhost:8080). if it is not active run the following command and start jenkins.

$ sudo systemctl start jenkins

image.png

 

 

 

 

 

 

image.png

image.png


Revision #5
Created 19 September 2024 05:07:20
Updated 25 September 2024 06:31:31