DEV Community

Cover image for Day 22 : Getting Started with Jenkins
Udoh Deborah
Udoh Deborah

Posted on

Day 22 : Getting Started with Jenkins

Task 1 – What is Jenkins and Why is it Used?

Jenkins is an open-source automation server that helps teams streamline the process of building, testing, and deploying software.
It acts like a smart assistant that takes repetitive tasks off your plate — so instead of manually running tests or deploying code every time there’s a change, Jenkins does it for you automatically.

In the DevOps lifecycle, Jenkins sits right in the middle of the action. Developers commit their code to a shared repository, Jenkins notices the change, and immediately kicks off a pipeline that:

  1. Builds the code
  2. Runs tests to check if everything works
  3. Deploys the application to a staging or production environment

The magic comes from plugins — these allow Jenkins to connect with almost any tool in the DevOps ecosystem (Git, Maven, Docker, AWS, etc.), making it flexible for different tech stacks.

Benefits of Jenkins:

  • Automation: Removes the need for manual intervention in build, test, and deployment.
  • Speed: Shortens the feedback loop so bugs are caught earlier.
  • Scalability: Can run multiple jobs across different environments.
  • Flexibility: Integrates with hundreds of tools through plugins.
  • Consistency: Ensures processes run the same way every time.

In short, Jenkins helps teams deliver software faster, more reliably, and with less human error — a core goal in DevOps.

Alright — here’s Task 2 broken down so you can directly follow it in Jenkins.


Task 2 – Create a Freestyle Pipeline to Print “Hello World”

let us set up a Jenkins Freestyle job that:

  1. Prints "Hello World"
  2. Prints the current date and time
  3. Clones a GitHub repository and lists its files
  4. Runs automatically every hour

Step 1 – Create the Job

  1. Open Jenkins dashboard.
  2. Click "New Item".
  3. Enter a name like HelloWorldJob.
  4. Select Freestyle project and click OK.

Step 2 – Add the Build Steps

  1. Scroll down to "Build" section.
  2. Click "Add build step" → "Execute shell" (Linux/Mac) or "Execute Windows batch command" (Windows).
  3. Enter the following script (Linux example):
echo "Hello World"
echo "Current date and time: $(date)"
git clone https://github.com/<your-username>/<your-repo>.git
cd <your-repo>
ls -la
Enter fullscreen mode Exit fullscreen mode

(Replace <your-username> and <your-repo> with your actual GitHub details.)

Step 3 – Schedule it to Run Hourly

  1. Scroll to the "Build Triggers" section.
  2. Check "Build periodically".
  3. In the schedule box, enter:
H * * * *
Enter fullscreen mode Exit fullscreen mode

This means: run once every hour, at a random minute (H) to balance load.

Step 4 – Save and Run

  1. Click "Save".
  2. Click "Build Now" to test it manually.
  3. Go to the "Console Output" of the build to see:
  • “Hello World” printed
  • Current date and time
  • GitHub repo contents listed

Now your Jenkins job runs automatically every hour and performs the given tasks — no manual clicks needed.

Top comments (0)