Skip to main content
Jenkins Pipeline
CHAPTER 01

Introduction to Jenkins and CI/CD

Updated: May 15, 2026
15 min read

# CHAPTER 1

Introduction to Jenkins and CI/CD

1. Introduction

Welcome to the world of DevOps! Historically, software development was a slow, manual process. Developers wrote code on their laptops, emailed zip files to the IT department, and prayed that the code would work on the production server. This often resulted in the famous excuse: "It works on my machine!" Today, we use Jenkins to automate this entire process. Jenkins acts as a robotic butler, fetching your code, testing it automatically, and deploying it to the internet without human intervention. In this chapter, we will introduce the foundational concepts of Continuous Integration (CI) and Continuous Delivery (CD).

2. Learning Objectives

By the end of this chapter, you will be able to:
  • Define Jenkins and understand its role as an automation server.
  • Explain the concept of Continuous Integration (CI).
  • Differentiate between Continuous Delivery and Continuous Deployment (CD).
  • Understand the modern DevOps Lifecycle.
  • Appreciate why manual deployments are a massive risk in software engineering.

3. Beginner-Friendly Explanation

Imagine running a restaurant kitchen.
  • The Old Way (Manual): A chef writes a recipe (writes code). They hand it to a waiter (IT operations). The waiter tries to cook it, but they don't know the oven temperature, so the food burns (server crash).
  • The DevOps Way (CI/CD):
  • CI (Continuous Integration): The chef puts the recipe on a conveyor belt. A robot immediately picks it up, cooks a tiny sample portion, and tastes it to make sure it isn't poisonous (Automated Testing).
  • CD (Continuous Delivery): The robot puts the perfectly cooked meal on a tray under a heat lamp, waiting for the manager to say "Serve it" (Manual approval for deployment).
  • Jenkins: Jenkins *is* the conveyor belt and the robot.

4. What is CI/CD?

CI/CD is the backbone of modern software engineering.

Continuous Integration (CI): When multiple developers work on the same app, their code often conflicts. CI means developers merge their code into a central repository (like GitHub) several times a day. Every time they merge, Jenkins automatically wakes up, downloads the new code, and runs automated tests to ensure the new code didn't break the old code.

Continuous Delivery vs. Deployment (CD):

  • Continuous Delivery: Once the code passes the CI tests, Jenkins automatically builds the final application package (like a Docker image) and places it in a staging environment. It stops there, waiting for a human to click "Deploy to Production."
  • Continuous Deployment: There is no human intervention. If the code passes all automated tests, Jenkins pushes it straight to live production servers. Companies like Amazon and Netflix use this to update their websites thousands of times a day.

5. Why Automation Matters

Human beings are terrible at doing the same task 100 times perfectly. We get tired, we make typos, and we forget steps.
  • Speed: Automated pipelines deploy code in minutes, whereas manual deployments can take days.
  • Reliability: Jenkins runs the exact same script every single time.
  • Rollbacks: If a bad piece of code makes it to production, an automated pipeline can roll back to the previous stable version in seconds.

6. Mini Project: Install Jenkins Locally

Before we build pipelines, we need our robotic butler.

Step-by-Step Walkthrough (Windows/Mac with Java):

  1. 1. Prerequisite: Jenkins runs on Java. Ensure you have Java Development Kit (JDK) 11 or 17 installed. Check by opening your terminal and typing java -version.
  1. 2. Download: Go to jenkins.io and download the .war file (Generic Java package).
  1. 3. Run: Open your terminal, navigate to where you downloaded the file, and run:
``bash java -jar jenkins.war --httpPort=8080 `
  1. 4. Access: Open your web browser and go to http://localhost:8080.
  1. 5. Keep the Terminal Open: Your Jenkins server is now running locally! In the next chapter, we will unlock and configure it.

7. Real-World Scenarios

In 2012, an investment firm named Knight Capital deployed a software update manually. An engineer missed copying the new code to one out of eight servers. When the market opened, that single server ran outdated, broken trading algorithms. Because they didn't have an automated CI/CD pipeline to ensure consistency across all servers, the rogue server lost the company $460 million in exactly 45 minutes, bankrupting the firm. Automation is not just about speed; it is about risk management.

8. Best Practices

  • Commit Early, Commit Often: CI only works if developers merge their code frequently. If a developer works on a feature branch for three weeks without merging, integrating it will be a nightmare (known as "Merge Hell").

9. Security Recommendations

  • Jenkins is a High-Value Target: Because Jenkins can deploy code directly to production servers, it holds the "keys to the kingdom." Never expose your Jenkins dashboard directly to the public internet without strict VPN access and Multi-Factor Authentication.

10. Troubleshooting Tips

  • Port Conflicts: If Jenkins refuses to start with java -jar jenkins.war, it usually means another application (like a local web server or Skype) is already using port 8080. You can change the port by running java -jar jenkins.war --httpPort=9090`.

11. Exercises

  1. 1. Explain the difference between Continuous Delivery and Continuous Deployment. Which one is generally safer for a highly regulated banking application?
  1. 2. Why is it dangerous for developers to manually log into production servers via SSH to update application code?

12. FAQs

Q: Is Jenkins the only CI/CD tool? A: No. There are many others like GitHub Actions, GitLab CI, and CircleCI. However, Jenkins is open-source, highly customizable, and heavily entrenched in enterprise environments. Learning Jenkins teaches you the core principles applicable to all CI/CD platforms.

13. Interview Questions

  • Q: Describe the CI/CD pipeline lifecycle from the moment a developer commits code to the repository to the moment it reaches the end user.
  • Q: What is the primary business value of implementing Continuous Integration? How does it affect the "Mean Time To Resolution" (MTTR) for software bugs?

14. Summary

In Chapter 1, we introduced the paradigm shift of DevOps. We learned that manual deployments are slow, error-prone, and economically dangerous. We defined Continuous Integration (CI) as the practice of constantly merging and automatically testing code, and Continuous Delivery (CD) as the automated preparation of that code for production release. Finally, we took the first step by downloading the Jenkins automation server to our local machine.

15. Next Chapter Recommendation

Now that we understand the theory, it's time to set up our laboratory properly. Proceed to Chapter 2: Installing Jenkins on Windows, Linux, and Docker.

Finish this Chapter

Save your progress on your learning path and prepare for coding interview challenges.

Discussion

Join the discussion

Log in or create a free account to participate.

Sort: ·