Day-22 : Getting Started with Jenkins

Introduction

With Linux, Git, GitHub, and Docker already covered, it's time to explore Jenkins, a powerful CI/CD automation tool that helps in deploying applications seamlessly.

What is Jenkins?

Jenkins is an open-source automation server written in Java that facilitates Continuous Integration (CI) and Continuous Deployment (CD) in the software development process. It automates building, testing, and deployment, making the DevOps pipeline more efficient.

Why Use Jenkins?

  1. Automation: Reduces manual effort and human errors.

  2. Continuous Integration: Ensures smooth code integration and testing.

  3. Continuous Deployment: Automates release processes for faster and more reliable software delivery.

  4. Extensibility: Supports various plugins for seamless integration with tools like Git, Docker, and AWS.

How Jenkins Fits into the DevOps Lifecycle

Jenkins plays a critical role in DevOps by automating repetitive tasks:

  1. Build Stage: Fetches the latest code and compiles it.

  2. Test Stage: Runs automated tests to identify bugs early.

  3. Deploy Stage: Deploys the tested application to staging or production environments.

By implementing Jenkins in a CI/CD pipeline, organizations can release high-quality software at a faster pace.

Task 1: Write an Article on Jenkins

Below is a concise article covering the importance of Jenkins and how it integrates into DevOps.

Jenkins: The Backbone of CI/CD in DevOps

In today's fast-paced software development environment, automation is crucial. Jenkins is a leading tool that helps developers build, test, and deploy applications efficiently, ensuring faster and more reliable software delivery.

Why Jenkins?

Jenkins helps developers by automating repetitive tasks, such as:

  • Code Integration: Detects code changes, compiles, and integrates them seamlessly.

  • Automated Testing: Runs test cases to ensure software reliability.

  • Deployment: Pushes tested code to production environments with minimal manual intervention.

  • Extensive Plugin Support: Integrates with Git, Docker, Kubernetes, AWS, and more.

Jenkins in Action

Jenkins automates the build, test, and deployment process through pipelines. Developers push code to a repository (e.g., GitHub), Jenkins fetches it, runs tests, and if successful, deploys the software to the target environment.

With Jenkins, teams can achieve faster releases, improved code quality, and reduced deployment risks, making it a must-have tool in modern DevOps workflows.

Task 2: Create a Freestyle Pipeline to Print "Hello World"

Steps to Create a Freestyle Job in Jenkins

  1. Login to Jenkins

  2. Create a New Job

    • Click on New Item

    • Enter a name (e.g., "HelloWorldJob")

    • Select Freestyle Project and click OK

  3. Configure Build Steps

    • Scroll down to Build section

    • Click Add Build Step โ†’ Execute Shell

    • Enter the following script:

        echo "Hello World"
        echo "Current Date and Time: $(date)"
        git clone https://github.com/YOUR_GITHUB_REPO.git
        ls -la YOUR_GITHUB_REPO
      
  4. Schedule the Job

    • Under Build Triggers, check Build periodically

    • Set the schedule as H * * * * (runs every hour)

  5. Save & Build

    • Click Save

    • Click Build Now to test

  6. Check Console Output

    • Go to Build History โ†’ Click on latest build

    • Click Console Output to verify results

Conclusion

Jenkins is an essential DevOps tool that automates the software delivery process, ensuring efficiency and speed. By following these steps, you have set up a basic Jenkins job. Next, explore Jenkins Pipelines and integrate it with Docker and Kubernetes for a complete CI/CD workflow.

Share Your Progress!

Post your learnings and screenshots on LinkedIn and tag #90DaysOfDevOps! ๐Ÿš€

0
Subscribe to my newsletter

Read articles from Shubhranshu Ransingh directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Shubhranshu Ransingh
Shubhranshu Ransingh