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:
- Builds the code
- Runs tests to check if everything works
- 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:
- Prints "Hello World"
- Prints the current date and time
- Clones a GitHub repository and lists its files
- Runs automatically every hour
Step 1 – Create the Job
- Open Jenkins dashboard.
- Click "New Item".
- Enter a name like
HelloWorldJob
. - Select Freestyle project and click OK.
Step 2 – Add the Build Steps
- Scroll down to "Build" section.
- Click "Add build step" → "Execute shell" (Linux/Mac) or "Execute Windows batch command" (Windows).
- 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
(Replace <your-username>
and <your-repo>
with your actual GitHub details.)
Step 3 – Schedule it to Run Hourly
- Scroll to the "Build Triggers" section.
- Check "Build periodically".
- In the schedule box, enter:
H * * * *
This means: run once every hour, at a random minute (H
) to balance load.
Step 4 – Save and Run
- Click "Save".
- Click "Build Now" to test it manually.
- 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)