VOOZH about

URL: https://www.geeksforgeeks.org/devops/how-to-make-a-ci-cd-pipeline-in-jenkins/

⇱ CI-CD Pipeline in Jenkins - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

CI-CD Pipeline in Jenkins

Last Updated : 30 Apr, 2026

A CI/CD pipeline in Jenkins automates the process of building, testing, and deploying code. It helps developers integrate changes and deploy them quickly and reliably. Jenkins makes this automation easy and efficient.

  • Defines pipelines in a Jenkinsfile for version-controlled build, test, and deploy steps.
  • Breaks workflows into automated stages like build, test, and deploy.
  • Triggers runs on code commits to provide quick feedback.
  • Uses agents for parallel and scalable execution.

Create CI-CD Pipeline in Jenkins

Step 1: Log In to Jenkins

Log in to your Jenkins account. This is where all your Jenkins jobs and pipelines will be configured and monitored.

👁 Jenkins login
Login Window Jenkins

Step 2: Redirected to the Jenkins Dashboard

When you logged in, you will be redirected to the Jenkins console or dashboard. This is where you can manage all your Jenkins jobs, pipelines, and settings.

Step 3: Create a New Project

On the Jenkins dashboard, click on the "New Item" option to create a new project select the option available in the Dashboard.

👁 New Item
 

Step 4: Configure the Project Type

On the next screen, list of options will be visible, along with a field to name the pipeline. Add a suitable name and select the "Pipeline" option to proceed.

👁 item name & Type
 

Step 5: Configure the General Section

The pipeline configuration page will open. In the General section:

  • Provide a description of the pipeline, describing the purpose or what it will do.
  • Establish the connection to the repository where Jenkins can access the project to trigger the pipeline.
👁 Image
 

Step 6: Set Build Triggers

In the Build Triggers section:

We need to specify the branch and repository and give the credentials too. And add additional behaviors if required so far. Refer to the screenshot to have a better understanding.

👁 Image
 

Step 7: Advanced Project Options

In the Advanced Project Options section:

  • This section is primarily used for advanced configurations and special pipeline settings.
  • For simpler projects, no configuration is required in this section, so you can leave it as is or adjust it based on your project's needs.
👁 Image
 

Step 8: Configure the Pipeline Section

This is the most critical part of the configuration process. In the Pipeline section:

  • Define the Jenkinsfile that Jenkins will use to build and deploy your application. The Jenkinsfile contains the pipeline script with all the stages and steps for the CI/CD process.
  • Specify where Jenkins should retrieve the pipeline script (either from the repository or from a file stored locally).
  • Provide any required credentials or paths to the Jenkinsfile.
👁 Pipeline script
 

Sample Jenkins Pipeline Script

Step 9: Save the Pipeline and Run It

After writing the pipeline is done click on save it will be directly redirected to the Dashboard of the project there we can use, the "Build Now" option to run the pipeline and check if it is successful or not, by using stage view or console output.

👁 Build Now
 

Step 10: Monitor the Pipeline Execution

Once the pipeline is triggered, you can monitor its progress:

  • Go to the Jenkins dashboard and click on your project.
  • Under Build History, click on the build you just triggered.
  • You can monitor the pipeline using the Stage View or Console Output.

Stage View: Provides a visual representation of the pipeline stages and their status (success, failure, etc.).

👁 Stage view
 

Console Output: Displays the detailed logs of each stage. This is useful for debugging any issues that may occur during the pipeline execution.

Step 11: Review the Build Status

At the bottom of the Console Output or Stage View, you will see the status of the pipeline:

  • Success: If all stages are completed without errors, you will see "Finished: Success."
  • Failure: If any stage fails, you will see error messages in the logs, which can help in debugging the issue.
👁 Console Output logs
👁 Output of the pipeline

Here we successfully created a Jenkins CI/CD pipeline to automate the process of building, testing, and deploying a Java web application .war file.

Comment
Article Tags:
Article Tags: